Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: handle ha service running not configured
......................................................................

packaging: setup: handle ha service running not configured

Handle automatically the stop of the HA services found running
without being configured by stopping them.

Change-Id: Iec96ab34cca90a19a813f1939ed235804d19b98a
Bug-Url: https://bugzilla.redhat.com/1134873
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py
1 file changed, 21 insertions(+), 6 deletions(-)


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

diff --git a/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py 
b/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py
index 938a236..ce3f9b4 100644
--- a/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py
+++ b/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py
@@ -24,6 +24,7 @@
 
 
 import gettext
+import os
 
 
 from otopi import util
@@ -59,13 +60,27 @@
             if self.services.status(
                 name=service,
             ):
-                raise RuntimeError(
-                    _(
-                        'Hosted Engine HA services are already running on '
-                        'this system. Hosted Engine cannot be deployed on '
-                        'a host already running those services.'
+                if os.path.exists(ohostedcons.FileLocations.ENGINE_VM_CONF):
+                    raise RuntimeError(
+                        _(
+                            'Hosted Engine HA services are already running '
+                            'on this system. Hosted Engine cannot be '
+                            'deployed on a host already running those '
+                            'services.'
+                        )
                     )
-                )
+                else:
+                    # Services are running by accident:
+                    # stopping them and continue the setup.
+                    # Related-To: https://bugzilla.redhat.com/1134873
+                    for service in (
+                        ohostedcons.Const.HA_AGENT_SERVICE,
+                        ohostedcons.Const.HA_BROCKER_SERVICE,
+                    ):
+                        self.services.state(
+                            name=service,
+                            state=False,
+                        )
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CLOSEUP,


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

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

Reply via email to