Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Allow destroying VM when aborting
......................................................................

packaging: setup: Allow destroying VM when aborting

Change-Id: I93734152b10f410c81d700a36b96ff1f984692f0
Bug-Url: https://bugzilla.redhat.com/1106556
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/engine/health.py
M src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
2 files changed, 19 insertions(+), 5 deletions(-)


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

diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/health.py 
b/src/plugins/ovirt-hosted-engine-setup/engine/health.py
index df16222..898e26f 100644
--- a/src/plugins/ovirt-hosted-engine-setup/engine/health.py
+++ b/src/plugins/ovirt-hosted-engine-setup/engine/health.py
@@ -80,10 +80,12 @@
                     'To continue make a selection from the options below:\n'
                     '(1) Continue setup - engine installation is complete\n'
                     '(2) Power off and restart the VM\n'
-                    '(3) Abort setup\n\n(@VALUES@)[@DEFAULT@]: '
+                    '(3) Abort setup\n'
+                    '(4) Destroy VM and abort setup\n'
+                    '\n(@VALUES@)[@DEFAULT@]: '
                 ),
                 prompt=True,
-                validValues=(_('1'), _('2'), _('3')),
+                validValues=(_('1'), _('2'), _('3'), _('4')),
                 default=_('1'),
                 caseSensitive=False)
             if response == _('1').lower():
@@ -98,6 +100,11 @@
                 self._create_vm()
             elif response == _('3').lower():
                 raise RuntimeError('Engine polling aborted by user')
+            elif response == _('4').lower():
+                self._destroy_vm()
+                raise RuntimeError(
+                    _('VM destroyed and setup aborted by user')
+                )
             else:
                 self.logger.error(
                     'Invalid option \'{0}\''.format(response)
diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py 
b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
index 243dc6f..b728d41 100644
--- a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
+++ b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py
@@ -154,10 +154,12 @@
                         'selection:\n\n'
                         '(1) Continue setup - VM installation is complete\n'
                         '(2) Reboot the VM and restart installation\n'
-                        '(3) Abort setup\n\n(@VALUES@)[@DEFAULT@]: '
+                        '(3) Abort setup\n'
+                        '(4) Destroy VM and abort setup\n'
+                        '\n(@VALUES@)[@DEFAULT@]: '
                     ),
                     prompt=True,
-                    validValues=(_('1'), _('2'), _('3')),
+                    validValues=(_('1'), _('2'), _('3'), _('4')),
                     default=_('1'),
                     caseSensitive=False)
                 if response == _('1').lower():
@@ -170,7 +172,12 @@
                 elif response == _('2').lower():
                     self._destroy_vm()
                 elif response == _('3').lower():
-                    raise RuntimeError('OS installation aborted by user')
+                    raise RuntimeError(_('OS installation aborted by user'))
+                elif response == _('4').lower():
+                    self._destroy_vm()
+                    raise RuntimeError(
+                        _('VM destroyed and setup aborted by user')
+                    )
                 else:
                     self.logger.error(
                         'Invalid option \'{0}\''.format(response)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I93734152b10f410c81d700a36b96ff1f984692f0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to