[node-patches] Change in ovirt-node[master]: ntpd: condition for start

dougsland at redhat.com dougsland at redhat.com
Tue Jun 2 05:34:14 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: ntpd: condition for start
......................................................................

ntpd: condition for start

Due the limitation that all services in the oVirt Node
must be enabled during the build time and there is
no option to disable the pre-configured ntp servers
from ntp.conf this patch adds a condition for
start of ntp service. The condition is the
/etc/ntp.conf be persisted. In other words, if users
set NTP servers via TUI or auto-install using
ntp=my-preferred-ntp-server will enable the ntp
daemon to be started in the boot.

Change-Id: Iebee8a8581fd0b51d07bde04b1f878a1cb5481ba
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1061081
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M ovirt-node.spec.in
M services/Makefile.am
A services/ntpd-pre-start.conf
M src/ovirt/node/setup/core/network_page.py
4 files changed, 18 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/12/41812/1

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 99e338b..73ee52c 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -647,10 +647,12 @@
 %{__install} -d -m0755 %{buildroot}%{_libexecdir}/ovirt-node/hooks/on-boot
 %{__install} -d -m0755 %{buildroot}%{_libexecdir}/ovirt-node/hooks/on-changed-boot-image
 
+%if %{is_systemd}
+%{__install} -Dp -m0644 services/ntpd-pre-start.conf \
+                       %{buildroot}%{_sysconfdir}/systemd/system/ntpd.service.d/ntpd-pre-start.conf
+%else
 # dracut patches for rhel6
-%if ! %{is_systemd}
 %{__install} -p -m0644 dracut/dracut-7ed4ff0636c74a2f819ad6e4f2ab4862.patch %{buildroot}%{app_root}
-
 %endif
 
 # python-augeas is not in RHEL-6
@@ -1059,6 +1061,7 @@
 %{_unitdir}/ovirt-post.service
 %{_unitdir}/ovirt-early.service
 %{_unitdir}/ovirt-kdump.service
+%{_sysconfdir}/systemd/system/ntpd.service.d/ntpd-pre-start.conf
 %else
 %{_initrddir}/ovirt-awake
 %{_initrddir}/ovirt-early
diff --git a/services/Makefile.am b/services/Makefile.am
index 1dec6e0..1a1ab3c 100644
--- a/services/Makefile.am
+++ b/services/Makefile.am
@@ -40,4 +40,8 @@
   init.d/ovirt-node-igor-slave
 endif
 
+EXTRA_DIST = \
+  ntpd-pre-start.conf \
+  $(NULL)
+
 # vim: ts=2
diff --git a/services/ntpd-pre-start.conf b/services/ntpd-pre-start.conf
new file mode 100644
index 0000000..c1778af
--- /dev/null
+++ b/services/ntpd-pre-start.conf
@@ -0,0 +1,2 @@
+[Unit]
+ConditionPathExists=/config/etc/ntp.conf
diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 235c1c5..eb59ee0 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -18,6 +18,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
+import os
+
 from ovirt.node import plugins, ui, valid, utils, config
 from ovirt.node.config import defaults
 from ovirt.node.plugins import Changeset
@@ -158,10 +160,11 @@
             for idx, nameserver in enumerate(nameservers):
                 model["dns[%d]" % idx] = nameserver
 
-        timeservers = config.network.timeservers()
-        if timeservers:
-            for idx, timeserver in enumerate(timeservers):
-                model["ntp[%d]" % idx] = timeserver
+        if os.path.exists(utils.fs.Config()._config_path("/etc/ntp.conf")):
+            timeservers = config.network.timeservers()
+            if timeservers:
+                for idx, timeserver in enumerate(timeservers):
+                    model["ntp[%d]" % idx] = timeserver
 
         model.update(self._model_extra)
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebee8a8581fd0b51d07bde04b1f878a1cb5481ba
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