From 72b2f28cebd815baca9d41567d02951d839527a1 Mon Sep 17 00:00:00 2001 From: Jan Orel Date: Wed, 17 Jul 2019 15:01:45 +0200 Subject: [PATCH] F #3244: Better mixed modes ceph/clone.ssh --- include/VirtualMachine.h | 4 +- include/VirtualMachineDisk.h | 2 +- install.sh | 7 +- src/tm/TransferManager.cc | 79 ++++++++++++++++----- src/tm_mad/ceph/clone | 53 ++++----------- src/tm_mad/ceph/clone.ssh | 124 +++++++++++++++++++++++++++++++++ src/tm_mad/ceph/cpds | 58 ++++------------ src/tm_mad/ceph/cpds.ssh | 128 +++++++++++++++++++++++++++++++++++ src/tm_mad/ceph/delete | 26 +++---- src/tm_mad/ceph/delete.ssh | 20 ++++++ src/tm_mad/ceph/ln | 28 ++------ src/tm_mad/ceph/ln.ssh | 109 +++++++++++++++++++++++++++++ src/tm_mad/ceph/mvds | 106 +---------------------------- src/tm_mad/ceph/mvds.ssh | 121 +++++++++++++++++++++++++++++++++ src/tm_mad/ceph/resize | 15 +--- src/tm_mad/ceph/resize.ssh | 63 +++++++++++++++++ src/tm_mad/one_tm.rb | 15 ++++ src/vm/VirtualMachineDisk.cc | 2 +- 18 files changed, 699 insertions(+), 261 deletions(-) create mode 100755 src/tm_mad/ceph/clone.ssh create mode 100755 src/tm_mad/ceph/cpds.ssh create mode 100755 src/tm_mad/ceph/delete.ssh create mode 100755 src/tm_mad/ceph/ln.ssh create mode 100755 src/tm_mad/ceph/mvds.ssh create mode 100755 src/tm_mad/ceph/resize.ssh diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 02ddfdea50d..a1d29659da1 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -2035,11 +2035,11 @@ class VirtualMachine : public PoolObjectSQL * netowrking updates. * @param context attribute of the VM * @param error string if any - * @param only_auto boolean to generate context only for vnets + * @param only_auto boolean to generate context only for vnets * with NETWORK_MODE = auto * @return 0 on success */ - int generate_network_context(VectorAttribute * context, string& error, + int generate_network_context(VectorAttribute * context, string& error, bool only_auto); /** diff --git a/include/VirtualMachineDisk.h b/include/VirtualMachineDisk.h index eb9fb0cccb8..ed26f369fe1 100644 --- a/include/VirtualMachineDisk.h +++ b/include/VirtualMachineDisk.h @@ -154,7 +154,7 @@ class VirtualMachineDisk : public VirtualMachineAttribute /** * Return the TM_MAD_SYSTEM attribute */ - std::string get_tm_mad_system(); + std::string get_tm_mad_system() const; /* ---------------------------------------------------------------------- */ /* Image Manager Interface */ diff --git a/install.sh b/install.sh index 6aee675b94f..ae7d8dc039b 100755 --- a/install.sh +++ b/install.sh @@ -1277,9 +1277,12 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \ src/tm_mad/dummy/resize" TM_CEPH_FILES="src/tm_mad/ceph/clone \ + src/tm_mad/ceph/clone.ssh \ src/tm_mad/ceph/ln \ + src/tm_mad/ceph/ln.ssh \ src/tm_mad/ceph/mv \ src/tm_mad/ceph/mvds \ + src/tm_mad/ceph/mvds.ssh \ src/tm_mad/ceph/cpds \ src/tm_mad/ceph/premigrate \ src/tm_mad/ceph/postmigrate \ @@ -1289,11 +1292,13 @@ TM_CEPH_FILES="src/tm_mad/ceph/clone \ src/tm_mad/ceph/snap_revert \ src/tm_mad/ceph/failmigrate \ src/tm_mad/ceph/delete \ + src/tm_mad/ceph/delete.ssh \ src/tm_mad/ceph/context \ src/tm_mad/ceph/mkimage \ src/tm_mad/ceph/monitor \ src/tm_mad/ceph/mkswap \ - src/tm_mad/ceph/resize" + src/tm_mad/ceph/resize \ + src/tm_mad/ceph/resize.ssh" TM_DEV_FILES="src/tm_mad/dev/clone \ src/tm_mad/dev/ln \ diff --git a/src/tm/TransferManager.cc b/src/tm/TransferManager.cc index db8d8d369cf..8880f665640 100644 --- a/src/tm/TransferManager.cc +++ b/src/tm/TransferManager.cc @@ -420,17 +420,23 @@ int TransferManager::prolog_transfer_command( // CLONE or LINK disk images // ----------------------------------------------------------------- - // tm_mad fe:SOURCE host:remote_system_ds/disk.i vmid dsid + // (.tm_mad_system) tm_mad fe:SOURCE host:remote_system_ds/disk.i vmid dsid" if (clon == "YES") { - xfr << "CLONE "; + xfr << "CLONE"; } else { - xfr << "LN "; + xfr << "LN"; } - xfr << tm_mad << " "; + std::string tsys = disk->get_tm_mad_system(); + if (!tsys.empty()) + { + xfr << "." << tsys; + } + + xfr << " " << tm_mad << " "; if ( source.find(":") == string::npos ) //Regular file { @@ -1121,9 +1127,16 @@ void TransferManager::epilog_transfer_command( return; } - //MVDS tm_mad hostname:remote_system_dir/disk.0 vmid dsid - xfr << "MVDS " - << tm_mad << " " + //MVDS(.tm_mad_system) tm_mad hostname:remote_system_dir/disk.0 vmid dsid + xfr << "MVDS"; + + string tsys = disk->vector_value("TM_MAD_SYSTEM"); + if (!tsys.empty()) + { + xfr << "." << tsys; + } + + xfr << " " << tm_mad << " " << host << ":" << vm->get_system_dir() << "/disk." << disk_id << " " << source << " " << vm->get_oid() << " " @@ -1148,10 +1161,18 @@ void TransferManager::epilog_transfer_command( vv_rc = disk->vector_value("DATASTORE_ID", ds_id_i); } + string tm_mad_system = ""; + string tsys = disk->vector_value("TM_MAD_SYSTEM"); + if (!tsys.empty()) + { + tm_mad_system = "." + tsys; + } + if ( !tm_mad.empty() && vv_rc == 0) { - //DELETE tm_mad hostname:remote_system_dir/disk.i vmid ds_id - xfr << "DELETE " + //DELETE(.tm_mad_system) tm_mad hostname:remote_system_dir/disk.i vmid ds_id + xfr << "DELETE" + << tm_mad_system << " " << tm_mad << " " << host << ":" << vm->get_system_dir() << "/disk." << disk_id << " " << vm->get_oid() << " " @@ -1487,11 +1508,18 @@ int TransferManager::epilog_delete_commands(VirtualMachine *vm, } } - //DELETE tm_mad host:remote_system_dir/disk.i vmid dsid(image) + //DELETE tm_mad(.tm_mad_system) host:remote_system_dir/disk.i vmid dsid(image) // *local* DELETE tm_mad fe:system_dir/disk.i vmid dsid(image) // *prev* DELETE tm_mad prev_host:remote_system_dir/disk.i vmid ds_id(image) - xfr << "DELETE " - << tm_mad << " " + xfr << "DELETE"; + + string tsys = (*disk)->vector_value("TM_MAD_SYSTEM"); + if (!tsys.empty()) + { + xfr << "." + tsys; + } + + xfr << " " << tm_mad << " " << host << ":" << system_dir << "/disk." << disk_id << " " << vm->get_oid() << " " @@ -1898,6 +1926,8 @@ void TransferManager::saveas_hot_action(int vid) string snap_id; string tm_mad; string ds_id; + string tsys; + string tm_mad_system; ostringstream os; @@ -1906,6 +1936,7 @@ void TransferManager::saveas_hot_action(int vid) VirtualMachine * vm; const TransferManagerDriver * tm_md; + VirtualMachineDisk * disk; Nebula& nd = Nebula::instance(); @@ -1944,9 +1975,16 @@ void TransferManager::saveas_hot_action(int vid) goto error_file; } + disk = vm->get_disk(disk_id); + tsys = disk->vector_value("TM_MAD_SYSTEM"); + if (!tsys.empty()) + { + tm_mad_system = "." + tsys; + } + //CPDS tm_mad hostname:remote_system_dir/disk.0 source snapid vmid dsid - xfr << "CPDS " - << tm_mad << " " + xfr << "CPDS" << tm_mad_system + << " " << tm_mad << " " << vm->get_hostname() << ":" << vm->get_system_dir() << "/disk." << disk_id << " " << src << " " @@ -2154,9 +2192,16 @@ void TransferManager::resize_command(VirtualMachine * vm, ds_id = disk->vector_value("DATASTORE_ID"); } - //RESIZE tm_mad host:remote_system_dir/disk.i size vmid dsid - xfr << "RESIZE " - << tm_mad << " " + //RESIZE.(tm_mad_system) tm_mad host:remote_system_dir/disk.i size vmid dsid + xfr << "RESIZE"; + + string tsys = disk->vector_value("TM_MAD_SYSTEM"); + if (!tsys.empty()) + { + xfr << "." + tsys; + } + + xfr << " " << tm_mad << " " << vm->get_hostname() << ":" << vm->get_system_dir()<< "/disk."<< disk->vector_value("DISK_ID")<< " " << disk->vector_value("SIZE") << " " diff --git a/src/tm_mad/ceph/clone b/src/tm_mad/ceph/clone index 888059eb2ad..6d1fc72ed15 100755 --- a/src/tm_mad/ceph/clone +++ b/src/tm_mad/ceph/clone @@ -74,15 +74,13 @@ done < <(onevm show -x $VM_ID| $XPATH \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_KEY \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_CONF \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SIZE \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/ORIGINAL_SIZE \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/TYPE ) + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/ORIGINAL_SIZE ) CEPH_USER="${XPATH_ELEMENTS[j++]}" CEPH_KEY="${XPATH_ELEMENTS[j++]}" CEPH_CONF="${XPATH_ELEMENTS[j++]}" SIZE="${XPATH_ELEMENTS[j++]}" ORIGINAL_SIZE="${XPATH_ELEMENTS[j++]}" -TYPE="${XPATH_ELEMENTS[j++]}" #------------------------------------------------------------------------------- # Get Datastore information @@ -117,49 +115,26 @@ if [ -n "$EC_POOL_NAME" ]; then EC_POOL_OPT="--data-pool ${EC_POOL_NAME}" fi -if [ "${TYPE}" = 'FILE' ]; then - ssh_make_path $DST_HOST $DST_DIR 'ssh' +CLONE_CMD=$(cat </dev/null 2>&1 && exit 0 - rbd_make_snap $SRC_PATH + rbd_make_snap $SRC_PATH - set -e -o pipefail + set -e -o pipefail - if [ "\$(rbd_format $SRC_PATH)" = "2" ]; then - $RBD export "$SRC_PATH@snap" $DST_PATH - else - $RBD export $SRC_PATH $DST_PATH - fi + if [ "\$(rbd_format $SRC_PATH)" = "2" ]; then + $RBD ${EC_POOL_OPT} clone "$SRC_PATH@snap" $RBD_DST + else + $RBD copy $SRC_PATH $RBD_DST + fi - if [ -n "$ORIGINAL_SIZE" -a "$SIZE" -gt "$ORIGINAL_SIZE" ]; then - qemu-img resize ${DST_PATH} ${SIZE}M - fi + if [ -n "$ORIGINAL_SIZE" -a "$SIZE" -gt "$ORIGINAL_SIZE" ]; then + $RBD resize $RBD_DST --size $SIZE + fi EOF ) -else - CLONE_CMD=$(cat </dev/null 2>&1 && exit 0 - - rbd_make_snap $SRC_PATH - - set -e -o pipefail - - if [ "\$(rbd_format $SRC_PATH)" = "2" ]; then - $RBD ${EC_POOL_OPT} clone "$SRC_PATH@snap" $RBD_DST - else - $RBD copy $SRC_PATH $RBD_DST - fi - - if [ -n "$ORIGINAL_SIZE" -a "$SIZE" -gt "$ORIGINAL_SIZE" ]; then - $RBD resize $RBD_DST --size $SIZE - fi -EOF -) -fi ssh_exec_and_log_stdin "$DST_HOST" "$CLONE_CMD" "$CEPH_UTILS" \ "Error cloning $SRC_PATH to $RBD_DST in $DST_HOST" diff --git a/src/tm_mad/ceph/clone.ssh b/src/tm_mad/ceph/clone.ssh new file mode 100755 index 00000000000..1517d91192a --- /dev/null +++ b/src/tm_mad/ceph/clone.ssh @@ -0,0 +1,124 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# clone.ssh fe:SOURCE host:remote_system_ds/disk.i size +# - fe is the front-end hostname +# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk +# - host is the target host to deploy the VM +# - remote_system_ds is the path for the system datastore in the host + +SRC=$1 +DST=$2 +VM_ID=$3 +DS_ID=$4 + +#-------------------------------------------------------------------------------- + +if [ -z "${ONE_LOCATION}" ]; then + TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh + LIB_LOCATION=/usr/lib/one +else + TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh + LIB_LOCATION=$ONE_LOCATION/lib +fi + +DRIVER_PATH=$(dirname $0) + +source $TMCOMMON +source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf + +CEPH_UTILS=${DRIVER_PATH}/../../datastore/ceph/ceph_utils.sh + +#------------------------------------------------------------------------------- +# Compute the destination image name +#------------------------------------------------------------------------------- + +DST_HOST=`arg_host $DST` + +SRC_PATH=`arg_path $SRC` +DST_PATH=`arg_path $DST` + +DST_DIR=`dirname $DST_PATH` + +DISK_ID=$(echo $DST|awk -F. '{print $NF}') +RBD_DST="${SRC_PATH}-${VM_ID}-${DISK_ID}" + +#------------------------------------------------------------------------------- +# Get Image information +#------------------------------------------------------------------------------- + +XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin" + +unset i j XPATH_ELEMENTS + +while IFS= read -r -d '' element; do + XPATH_ELEMENTS[i++]="$element" +done < <(onevm show -x $VM_ID| $XPATH \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_USER \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_KEY \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_CONF \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SIZE \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/ORIGINAL_SIZE) + +CEPH_USER="${XPATH_ELEMENTS[j++]}" +CEPH_KEY="${XPATH_ELEMENTS[j++]}" +CEPH_CONF="${XPATH_ELEMENTS[j++]}" +SIZE="${XPATH_ELEMENTS[j++]}" +ORIGINAL_SIZE="${XPATH_ELEMENTS[j++]}" + +#------------------------------------------------------------------------------- +# Create @snap and export it +#------------------------------------------------------------------------------- + +if [ -n "$CEPH_USER" ]; then + RBD="$RBD --id ${CEPH_USER}" +fi + +if [ -n "$CEPH_KEY" ]; then + RBD="$RBD --keyfile ${CEPH_KEY}" +fi + +if [ -n "$CEPH_CONF" ]; then + RBD="$RBD --conf ${CEPH_CONF}" +fi + + +ssh_make_path $DST_HOST $DST_DIR 'ssh' + +CLONE_CMD=$(cat <&2 + RBD_DST=\$(rbd_find_snap $RBD_DST $SNAP_ID) + + if [ -z "\$RBD_DST" ]; then + echo "Target RBD not found." >&2 exit 1 fi - $RBD import $FORMAT_OPT $SRC_PATH $DST -EOF -) -else - COPY_CMD=$(cat <&2 - exit 1 - fi - - RBD_DST=\$RBD_DST@$SNAP_ID - else - RBD_DST=$RBD_DST - fi + RBD_DST=\$RBD_DST@$SNAP_ID + else + RBD_DST=$RBD_DST + fi - $RBD ${EC_POOL_OPT} copy \$RBD_DST $DST + $RBD ${EC_POOL_OPT} copy \$RBD_DST $DST EOF ) -fi ssh_exec_and_log_stdin "$SRC_HOST" "$COPY_CMD" "$CEPH_UTILS" \ "Error cloning $RBD_DST to $DST in $SRC_HOST" diff --git a/src/tm_mad/ceph/cpds.ssh b/src/tm_mad/ceph/cpds.ssh new file mode 100755 index 00000000000..a22f9075e2e --- /dev/null +++ b/src/tm_mad/ceph/cpds.ssh @@ -0,0 +1,128 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +# cpds host:remote_system_ds/disk.i fe:SOURCE snapid vmid dsid +# - fe is the front-end hostname +# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk +# - host is the target host to deploy the VM +# - remote_system_ds is the path for the system datastore in the host +# - snapid is the snapshot id. "-1" for none + +SRC=$1 +DST=$2 +SNAP_ID=$3 +VM_ID=$4 +DS_ID=$5 + +#-------------------------------------------------------------------------------- + +if [ -z "${ONE_LOCATION}" ]; then + TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh + LIB_LOCATION=/usr/lib/one +else + TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh + LIB_LOCATION=$ONE_LOCATION/lib +fi + +DRIVER_PATH=$(dirname $0) + +source $TMCOMMON +source ${DRIVER_PATH}/../../etc/datastore/ceph/ceph.conf +source ${DRIVER_PATH}/../../etc/vmm/kvm/kvmrc + +CEPH_UTILS=${DRIVER_PATH}/../../datastore/ceph/ceph_utils.sh + +#------------------------------------------------------------------------------- +# Set dst path and dir +#------------------------------------------------------------------------------- + +SRC_PATH=`arg_path $SRC` +SRC_HOST=`arg_host $SRC` +RBD_SRC=`arg_path $SRC` + +#------------------------------------------------------------------------------- +# Get Image information +#------------------------------------------------------------------------------- + +DISK_ID=$(echo "$RBD_SRC" | $AWK -F. '{print $NF}') + +XPATH="${DRIVER_PATH}/../../datastore/xpath.rb --stdin" + +unset i j XPATH_ELEMENTS + +while IFS= read -r -d '' element; do + XPATH_ELEMENTS[i++]="$element" +done < <(onevm show -x $VM_ID| $XPATH \ + /VM/DEPLOY_ID \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/SOURCE \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CLONE \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_USER \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_KEY \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_CONF \ + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/TYPE ) + +DEPLOY_ID="${XPATH_ELEMENTS[j++]}" +RBD_SRC="${XPATH_ELEMENTS[j++]}" +CLONE="${XPATH_ELEMENTS[j++]}" +CEPH_USER="${XPATH_ELEMENTS[j++]}" +CEPH_KEY="${XPATH_ELEMENTS[j++]}" +CEPH_CONF="${XPATH_ELEMENTS[j++]}" +TYPE="${XPATH_ELEMENTS[j++]}" + + +#------------------------------------------------------------------------------- +# Copy Image back to the datastore +#------------------------------------------------------------------------------- + +if [ -n "$CEPH_USER" ]; then + RBD="$RBD --id ${CEPH_USER}" +fi + +if [ -n "$CEPH_KEY" ]; then + RBD="$RBD --keyfile ${CEPH_KEY}" +fi + +if [ -n "$CEPH_CONF" ]; then + RBD="$RBD --conf ${CEPH_CONF}" +fi + +if [ "$RBD_FORMAT" = "2" ]; then + FORMAT_OPT="--image-format 2" +fi + +if [ "$SNAP_ID" != "-1" ]; then + error_message "$script_name: Operation not supported on disk type ${TYPE} with snapshots" + exit 1 +fi + +COPY_CMD=$(cat <&2 + exit 1 + fi + + $RBD import $FORMAT_OPT $SRC_PATH $DST +EOF +) + +ssh_exec_and_log_stdin "$SRC_HOST" "$COPY_CMD" "$CEPH_UTILS" \ + "Error cloning $RBD_DST to $DST in $SRC_HOST" diff --git a/src/tm_mad/ceph/delete b/src/tm_mad/ceph/delete index f0937e9dd6f..fa2033ea9a7 100755 --- a/src/tm_mad/ceph/delete +++ b/src/tm_mad/ceph/delete @@ -115,8 +115,7 @@ done < <(onevm show -x $VM_ID | $XPATH \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_USER \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_KEY \ /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/CEPH_CONF \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/POOL_NAME \ - /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/TYPE ) + /VM/TEMPLATE/DISK[DISK_ID=$DISK_ID]/POOL_NAME) SRC="${XPATH_ELEMENTS[j++]}" CLONE="${XPATH_ELEMENTS[j++]}" @@ -124,7 +123,6 @@ CEPH_USER="${XPATH_ELEMENTS[j++]}" CEPH_KEY="${XPATH_ELEMENTS[j++]}" CEPH_CONF="${XPATH_ELEMENTS[j++]}" POOL_NAME="${XPATH_ELEMENTS[j++]:-$POOL_NAME}" -TYPE="${XPATH_ELEMENTS[j++]}" # No need to delete no cloned images if [ "$CLONE" = "NO" ]; then @@ -159,24 +157,20 @@ fi log "Deleting $DST_PATH" -if [ "${TYPE}" = 'FILE' ]; then - exit 0 -else - DELETE_CMD=$(cat < persistnet) @@ -93,27 +88,12 @@ if [ -n "$CEPH_CONF" ]; then RBD="$RBD --conf ${CEPH_CONF}" fi -if [ "${TYPE}" = 'FILE' ]; then - ssh_make_path $DST_HOST $DST_DIR 'ssh' - - LN_CMD=$(cat < persistnet) +#------------------------------------------------------------------------------- + +if [ -n "$CEPH_USER" ]; then + RBD="$RBD --id ${CEPH_USER}" +fi + +if [ -n "$CEPH_KEY" ]; then + RBD="$RBD --keyfile ${CEPH_KEY}" +fi + +if [ -n "$CEPH_CONF" ]; then + RBD="$RBD --conf ${CEPH_CONF}" +fi + +ssh_make_path $DST_HOST $DST_DIR 'ssh' + +LN_CMD=$(cat <