[node-patches] Change in ovirt-node[master]: network: write new hostname into /etc/hostname

dougsland at redhat.com dougsland at redhat.com
Thu Aug 6 04:07:43 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: network: write new hostname into /etc/hostname
......................................................................

network: write new hostname into /etc/hostname

Currently, when users set a new hostname via TUI
and reboot the host, it won't save the new hostname.
This happens because hostnamectl is not saving the
new hostname into /etc/hostname. This patch adds
a workaround until we find the root cause.

Change-Id: I9bbb7b96f98a70915190846eb7c9d3b22e0af3a1
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/config/network.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/55/44455/1

diff --git a/src/ovirt/node/config/network.py b/src/ovirt/node/config/network.py
index 48779f6..12021a2 100644
--- a/src/ovirt/node/config/network.py
+++ b/src/ovirt/node/config/network.py
@@ -230,6 +230,15 @@
         utils.process.check_call(["hostnamectl", "set-hostname",
                                   new_hostname])
 
+    # FIXME:
+    # hostnamectl --static is not writing into /etc/hostname.
+    # Because of that, the new hostname won't persist across
+    # reboot in case user change it via TUI.
+    # Restarting systemd-hostnamed doesn't help either.
+    with open('/etc/hostname', 'w+') as f:
+        if f.read() != new_hostname:
+            f.write(new_hostname)
+
     return socket.gethostname()
 
 


-- 
To view, visit https://gerrit.ovirt.org/44455
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bbb7b96f98a70915190846eb7c9d3b22e0af3a1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list