ssh_tm_clone.sh.patch
ssh_tm_clone.sh 2011-09-17 21:25:54.843976590 -0500 | ||
---|---|---|
18 | 18 | |
19 | 19 |
SRC=$1 |
20 | 20 |
DST=$2 |
21 |
COW=false # Replace later by script parameters. This dictates whether we create a copy-on-write disk for an existing QCOW disk. |
|
21 | 22 | |
22 | 23 |
if [ -z "${ONE_LOCATION}" ]; then |
23 | 24 |
TMCOMMON=/usr/lib/one/mads/tm_common.sh |
... | ... | |
52 | 53 | |
53 | 54 |
*) |
54 | 55 |
log "Cloning $SRC" |
55 |
exec_and_log "$SCP $SRC $DST" \ |
|
56 | ||
57 |
# Support QEMU copy-on-write disks when given a disk of QCOW type. |
|
58 |
fileType=$(file -b $SRC | cut -f 1 -d ' ') |
|
59 |
if [[ "$fileType" == "QCOW" && $COW == true ]]; then |
|
60 |
exec_and_log "$SSH $DST_HOST qemu-img create -f qcow2 -o backing_file=$SRC_PATH $DST_PATH" \ |
|
61 |
"Error copying $SRC to $DST" |
|
62 |
else |
|
63 |
exec_and_log "$SCP $SRC $DST" \ |
|
56 | 64 |
"Error copying $SRC to $DST" |
65 |
fi |
|
57 | 66 |
;; |
58 | 67 |
esac |
59 | 68 |