Miscellaneous Create a VM for the Controller In this document, I show how to provition an Ubuntu 20.04.5 Server virtual machine instance for a CHI controller node. Make sure the VM gets at least 32GB RAM and 40GB storage with 8 CPUs.
Install necessary packages and perform checks
Copy $ sudo apt install cpu-checker
$ sudo apt update
$ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst
$ sudo adduser 'expeca' libvirt
$ sudo adduser 'expeca' kvm
$ virsh list --all
$ sudo systemctl status libvirtd
Download OS image
Copy $ cd /var/lib/libvirt/boot/
$ sudo wget https://releases.ubuntu.com/focal/ubuntu-20.04.5-live-server-amd64.iso
Create the network bridges
Assume eno8303
interface is reserved for management purposes. Interfaces ens1f0
and ens1f1
will be used for Openstack's internal and public networks respectively. Therefore, 3 bridges are needed for a VM: ssh, private network, and public network. Replace the contents of /etc/netplan/00-installer-config.yaml
with the following
Copy network:
ethernets:
eno8303:
dhcp4: false
dhcp6: false
ens1f0:
dhcp4: false
dhcp6: false
ens1f1:
dhcp4: false
dhcp6: false
version: 2
bridges:
mgmt-br:
interfaces: [eno8303]
addresses: [10.10.2.3/16]
gateway4: 10.10.1.1
nameservers:
search:
- expeca
addresses:
- 10.10.1.1
internal-br:
interfaces: [ens1f0]
addresses: [10.20.111.10/23]
public-br:
interfaces: [ens1f1]
addresses: [10.0.87.10/24]
and apply the configuration using sudo netplan generate && sudo netplan apply
Install the virtual machine
Copy $ virt-install \
--name edge-vm1 \
--ram 32000 \
--disk path=/var/lib/libvirt/images/vm1.img,size=40 \
--vcpus 8 \
--os-variant ubuntu20.04 \
--network bridge=mgmt-br \
--network bridge=public-br \
--network bridge=internal-br \
--graphics none \
--console pty,target_type=serial \
--location /var/lib/libvirt/boot/ubuntu-20.04.5-live-server-amd64.iso,kernel=casper/vmlinuz,initrd=casper/initrd \
--extra-args 'console=ttyS0,115200n8 serial'
During installation
Copy partitioning: Use entire disk
machine-name: edge-vm1
username: expeca
pass: expeca
packages: install openssh-server
If encountered [FAILED] Failed unmounting /cdrom.
just press CTRL+C and continue.
Once the VM is up and running, the mgmt network interface must be setup to enable ssh access.
Configure the VM to autostart again after host reboot
Copy $ sudo virsh autostart <vm_name>
How to completely remove a VM
Copy $ virsh destroy <vm_name>
$ virsh snapshot-delete <vm_name> <snapshot_name>
$ virsh undefine <vm_name> --remove-all-storage
$ sudo rm /var/lib/libvirt/images/vm1.img
How to take a snapshot
Copy $ virsh snapshot-create-as --domain edge-vm1 \
--name "edge_controller_clean" \
--description "Network interfaces ready to start chi-in-a-box"
How to revert back to a snapshot
Copy virsh snapshot-revert edge-vm1 edge_controller_clean
How to fix the VM's clock after reverting
Copy sudo hwclock --hctosys