[one-users] Delete & Recreate fails in case of Host-Error
Fabian Zimmermann
dev.faz at gmail.com
Thu Dec 11 04:19:20 PST 2014
Hi,
I just setup our fencing system and everything is working so far, but if
I use the HOST-ERROR-Hook to delete&recreate the VMs this will fail.
The CLEANUP is tried on the broken host - of course it will fail - and
the followed CLONE will fail, because of already existing snapshots/disks.
I just workaround this - see attached patch, which will just skip clone
if disk/snap already exists, but what's the correct way to handle this?
Thanks a lot,
Fabian Zimmermann
-------------- next part --------------
--- clone.old 2014-12-11 13:13:52.001648056 +0100
+++ clone 2014-12-11 09:32:18.882111020 +0100
@@ -76,14 +76,15 @@
CLONE_CMD=$(cat <<EOF
set -e
- RBD_FORMAT=\$($RBD info $SRC_PATH | sed -n 's/.*format: // p')
-
- if [ "\$RBD_FORMAT" = "2" ]; then
- $RBD snap create "$SRC_PATH@$RBD_SNAP"
- $RBD snap protect "$SRC_PATH@$RBD_SNAP"
- $RBD clone "$SRC_PATH@$RBD_SNAP" $RBD_DST
- else
- $RBD copy $SRC_PATH $RBD_DST
+ if ! $RBD info $RBD_DST; then
+ RBD_FORMAT=\$($RBD info $SRC_PATH | sed -n 's/.*format: // p')
+ if [ "\$RBD_FORMAT" = "2" ]; then
+ $RBD snap create "$SRC_PATH@$RBD_SNAP"
+ $RBD snap protect "$SRC_PATH@$RBD_SNAP"
+ $RBD clone "$SRC_PATH@$RBD_SNAP" $RBD_DST
+ else
+ $RBD copy $SRC_PATH $RBD_DST
+ fi
fi
EOF
)
More information about the Users
mailing list