Updates for faster kvm nodes, dual NIC support, local mirrors

This commit is contained in:
David A. Desrosiers 2019-03-26 16:12:00 +00:00
parent 368afe9cc9
commit 82685ff2ff
2 changed files with 28 additions and 14 deletions

View File

@ -115,12 +115,15 @@ build_maas() {
maas $maas_profile maas set-config name=enable_http_proxy value=true
maas $maas_profile maas set-config name=enable_third_party_drivers value=false
maas $maas_profile maas set-config name=curtin_verbose value=true
# maas $maas_profile boot-source update 1 url=http://10.0.1.28/maas/images/ephemeral-v3/daily/
maas $maas_profile boot-source update 1 url=http://$maas_bridge_ip:8765/maas/images/ephemeral-v3/daily/
maas $maas_profile package-repository update 1 name='main_archive' url=http://$maas_bridge_ip:8765/mirror/ubuntu
maas $maas_profile subnet update 2 gateway_ip=$maas_bridge_ip
sleep 3
maas $maas_profile ipranges create type=dynamic start_ip=192.168.100.100 end_ip=192.168.100.200 comment='This is the reserved range for MAAS nodes'
sleep 6
maas $maas_profile vlan update fabric-1 0 dhcp_on=True primary_rack="$maas_system_id"
sleep 3
maas $maas_profile vlan update fabric-2 0 dhcp_on=True primary_rack="$maas_system_id"
# This is needed, because it points to localhost by default and will fail to
# commission/deploy in this state
@ -171,6 +174,11 @@ clouds:
description: MAAS cloud for $cloud_name
# endpoint: ${maas_endpoint:0:-8}
endpoint: $maas_endpoint
config:
apt-mirror: http://192.168.1.10:8765/mirror/ubuntu/
enable-os-refresh-update: true
enable-os-upgrade: false
logging-config: <root>=DEBUG
EOF
cat > credentials-"$rand_uuid".yaml <<EOF

View File

@ -8,9 +8,12 @@ compute="maas-node"
node_count=20
node_start=1
node_cpus=4
node_ram=4096
node_ram=8192
nic_model="virtio"
network="maas"
d1=20
d2=50
d3=50
create_vms() {
create_storage & build_vms
@ -26,9 +29,9 @@ create_storage() {
for ((machine="$node_start"; machine<=node_count; machine++)); do
printf -v maas_node %s-%02d "$compute" "$machine"
mkdir -p "$storage_path/$maas_node"
/usr/bin/qemu-img create -f "$storage_format" "$storage_path/$maas_node/$maas_node-d1.img" 40G &
/usr/bin/qemu-img create -f "$storage_format" "$storage_path/$maas_node/$maas_node-d2.img" 20G &
/usr/bin/qemu-img create -f "$storage_format" "$storage_path/$maas_node/$maas_node-d3.img" 20G &
/usr/bin/qemu-img create -f "$storage_format" -o preallocation=metadata,compat=1.1,lazy_refcounts=on "$storage_path/$maas_node/$maas_node-d1.img" "$d1"G &
/usr/bin/qemu-img create -f "$storage_format" -o preallocation=metadata,compat=1.1,lazy_refcounts=on "$storage_path/$maas_node/$maas_node-d2.img" "$d2"G &
/usr/bin/qemu-img create -f "$storage_format" -o preallocation=metadata,compat=1.1,lazy_refcounts=on "$storage_path/$maas_node/$maas_node-d3.img" "$d3"G &
done
}
@ -39,24 +42,27 @@ build_vms() {
ram="$node_ram"
vcpus="$node_cpus"
bus="scsi"
macaddr=$(printf '52:54:00:63:%02x:%02x\n' "$((RANDOM%256))" "$((RANDOM%256))")
macaddr1=$(printf '52:54:00:63:%02x:%02x\n' "$((RANDOM%256))" "$((RANDOM%256))")
macaddr2=$(printf '52:54:00:63:%02x:%02x\n' "$((RANDOM%256))" "$((RANDOM%256))")
virt-install -v --noautoconsole \
--print-xml \
--autostart \
--boot network,hd,menu=on \
--graphics spice \
--video qxl,vram=1024 \
--video qxl,vram=256 \
--channel spicevmc \
--name "$virt_node" \
--ram "$ram" \
--vcpus "$vcpus" \
--console pty,target_type=serial \
--graphics spice,clipboard_copypaste=no,mouse_mode=client,filetransfer_enable=off \
--cpu host-passthrough,cache.mode=passthrough \
--controller "$bus",model=virtio-scsi,index=0 \
--disk path="$storage_path/$virt_node/$virt_node-d1.img,format=$storage_format,size=40,bus=$bus,cache=writeback" \
--disk path="$storage_path/$virt_node/$virt_node-d2.img,format=$storage_format,size=20,bus=$bus,cache=writeback" \
--disk path="$storage_path/$virt_node/$virt_node-d3.img,format=$storage_format,size=20,bus=$bus,cache=writeback" \
--network=network=$network,mac="$macaddr",model=$nic_model > "$virt_node.xml"
--disk path="$storage_path/$virt_node/$virt_node-d1.img,format=$storage_format,size=$d1,bus=$bus,io=native,cache=none" \
--disk path="$storage_path/$virt_node/$virt_node-d2.img,format=$storage_format,size=$d2,bus=$bus,io=native,cache=none" \
--disk path="$storage_path/$virt_node/$virt_node-d3.img,format=$storage_format,size=$d3,bus=$bus,io=native,cache=none" \
--network=network=$network,mac="$macaddr1",model=$nic_model \
--network=network=$network,mac="$macaddr2",model=$nic_model > "$virt_node.xml"
virsh define "$virt_node.xml"
# virsh start "$virt_node"
done