Francesco Romani has uploaded a new change for review. Change subject: vm: serialize destroy() and creation ......................................................................
vm: serialize destroy() and creation Change-Id: I234922e46791f5baf46fcb5c790a9d386ac92371 Signed-off-by: Francesco Romani <from...@redhat.com> --- M vdsm/virt/vm.py 1 file changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/55150/1 diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 60d17e2..5950d1e 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -84,6 +84,10 @@ from .vmxml import METADATA_VM_TUNE_PREFIX +# in seconds, just selected "big enough" random value +_DESTROY_STARTUP_TIMEOUT = 30 + + DEFAULT_BRIDGE = config.get("vars", "default_bridge") # A libvirt constant for undefined cpu quota @@ -303,6 +307,7 @@ self._numaInfo = {} self._vmJobs = None self._clientPort = '' + self._created = threading.Event() @property def start_time(self): @@ -751,6 +756,7 @@ self.log.exception("The vm start process failed") self.setDownStatus(ERROR, vmexitreason.GENERIC_ERROR, str(e)) finally: + self._created.set() if acquired: self.log.debug('Releasing incoming migration semaphore') migration.incomingMigrations.release() @@ -1744,15 +1750,6 @@ uuidPath, name) def _domDependentInit(self): - if self._destroyed.is_set(): - # reaching here means that Vm.destroy() was called before we could - # handle it. We must handle it now - try: - self._dom.destroy() - except Exception: - pass - raise Exception('destroy() called before Vm started') - if not self._dom.connected: raise MissingLibvirtDomainError(vmexitreason.LIBVIRT_START_FAILED) @@ -3884,6 +3881,9 @@ def destroy(self): self.log.debug('destroy Called') + if not self._created.wait(_DESTROY_STARTUP_TIMEOT): + self.log.warning('VM still booting, timeout reached') + return response.error('unavail') result = self.doDestroy() if response.is_error(result): -- To view, visit https://gerrit.ovirt.org/55150 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I234922e46791f5baf46fcb5c790a9d386ac92371 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <from...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches