Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page describes how to create new virtual machines on the infra/api hosts running KVM/libvirt, with Virtual Machine Manager or with CLI tools

In order for any of this to work, it is required that one or more hosts are installed with the role::kvm puppet role.

Virtual Machine Manager

Install Virtual Machine Manager

...

Code Block
$ virt-install --name <vm-name> --memory <RAM in MB> --vcpus <cpus> --cpu host --pxe --boot network,hd --os-variant ubuntu16.04 --disk size=<disk size in GB>,pool=vmvg -w network:<net-name> --autostart --noautoconsole --wait 0

...

Code Block
$ virsh domiflist <vm-name>
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    management virtio      52:54:00:e8:8d:1c

Start/stop/reset machine

Code Block
$ virsh start <vm-name>    # start a shutdown machine
$ virsh destroy <vm-name>  # Force stop a machine
$ virsh shutdown <vm-name> # Gracefully shutdown a machine
$ virsh reboot <vm-name>   # Gracefully reboot a machine
$ virsh reset <vm-name>    # Hard reset / cold boot a machine

 

Important note

If you know that the VM you're creating is supposed to run a keepalived instance, enable allmulticast on the VM's vtap interface:

Code Block
root@infra1# ip link set dev macvtap<N> allmulticast on