Hello Yedidyah Bar David,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/20868

to review the following change.

Change subject: packaging: setup: update libvirt configuration
......................................................................

packaging: setup: update libvirt configuration

Updated livirt configuration for  using the new VDSM
command line tool

Requires: http://gerrit.ovirt.org/20100

Change-Id: I735111e33dd7435067854ec7694b137f4bc62da2
Signed-off-by: Yedidyah Bar David <[email protected]>
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py
2 files changed, 34 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/68/20868/1

diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 391356e..15d13c3 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -167,8 +167,6 @@
         'libvirt',
         'qemu.conf'
     )
-    VDSMD_SYSTEMD_SERVICE = '/lib/systemd/systemd-vdsmd'
-    VDSMD_SYSV_SERVICE = '/etc/init.d/vdsmd'
 
 
 @util.export
diff --git a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py 
b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py
index 5216796..60b9d23 100644
--- a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py
+++ b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py
@@ -23,7 +23,6 @@
 import pwd
 import grp
 import gettext
-import os
 import socket
 import time
 
@@ -104,6 +103,12 @@
         )
 
     @plugin.event(
+        stage=plugin.Stages.STAGE_SETUP,
+    )
+    def _setup(self):
+        self.command.detect('vdsm-tool')
+
+    @plugin.event(
         stage=plugin.Stages.STAGE_LATE_SETUP,
         after=(
             ohostedcons.Stages.VDSMD_CONF_LOADED,
@@ -116,25 +121,36 @@
                 ohostedcons.VDSMEnv.VDSMD_SERVICE
             ]
         ):
-            for service_exec in (
-                ohostedcons.FileLocations.VDSMD_SYSTEMD_SERVICE,
-                ohostedcons.FileLocations.VDSMD_SYSV_SERVICE,
-            ):
-                if os.path.exists(service_exec):
-                    rc, _stdout, _stderr = self.execute(
-                        (
-                            service_exec,
-                            'reconfigure',
-                        ),
-                        raiseOnError=False,
+            rc, _stdout, _stderr = self.execute(
+                (
+                    self.command.get('vdsm-tool'),
+                    'is-configured',
+                    '--module libvirt',
+                ),
+                raiseOnError=False,
+            )
+            if rc != 0:
+                self.execute(
+                    (
+                        self.command.get('vdsm-tool'),
+                        'configure',
+                        '--module libvirt',
+                        '--force',
                     )
-                    if rc != 0:
-                        raise RuntimeError(
-                            _(
-                                'Failed to reconfigure libvirt for vdsm'
-                            )
+                )
+                rc, _stdout, _stderr = self.execute(
+                    (
+                        self.command.get('vdsm-tool'),
+                        'is-configured',
+                        '--module libvirt',
+                    )
+                )
+                if rc != 0:
+                    raise RuntimeError(
+                        _(
+                            'Failed to reconfigure libvirt for VDSM'
                         )
-                    break
+                    )
             self.services.state(
                 name=self.environment[
                     ohostedcons.VDSMEnv.VDSMD_SERVICE


-- 
To view, visit http://gerrit.ovirt.org/20868
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I735111e33dd7435067854ec7694b137f4bc62da2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to