diff options
| author | Daniel P. Berrange <berrange@redhat.com> | 2012-03-07 12:49:38 -0500 |
|---|---|---|
| committer | Daniel P. Berrange <berrange@redhat.com> | 2012-03-23 19:23:13 +0000 |
| commit | 81ac4e729c0ca9e8fdb8064db30ae05eb8ce74a7 (patch) | |
| tree | b07ae89e1d2d1cabd2d0e55852759e19b17b02fa /nova/tests | |
| parent | c0f678778afefc71649253e685e8f5d6af96b3a9 (diff) | |
Introduce a class for storing libvirt CPU configuration
Extend the libvirt config APIs to include a new class
LibvirtConfigCPU for storing host/guest CPU configuration
data
blueprint libvirt-xml-config-apis
Change-Id: Ib508637c1e0ca69860d461b0a480347c59165e6b
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_libvirt_config.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nova/tests/test_libvirt_config.py b/nova/tests/test_libvirt_config.py index 186fb5a18..8d6ede1be 100644 --- a/nova/tests/test_libvirt_config.py +++ b/nova/tests/test_libvirt_config.py @@ -361,3 +361,40 @@ class LibvirtConfigGuestTest(LibvirtConfigBaseTest): </disk> </devices> </domain>""") + + +class LibvirtConfigCPUTest(LibvirtConfigBaseTest): + + def test_config_cpu(self): + obj = config.LibvirtConfigCPU() + obj.vendor = "AMD" + obj.model = "Quad-Core AMD Opteron(tm) Processor 2350" + obj.arch = "x86_64" + obj.add_feature("svm") + obj.add_feature("extapic") + obj.add_feature("constant_tsc") + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + <cpu> + <arch>x86_64</arch> + <model>Quad-Core AMD Opteron(tm) Processor 2350</model> + <vendor>AMD</vendor> + <feature name="svm"/> + <feature name="extapic"/> + <feature name="constant_tsc"/> + </cpu>""") + + def test_config_topology(self): + obj = config.LibvirtConfigCPU() + obj.vendor = "AMD" + obj.sockets = 2 + obj.cores = 4 + obj.threads = 2 + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + <cpu> + <vendor>AMD</vendor> + <topology cores="4" threads="2" sockets="2"/> + </cpu>""") |
