ssh tm - image should not be deleted after mv failure
|Assignee:||Javi Fontan||% Done:|
|Category:||Drivers - Auth|
|Target version:||Release 3.2|
|Affected Versions:||OpenNebula 3.0|
If using persistent images and ssh TM the image is transferred to destination host, and transferred back to ONE host after undeploy. If something goes wrong while moving the image back the image is deleted on destination host and all changes in image are lost.
I think this small hack should work.
--- tm_mv.sh.org 2011-12-27 11:32:55.888460191 +0100 +++ tm_mv.sh 2011-12-27 11:36:14.860457937 +0100 @@ -40,4 +40,9 @@ "Unable to create directory $DST_DIR" exec_and_log "$SCP -r $SRC $DST" \ "Could not copy $SRC to $DST" -exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH" +code=$? + if [ "x$code" != "x0" ]; then + exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH" +else + log "Moving $SRC_PATH failed. Move $SRC_PATH manually:" +fi