-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Option to select ssh cipher and set decent default for it
- Loading branch information
Showing
1 changed file
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ declare opt_vm_ids='' | |
declare opt_snapshot_prefix='mirror-' | ||
declare opt_rewrite='' | ||
declare opt_pool='rbd' | ||
declare opt_sshcipher='[email protected],aes128-cbc' | ||
declare -i opt_prefix_id | ||
declare opt_exclude_vmids='' | ||
declare -i opt_debug=0 | ||
|
@@ -118,6 +119,7 @@ Commands: | |
mirror Replicate a stopped VM to another Cluster (full clone) | ||
Options: | ||
--sshcipher SSH Cipher to use for transfer (default: [email protected],aes128-cbc) | ||
--vmid The source+target ID of the VM/CT, comma separated (eg. --vmid=100:100,101:101), or all for all | ||
--prefixid Prefix for VMID's on target System [optional] | ||
--excludevmids Exclusde VM IDs when using --vmid==all | ||
|
@@ -154,7 +156,7 @@ function parse_opts(){ | |
local args | ||
args=$(getopt \ | ||
--options '' \ | ||
--longoptions=vmid:,prefixid:,excludevmids:,destination:,pool:,keeplocal:,keepremote:,rewrite:,influxurl:,influxorg:,influxtoken:,influxbucket:,jobname:,mail:,online,migrate,nolock,keep-slock,keep-dlock,overwrite,dry-run,noconfirm,debug,syslog \ | ||
--longoptions=sshcipher:,vmid:,prefixid:,excludevmids:,destination:,pool:,keeplocal:,keepremote:,rewrite:,influxurl:,influxorg:,influxtoken:,influxbucket:,jobname:,mail:,online,migrate,nolock,keep-slock,keep-dlock,overwrite,dry-run,noconfirm,debug,syslog \ | ||
--name "$PROGNAME" \ | ||
-- "$@") \ | ||
|| end_process 128 | ||
|
@@ -163,6 +165,7 @@ function parse_opts(){ | |
|
||
while true; do | ||
case "$1" in | ||
--sshcipher) opt_sshcipher=$2; shift 2;; | ||
--vmid) opt_vm_ids=$2; shift 2;; | ||
--prefixid) opt_prefix_id=$2; shift 2;; | ||
--excludevmids) opt_exclude_vmids=$2; shift 2;; | ||
|
@@ -616,7 +619,7 @@ function mirror() { | |
#snapts=$(echo $currentlocal | sed -r -e 's/.*@mirror-(.*)/\1/') | ||
snapshotsize=$(rbd du --pretty-format --format json $src_image_pool/$src_image_name|jq '.images[] | select (.snapshot_id == null) | {provisioned_size}.provisioned_size'|tail -1) | ||
log debug "snapsize: $snapshotsize " | ||
xmitjob="rbd export --rbd-concurrent-management-ops 8 $src_image_pool/$src_image_name$snapshot_name --no-progress - | tee >({ wc -c; } >/tmp/$PROGNAME.$pid.$dst_image_pool-$dst_image_name.size) | pv -s $snapshotsize -F \"VM $vm_id - F $src_image_pool/$src_image_name$snapshot_name: $PVFORMAT_FULL\" | ssh $opt_destination rbd import --image-format 2 - $dst_image_pool/$dst_image_name $dst_data_opt 2>/dev/null" | ||
xmitjob="rbd export --rbd-concurrent-management-ops 8 $src_image_pool/$src_image_name$snapshot_name --no-progress - | tee >({ wc -c; } >/tmp/$PROGNAME.$pid.$dst_image_pool-$dst_image_name.size) | pv -s $snapshotsize -F \"VM $vm_id - F $src_image_pool/$src_image_name$snapshot_name: $PVFORMAT_FULL\" | ssh -c $opt_sshcipher $opt_destination rbd import --image-format 2 - $dst_image_pool/$dst_image_name $dst_data_opt 2>/dev/null" | ||
# create initial snapshot on destination | ||
log debug "xmitjob: $xmitjob" | ||
startdisk=$(date +%s) | ||
|
@@ -644,7 +647,7 @@ function mirror() { | |
#disk was not attached, or really nothing has changed.. | ||
snapshotsize=0 | ||
fi | ||
xmitjob="rbd export-diff --no-progress --from-snap $opt_snapshot_prefix$basets $src_image_pool/$currentlocal - | tee >({ wc -c; } >/tmp/$PROGNAME.$pid.$dst_image_pool-$dst_image_name.size) | pv -F \"VM $vm_id - I $src_image_pool/$src_image_name$snapshot_name: $PVFORMAT_SNAP\" | ssh $opt_destination rbd import-diff --no-progress - $dst_image_pool/$dst_image_name $dst_data_opt" | ||
xmitjob="rbd export-diff --no-progress --from-snap $opt_snapshot_prefix$basets $src_image_pool/$currentlocal - | tee >({ wc -c; } >/tmp/$PROGNAME.$pid.$dst_image_pool-$dst_image_name.size) | pv -F \"VM $vm_id - I $src_image_pool/$src_image_name$snapshot_name: $PVFORMAT_SNAP\" | ssh -c $opt_sshcipher $opt_destination rbd import-diff --no-progress - $dst_image_pool/$dst_image_name $dst_data_opt" | ||
log debug "xmitjob: $xmitjob" | ||
startdisk=$(date +%s) | ||
do_run "$xmitjob" | ||
|