Francesco Romani has uploaded a new change for review.
Change subject: vm: run before_vm_create hook only in the VM boot ......................................................................
vm: run before_vm_create hook only in the VM boot
The 'before_vm_create' hook is running in two flows: * as expected, in the VM creation flow. * as may not be expected, in the VM dehybernation flow.
The latter is surprising and, most important, contractdicting because in the dehibernation flow * the domain XML returned by the before_vm_create is never used * just after the before_vm_create hook, we run the before_vm_dehibernate hook with the stored domain XML.
At risk to breaking some probably already incorrect hook, this patch makes the before_vm_create hook run only in the VM creation path.
Change-Id: I2ad05e39029acc7b898c7b2af2141bba1d7d3c8e Signed-off-by: Francesco Romani fromani@redhat.com --- M vdsm/virt/vm.py 1 file changed, 3 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/34530/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 6e46119..751947e 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -2667,10 +2667,6 @@ # we need to complete the initialization, including # domDependentInit, after the migration is completed.
- if not self.recovering and initDomain: - domxml = hooks.before_vm_start(self._buildDomainXML(), self.conf) - self.log.debug(domxml) - if self.recovering: self._dom = NotifyingVirDomain( self._connection.lookupByUUIDString(self.id), @@ -2698,6 +2694,9 @@ self._connection.lookupByUUIDString(self.id), self._timeoutExperienced) else: + domxml = hooks.before_vm_start(self._buildDomainXML(), self.conf) + self.log.debug(domxml) + flags = libvirt.VIR_DOMAIN_NONE if 'launchPaused' in self.conf: flags |= libvirt.VIR_DOMAIN_START_PAUSED