From 1d877edfe762c0a1da35d37ffdc0c017893f7108 Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 1 Nov 2011 19:46:22 -0700 Subject: [PATCH] bug 11858: fake pv : use version in host parameter instead, fix XCP override status 11858: resolved fixed commit-by: Kevin Brooks review-by: Anthony Xu --- .../hypervisor/xenserver/make_migratable.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/vm/hypervisor/xenserver/make_migratable.sh b/scripts/vm/hypervisor/xenserver/make_migratable.sh index 31d93b5509d..f2c49ac963e 100755 --- a/scripts/vm/hypervisor/xenserver/make_migratable.sh +++ b/scripts/vm/hypervisor/xenserver/make_migratable.sh @@ -18,6 +18,8 @@ fake(){ /local/domain/${domid}/data/updated 1 } +VERSION_RE="\([[:digit:]]\{1,3\}\.\)\{2\}[[:digit:]]\{1,3\}" + uuid=$(xe vm-list uuid=$1 params=uuid --minimal) if [ $? -ne 0 ]; then echo "Argument should be a VM uuid" @@ -25,12 +27,21 @@ if [ $? -ne 0 ]; then exit 1 fi -# use the PRODUCT_VERSION from here: +# use the INSTALLATION_UUID from here: . /etc/xensource-inventory -major=$(echo ${PRODUCT_VERSION} | cut -f 1 -d .) -minor=$(echo ${PRODUCT_VERSION} | cut -f 2 -d .) -micro=$(echo ${PRODUCT_VERSION} | cut -f 3 -d .) +product_version=$(xe host-list params=software-version uuid="$INSTALLATION_UUID" | \ + sed -n -e 's/product_version: \('${VERSION_RE}'\).*/\1/' \ + -e 's/^.*\('${VERSION_RE}'\)/\1/p') + +if [ $? -ne 0 ]; then + echo "Failed to get product version" + exit 1 +fi + +major=$(echo $product_version | cut -f 1 -d .) +minor=$(echo $product_version | cut -f 2 -d .) +micro=$(echo $product_version | cut -f 3 -d .) # Check the VM is running on this host resident_on=$(xe vm-list uuid=${uuid} params=resident-on --minimal)