mooli tayer has uploaded a new change for review.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. It will be used in a seperate commit. ......................................................................
This commit only adds the libvirtd_sysv2upstart to configurator. It will be used in a seperate commit.
Change-Id: I872100a6d28ea6da40e6896939aeff4b514f3e71 Signed-off-by: Mooli Tayer mtayer@redhat.com --- M lib/vdsm/tool/configurator.py 1 file changed, 39 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/26958/1
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py index f0944f3..744a8c6 100644 --- a/lib/vdsm/tool/configurator.py +++ b/lib/vdsm/tool/configurator.py @@ -21,6 +21,10 @@ import sys import grp import argparse +import filecmp +import itertools +import rpm +import shutil
from .. import utils from . import service, expose @@ -96,6 +100,41 @@ def configure(self): self._exec_libvirt_configure("reconfigure")
+ def libvirtd_sysv2upstart(self): + """ + On RHEL 6, libvirtd can be started by either SysV init or Upstart. + We prefer upstart because it respawns libvirtd if when libvirtd + crashed. + """ + INITCTL = '/sbin/initctl' + LIBVIRTD_UPSTART = 'libvirtd.upstart' + TARGET = "/etc/init/libvirtd.conf" + if os.path.isfile(INITCTL) and os.access(INITCTL, os.X_OK): + ts = rpm.TransactionSet() + mi = itertools.chain(*[ts.dbMatch('name', name) + for name in ['libvirt', 'libvirt-daemon']]) + # libvirtd package does not provide libvirtd.upstart, + # this could happen in Ubuntu or other distro, + # so continue to use system default init mechanism + for filename in itertools.chain(*[h[rpm.RPMTAG_FILENAMES] + for h in mi]): + if LIBVIRTD_UPSTART in filename: + packeged = filename + break + if packeged is not None and os.path.isfile(packeged): + if not os.path.isfile(TARGET): + service.service_stop('libvirtd') + if not os.path.isfile(TARGET) or \ + not filecmp.cmp(packeged, TARGET): + shutil.copyfile(packeged, TARGET) + rc, out, err = utils.execCmd((INITCTL, + "reload-configuration")) + if rc != 0: + sys.stdout.write(out) + sys.stderr.write(err) + raise RuntimeError( + "Failed to reload upstart configuration.") + def validate(self): """ Validate conflict in configured files
oVirt Jenkins CI Server has posted comments on this change.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. It will be used in a seperate commit. ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8218/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8331/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7428/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8350/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7560/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8470/ : FAILURE
oVirt Jenkins CI Server has posted comments on this change.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8410/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7620/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8530/ : SUCCESS
Yaniv Bronhaim has posted comments on this change.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. ......................................................................
Patch Set 3: Code-Review-1
i'd merge it with http://gerrit.ovirt.org/#/c/27130/2 to have full implementation in one patch of the conversion to python
mooli tayer has abandoned this change.
Change subject: This commit only adds the libvirtd_sysv2upstart to configurator. ......................................................................
Abandoned
squashed to http://gerrit.ovirt.org/#/c/27298/1
vdsm-patches@lists.fedorahosted.org