コード例 #1
0
ファイル: vmTests.py プロジェクト: edwardbadboy/vdsm-ubuntu
    def testOSXML(self):
        expectedXMLs = [
            """
            <os>
                <type arch="x86_64" machine="pc">hvm</type>
                <initrd>/tmp/initrd-2.6.18.img</initrd>
                <kernel>/tmp/vmlinuz-2.6.18</kernel>
                <cmdline>console=ttyS0 1</cmdline>
                <smbios mode="sysinfo"/>
            </os>"""
        ]
        vmConfs = [
            {"kernel": "/tmp/vmlinuz-2.6.18", "initrd": "/tmp/initrd-2.6.18.img", "kernelArgs": "console=ttyS0 1"}
        ]

        OSXML = """
            <os>
                 <type arch="x86_64" machine="pc">hvm</type>
                 <boot dev="%s"/>
                 <smbios mode="sysinfo"/>
            </os>"""

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

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendOs()
            self.assertXML(domxml.dom, xml, "os")
コード例 #2
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
    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 qemu2libvirtBoot.iteritems():
            vmConfs.append({'boot': k})
            expectedXMLs.append(OSXML % v)

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log,
                                caps.Architecture.PPC64)
            domxml.appendOs()
            self.assertXML(domxml.dom, xml, 'os')
コード例 #3
0
    def testOSXML(self):
        expectedXMLs = [
            """
            <os>
                <type arch="x86_64" machine="pc">hvm</type>
                <initrd>/tmp/initrd-2.6.18.img</initrd>
                <kernel>/tmp/vmlinuz-2.6.18</kernel>
                <cmdline>console=ttyS0 1</cmdline>
                <smbios mode="sysinfo"/>
            </os>"""
        ]
        vmConfs = [{
            'kernel': '/tmp/vmlinuz-2.6.18',
            'initrd': '/tmp/initrd-2.6.18.img',
            'kernelArgs': 'console=ttyS0 1'
        }]

        OSXML = """
            <os>
                 <type arch="x86_64" machine="pc">hvm</type>
                 <boot dev="%s"/>
                 <smbios mode="sysinfo"/>
            </os>"""

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

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendOs()
            self.assertXML(domxml.dom, xml, 'os')
コード例 #4
0
ファイル: vmTests.py プロジェクト: edwardbadboy/vdsm-ubuntu
    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="2" threads="2"/>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="2-3" vcpu="1"/>
              <vcpupin cpuset="0-1" vcpu="0"/>
          </cputune> """

        vmConf = {
            "cpuType": "Opteron_G4,+sse4_1,+sse4_2,-svm",
            "smpCoresPerSocket": 2,
            "smpThreadsPerCore": 2,
            "cpuPinning": {"0": "0-1", "1": "2-3"},
        }
        vmConf.update(self.conf)
        domxml = vm._DomXML(vmConf, self.log)
        domxml.appendCpu()
        self.assertXML(domxml.dom, cpuXML, "cpu")
        self.assertXML(domxml.dom, cputuneXML, "cputune")
コード例 #5
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="2" threads="2"/>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="2-3" vcpu="1"/>
              <vcpupin cpuset="0-1" vcpu="0"/>
          </cputune> """

        vmConf = {
            'cpuType': "Opteron_G4,+sse4_1,+sse4_2,-svm",
            'smpCoresPerSocket': 2,
            'smpThreadsPerCore': 2,
            'cpuPinning': {
                '0': '0-1',
                '1': '2-3'
            }
        }
        vmConf.update(self.conf)
        domxml = vm._DomXML(vmConf, self.log)
        domxml.appendCpu()
        self.assertXML(domxml.dom, cpuXML, 'cpu')
        self.assertXML(domxml.dom, cputuneXML, 'cputune')
コード例 #6
0
 def testFeaturesXML(self):
     featuresXML = """
         <features>
               <acpi/>
         </features>"""
     domxml = vm._DomXML(self.conf, self.log)
     domxml.appendFeatures()
     self.assertXML(domxml.dom, featuresXML, 'features')
コード例 #7
0
ファイル: vmTests.py プロジェクト: hackxay/vdsm
 def testFeaturesXML(self):
     featuresXML = """
         <features>
               <acpi/>
         </features>"""
     domxml = vm._DomXML(self.conf, self.log)
     domxml.appendFeatures()
     self.assertXML(domxml.dom, featuresXML, 'features')
コード例 #8
0
ファイル: vmTests.py プロジェクト: edwardbadboy/vdsm-ubuntu
    def testInputXML(self):
        expectedXMLs = ["""<input bus="ps2" type="mouse"/>""", """<input bus="usb" type="tablet"/>"""]

        vmConfs = [{}, {"tabletEnable": "true"}]
        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendInput()
            self.assertXML(domxml.dom, xml, "devices/input")
コード例 #9
0
 def testClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="rtc" tickpolicy="catchup"/>
         </clock>"""
     self.conf['timeOffset'] = '-3600'
     domxml = vm._DomXML(self.conf, self.log)
     domxml.appendClock()
     self.assertXML(domxml.dom, clockXML, 'clock')
コード例 #10
0
ファイル: vmTests.py プロジェクト: hackxay/vdsm
 def testClockXML(self):
     clockXML = """
         <clock adjustment="-3600" offset="variable">
             <timer name="rtc" tickpolicy="catchup"/>
         </clock>"""
     self.conf['timeOffset'] = '-3600'
     domxml = vm._DomXML(self.conf, self.log)
     domxml.appendClock()
     self.assertXML(domxml.dom, clockXML, 'clock')
コード例 #11
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
 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 = vm._DomXML(self.conf, self.log,
                         caps.Architecture.X86_64)
     domxml.appendClock()
     self.assertXML(domxml.dom, clockXML, 'clock')
コード例 #12
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
    def testInputXMLPPC64(self):
        expectedXMLs = [
            """<input bus="usb" type="mouse"/>""",
            """<input bus="usb" type="tablet"/>"""]

        vmConfs = [{}, {'tabletEnable': 'true'}]
        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log,
                                caps.Architecture.PPC64)
            domxml.appendInput()
            self.assertXML(domxml.dom, xml, 'devices/input')
コード例 #13
0
    def testInputXML(self):
        expectedXMLs = [
            """<input bus="ps2" type="mouse"/>""",
            """<input bus="usb" type="tablet"/>"""
        ]

        vmConfs = [{}, {'tabletEnable': 'true'}]
        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendInput()
            self.assertXML(domxml.dom, xml, 'devices/input')
コード例 #14
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 = vm._DomXML(self.conf, self.log)
     domxml._appendAgentDevice(path, name)
     self.assertXML(domxml.dom, channelXML, 'devices/channel')
コード例 #15
0
ファイル: vmTests.py プロジェクト: hackxay/vdsm
 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 = vm._DomXML(self.conf, self.log)
     domxml._appendAgentDevice(path, name)
     self.assertXML(domxml.dom, channelXML, 'devices/channel')
コード例 #16
0
ファイル: libvirtvmTests.py プロジェクト: lukas-bednar/vdsm
    def testDomXML(self):
        expectedXML = """
           <domain type="kvm">
              <name>testVm</name>
              <uuid>9ffe28b6-6134-4b1e-8804-1185f49c436f</uuid>
              <memory>1048576</memory>
              <currentMemory>1048576</currentMemory>
              <vcpu>8</vcpu>
              <devices/>
           </domain>"""

        domxml = vm._DomXML(self.conf, self.log)
        self.assertXML(domxml.dom, expectedXML)
コード例 #17
0
    def testDomXML(self):
        expectedXML = """
           <domain type="kvm">
              <name>testVm</name>
              <uuid>9ffe28b6-6134-4b1e-8804-1185f49c436f</uuid>
              <memory>1048576</memory>
              <currentMemory>1048576</currentMemory>
              <vcpu>8</vcpu>
              <memtune>
                  <min_guarantee>524288</min_guarantee>
              </memtune>
              <devices/>
           </domain>"""

        domxml = vm._DomXML(self.conf, self.log)
        self.assertXML(domxml.dom, expectedXML)
コード例 #18
0
    def testGraphicsXML(self):
        expectedXMLs = [
            """
            <graphics autoport="yes" keymap="en-us" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
                <listen network="vdsm-vmDisplay" type="network"/>
            </graphics>""", """
            <graphics autoport="yes" listen="0" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1"
                      tlsPort="-1" type="spice">
                <channel mode="secure" name="main"/>
                <channel mode="secure" name="inputs"/>
                <channel mode="secure" name="cursor"/>
                <channel mode="secure" name="playback"/>
                <channel mode="secure" name="record"/>
                <channel mode="secure" name="display"/>
            </graphics>"""
        ]

        spiceChannelXML = """
            <channel type="spicevmc">
                <target name="com.redhat.spice.0" type="virtio"/>
            </channel>"""

        vmConfs = [{
            'display': 'vnc',
            'displayPort': '-1',
            'displayNetwork': 'vmDisplay',
            'keyboardLayout': 'en-us'
        }, {
            'display':
            'qxl',
            'displayPort':
            '-1',
            'displaySecurePort':
            '-1',
            'spiceSecureChannels':
            "smain,sinputs,scursor,splayback,srecord,sdisplay"
        }]

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendGraphics()
            self.assertXML(domxml.dom, xml, 'devices/graphics')
            if vmConf['display'] == 'qxl':
                self.assertXML(domxml.dom, spiceChannelXML, 'devices/channel')
コード例 #19
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
    def testDomXML(self):
        expectedXML = """
           <domain type="kvm">
              <name>testVm</name>
              <uuid>9ffe28b6-6134-4b1e-8804-1185f49c436f</uuid>
              <memory>1048576</memory>
              <currentMemory>1048576</currentMemory>
              <vcpu current="8">160</vcpu>
              <memtune>
                  <min_guarantee>524288</min_guarantee>
              </memtune>
              <devices/>
           </domain>"""

        domxml = vm._DomXML(self.conf, self.log,
                            caps.Architecture.X86_64)
        self.assertXML(domxml.dom, expectedXML)
コード例 #20
0
ファイル: vmTests.py プロジェクト: edwardbadboy/vdsm-ubuntu
 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 = vm._DomXML(self.conf, self.log)
     domxml.appendSysinfo(product, version, serial)
     self.assertXML(domxml.dom, sysinfoXML, "sysinfo")
コード例 #21
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 = vm._DomXML(self.conf, self.log)
     domxml.appendSysinfo(product, version, serial)
     self.assertXML(domxml.dom, sysinfoXML, 'sysinfo')
コード例 #22
0
ファイル: vmTests.py プロジェクト: edwardbadboy/vdsm-ubuntu
    def testGraphicsXML(self):
        expectedXMLs = [
            """
            <graphics autoport="yes" keymap="en-us" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
                <listen network="vdsm-vmDisplay" type="network"/>
            </graphics>""",
            """
            <graphics autoport="yes" listen="0" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1"
                      tlsPort="-1" type="spice">
                <channel mode="secure" name="main"/>
                <channel mode="secure" name="inputs"/>
                <channel mode="secure" name="cursor"/>
                <channel mode="secure" name="playback"/>
                <channel mode="secure" name="record"/>
                <channel mode="secure" name="display"/>
            </graphics>""",
        ]

        spiceChannelXML = """
            <channel type="spicevmc">
                <target name="com.redhat.spice.0" type="virtio"/>
            </channel>"""

        vmConfs = [
            {"display": "vnc", "displayPort": "-1", "displayNetwork": "vmDisplay", "keyboardLayout": "en-us"},
            {
                "display": "qxl",
                "displayPort": "-1",
                "displaySecurePort": "-1",
                "spiceSecureChannels": "smain,sinputs,scursor,splayback,srecord,sdisplay",
            },
        ]

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log)
            domxml.appendGraphics()
            self.assertXML(domxml.dom, xml, "devices/graphics")
            if vmConf["display"] == "qxl":
                self.assertXML(domxml.dom, spiceChannelXML, "devices/channel")
コード例 #23
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
 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 = vm._DomXML(self.conf, self.log,
                         caps.Architecture.X86_64)
     domxml.appendSysinfo(product, version, serial)
     self.assertXML(domxml.dom, sysinfoXML, 'sysinfo')
コード例 #24
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
    def testGraphicsXML(self):
        expectedXMLs = [
            """
            <graphics autoport="yes" keymap="en-us" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
                <listen network="vdsm-vmDisplay" type="network"/>
            </graphics>""",

            """
            <graphics autoport="yes" listen="0" passwd="*****"
                      passwdValidTo="1970-01-01T00:00:01" port="-1"
                      tlsPort="-1" type="spice">
                <channel mode="secure" name="main"/>
                <channel mode="secure" name="inputs"/>
                <channel mode="secure" name="cursor"/>
                <channel mode="secure" name="playback"/>
                <channel mode="secure" name="record"/>
                <channel mode="secure" name="display"/>
            </graphics>"""]

        spiceChannelXML = """
            <channel type="spicevmc">
                <target name="com.redhat.spice.0" type="virtio"/>
            </channel>"""

        vmConfs = [
            {'display': 'vnc', 'displayPort': '-1', 'displayNetwork':
             'vmDisplay', 'keyboardLayout': 'en-us'},

            {'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
             'spiceSecureChannels':
             "smain,sinputs,scursor,splayback,srecord,sdisplay"}]

        for vmConf, xml in zip(vmConfs, expectedXMLs):
            vmConf.update(self.conf)
            domxml = vm._DomXML(vmConf, self.log,
                                caps.Architecture.X86_64)
            domxml.appendGraphics()
            self.assertXML(domxml.dom, xml, 'devices/graphics')
            if vmConf['display'] == 'qxl':
                self.assertXML(domxml.dom, spiceChannelXML, 'devices/channel')
コード例 #25
0
ファイル: vmTests.py プロジェクト: int64ago-public/vdsm
    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="512000"/>
                  <cell cpus="2,3" memory="512000"/>
              </numa>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="2-3" vcpu="1"/>
              <vcpupin cpuset="0-1" vcpu="0"/>
          </cputune> """

        numatuneXML = """
          <numatune>
              <memory mode="strict" nodeset="0-1"/>
          </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'},
                  'guestNumaNodes': [{'cpus': '0-1', 'memory': '512000'},
                                     {'cpus': '2,3', 'memory': 512000}]}
        vmConf.update(self.conf)
        domxml = vm._DomXML(vmConf, self.log,
                            caps.Architecture.X86_64)
        domxml.appendCpu()
        self.assertXML(domxml.dom, cpuXML, 'cpu')
        self.assertXML(domxml.dom, cputuneXML, 'cputune')

        domxml.appendNumaTune()
        self.assertXML(domxml.dom, numatuneXML, 'numatune')
コード例 #26
0
ファイル: vmTests.py プロジェクト: therealmik/vdsm
    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"/>
          </cpu> """
        cputuneXML = """
          <cputune>
              <vcpupin cpuset="2-3" vcpu="1"/>
              <vcpupin cpuset="0-1" vcpu="0"/>
          </cputune> """

        vmConf = {'cpuType': "Opteron_G4,+sse4_1,+sse4_2,-svm",
                  'smpCoresPerSocket': 2, 'smpThreadsPerCore': 2,
                  'cpuPinning': {'0': '0-1', '1': '2-3'}}
        vmConf.update(self.conf)
        domxml = vm._DomXML(vmConf, self.log,
                            caps.Architecture.X86_64)
        domxml.appendCpu()
        self.assertXML(domxml.dom, cpuXML, 'cpu')
        self.assertXML(domxml.dom, cputuneXML, 'cputune')