← Back to team overview

openstack team mailing list archive

Adding OpenVZ support via libvirt to Nova

 

Hey all,

I'm currently working on supporting OpenVZ through the libvirt driver in
Nova.
I can successfully spin up and tear down OpenVZ containers using a slightly
modified version of devstack (yay!), but I've come across an issue with the
networking part of it that I could use some advice on from libvirt experts
out
there.

When my containers are spawned, they do not have their networking
setup completely. I have to manually use vzctl to set the IP address:

  sudo vzctl set 101 --ipadd 10.0.0.2 --save

I need to do the same for the nameserver and hostname. Nova generates
this libvirt XML for the container's network interface:

    <interface type="bridge">
      <mac address="fa:16:3e:3c:0a:29"/>
      <source bridge="br100"/>
      <filterref filter="nova-instance-100000001-fa163e3c0a29">
        <parameter name="IP" value="10.0.0.2"/>
        <parameter name="DHCPSERVER" value="10.0.0.1"/>
        <parameter name="PROJNET" value="10.0.0.0"/>
        <parameter name="PROJMASK" value="255.255.255.0"/>
      </filterref>
    </interface>

I'd obviously like to avoid making calls 'vzctl' to finish setting up the
networking, so if it can be done by modifying the libvirt XML, I'd like
to do that, but can't seem to figure it out, and don't want to break
functionality by making stupid changes. I don't consider myself to
be either a libvirt or OpenVZ expert.

I did get an XML configuration like this automagically set the
IP address:

    <interface type="ethernet">
      <mac address="fa:16:3e:3c:0a:29"/>
      <ip address="10.0.0.2"/>
    </interface>

However, I don't know if this will break anything if I change Nova
to output this for OpenVZ.

So, any advice from libvirt experts?

-Dave