mirror of
https://github.com/lephisto/crossover.git
synced 2025-12-06 04:09:20 +01:00
Add preflight check: pool_exists
This commit is contained in:
17
crossover
17
crossover
@@ -433,6 +433,11 @@ function mirror() {
|
||||
map_vmids_to_host
|
||||
map_vmids_to_dsthost "$opt_destination"
|
||||
|
||||
if [ $(check_pool_exist "$opt_pool") -eq 0 ]; then
|
||||
log error "Preflight check: Destination RBD-Pool $opt_pool does not exist."
|
||||
end_process 255
|
||||
fi
|
||||
|
||||
for vm_id in $svmids; do
|
||||
(( vmcount++ ))
|
||||
local file_config; file_config=$(get_config_file)
|
||||
@@ -816,6 +821,18 @@ function get_ha_status() {
|
||||
echo "$ha_status"
|
||||
}
|
||||
|
||||
function check_pool_exist() {
|
||||
local poolname="$1"
|
||||
local -i exists=255
|
||||
pool_status=$(ssh $opt_destination pvesm status|grep rbd|cut -d " " -f 1|grep $poolname)
|
||||
if [ "$pool_status" == "$poolname" ]; then
|
||||
exists=1
|
||||
else
|
||||
exists=0
|
||||
fi
|
||||
echo $exists
|
||||
}
|
||||
|
||||
function main(){
|
||||
[ $# = 0 ] && usage;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user