~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_libvirt_config.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
431
431
        xml = obj.to_xml()
432
432
        self.assertXmlEqual(xml, """
433
433
            <serial type="file">
434
 
              <source file="/tmp/vm.log"/>
 
434
              <source path="/tmp/vm.log"/>
435
435
            </serial>""")
436
436
 
437
437
 
438
 
class LibvirtConfigGuestSerialTest(LibvirtConfigBaseTest):
 
438
class LibvirtConfigGuestConsoleTest(LibvirtConfigBaseTest):
439
439
    def test_config_pty(self):
440
440
        obj = config.LibvirtConfigGuestConsole()
441
441
        obj.type = "pty"
556
556
              </devices>
557
557
            </domain>""")
558
558
 
559
 
    def test_config_xen(self):
 
559
    def test_config_xen_pv(self):
560
560
        obj = config.LibvirtConfigGuest()
561
561
        obj.virt_type = "xen"
562
562
        obj.memory = 1024 * 1024 * 100
599
599
              </devices>
600
600
            </domain>""")
601
601
 
 
602
    def test_config_xen_hvm(self):
 
603
        obj = config.LibvirtConfigGuest()
 
604
        obj.virt_type = "xen"
 
605
        obj.memory = 1024 * 1024 * 100
 
606
        obj.vcpus = 2
 
607
        obj.name = "demo"
 
608
        obj.uuid = "b38a3f43-4be2-4046-897f-b67c2f5e0147"
 
609
        obj.os_type = "hvm"
 
610
        obj.os_loader = '/usr/lib/xen/boot/hvmloader'
 
611
        obj.os_root = "root=xvda"
 
612
        obj.os_cmdline = "console=xvc0"
 
613
 
 
614
        disk = config.LibvirtConfigGuestDisk()
 
615
        disk.source_type = "file"
 
616
        disk.source_path = "/tmp/img"
 
617
        disk.target_dev = "/dev/xvda"
 
618
        disk.target_bus = "xen"
 
619
 
 
620
        obj.add_device(disk)
 
621
 
 
622
        xml = obj.to_xml()
 
623
        self.assertXmlEqual(xml, """
 
624
            <domain type="xen">
 
625
              <uuid>b38a3f43-4be2-4046-897f-b67c2f5e0147</uuid>
 
626
              <name>demo</name>
 
627
              <memory>104857600</memory>
 
628
              <vcpu>2</vcpu>
 
629
              <os>
 
630
                <type>hvm</type>
 
631
                <loader>/usr/lib/xen/boot/hvmloader</loader>
 
632
                <cmdline>console=xvc0</cmdline>
 
633
                <root>root=xvda</root>
 
634
              </os>
 
635
              <devices>
 
636
                <disk type="file" device="disk">
 
637
                  <source file="/tmp/img"/>
 
638
                  <target bus="xen" dev="/dev/xvda"/>
 
639
                </disk>
 
640
              </devices>
 
641
            </domain>""")
 
642
 
602
643
    def test_config_kvm(self):
603
644
        obj = config.LibvirtConfigGuest()
604
645
        obj.virt_type = "kvm"