kvm instance creation

Michael Foord michael.foord at canonical.com
Tue Jun 2 08:30:15 UTC 2015


Hey folks,

Just wanting to share the knowledge in case I get hit by a bus (and 
provide an opportunity for those of you who know more than me to point 
out my howling errors) :-)

With the new MAAS (1.8) devices API, to allocate an IP address for a 
container we need to know the MAC address of the container. To setup 
routing for the container we need to know the IP address before we 
create the container. So we need to know (i.e. generate) the MAC address 
before container creation.

In order to specify a MAC address for a KVM image we need to create a 
libvirt domain xml template to pass as the template argument to uvt-kvm.

References:

http://manpages.ubuntu.com/manpages/trusty/man1/uvt-kvm.1.html
https://libvirt.org/formatdomain.html#elementsNICS
https://help.ubuntu.com/lts/serverguide/cloud-images-and-uvtool.html

Ideally we'd like to specify as *little as possible* in the template and 
have the generated libvirt xml (i.e. the created image) be identical to 
what uvt-kvm would have created for us without the template. The only 
change being that the image will have a network interface with the MAC 
address we specify.

Attached are two xml files. "juju-bare-metal.xml" is the *generated* xml 
(using master) for a kvm image on MAAS bare metal (functionally the same 
as the xml we generate for a kvm image in a kvm image - I checked). 
"template.xml" is the minimal template I found that would cause uvt-kvm 
to generate the same image.

We already have code support (need to check it works) for specifying a 
NIC with MAC address for lxc.

All the best,

Michael Foord

-------------- next part --------------
A non-text attachment was scrubbed...
Name: juju-bare-metal.xml
Type: text/xml
Size: 2256 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20150602/2920f403/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: template.xml
Type: text/xml
Size: 1166 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20150602/2920f403/attachment-0001.xml>


More information about the Juju-dev mailing list