mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-19 06:50:07 +03:00
F #814: skip VM snapshots xml if metadata are missing
This commit is contained in:
parent
5c711d8ba7
commit
c419db5664
@ -46,13 +46,14 @@ SNAP_NAME="snap-${SNAP_ID}"
|
||||
data=`virsh --connect $LIBVIRT_URI snapshot-create-as $DOMAIN --name "$SNAP_NAME"`
|
||||
|
||||
if [ "$?" = "0" ]; then
|
||||
|
||||
SNAP_XML_PATH="${DATASTORE_PATH}/${SNAP_NAME}.xml"
|
||||
|
||||
# dump snapshot metadata xml to the VM location
|
||||
virsh --connect $LIBVIRT_URI snapshot-dumpxml $DOMAIN $SNAP_NAME > $SNAP_XML_PATH || true
|
||||
|
||||
echo "$data" | awk '{print $3}'
|
||||
|
||||
if [ -n "$DATASTORE_PATH" ]; then
|
||||
SNAP_XML_PATH="${DATASTORE_PATH}/${SNAP_NAME}.xml"
|
||||
|
||||
# dump snapshot metadata xml to the VM location
|
||||
virsh --connect $LIBVIRT_URI snapshot-dumpxml $DOMAIN $SNAP_NAME > $SNAP_XML_PATH || true
|
||||
fi
|
||||
else
|
||||
error_message "Could not create snapshot $NAME for domain $DOMAIN."
|
||||
exit -1
|
||||
|
@ -42,7 +42,7 @@ DATASTORE_PATH="${XPATH_ELEMENTS[i++]}"
|
||||
|
||||
# ------ Delete snapshot metadata and the snapshot itself ----------
|
||||
|
||||
rm ${DATASTORE_PATH}/${NAME}.xml 2>/dev/null || true
|
||||
[ -n "$DATASTORE_PATH" ] && rm ${DATASTORE_PATH}/${NAME}.xml 2>/dev/null || true
|
||||
|
||||
exec_and_log \
|
||||
"virsh --connect $LIBVIRT_URI snapshot-delete $DOMAIN $NAME" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user