70 |
70 |
IMAGE_NAME="one-${ID}"
|
71 |
71 |
RBD_DST="${POOL_NAME}/${IMAGE_NAME}"
|
72 |
72 |
|
73 |
|
ssh_exec_and_log "$DST_HOST" "$RBD copy $SRC $RBD_DST" \
|
|
73 |
COPY_CMD=$(cat <<EOF
|
|
74 |
set -e
|
|
75 |
$RBD copy $SRC $RBD_DST
|
|
76 |
$RBD snap create "$RBD_DST@snap"
|
|
77 |
$RBD snap protect "$RBD_DST@snap"
|
|
78 |
EOF
|
|
79 |
)
|
|
80 |
|
|
81 |
ssh_exec_and_log "$DST_HOST" "$COPY_CMD" \
|
74 |
82 |
"Error cloning $SRC to $RBD_DST in $DST_HOST"
|
75 |
83 |
|
76 |
84 |
echo "$RBD_DST"
|
77 |
|
-- datastore/ceph/cp.orig 2014-11-17 15:41:14.045970435 +0000
|
|
85 |
++ datastore/ceph/cp 2014-11-17 14:06:12.271424888 +0000
|
... | ... | |
135 |
135 |
fi
|
136 |
136 |
|
137 |
137 |
$RBD import $FORMAT_OPT $TMP_DST $RBD_SOURCE
|
|
138 |
$RBD snap create "$RBD_SOURCE@snap"
|
|
139 |
$RBD snap protect "$RBD_SOURCE@snap"
|
138 |
140 |
|
139 |
141 |
# remove original
|
140 |
142 |
$RM -f $TMP_DST
|
141 |
|
-- datastore/ceph/mkfs.orig 2014-11-17 15:41:14.217969732 +0000
|
|
143 |
++ datastore/ceph/mkfs 2014-11-17 15:18:21.855282994 +0000
|
... | ... | |
115 |
115 |
# remove original
|
116 |
116 |
$RM -f $TMP_DST
|
117 |
117 |
fi
|
|
118 |
$RBD snap create "$RBD_SOURCE@snap"
|
|
119 |
$RBD snap protect "$RBD_SOURCE@snap"
|
118 |
120 |
EOF
|
119 |
121 |
)
|
120 |
|
-- datastore/ceph/rm.orig 2014-11-17 15:41:14.565968302 +0000
|
|
122 |
++ datastore/ceph/rm 2014-11-17 15:03:47.681705160 +0000
|
... | ... | |
61 |
61 |
|
62 |
62 |
log "Removing $SRC from the rbd image repository in $DST_HOST"
|
63 |
63 |
|
64 |
|
ssh_exec_and_log "$DST_HOST" "$RBD rm $SRC" "Error removing $SRC in $DST_HOST"
|
|
64 |
RM_CMD=$(cat <<EOF
|
|
65 |
set -e
|
|
66 |
$RBD snap unprotect "$SRC@snap"
|
|
67 |
$RBD snap rm "$SRC@snap"
|
|
68 |
$RBD rm $SRC
|
|
69 |
EOF
|
|
70 |
)
|
|
71 |
|
|
72 |
ssh_exec_and_log "$DST_HOST" "$RM_CMD" "Error removing $SRC in $DST_HOST"
|
65 |
73 |
|
66 |
74 |
exit 0
|
67 |
|
-- tm/ceph/clone.orig 2014-11-17 15:41:25.025925372 +0000
|
|
75 |
++ tm/ceph/clone 2014-11-17 15:04:18.921624655 +0000
|
... | ... | |
59 |
59 |
RBD_FORMAT=\$(rbd info $SRC_PATH | sed -n 's/.*format: // p')
|
60 |
60 |
|
61 |
61 |
if [ "\$RBD_FORMAT" = "2" ]; then
|
62 |
|
$RBD snap create "$SRC_PATH@$RBD_SNAP"
|
63 |
|
$RBD snap protect "$SRC_PATH@$RBD_SNAP"
|
64 |
|
$RBD clone "$SRC_PATH@$RBD_SNAP" $RBD_DST
|
|
62 |
$RBD clone "$SRC_PATH@snap" $RBD_DST
|
65 |
63 |
else
|
66 |
64 |
$RBD copy $SRC_PATH $RBD_DST
|
67 |
65 |
fi
|
68 |
|
-- tm/ceph/cpds.orig 2014-11-17 15:41:25.201924649 +0000
|
|
66 |
++ tm/ceph/cpds 2014-11-17 15:09:16.436833482 +0000
|
... | ... | |
74 |
74 |
RBD_DST="${RBD_SRC}-${VM_ID}-${DISK_ID}"
|
75 |
75 |
fi
|
76 |
76 |
|
77 |
|
ssh_exec_and_log "$SRC_HOST" "$RBD copy $RBD_DST $DST" \
|
|
77 |
COPY_CMD=$(cat <<EOF
|
|
78 |
set -e
|
|
79 |
$RBD copy $RBD_DST $DST
|
|
80 |
$RBD snap create "$DST@snap"
|
|
81 |
$RBD snap protect "$DST@snap"
|
|
82 |
EOF
|
|
83 |
)
|
|
84 |
|
|
85 |
ssh_exec_and_log "$SRC_HOST" "$COPY_CMD" \
|
78 |
86 |
"Error cloning $RBD_DST to $DST in $SRC_HOST"
|
79 |
87 |
|
80 |
88 |
exit 0
|
81 |
|
-- tm/ceph/delete.orig 2014-11-17 15:41:25.373923944 +0000
|
|
89 |
++ tm/ceph/delete 2014-11-17 15:04:53.721534376 +0000
|
... | ... | |
92 |
92 |
|
93 |
93 |
DELETE_CMD=$(cat <<EOF
|
94 |
94 |
set -e
|
95 |
|
|
96 |
95 |
RBD_FORMAT=\$(rbd info $RBD_SRC | sed -n 's/.*format: // p')
|
97 |
|
|
98 |
96 |
$RBD rm $RBD_SRC
|
99 |
|
|
100 |
|
if [ "\$RBD_FORMAT" = "2" ]; then
|
101 |
|
$RBD snap unprotect $SRC@$RBD_SNAP
|
102 |
|
$RBD snap rm $SRC@$RBD_SNAP
|
103 |
|
fi
|
104 |
97 |
EOF
|
105 |
98 |
)
|
106 |
99 |
|
107 |
|
-- tm/ceph/mvds.orig 2014-11-17 15:41:25.901921775 +0000
|
|
100 |
++ tm/ceph/mvds 2014-11-17 15:27:14.053478397 +0000
|
... | ... | |
86 |
86 |
|
87 |
87 |
if [ "\${RBD_FORMAT}" = "2" ]; then
|
88 |
88 |
$RBD flatten $RBD_DST
|
89 |
|
$RBD snap unprotect $RBD_SRC@$RBD_SNAP
|
90 |
|
$RBD snap rm $RBD_SRC@$RBD_SNAP
|
91 |
89 |
fi
|
92 |
90 |
|
93 |
91 |
$RBD rename $RBD_DST $DST
|
|
92 |
$RBD snap create "$DST@snap"
|
|
93 |
$RBD snap protect "$DST@snap"
|
|
94 |
|
94 |
95 |
EOF
|
95 |
96 |
)
|