From ecad87542101d137e23ffe44158b2f52a471e1a0 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Wed, 26 Jan 2011 17:39:04 +0000 Subject: [PATCH] CP-1981: Hook in the reset-vdis script to HA 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 --- scripts/10resetvdis | 13 +++++++++++++ scripts/OMakefile | 2 ++ xapi.spec | 1 + 3 files changed, 16 insertions(+) create mode 100644 scripts/10resetvdis diff --git a/scripts/10resetvdis b/scripts/10resetvdis new file mode 100644 index 00000000..ff348cbb --- /dev/null +++ b/scripts/10resetvdis @@ -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 diff --git a/scripts/OMakefile b/scripts/OMakefile index 78020b1c..c708a925 100644 --- a/scripts/OMakefile +++ b/scripts/OMakefile @@ -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 diff --git a/xapi.spec b/xapi.spec index f2586f5a..ab622e20 100644 --- 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,-) -- 2.39.5