diff --git a/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh b/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh index 5760d5dffe3..d2ed050cb9b 100755 --- a/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh +++ b/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh @@ -77,6 +77,12 @@ elif [ $type == "lvmoiscsi" -o $type == "lvm" ]; then cleanup exit 0 fi + lvsize=$(xe vdi-param-get uuid=$uuid param-name=physical-utilisation) + if [ $? -ne 0 ]; then + echo "12#failed to get physical size of vdi $uuid" + cleanup + exit 0 + fi lvchange -ay /dev/VG_XenStorage-$sruuid/VHD-$uuid if [ $? -ne 0 ]; then echo "10#lvm can not make VDI $uuid visiable" @@ -89,12 +95,6 @@ elif [ $type == "lvmoiscsi" -o $type == "lvm" ]; then cleanup exit 0 fi - lvsize=$(xe vdi-param-get uuid=$uuid param-name=physical-utilisation) - if [ $? -ne 0 ]; then - echo "12#failed to get physical size of vdi $uuid" - cleanup - exit 0 - fi vhd-util modify -s $lvsize -n /dev/VG_XenStorage-$sruuid/VHD-$uuid if [ $? -ne 0 ]; then echo "13#failed to set new vhd physical size for vdi vdi $uuid"