Mike Burns
2011-Aug-15 18:42 UTC
[Ovirt-devel] [PATCH node] Don't start ntp daemons until networking is started
- Default NETWORKING=no in /etc/sysconfig/network - Update to yes when configuring network through TUI or firstboot - After configuration in TUI, (re)start ntp daemons rhbz#675870 Signed-off-by: Mike Burns <mburns at redhat.com> --- recipe/common-post.ks | 6 ++++++ scripts/network.py | 10 +++++++++- scripts/ovirt-config-networking | 1 + 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/recipe/common-post.ks b/recipe/common-post.ks index 4507959..e9a8a28 100644 --- a/recipe/common-post.ks +++ b/recipe/common-post.ks @@ -225,3 +225,9 @@ mkdir -p /root/.virt-manager /home/admin/.virt-manager #symlink virt-manager-tui pointer file to .pyc version sed -i "s/tui.py/tui.pyc/g" /usr/bin/virt-manager-tui + +#set NETWORKING off by default +augtool << \EOF_NETWORKING +set /files/etc/sysconfig/network/NETWORKING no +save +EOF_NETWORKING diff --git a/scripts/network.py b/scripts/network.py index 50d4624..ea16212 100644 --- a/scripts/network.py +++ b/scripts/network.py @@ -184,6 +184,9 @@ class Network: elif offset == 2: augtool("set", "/files/etc/ntp.conf/server[2]", server) offset = offset + 1 + os.system("service ntpd stop &> /dev/null") + os.system("service ntpdate start &> /dev/null") + os.system("service ntpd start &> /dev/null") def save_network_configuration(self): net_configured=0 @@ -255,10 +258,13 @@ class Network: for nic in self.CONFIGURED_NICS: ovirt_store_config("%s%s" % (self.IFSCRIPTS_PATH, nic) ) ovirt_store_config(self.NTP_CONFIG_FILE) + augtool("set", "/files/etc/sysconfig/network/NETWORKING", "yes") + ovirt_store_config("/etc/sysconfig/network") log("Network configured successfully") if net_configured == 1: - log("\nStopping Network service") + log("\nStopping Network services") os.system("service network stop &> /dev/null") + os.system("service ntpd stop &> /dev/null") # XXX eth assumed in breth brctl_cmd = "brctl show|grep breth|awk '{print $1}'" brctl = subprocess.Popen(brctl_cmd, shell=True, stdout=PIPE, stderr=STDOUT) @@ -270,6 +276,8 @@ class Network: os.system(del_br_cmd) log("\nStarting Network service") os.system("service network start &> /dev/null") + os.system("service ntpdate start &> /dev/null") + os.system("service ntpd start &> /dev/null") if OVIRT_VARS.has_key("NTP"): log("Testing NTP Configuration") test_ntp_configuration() diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking index cb96ab5..116159e 100755 --- a/scripts/ovirt-config-networking +++ b/scripts/ovirt-config-networking @@ -563,6 +563,7 @@ if ls "$WORKDIR"/augtool-* > /dev/null 2>&1 ; then config="$WORKDIR"/config-augtool cat "$WORKDIR"/augtool-* > $config + echo "set /files/etc/sysconfig/network/NETWORKING yes" >> $config CONFIGURED_NICS="$CONFIGURED_NIC br$CONFIGURED_NIC" if [ -n "${VLAN_ID}" ]; then CONFIGURED_NICS="$CONFIGURED_NICS $CONFIGURED_NIC.$VLAN_ID" -- 1.7.4.4