Beispiel #1
0
    def testOSPPCXML(self):
        expectedXMLs = ["""
            <os>
                <type arch="ppc64" machine="pseries">hvm</type>
                <initrd>/tmp/initrd-2.6.18.img</initrd>
                <kernel>/tmp/vmlinuz-2.6.18</kernel>
                <cmdline>console=ttyS0 1</cmdline>
            </os>"""]
        vmConfs = [{'kernel': '/tmp/vmlinuz-2.6.18', 'initrd':
                   '/tmp/initrd-2.6.18.img', 'kernelArgs': 'console=ttyS0 1'}]

        OSXML = """
            <os>
                 <type arch="ppc64" machine="pseries">hvm</type>
                 <boot dev="%s"/>
            </os>"""

        qemu2libvirtBoot = {'a': 'fd', 'c': 'hd', 'd': 'cdrom', 'n': 'network'}
        for k, v in six.iteritems(qemu2libvirtBoot):
            vmConfs.append({'boot': k})
            expectedXMLs.append(OSXML % v)

        for vmConf, osXML in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.PPC64)
            domxml.appendOs()
            xml = find_xml_element(domxml.toxml(), './os')
            self.assertXMLEqual(xml, osXML)
Beispiel #2
0
    def testSharedGuestNumaNodes(self):
        numaXML = """
              <numa>
                  <cell cpus="0-1" memory="5242880" memAccess="shared"/>
              </numa>
              """

        vmConf = {'cpuType': "Opteron_G4,+sse4_1,+sse4_2,-svm",
                  'smpCoresPerSocket': 2, 'smpThreadsPerCore': 2,
                  'cpuPinning': {'0': '0-1', '1': '2-3'},
                  'numaTune': {'mode': 'strict',
                               'nodeset': '0-1',
                               'memnodes': [
                                   {'vmNodeIndex': '0', 'nodeset': '1'},
                                   {'vmNodeIndex': '1', 'nodeset': '0'}
                               ]},
                  'guestNumaNodes': [{'cpus': '0-1', 'memory': '5120',
                                      'nodeIndex': 0},
                                     ]}

        vmConf.update(self.conf)
        domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.X86_64)
        domxml.appendCpu(hugepages_shared=True)
        xml = domxml.toxml()
        self.assertXMLEqual(find_xml_element(xml, "./cpu/numa"), numaXML)
Beispiel #3
0
    def testOSPPCXML(self):
        expectedXMLs = [
            """
            <os>
                <type arch="ppc64" machine="pseries">hvm</type>
                <initrd>/tmp/initrd-2.6.18.img</initrd>
                <kernel>/tmp/vmlinuz-2.6.18</kernel>
                <cmdline>console=ttyS0 1</cmdline>
            </os>"""
        ]
        vmConfs = [{
            'kernel': '/tmp/vmlinuz-2.6.18',
            'initrd': '/tmp/initrd-2.6.18.img',
            'kernelArgs': 'console=ttyS0 1'
        }]

        OSXML = """
            <os>
                 <type arch="ppc64" machine="pseries">hvm</type>
                 <boot dev="%s"/>
            </os>"""

        qemu2libvirtBoot = {'a': 'fd', 'c': 'hd', 'd': 'cdrom', 'n': 'network'}
        for k, v in six.iteritems(qemu2libvirtBoot):
            vmConfs.append({'boot': k})
            expectedXMLs.append(OSXML % v)

        for vmConf, osXML in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.PPC64)
            domxml.appendOs()
            xml = find_xml_element(domxml.toxml(), './os')
            self.assertXMLEqual(xml, osXML)
Beispiel #4
0
    def testCpuXML(self):
        cpuXML = """
          <cpu match="exact">
              <model>Opteron_G4</model>
              <feature name="sse4.1" policy="require"/>
              <feature name="sse4.2" policy="require"/>
              <feature name="svm" policy="disable"/>
              <topology cores="2" sockets="40" threads="2"/>
              <numa>
                  <cell cpus="0-1" memory="5242880"/>
                  <cell cpus="2,3" memory="5242880"/>
              </numa>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="0-1" vcpu="0"/>
              <vcpupin cpuset="2-3" vcpu="1"/>
          </cputune> """

        numatuneXML = """
          <numatune>
              <memory mode="strict" nodeset="0-1"/>
              <memnode cellid="0" mode="strict" nodeset="1"/>
              <memnode cellid="1" mode="strict" nodeset="0"/>
          </numatune> """

        vmConf = {'cpuType': "Opteron_G4,+sse4_1,+sse4_2,-svm",
                  'smpCoresPerSocket': 2, 'smpThreadsPerCore': 2,
                  'cpuPinning': {'0': '0-1', '1': '2-3'},
                  'numaTune': {'mode': 'strict',
                               'nodeset': '0-1',
                               'memnodes': [
                                   {'vmNodeIndex': '0', 'nodeset': '1'},
                                   {'vmNodeIndex': '1', 'nodeset': '0'}
                               ]},
                  'guestNumaNodes': [{'cpus': '0-1', 'memory': '5120',
                                      'nodeIndex': 0},
                                     {'cpus': '2,3', 'memory': '5120',
                                      'nodeIndex': 1}]}
        vmConf.update(self.conf)
        domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.X86_64)
        domxml.appendCpu()
        domxml.appendNumaTune()
        xml = domxml.toxml()
        self.assertXMLEqual(find_xml_element(xml, "./cpu"), cpuXML)
        self.assertXMLEqual(find_xml_element(xml, "./cputune"), cputuneXML)
        self.assertXMLEqual(find_xml_element(xml, './numatune'), numatuneXML)
Beispiel #5
0
 def testFeaturesXML(self):
     featuresXML = """
         <features>
               <acpi/>
         </features>"""
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendFeatures()
     xml = find_xml_element(domxml.toxml(), './features')
     self.assertXMLEqual(xml, featuresXML)
Beispiel #6
0
 def testFeaturesXML(self):
     featuresXML = """
         <features>
               <acpi/>
         </features>"""
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendFeatures()
     xml = find_xml_element(domxml.toxml(), './features')
     self.assertXMLEqual(xml, featuresXML)
Beispiel #7
0
 def testNumaTuneXMLMultiNode(self):
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     devices = [hostdevice.HostDevice(
         self.log, **{'type': 'hostdev', 'device': device}) for
         device in [_SRIOV_PF, _SRIOV_VF, 'pci_0000_00_02_0']]
     domxml.appendHostdevNumaTune(devices)
     xml = vmxml.format_xml(domxml.dom)
     self.assertRaises(AssertionError,
                       lambda: find_xml_element(xml, './numatune'))
Beispiel #8
0
    def testInputXMLPPC64(self):
        expectedXMLs = [
            """<input bus="usb" type="mouse"/>""",
            """<input bus="usb" type="tablet"/>"""]

        vmConfs = [{}, {'tabletEnable': 'true'}]
        for vmConf, inputXML in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.PPC64)
            domxml.appendInput()
            xml = find_xml_element(domxml.toxml(), './devices/input')
            self.assertXMLEqual(xml, inputXML)
Beispiel #9
0
    def testMemoryBackingXML(self):
        memorybacking_xml = """
          <memoryBacking>
            <hugepages>
              <page size="1048576" />
            </hugepages>
          </memoryBacking>"""

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
        domxml.appendMemoryBacking(1048576)
        xml = find_xml_element(domxml.toxml(), './memoryBacking')
        self.assertXMLEqual(xml, memorybacking_xml)
Beispiel #10
0
 def testClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="rtc" tickpolicy="catchup"/>
             <timer name="pit" tickpolicy="delay"/>
             <timer name="hpet" present="no"/>
         </clock>"""
     self.conf['timeOffset'] = '-3600'
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendClock()
     xml = find_xml_element(domxml.toxml(), './clock')
     self.assertXMLEqual(xml, clockXML)
Beispiel #11
0
 def testOSXMLBootMenu(self):
     vmConfs = (
         # trivial cases first
         {},
         {'bootMenuEnable': 'true'},
         {'bootMenuEnable': 'false'},
         {'bootMenuEnable': True},
         {'bootMenuEnable': False},
         # next with more fields
         {'bootMenuEnable': True,
          'kernelArgs': 'console=ttyS0 1'},
         {'bootMenuEnable': False,
          'kernelArgs': 'console=ttyS0 1'})
     expectedXMLs = ("""
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <cmdline>console=ttyS0 1</cmdline>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <cmdline>console=ttyS0 1</cmdline>
              <smbios mode="sysinfo"/>
         </os>""")
     for conf, osXML in zip(vmConfs, expectedXMLs):
         conf.update(self.conf)
         domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
         domxml.appendOs()
         xml = find_xml_element(domxml.toxml(), './os')
         self.assertXMLEqual(xml, osXML)
Beispiel #12
0
 def testClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="rtc" tickpolicy="catchup"/>
             <timer name="pit" tickpolicy="delay"/>
             <timer name="hpet" present="no"/>
         </clock>"""
     self.conf['timeOffset'] = '-3600'
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendClock()
     xml = find_xml_element(domxml.toxml(), './clock')
     self.assertXMLEqual(xml, clockXML)
Beispiel #13
0
 def testNumaTuneXMLMultiNode(self):
     domxml = vmxml.Domain(self.conf, self.log, cpuarch.X86_64)
     devices = [
         hostdevice.HostDevice(self.conf, self.log, **{
             'type': 'hostdev',
             'device': device
         }) for device in [_SRIOV_PF, _SRIOV_VF, 'pci_0000_00_02_0']
     ]
     domxml.appendHostdevNumaTune(devices)
     xml = vmxml.format_xml(domxml.dom)
     self.assertRaises(AssertionError,
                       lambda: find_xml_element(xml, './numatune'))
Beispiel #14
0
    def testMemoryBackingXML(self):
        memorybacking_xml = """
          <memoryBacking>
            <hugepages>
              <page size="1048576" />
            </hugepages>
          </memoryBacking>"""

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
        domxml.appendMemoryBacking(1048576)
        xml = find_xml_element(domxml.toxml(), './memoryBacking')
        self.assertXMLEqual(xml, memorybacking_xml)
Beispiel #15
0
 def testChannelXML(self):
     channelXML = """
       <channel type="unix">
          <target name="%s" type="virtio"/>
          <source mode="bind" path="%s"/>
       </channel>"""
     path = '/tmp/channel-socket'
     name = 'org.linux-kvm.port.0'
     channelXML = channelXML % (name, path)
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml._appendAgentDevice(path, name)
     xml = find_xml_element(domxml.toxml(), './devices/channel')
     self.assertXMLEqual(xml, channelXML)
Beispiel #16
0
    def testNumaTuneXMLSingleNode(self, devices, numa_node):
        numatuneXML = """
          <numatune>
              <memory mode="preferred" nodeset="{}" />
          </numatune> """.format(numa_node)

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
        devices = [hostdevice.HostDevice(
            self.log, **{'type': 'hostdev', 'device': device}) for
            device in devices]
        domxml.appendHostdevNumaTune(devices)
        xml = vmxml.format_xml(domxml.dom)
        self.assertXMLEqual(find_xml_element(xml, './numatune'), numatuneXML)
Beispiel #17
0
    def testInputXMLPPC64(self):
        expectedXMLs = [
            """<input bus="usb" type="mouse"/>""",
            """<input bus="usb" type="tablet"/>"""
        ]

        vmConfs = [{}, {'tabletEnable': 'true'}]
        for vmConf, inputXML in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.PPC64)
            domxml.appendInput()
            xml = find_xml_element(domxml.toxml(), './devices/input')
            self.assertXMLEqual(xml, inputXML)
Beispiel #18
0
    def testMemoryBackingXMLDefaultPPC(self):
        memorybacking_xml = """
          <memoryBacking>
            <hugepages>
              <page size="16384" />
            </hugepages>
          </memoryBacking>"""

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.PPC64LE)
        domxml.appendMemoryBacking(
            hugepages.DEFAULT_HUGEPAGESIZE[cpuarch.real()])
        xml = find_xml_element(domxml.toxml(), './memoryBacking')
        self.assertXMLEqual(xml, memorybacking_xml)
Beispiel #19
0
 def testChannelXML(self):
     channelXML = """
       <channel type="unix">
          <target name="%s" type="virtio"/>
          <source mode="bind" path="%s"/>
       </channel>"""
     path = '/tmp/channel-socket'
     name = 'org.linux-kvm.port.0'
     channelXML = channelXML % (name, path)
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml._appendAgentDevice(path, name)
     xml = find_xml_element(domxml.toxml(), './devices/channel')
     self.assertXMLEqual(xml, channelXML)
Beispiel #20
0
    def testMemoryBackingXMLDefaultPPC(self):
        memorybacking_xml = """
          <memoryBacking>
            <hugepages>
              <page size="16384" />
            </hugepages>
          </memoryBacking>"""

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.PPC64LE)
        domxml.appendMemoryBacking(
            hugepages.DEFAULT_HUGEPAGESIZE[cpuarch.real()]
        )
        xml = find_xml_element(domxml.toxml(), './memoryBacking')
        self.assertXMLEqual(xml, memorybacking_xml)
Beispiel #21
0
 def testHyperVClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="hypervclock" present="yes"/>
             <timer name="rtc" tickpolicy="catchup"/>
             <timer name="pit" tickpolicy="delay"/>
             <timer name="hpet" present="no"/>
         </clock>"""
     conf = {'timeOffset': '-3600', 'hypervEnable': 'true'}
     conf.update(self.conf)
     domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
     domxml.appendClock()
     xml = find_xml_element(domxml.toxml(), './clock')
     self.assertXMLEqual(xml, clockXML)
Beispiel #22
0
 def testHyperVClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="hypervclock" present="yes"/>
             <timer name="rtc" tickpolicy="catchup"/>
             <timer name="pit" tickpolicy="delay"/>
             <timer name="hpet" present="no"/>
         </clock>"""
     conf = {'timeOffset': '-3600', 'hypervEnable': 'true'}
     conf.update(self.conf)
     domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
     domxml.appendClock()
     xml = find_xml_element(domxml.toxml(), './clock')
     self.assertXMLEqual(xml, clockXML)
Beispiel #23
0
    def testNumaTuneXMLSingleNode(self, devices, numa_node):
        numatuneXML = """
          <numatune>
              <memory mode="preferred" nodeset="{}" />
          </numatune> """.format(numa_node)

        domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
        devices = [
            hostdevice.HostDevice(self.log, **{
                'type': 'hostdev',
                'device': device
            }) for device in devices
        ]
        domxml.appendHostdevNumaTune(devices)
        xml = xmlutils.tostring(domxml.dom)
        self.assertXMLEqual(find_xml_element(xml, './numatune'), numatuneXML)
Beispiel #24
0
 def testFeaturesHyperVXML(self):
     featuresXML = """
         <features>
               <acpi/>
               <hyperv>
                      <relaxed state="on"/>
                      <vapic state="on"/>
                      <spinlocks retries="8191" state="on"/>
               </hyperv>
         </features>"""
     conf = {'hypervEnable': 'true'}
     conf.update(self.conf)
     domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
     domxml.appendFeatures()
     xml = find_xml_element(domxml.toxml(), './features')
     self.assertXMLEqual(xml, featuresXML)
Beispiel #25
0
 def testFeaturesHyperVXML(self):
     featuresXML = """
         <features>
               <acpi/>
               <hyperv>
                      <relaxed state="on"/>
                      <vapic state="on"/>
                      <spinlocks retries="8191" state="on"/>
               </hyperv>
         </features>"""
     conf = {'hypervEnable': 'true'}
     conf.update(self.conf)
     domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
     domxml.appendFeatures()
     xml = find_xml_element(domxml.toxml(), './features')
     self.assertXMLEqual(xml, featuresXML)
Beispiel #26
0
    def testSharedGuestNumaNodes(self):
        numaXML = """
              <numa>
                  <cell cpus="0-1" memory="5242880" memAccess="shared"/>
              </numa>
              """

        vmConf = {
            'cpuType': "Opteron_G4,+sse4_1,+sse4_2,-svm",
            'smpCoresPerSocket': 2,
            'smpThreadsPerCore': 2,
            'cpuPinning': {
                '0': '0-1',
                '1': '2-3'
            },
            'numaTune': {
                'mode':
                'strict',
                'nodeset':
                '0-1',
                'memnodes': [{
                    'vmNodeIndex': '0',
                    'nodeset': '1'
                }, {
                    'vmNodeIndex': '1',
                    'nodeset': '0'
                }]
            },
            'guestNumaNodes': [
                {
                    'cpus': '0-1',
                    'memory': '5120',
                    'nodeIndex': 0
                },
            ]
        }

        vmConf.update(self.conf)
        domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.X86_64)
        domxml.appendCpu(hugepages_shared=True)
        xml = domxml.toxml()
        self.assertXMLEqual(find_xml_element(xml, "./cpu/numa"), numaXML)
Beispiel #27
0
 def testSysinfoXML(self):
     sysinfoXML = """
         <sysinfo type="smbios">
           <system>
             <entry name="manufacturer">%s</entry>
             <entry name="product">%s</entry>
             <entry name="version">%s</entry>
             <entry name="serial">%s</entry>
             <entry name="uuid">%s</entry>
           </system>
         </sysinfo>"""
     product = 'oVirt Node'
     version = '17-1'
     serial = 'A5955881-519B-11CB-8352-E78A528C28D8_00:21:cc:68:d7:38'
     sysinfoXML = sysinfoXML % (constants.SMBIOS_MANUFACTURER, product,
                                version, serial, self.conf['vmId'])
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendSysinfo(product, version, serial)
     xml = find_xml_element(domxml.toxml(), './sysinfo')
     self.assertXMLEqual(xml, sysinfoXML)
Beispiel #28
0
 def testSysinfoXML(self):
     sysinfoXML = """
         <sysinfo type="smbios">
           <system>
             <entry name="manufacturer">%s</entry>
             <entry name="product">%s</entry>
             <entry name="version">%s</entry>
             <entry name="serial">%s</entry>
             <entry name="uuid">%s</entry>
           </system>
         </sysinfo>"""
     product = 'oVirt Node'
     version = '17-1'
     serial = 'A5955881-519B-11CB-8352-E78A528C28D8_00:21:cc:68:d7:38'
     sysinfoXML = sysinfoXML % (constants.SMBIOS_MANUFACTURER,
                                product, version, serial, self.conf['vmId'])
     domxml = libvirtxml.Domain(self.conf, self.log, cpuarch.X86_64)
     domxml.appendSysinfo(product, version, serial)
     xml = find_xml_element(domxml.toxml(), './sysinfo')
     self.assertXMLEqual(xml, sysinfoXML)
Beispiel #29
0
    def testCpuXML(self):
        cpuXML = """
          <cpu match="exact">
              <model>Opteron_G4</model>
              <feature name="sse4.1" policy="require"/>
              <feature name="sse4.2" policy="require"/>
              <feature name="svm" policy="disable"/>
              <topology cores="2" sockets="40" threads="2"/>
              <numa>
                  <cell cpus="0-1" memory="5242880"/>
                  <cell cpus="2,3" memory="5242880"/>
              </numa>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="0-1" vcpu="0"/>
              <vcpupin cpuset="2-3" vcpu="1"/>
          </cputune> """

        numatuneXML = """
          <numatune>
              <memory mode="strict" nodeset="0-1"/>
              <memnode cellid="0" mode="strict" nodeset="1"/>
              <memnode cellid="1" mode="strict" nodeset="0"/>
          </numatune> """

        vmConf = {
            'cpuType':
            "Opteron_G4,+sse4_1,+sse4_2,-svm",
            'smpCoresPerSocket':
            2,
            'smpThreadsPerCore':
            2,
            'cpuPinning': {
                '0': '0-1',
                '1': '2-3'
            },
            'numaTune': {
                'mode':
                'strict',
                'nodeset':
                '0-1',
                'memnodes': [{
                    'vmNodeIndex': '0',
                    'nodeset': '1'
                }, {
                    'vmNodeIndex': '1',
                    'nodeset': '0'
                }]
            },
            'guestNumaNodes': [{
                'cpus': '0-1',
                'memory': '5120',
                'nodeIndex': 0
            }, {
                'cpus': '2,3',
                'memory': '5120',
                'nodeIndex': 1
            }]
        }
        vmConf.update(self.conf)
        domxml = libvirtxml.Domain(vmConf, self.log, cpuarch.X86_64)
        domxml.appendCpu()
        domxml.appendNumaTune()
        xml = domxml.toxml()
        self.assertXMLEqual(find_xml_element(xml, "./cpu"), cpuXML)
        self.assertXMLEqual(find_xml_element(xml, "./cputune"), cputuneXML)
        self.assertXMLEqual(find_xml_element(xml, './numatune'), numatuneXML)
Beispiel #30
0
 def testOSXMLBootMenu(self):
     vmConfs = (
         # trivial cases first
         {},
         {
             'bootMenuEnable': 'true'
         },
         {
             'bootMenuEnable': 'false'
         },
         {
             'bootMenuEnable': True
         },
         {
             'bootMenuEnable': False
         },
         # next with more fields
         {
             'bootMenuEnable': True,
             'kernelArgs': 'console=ttyS0 1'
         },
         {
             'bootMenuEnable': False,
             'kernelArgs': 'console=ttyS0 1'
         })
     expectedXMLs = ("""
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <smbios mode="sysinfo"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <cmdline>console=ttyS0 1</cmdline>
              <smbios mode="sysinfo"/>
              <bootmenu enable="yes" timeout="10000"/>
         </os>""", """
         <os>
              <type arch="x86_64" machine="pc">hvm</type>
              <cmdline>console=ttyS0 1</cmdline>
              <smbios mode="sysinfo"/>
         </os>""")
     for conf, osXML in zip(vmConfs, expectedXMLs):
         conf.update(self.conf)
         domxml = libvirtxml.Domain(conf, self.log, cpuarch.X86_64)
         domxml.appendOs()
         xml = find_xml_element(domxml.toxml(), './os')
         self.assertXMLEqual(xml, osXML)