Change in vdsm[master]: Added two new hook points: before/after_device_migrate_sourc...

amuller at redhat.com amuller at redhat.com
Sun Apr 14 07:15:42 UTC 2013


Assaf Muller has uploaded a new change for review.

Change subject: Added two new hook points: before/after_device_migrate_source
......................................................................

Added two new hook points: before/after_device_migrate_source

Continued effort on device custom properties. Added two new hook points
before/after_device_migrate_source. The new hooks are called for every
device that has custom properties.

Change-Id: I12278b91102f9bc0f031c4605ebf8b43fcb1bd6f
Signed-off-by: Assaf Muller <amuller at redhat.com>
---
M vdsm/hooks.py
M vdsm/libvirtvm.py
2 files changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/13876/1

diff --git a/vdsm/hooks.py b/vdsm/hooks.py
index c66bfef..aaa56e5 100644
--- a/vdsm/hooks.py
+++ b/vdsm/hooks.py
@@ -138,6 +138,16 @@
                         vmconf=vmconf, raiseError=False)
 
 
+def before_device_migrate_source(devicexml, vmconf={}, customProperties={}):
+    return _runHooksDir(devicexml, 'before_device_migrate_source',
+                        vmconf=vmconf, params=customProperties)
+
+
+def after_device_migrate_source(devicexml, vmconf={}, customProperties={}):
+    return _runHooksDir(devicexml, 'after_device_migrate_source',
+                        vmconf=vmconf, params=customProperties)
+
+
 def before_vm_migrate_source(domxml, vmconf={}):
     return _runHooksDir(domxml, 'before_vm_migrate_source', vmconf=vmconf)
 
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 429b4ae..a33a8d1 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -465,6 +465,9 @@
                 self._vm._vmStats.cont()
                 raise
         else:
+            for dev in self._vm._customDevices():
+                hooks.before_device_migrate_source(
+                    dev._deviceXML, self._vm.conf, dev.custom)
             hooks.before_vm_migrate_source(self._vm._dom.XMLDesc(0),
                                            self._vm.conf)
             response = self.destServer.migrationCreate(self._machineParams)
@@ -3096,6 +3099,9 @@
             if (detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_MIGRATED and
                     self.lastStatus == 'Migration Source'):
                 hooks.after_vm_migrate_source(self._lastXMLDesc, self.conf)
+                for dev in self._customDevices():
+                    hooks.after_device_migrate_source(
+                        dev._deviceXML, self.conf, dev.custom)
             elif (detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_SAVED and
                     self.lastStatus == 'Saving State'):
                 hooks.after_vm_hibernate(self._lastXMLDesc, self.conf)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12278b91102f9bc0f031c4605ebf8b43fcb1bd6f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller at redhat.com>


More information about the vdsm-patches mailing list