8000 kvm: Set hostname inside kvm container. Closes #2189 by squall0gd · Pull Request #2190 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

kvm: Set hostname inside kvm container. Closes #2189 #2190

Merged
merged 1 commit into from
Feb 23, 2016

Conversation

squall0gd
Copy link
Contributor

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

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)
Copy link
Contributor

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("...")

@squall0gd squall0gd force-pushed the mstachow/rkt_set_hostname branch 2 times, most recently from a0839a1 to 0e65551 Compare February 18, 2016 09:47
@@ -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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@squall0gd squall0gd force-pushed the mstachow/rkt_set_hostname branch 2 times, most recently from dff6df7 to 5ef9d64 Compare February 18, 2016 11:01
@ppalucki
Copy link
Contributor

👍

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf

@squall0gd squall0gd force-pushed the mstachow/rkt_set_hostname branch from 5ef9d64 to 4b27f8d Compare February 18, 2016 13:17
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
squall0gd added a commit to intelsdi-x/rkt that referenced this pull request Feb 20, 2016 8000
Cherry pick for tests purposses. It should be merged in
pull request rkt#2190

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
squall0gd added a commit to intelsdi-x/rkt that referenced this pull request Feb 23, 2016
Cherry pick for tests purposses. It should be merged in
pull request rkt#2190

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
@squall0gd
Copy link
Contributor Author

Review request

@iaguis
Copy link
Member
iaguis commented Feb 23, 2016

LGTM

iaguis added a commit that referenced this pull request Feb 23, 2016
kvm: Set hostname inside kvm container. Closes #2189
@iaguis iaguis merged commit 5394531 into rkt:master Feb 23, 2016
@squall0gd squall0gd deleted the mstachow/rkt_set_hostname branch April 11, 2016 08:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0