From f11be6be55ca0cc1006a0f2e1def493505d923c4 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Mon, 10 Jan 2022 10:32:39 +0000 Subject: [PATCH] fix ceph_storage for building VMs and update hp01 definition --- configs/hp01.config | 1 + manage-vm-nodes.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configs/hp01.config b/configs/hp01.config index c3edb38..01de2c2 100644 --- a/configs/hp01.config +++ b/configs/hp01.config @@ -6,6 +6,7 @@ hypervisor_tag="hp" ip_suffix=251 storage_path="/var/lib/vz/maas" +ceph_storage_path="/var/lib/libvirt/maas" external_ip=192.168.1.200 diff --git a/manage-vm-nodes.sh b/manage-vm-nodes.sh index fc16eab..d8373da 100755 --- a/manage-vm-nodes.sh +++ b/manage-vm-nodes.sh @@ -234,7 +234,7 @@ create_storage() { file_name="$final_storage_path/$virt_node/$virt_node-d$((${disk} + 1)).img" if [[ ! -f $file_name ]] ; then - /usr/bin/qemu-img create -f "$final_storage_format" "${file_name}" "${disks[$disk]}"G & + /usr/bin/qemu-img create -f "$storage_format" "${file_name}" "${disks[$disk]}"G & fi done done @@ -392,7 +392,12 @@ build_vms() { # disks to the VM disk_spec="" for ((disk=0;disk<${disk_count};disk++)); do - disk_spec+=" --disk path=$storage_path/$virt_node/$virt_node-d$((${disk} + 1)).img" + if [[ $disk -eq 0 ]] ; then + final_storage_path=$storage_path + else + final_storage_path=$ceph_storage_path + fi + disk_spec+=" --disk path=$final_storage_path/$virt_node/$virt_node-d$((${disk} + 1)).img" disk_spec+=",format=$storage_format,size=${disks[$disk]},bus=$stg_bus,io=native,cache=directsync" done fi