Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: check for stale VM before creation
......................................................................

packaging: setup: check for stale VM before creation

Added a check for stale Hosted Engine VM before creating it.
In normal execution flow, this should never happen.
However, it is possible that the user starts again the VM
manually after having installed the OS and forget to poweroff
(destroy) the VM.
Now the user will be warned to properly poweroff the VM
started manually in order to continue the setup process.
The poweroff is not issued automatically because the VM can
be in a stale state after a failure and the user must be
aware that the VM is still around in order to debug the issue.

Bug-Url: https://bugzilla.redhat.com/1010980
Change-Id: I8d5dfc17e10e677959e903f03515a124d5e97611
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
1 file changed, 12 insertions(+), 0 deletions(-)


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

diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
index 4615048..9ea529f 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
@@ -48,6 +48,7 @@
 
     TICKET_MAX_TRIES = 10
     TICKET_DELAY = 1
+    POWEROFF_CHECK_INTERVALL = 1
 
     def __init__(self, context):
         super(Plugin, self).__init__(context=context)
@@ -124,6 +125,17 @@
             )
 
     def _create(self):
+        if not self._wait_vm_destroyed():
+            self.logger.warning(
+                _(
+                    'The Hosted Engine VM has been found still powered on:\n'
+                    'please turn it off using "hosted-engine --vm-poweroff".\n'
+                    'The system will wait until the VM is powered off.'
+                )
+            )
+            while not self._wait_vm_destroyed():
+                time.sleep(self.POWEROFF_CHECK_INTERVALL)
+
         self.logger.info(_('Creating VM'))
         cmd = self._vdscommand + [
             'create',


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

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

Reply via email to