Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: check existing VMs running ......................................................................
packaging: setup: check existing VMs running Check if there is already a any VM running and fail if it exists. Change-Id: Iae7b88d5c56bd76b87cfcdef29e629a3a30b6491 Bug-Url: https://bugzilla.redhat.com/1034726 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- M src/ovirt_hosted_engine_setup/constants.py M src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py M src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py 3 files changed, 27 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/81/24481/1 diff --git a/src/ovirt_hosted_engine_setup/constants.py b/src/ovirt_hosted_engine_setup/constants.py index 8558338..e48420e 100644 --- a/src/ovirt_hosted_engine_setup/constants.py +++ b/src/ovirt_hosted_engine_setup/constants.py @@ -545,6 +545,7 @@ VDSMD_START = 'ohosted.vdsm.started' VDSMD_PKI = 'ohosted.vdsm.pki.available' VDSMD_CONFIGURED = 'ohosted.vdsm.configured' + VDSMD_LATE_SETUP_READY = 'ohosted.vdsm.late_setup_ready' SANLOCK_INITIALIZED = 'ohosted.sanlock.initialized' STORAGE_AVAILABLE = 'ohosted.storage.available' VM_IMAGE_AVAILABLE = 'ohosted.vm.image.available' diff --git a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py index a14bb23..4b8838e 100644 --- a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py +++ b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py @@ -118,6 +118,7 @@ after=( ohostedcons.Stages.VDSMD_CONF_LOADED, ), + name=ohostedcons.Stages.VDSMD_LATE_SETUP_READY, ) def _late_setup(self): #We need vdsmd up for customization checks diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py index 54adeef..7b73b51 100644 --- a/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py +++ b/src/plugins/ovirt-hosted-engine-setup/vm/configurevm.py @@ -87,6 +87,31 @@ ) @plugin.event( + stage=plugin.Stages.STAGE_LATE_SETUP, + after=( + ohostedcons.Stages.VDSMD_CONF_LOADED, + ), + name=ohostedcons.Stages.VDSMD_LATE_SETUP_READY, + ) + def _late_setup(self): + serv = self.environment[ohostedcons.VDSMEnv.VDS_CLI] + response = serv.s.list() + if response['status']['code'] == 0: + self.logger.debug(response['vmList']) + if response['vmList']: + self.logger.error( + _( + 'The following VMs has been found: ' + '{vms}' + ).format( + vms=', '.join(x['vmId'] for x in response['vmList']) + ) + ) + raise RuntimeError( + _('Cannot setup Hosted Engine with other VMs running') + ) + + @plugin.event( stage=plugin.Stages.STAGE_CUSTOMIZATION, name=ohostedcons.Stages.CONFIG_BOOT_DEVICE, after=( -- To view, visit http://gerrit.ovirt.org/24481 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iae7b88d5c56bd76b87cfcdef29e629a3a30b6491 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches