Tuning of partition creation
Also updating MAAS API key from new bootstrapped MAAS
This commit is contained in:
parent
52daf21f48
commit
5a80b36dce
@ -8,3 +8,9 @@ ip_suffix=241
|
||||
external_ip=192.168.1.211
|
||||
|
||||
compute="as1-maas-node"
|
||||
|
||||
# Disks that exist on the server
|
||||
disk_name=()
|
||||
disk_names+=(sda)
|
||||
disk_names+=(nvme0n1)
|
||||
disk_names+=(nvme1n1)
|
||||
|
@ -8,3 +8,8 @@ ip_suffix=242
|
||||
external_ip=192.168.1.212
|
||||
|
||||
compute="as2-maas-node"
|
||||
|
||||
# Disks that exist on the server
|
||||
disk_name=()
|
||||
disk_names+=(sda)
|
||||
disk_names+=(nvme0n1)
|
||||
|
@ -8,3 +8,8 @@ ip_suffix=243
|
||||
external_ip=192.168.1.213
|
||||
|
||||
compute="as3-maas-node"
|
||||
|
||||
# Disks that exist on the server
|
||||
disk_name=()
|
||||
disk_names+=(sda)
|
||||
disk_names+=(nvme0n1)
|
||||
|
@ -16,7 +16,7 @@ maas_version="2.9"
|
||||
#no_proxy="localhost,127.0.0.1,$maas_system_ip"
|
||||
#squid_proxy="http://192.168.1.23:3128"
|
||||
maas_pkg_type="snap"
|
||||
maas_api_key="QjzaY5ucvSSrydMKnz:aChrPQrVG4tfeAabrm:5ySUKY7c7EMhKhuKhpsXGzeaQLYpMAXx"
|
||||
maas_api_key="cP5gj8RyemEhBLvyKG:AmRXEzR8MPAbRPWGBH:7T9LPemF3gAPe3qwr47rXAkLWZysjeRB"
|
||||
maas_subnet_start="10.0.1.1"
|
||||
maas_subnet_end="10.0.1.99"
|
||||
maas_dhcp_start_postfix="1"
|
||||
|
@ -64,11 +64,17 @@ maas_create_partitions()
|
||||
{
|
||||
system_id=$1
|
||||
|
||||
disks=$(maas ${maas_profile} block-devices read ${system_id})
|
||||
|
||||
size=20
|
||||
|
||||
actual_size=$(( $size * 1024 * 1024 * 1024 ))
|
||||
|
||||
storage_layout=$(maas ${maas_profile} machine set-storage-layout ${system_id} storage_layout=lvm vg_name=${hypervisor_name} lv_name=root lv_size=${actual_size})
|
||||
boot_disk=$(echo $disks | jq ".[] | select(.name == \"${disk_names[0]}\") | .id")
|
||||
|
||||
set_boot_disk=$(maas ${maas_profile} block-device set-boot-disk ${system_id} ${boot_disk})
|
||||
|
||||
storage_layout=$(maas ${maas_profile} machine set-storage-layout ${system_id} storage_layout=lvm vg_name=${hypervisor_name} lv_name=root lv_size=${actual_size} root_disk=${boot_disk})
|
||||
|
||||
vg_device=$(echo $storage_layout | jq ".volume_groups[].id" )
|
||||
remaining_space=$(maas ${maas_profile} volume-group read ${system_id} ${vg_device} | jq ".available_size" | sed s/\"//g)
|
||||
@ -77,7 +83,34 @@ maas_create_partitions()
|
||||
libvirt_block_id=$(echo ${libvirt_lv} | jq .id)
|
||||
|
||||
stg_fs=$(maas ${maas_profile} block-device format ${system_id} ${libvirt_block_id} fstype=ext4)
|
||||
stg_mount=$(maas ${maas_profile} block-device mount ${system_id} ${libvirt_block_id} mount_point=${storage_path})
|
||||
|
||||
stg_mount=$(maas ${maas_profile} block-device mount ${system_id} ${libvirt_block_id} mount_point=${ceph_storage_path})
|
||||
|
||||
for ((disk=1;disk<${#disk_names[@]};disk++)); do
|
||||
|
||||
disk_id=$(echo $disks | jq ".[] | select(.name == \"${disk_names[$disk]}\") | .id")
|
||||
|
||||
create_partition=$(maas ${maas_profile} partitions create ${system_id} ${disk_id})
|
||||
|
||||
part_id=$(echo $create_partition | jq .id)
|
||||
|
||||
if [[ $disk -eq 1 ]] ; then
|
||||
vg_create=$(maas ${maas_profile} volume-groups create ${system_id} name=${hypervisor_name}-nvme block_device=${disk_id} partitions=${part_id})
|
||||
|
||||
vg_id=$(echo $vg_create | jq .id)
|
||||
vg_size=$(echo $vg_create | jq .size)
|
||||
else
|
||||
|
||||
vg_update=$(maas ${maas_profile} volume-group update ${system_id} ${vg_id} add_partitions=${part_id})
|
||||
vg_size=$(echo $vg_update | jq .size)
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
lv_create=$(maas admin volume-group create-logical-volume ${system_id} ${vg_id} name=images size=${vg_size})
|
||||
lv_id=$(echo $lv_create | jq .id)
|
||||
lv_fs=$(maas ${maas_profile} block-device format ${system_id} ${lv_id} fstype=ext4)
|
||||
lv_mount=$(maas ${maas_profile} block-device mount ${system_id} ${lv_id} mount_point=${storage_path})
|
||||
}
|
||||
|
||||
maas_add_pod()
|
||||
|
@ -95,6 +95,9 @@ write_files:
|
||||
enp2s0:
|
||||
wakeonlan: true
|
||||
link-local: []
|
||||
enp3s0:
|
||||
wakeonlan: true
|
||||
link-local: []
|
||||
permissions: '0644'
|
||||
owner: root:root
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user