This repository was archived by the owner on Feb 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 880
kvm: Set hostname inside kvm container. Closes #2189 #2190
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hostname := stage1initcommon.GetMachineID(p) | ||
hostnamePath := filepath.Join(common.Stage1RootfsPath(p.Root), "etc/hostname") | ||
if err := ioutil.WriteFile(hostnamePath, []byte(hostname), 0644); err != nil { | ||
log.FatalE("error writing /etc/machine-id", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace log & panic with return and fix the message (return nil, nil, errors.New("...")
a0839a1
to
0e65551
Compare
@@ -296,6 +296,13 @@ func getArgsEnv(p *stage1commontypes.Pod, flavor string, debug bool, n *networki | |||
nsargs := stage1initcommon.VolumesToKvmDiskArgs(p.Manifest.Volumes) | |||
args = append(args, nsargs...) | |||
|
|||
// set hostname inside pod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not a problem, please add a comment referring to systemd-hostname why writing /etc/hostname is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
dff6df7
to
5ef9d64
Compare
👍 |
hostname := stage1initcommon.GetMachineID(p) | ||
hostnamePath := filepath.Join(common.Stage1RootfsPath(p.Root), "etc/hostname") | ||
if err := ioutil.WriteFile(hostnamePath, []byte(hostname), 0644); err != nil { | ||
return nil, nil, errors.New(fmt.Sprintf("error writing %s, %s", hostnamePath, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Errorf
5ef9d64
to
4b27f8d
Compare
This patch provides setting pod hostname for kvm flavor. By default rkt with kvm flavor sets "rkt" name for each pod. This patch prepares /etc/hostname file for pod on stage1. Its fixing rkt#2189
Review request |
LGTM |
iaguis
added a commit
that referenced
this pull request
Feb 23, 2016
kvm: Set hostname inside kvm container. Closes #2189
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch provides setting pod hostname for kvm flavor.
By default, there is one hostname for each pod, instead of unique name (like in coreos flavor)
This patch prepares /etc/hostname file for pod on stage1.
Closes #2189