diff options
| author | Daniel P. Berrange <berrange@redhat.com> | 2012-03-08 11:33:47 -0500 |
|---|---|---|
| committer | Daniel P. Berrange <berrange@redhat.com> | 2012-03-23 19:23:13 +0000 |
| commit | 0b10c3f1a042003f917a4af95712a2d85561e53e (patch) | |
| tree | 489fc2892fa13075d5eb9d28d5569d75ede8737d | |
| parent | bbf078a6d95d3434da532040e14b825af1f3bcce (diff) | |
Convert libvirt connection class to use config APIs for filesystem devices
Remove the <filesystem> element from the Cheetah XML template
and make the libvirt connection class use the LibvirtConfigGuestFilesys
class for it instead
blueprint libvirt-xml-config-apis
Change-Id: I9dad031703161d1dff86af03eff7b1ebf657fc0c
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
| -rw-r--r-- | nova/virt/libvirt.xml.template | 7 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/nova/virt/libvirt.xml.template b/nova/virt/libvirt.xml.template index 9c8c2d9a3..8b9d6a4d0 100644 --- a/nova/virt/libvirt.xml.template +++ b/nova/virt/libvirt.xml.template @@ -58,12 +58,7 @@ #end if <vcpu>${vcpus}</vcpu> <devices> -#if $type == 'lxc' - <filesystem type='mount'> - <source dir='${basepath}/rootfs'/> - <target dir='/'/> - </filesystem> -#else +#if $type != 'lxc' #if $getVar('rescue', False) <disk type='file'> <driver type='${driver_type}' cache='${cachemode}'/> diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 35d794548..e1537558e 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -1372,6 +1372,15 @@ class LibvirtConnection(driver.ComputeDriver): for (network, mapping) in network_info: cfg = self.vif_driver.plug(instance, network, mapping) devs.append(cfg.to_xml()) + + if FLAGS.libvirt_type == "lxc": + fs = config.LibvirtConfigGuestFilesys() + fs.type = "mount" + fs.source_dir = os.path.join(FLAGS.instances_path, + instance['name'], + "rootfs") + devs.append(fs.to_xml()) + # FIXME(vish): stick this in db inst_type_id = instance['instance_type_id'] inst_type = instance_types.get_instance_type(inst_type_id) |
