Vered Volansky has uploaded a new change for review.
Change subject: hooks: Add disk hot plug/unplug hooks
......................................................................
hooks: Add disk hot plug/unplug hooks
Change-Id: I10b689964fad3a1118974f7ba7b91e795cbffd1f
Signed-off-by: Vered Volansky <vvolansk(a)redhat.com>
---
M vdsm/hooks.py
M vdsm/libvirtvm.py
2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/12479/1
diff --git a/vdsm/hooks.py b/vdsm/hooks.py
index b3c53d3..95516a8 100644
--- a/vdsm/hooks.py
+++ b/vdsm/hooks.py
@@ -201,6 +201,22 @@
raiseError=False)
+def before_disk_hotplug(domxml, vmconf={}):
+ return _runHooksDir(domxml, 'before_disk_hotplug', vmconf=vmconf)
+
+
+def after_disk_hotplug(domxml, vmconf={}):
+ return _runHooksDir(domxml, 'after_disk_hotplug', vmconf=vmconf)
+
+
+def before_disk_hotunplug(domxml, vmconf={}):
+ return _runHooksDir(domxml, 'before_disk_hotunplug', vmconf=vmconf)
+
+
+def after_disk_hotunplug(domxml, vmconf={}):
+ return _runHooksDir(domxml, 'after_disk_hotunplug', vmconf=vmconf)
+
+
def before_vdsm_start():
return _runHooksDir(None, 'before_vdsm_start', raiseError=False)
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index e2ada06..d96d3cc 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1740,7 +1740,9 @@
self.log.debug("Hotplug disk xml: %s" % (driveXml))
try:
+ hooks.before_disk_hotplug(driveXml, self.conf)
self._dom.attachDevice(driveXml)
+ hooks.after_disk_hotplug(driveXml, self.conf)
except libvirt.libvirtError as e:
self.log.error("Hotplug failed", exc_info=True)
self.cif.teardownVolumePath(diskParams)
@@ -1800,7 +1802,9 @@
self.saveState()
try:
+ hooks.before_disk_hotunplug(driveXml, self.conf)
self._dom.detachDevice(driveXml)
+ hooks.after_disk_hotunplug(driveXml, self.conf)
except libvirt.libvirtError as e:
self.log.error("Hotunplug failed", exc_info=True)
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
--
To view, visit
http://gerrit.ovirt.org/12479
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I10b689964fad3a1118974f7ba7b91e795cbffd1f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <vvolansk(a)redhat.com>