Douglas Schilling Landgraf has uploaded a new change for review. Change subject: engine_page: Replace deployUtil._logExec ......................................................................
engine_page: Replace deployUtil._logExec Replacing deployUtil calls for stop and start vdsm-reg-setup daemon Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1192160 Change-Id: I269d2da9a52ef2ad493c152a50edd86a9e3c99b5 Signed-off-by: Douglas Schilling Landgraf <[email protected]> --- M src/engine_page.py 1 file changed, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm refs/changes/14/38014/1 diff --git a/src/engine_page.py b/src/engine_page.py index 956a6c0..d028e6c 100644 --- a/src/engine_page.py +++ b/src/engine_page.py @@ -23,6 +23,8 @@ import errno import httplib import os +import subprocess +import shlex import sys import traceback @@ -43,6 +45,18 @@ LOGGER = log.getLogger(__name__) + +def execute_cmd(cmd, env_shell=False): + cmd = subprocess.Popen(shlex.split(cmd), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + shell=env_shell) + + output, err = cmd.communicate() + if cmd.returncode != 0: + LOGGER.debug("Cannot execute cmd [%s]" % cmd) + + return cmd.returncode def update_conf(conf_file, session, option, value): """ @@ -538,6 +552,7 @@ Config().persist(config.VDSM_CONFIG) def commit(self): + _LOCK_FILE_VDSM_REG = "/var/lock/subsys/vdsm-reg" self.logger.info("Connecting to VDSM server") if not self.cert_validator(): @@ -555,7 +570,9 @@ # Stopping vdsm-reg may fail but its ok - its in the case when the # menus are run after installation self.logger.info("Stopping vdsm-reg service") - deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop']) + if os.path.exists(_LOCK_FILE_VDSM_REG): + os.remove(_LOCK_FILE_VDSM_REG) + execute_cmd('killall -9 vdsm-reg-setup') try: update_conf( @@ -582,7 +599,8 @@ raise RuntimeError(msgConf) self.logger.info("Starting vdsm-reg service") - deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'start']) + execute_cmd("/usr/share/vdsm-reg/vdsm-reg-setup") + execute_cmd("touch %s" % _LOCK_FILE_VDSM_REG) sync_mgmt() msgConf = "{engine_name} Configuration Successfully Updated".format( -- To view, visit http://gerrit.ovirt.org/38014 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I269d2da9a52ef2ad493c152a50edd86a9e3c99b5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node-plugin-vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Douglas Schilling Landgraf <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
