diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-29 17:58:44 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-29 17:58:44 -0700 |
| commit | 16e89bad15f5665a5f46c0bdcdfab1b7f3df4039 (patch) | |
| tree | 246030f327aaf9a835d753c1e1f18553acdfad86 | |
| parent | 73a47dfecf4b1ba66a45421bbd925f3e0db054c5 (diff) | |
flag for libvirt type
| -rw-r--r-- | nova/compute/libvirt.xml.template | 2 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/nova/compute/libvirt.xml.template b/nova/compute/libvirt.xml.template index a763e8a4d..a17cd8fae 100644 --- a/nova/compute/libvirt.xml.template +++ b/nova/compute/libvirt.xml.template @@ -1,7 +1,7 @@ <domain type='kvm'> <name>%(name)s</name> <os> - <type>hvm</type> + <type>%(type)s</type> <kernel>%(basepath)s/kernel</kernel> <initrd>%(basepath)s/ramdisk</initrd> <cmdline>root=/dev/vda1 console=ttyS0</cmdline> diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index c545e4190..e37444f63 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -48,6 +48,10 @@ flags.DEFINE_string('libvirt_xml_template', utils.abspath('compute/libvirt.xml.template'), 'Libvirt XML Template') +flags.DEFINE_string('libvirt_type', + 'hvm', + 'Libvirt virtualization type (hvm, qemu, etc)') + def get_connection(read_only): # These are loaded late so that there's no need to install these # libraries when not using libvirt. @@ -235,6 +239,7 @@ class LibvirtConnection(object): # TODO(termie): lazy lazy hack because xml is annoying xml_info['nova'] = json.dumps(instance.datamodel.copy()) + xml_info['type'] = FLAGS.libvirt_type libvirt_xml = libvirt_xml % xml_info logging.debug("Finished the toXML method") @@ -255,7 +260,7 @@ class LibvirtConnection(object): """ Note that this function takes an instance ID, not an Instance, so that it can be called by monitor. - + Returns a list of all block devices for this domain. """ domain = self._conn.lookupByName(instance_id) @@ -298,7 +303,7 @@ class LibvirtConnection(object): """ Note that this function takes an instance ID, not an Instance, so that it can be called by monitor. - + Returns a list of all network interfaces for this instance. """ domain = self._conn.lookupByName(instance_id) @@ -341,7 +346,7 @@ class LibvirtConnection(object): """ Note that this function takes an instance ID, not an Instance, so that it can be called by monitor. - """ + """ domain = self._conn.lookupByName(instance_id) return domain.blockStats(disk) @@ -350,6 +355,6 @@ class LibvirtConnection(object): """ Note that this function takes an instance ID, not an Instance, so that it can be called by monitor. - """ + """ domain = self._conn.lookupByName(instance_id) return domain.interfaceStats(interface) |
