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>
This commit is contained in:
Daniel P. Berrange 2012-03-08 11:33:47 -05:00
parent bbf078a6d9
commit 0b10c3f1a0
2 changed files with 10 additions and 6 deletions

View File

@ -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}'/>

View File

@ -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)