Laszlo Hornyak has uploaded a new change for review.

Change subject: WIP watchdog hook
......................................................................

WIP watchdog hook

adds a hook that creates a watchdog device in the libvirt domain xml if
the watchdog parameter is set. The watchdog parameter must be in format
watchdog=<model>,<action>

For the possible values, see
http://libvirt.org/formatdomain.html#elementsWatchdog

Change-Id: Ibc1d21ff8e14013869d78532632e8485f0414793
Signed-off-by: Laszlo Hornyak <[email protected]>
---
A vdsm_hooks/watchdog/before_vm_start.py
1 file changed, 38 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/10619/1

diff --git a/vdsm_hooks/watchdog/before_vm_start.py 
b/vdsm_hooks/watchdog/before_vm_start.py
new file mode 100644
index 0000000..6e5674d
--- /dev/null
+++ b/vdsm_hooks/watchdog/before_vm_start.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+import os
+
+import hooking
+import traceback
+
+'''
+watchdog vdsmhook
+=================
+Adds a watchdog device to libvirt domain entry.
+
+Synatx:
+watchdog=model,action
+
+<devices>
+  <watchdog model="i6300esb" action="dump"/>
+</devices>
+'''
+
+if 'watchdog' in os.environ:
+    try:
+        domxml = hooking.read_domxml()
+
+        watchdog = os.environ['watchdog']
+        watchdogmodel = watchdog.split(',')[0]
+        watchdogaction = watchdog.split(',')[1]
+
+        devices = domxml.getElementsByTagName('devices')[0]
+        watchdog_device = domxml.createElement('watchdog')
+        watchdog_device.setAttribute('model',watchdogmodel)
+        watchdog_device.setAttribute('action',watchdogaction)
+
+       devices.appendChild(watchdog_device)
+
+    except:
+        sys.stderr.write('watchdog: [unexpected error]: %s\n' % 
traceback.format_exc())
+


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc1d21ff8e14013869d78532632e8485f0414793
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to