See also http://twiki.mwt2.org/bin/view/Admins/HypervisorConfiguration

Building a new VM

Cobbler setup

Before constructing the VM, it's useful already to have configured Cobbler to netboot the new system. This is more thoroughly described in http://twiki.mwt2.org/bin/view/Admins/NewCobblerNode, but it's pretty straightforward to do through the GUI. When setting a MAC address for the new VM, be sure that it isn't in Cobbler's dhcpd.conf or in http://twiki.mwt2.org/bin/view/Admins/NetworkInventoryUC. MAC prefixes should be as follows:

54:52:00:00 ITB
54:52:00:01 MWT2 UC
54:52:00:03 TIER3
54:52:00:04 MWT2 IU
54:52:00:05 SPT
54:52:00:06 UC3
54:52:00:07 OSGCONNECT

In order to have a strong mapping of MAC addresses to IP addresses for new nodes, I'm beginning a couple of new series. A strong mapping makes it easier for us to assure availability of both MAC and IP. Note that 54:52:00 is the OUI vendor prefix for Linux KVM, so we're really only allocating the "0a" (decimal 10) and "87" (decimal 135) sub-prefixes. Because of the strong mapping to IP addresses, the MAC field will be sparsely populated, but given the MAC or the IP, you can infer the other.

54:52:00:0a   MAC prefix for IP addresses in 10.1.0.0/16.  54:52:00:0a:xx:yy => 10.1.xx.yy.
54:52:00:87   MAC prefix for IP addresses in 128.135.0.0/16.  54:52:00:87:xx:yy => 128.135.xx.yy.

In Cobbler, pay particular attention to these settings:

General/Name [name of server; e.g. uct2-newserver.mwt2.org]
General/Profile [select a profile; e.g. SL-55-x86_64-kvm]
General/Netboot enabled check
Virtualization/Virt Path [path for root disk image; e.g. /kvm/uct2-newserver.mwt2.org.img]
Virtualization/Virt File Size inherit
Virtualization/Virt Type qemu
Virtualization/Virt CPUs # of cpus
Virtualization/Virt RAM [size of memory in MEGABYTES]
Virtualization/Virt Auto Boot? yes or no
Networking (Global)/Hostname [the nodename of the machine, which actually has nothing to do with networks; e.g. uct2-newserver.mwt2.org]
Networking (Global)/Gateway Default gw, e.g. 128.135.158.129
Networking/eth0/MAC Address 54:52:00:XX:YY:Z1
Networking/eth0/IP Address [private, internal IP; e.g. 10.1.x.y]
Networking/eth0/Virt Bridge br0
Networking/eth1/MAC Address 54:52:00:XX:YY:Z2
Networking/eth1/IP Address [public, external IP; e.g. 128.135.x.y]
Networking/eth1/Static? yes
Networking/eth1/Subnet [whatever is appropriate; e.g. 255.255.255.128]
Networking/eth1/Virt Bridge br1

The Cobbler DHCP service listens on the private network. It will configure eth0 using DHCP, but eth1 must be configured as static.

Everything else, to the best of my knowledge, will be inherited or configured at installation time.

Be sure to sync cobbler before proceeding, so that DHCP and PXE are updated.

Libvirt setup

Libvirt stores virtual machine metadata in XML files. A machine description for hostname goes in /etc/libvirt/qemu/hostname.xml. On uct3-grid10, virtual disks reside in /kvm, and are referenced by the XML VM descriptor.

You can create an XML descriptor for a new VM manually, or by using an existing VM as a template, or you can use the virt-install command. (See references.) But the easiest is to use koan:

koan --server=bootstrap.mwt2.org --virt --system=uct2-newserver.mwt2.org

After running koan, the VM will boot and attempt to PXE boot. If everything is good so far, it will begin network installation. It will shut down on completion. You will restart it:

virsh start uct2-newserver.mwt2.org

The new system will come up.

References

http://wiki.libvirt.org/page/VM_lifecycle

-- DavidChampion - 08 Feb 2013
Topic revision: r5 - 28 Aug 2014, DavidChampion
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback