Fix OpenNebula save/restore

This commit is contained in:
Vitaliy Filippov
2024-09-04 11:05:56 +03:00
parent 9c2132882c
commit 8be67a2d5b
5 changed files with 22 additions and 5 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ set -e
reapply_patch() {
if ! patch -f --dry-run -l -R $1 < $2 >/dev/null; then
already_applied=0
if ! patch -l -f $1 < $2; then
if ! patch --no-backup-if-mismatch -r - -l -f $1 < $2; then
applied_ok=0
echo "ERROR: Failed to patch file $1, please apply the patch $2 manually"
fi
+3 -1
View File
@@ -19,7 +19,7 @@ XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH \
done < <(cat | $XPATH \
/VMM_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VITASTOR_CONF \
/VMM_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/IMAGE_PREFIX)
@@ -35,3 +35,5 @@ SRC_IMAGE="${IMAGE_PREFIX}-sys-${VM_ID}-checkpoint"
exec_and_log "$CLI dd iimg=$SRC_IMAGE of=$FILE" "Error exporting checkpoint into from $SRC_IMAGE to $FILE"
exec_and_log "$CLI rm $SRC_IMAGE" "Error removing checkpoint $SRC_IMAGE"
"$DRIVER_PATH"/restore $@
+5 -2
View File
@@ -14,13 +14,16 @@ FILE=$2
VM_ID=$4
DS_ID=$5
rm -f "$FILE"
"$DRIVER_PATH"/save $@
XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin"
unset i j XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH \
done < <(cat | $XPATH \
/VMM_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VITASTOR_CONF \
/VMM_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/IMAGE_PREFIX \
/VMM_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/POOL_NAME)
@@ -39,7 +42,7 @@ fi
DST_IMAGE="${IMAGE_PREFIX}-sys-${VM_ID}-checkpoint"
exec_and_log "$CLI dd if=$FILE oimg=$DST_IMAGE" "Error importing checkpoint into $DST_IMAGE"
exec_and_log "$CLI dd if=$FILE oimg=$DST_IMAGE conv=trunc" "Error importing checkpoint into $DST_IMAGE"
exec_and_log "$RM -f $FILE" "Error removing checkpoint ($FILE)"
exit 0