mirror of
https://github.com/lephisto/crossover.git
synced 2025-12-06 04:09:20 +01:00
minor changes and fixes
This commit is contained in:
11
crossover
11
crossover
@@ -43,6 +43,7 @@ declare -i opt_keep_remote=0
|
|||||||
|
|
||||||
declare -r redstconf='^\/etc\/pve\/nodes\/(.*)\/qemu-server\/([0-9]+).conf$'
|
declare -r redstconf='^\/etc\/pve\/nodes\/(.*)\/qemu-server\/([0-9]+).conf$'
|
||||||
declare -r recephimg='([a-zA-Z0-9]+)\:(.*)'
|
declare -r recephimg='([a-zA-Z0-9]+)\:(.*)'
|
||||||
|
declare -r restripsnapshots='/^$/,$d'
|
||||||
|
|
||||||
function usage(){
|
function usage(){
|
||||||
shift
|
shift
|
||||||
@@ -134,6 +135,7 @@ function parse_opts(){
|
|||||||
if [ $opt_debug -eq 1 ]; then
|
if [ $opt_debug -eq 1 ]; then
|
||||||
log info "============================================"
|
log info "============================================"
|
||||||
log info "Proxmox Crosspool Migration: $VERSION";
|
log info "Proxmox Crosspool Migration: $VERSION";
|
||||||
|
log info "pid: $(cat /var/run/$PROGNAME.pid)"
|
||||||
log info "============================================"
|
log info "============================================"
|
||||||
log info "Proxmox VE Version:"
|
log info "Proxmox VE Version:"
|
||||||
|
|
||||||
@@ -399,19 +401,20 @@ function mirror() {
|
|||||||
if [ $localsnapcount -ge 2 ]; then
|
if [ $localsnapcount -ge 2 ]; then
|
||||||
# we have at least 2 local snapshots, to we can make an incremental copy
|
# we have at least 2 local snapshots, to we can make an incremental copy
|
||||||
currentlocal=$(rbd ls -l $src_image_pool | grep $src_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1|tail -n 1)
|
currentlocal=$(rbd ls -l $src_image_pool | grep $src_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1|tail -n 1)
|
||||||
localts=$(rbd ls -l $src_image_pool | grep $src_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1 | sed -r -e 's/.*@mirror-(.*)/\1/')
|
localts=$(rbd ls -l $src_image_pool | grep $src_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1 | sed -r -e 's/.*@'$opt_snapshot_prefix'(.*)/\1/')
|
||||||
fi
|
fi
|
||||||
latestremote=$(ssh $opt_destination rbd ls -l $dst_image_pool | grep $dst_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1|tail -n 1)
|
latestremote=$(ssh $opt_destination rbd ls -l $dst_image_pool | grep $dst_image_name@$opt_snapshot_prefix | cut -d ' ' -f 1|tail -n 1)
|
||||||
if [ $latestremote ]; then
|
if [ "$latestremote" ]; then
|
||||||
[[ $latestremote =~ ^.*@$opt_snapshot_prefix([0-9]+)$ ]]
|
[[ $latestremote =~ ^.*@$opt_snapshot_prefix([0-9]+)$ ]]
|
||||||
latestremotets=${BASH_REMATCH[1]}
|
latestremotets=${BASH_REMATCH[1]}
|
||||||
for ts in $localts; do
|
for ts in $localts; do
|
||||||
if [ $ts == $latestremotets ]; then
|
if [ "$ts" == "$latestremotets" ]; then
|
||||||
basets=$ts
|
basets=$ts
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ -z $basets ]; then
|
if [ -z "$basets" ]; then
|
||||||
|
xmittype='full'
|
||||||
log debug "No matching Snapshot found on destination - Full Copy $src_image_pool/$src_image_name$snapshot_name to $dst_image_pool/$dst_image_name"
|
log debug "No matching Snapshot found on destination - Full Copy $src_image_pool/$src_image_name$snapshot_name to $dst_image_pool/$dst_image_name"
|
||||||
#snapts=$(echo $currentlocal | sed -r -e 's/.*@mirror-(.*)/\1/')
|
#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)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user