]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
CP-1981: Hook in the reset-vdis script to HA
authorJon Ludlam <jonathan.ludlam@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
committerJon Ludlam <jonathan.ludlam@eu.citrix.com>
Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)
The 'locks' for the VDIs, which are maintained by the SM backends now, are stored in xapi's database. In the event of a master failover, the pool database may rev
ert to a previous backup, which is then resynced with reality. Unfortunately there's no logic to resync the SM backends' data, nor any hook point to do this. Idea
lly, the SM backends would store their critical data internally somehow, but until this happens xapi will have to contain the important logic to resynchronise the
se locks.

This patch adds a host-post-declare-dead script that causes the reset of the locks of VDIs that were present on a host that has been declared dead.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
scripts/10resetvdis [new file with mode: 0644]
scripts/OMakefile
xapi.spec

diff --git a/scripts/10resetvdis b/scripts/10resetvdis
new file mode 100644 (file)
index 0000000..ff348cb
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Call the SM backend python program to reset the locks on all the VDIs that were on the
+# host that has been declared dead
+
+HOSTUUID=$2
+
+IFS=","
+for i in `xe pbd-list host-uuid=$HOSTUUID --minimal`
+do
+   SR=`xe pbd-param-get uuid=$i param-name=sr-uuid`  
+   /opt/xensource/sm/resetvdis.py $HOSTUUID $SR 
+done
index 78020b1ca4a3bed4d9bbe320090a6b83c363b78c..c708a92568391f3cecac0c61802899c619bc199a 100644 (file)
@@ -99,6 +99,8 @@ install:
        $(IPROG) plugins/extauth-hook $(DESTDIR)/etc/xapi.d/plugins/
        $(IPROG) plugins/extauth-hook-AD.py $(DESTDIR)/etc/xapi.d/plugins/
        $(IPROG) set-dom0-memory-target-from-packs $(LIBEXEC)
+       mkdir -p $(DESTDIR)/etc/xapi.d/host-post-declare-dead
+       $(IPROG) 10resetvdis $(DESTDIR)/etc/xapi.d/host-post-declare-dead/
 
 .PHONY: sdk-install
 sdk-install: install
index f2586f5ad38e620f7608a1a71f2719b92962e4fd..ab622e201346d1420b0a99c71aad278ddcf57b06 100644 (file)
--- a/xapi.spec
+++ b/xapi.spec
@@ -259,6 +259,7 @@ rm -rf $RPM_BUILD_ROOT
 %exclude   /usr/lib/python2.4/site-packages/xen/lowlevel/*
 /var/xapi/udhcpd.skel
 /opt/xensource/debug/rbac_static.csv
+/etc/xapi.d/host-post-declare-dead/10resetvdis
 
 %files xe
 %defattr(-,root,root,-)