def testAlterMinimalGuest(self): guest, outfile = self._get_test_content("change-minimal-guest") check = self._make_checker(guest.features) check("acpi", False, True) check("pae", False) self.assertTrue( guest.features.get_xml_config().startswith("<features")) check = self._make_checker(guest.clock) check("offset", None, "utc") self.assertTrue(guest.clock.get_xml_config().startswith("<clock")) seclabel = virtinst.Seclabel(guest.conn) guest.add_child(seclabel) seclabel.model = "testSecurity" seclabel.type = "static" seclabel.label = "frob" self.assertTrue( guest.seclabels[0].get_xml_config().startswith("<seclabel")) check = self._make_checker(guest.cpu) check("model", None, "foobar") check("model_fallback", None, "allow") check("cores", None, 4) guest.cpu.add_feature("x2apic", "forbid") guest.cpu.set_topology_defaults(guest.vcpus) self.assertTrue(guest.cpu.get_xml_config().startswith("<cpu")) self.assertTrue(guest.os.get_xml_config().startswith("<os")) self._alter_compare(guest.get_xml_config(), outfile)
def testManyDevices(self): i = make_pxe_installer() g = get_basic_fullyvirt_guest(installer=i) g.description = "foooo barrrr \n baz && snarf. '' \"\" @@$\n" # Hostdevs dev1 = VirtualHostDeviceUSB(g.conn) dev1.product = "0x1234" dev1.vendor = "0x4321" g.hostdevs.append(dev1) # Sound devices g.sound_devs.append(VirtualAudio("sb16", conn=g.conn)) g.sound_devs.append(VirtualAudio("es1370", conn=g.conn)) # Disk devices g.disks.append(VirtualDisk(conn=g.conn, path="/dev/loop0", device=VirtualDisk.DEVICE_FLOPPY)) g.disks.append(VirtualDisk(conn=g.conn, path="/dev/loop0", bus="scsi")) g.disks.append(VirtualDisk(conn=g.conn, path="/tmp", device="floppy")) d3 = VirtualDisk(conn=g.conn, path="/default-pool/testvol1.img", bus="scsi", driverName="qemu") g.disks.append(d3) # Controller devices c1 = VirtualController.get_class_for_type(VirtualController.CONTROLLER_TYPE_IDE)(g.conn) c1.index = "3" c2 = VirtualController.get_class_for_type(VirtualController.CONTROLLER_TYPE_VIRTIOSERIAL)(g.conn) c2.ports = "32" c2.vectors = "17" g.add_device(c1) g.add_device(c2) # Network devices net1 = get_virtual_network() net1.model = "e1000" net2 = VirtualNetworkInterface(type="user", macaddr="11:11:11:11:11:11") g.nics.append(net1) g.nics.append(net2) # Character devices cdev1 = VirtualCharDevice.get_dev_instance(g.conn, VirtualCharDevice.DEV_SERIAL, VirtualCharDevice.CHAR_NULL) cdev2 = VirtualCharDevice.get_dev_instance(g.conn, VirtualCharDevice.DEV_PARALLEL, VirtualCharDevice.CHAR_UNIX) cdev2.source_path = "/tmp/foobar" g.add_device(cdev1) g.add_device(cdev2) # Video Devices vdev1 = VirtualVideoDevice(g.conn) vdev1.model_type = "vmvga" vdev2 = VirtualVideoDevice(g.conn) vdev2.model_type = "cirrus" vdev2.vram = 10 * 1024 vdev2.heads = 3 vdev3 = VirtualVideoDevice(g.conn) g.add_device(vdev1) g.add_device(vdev2) g.add_device(vdev3) wdev2 = VirtualWatchdog(g.conn) wdev2.model = "ib700" wdev2.action = "none" g.add_device(wdev2) g.clock.offset = "localtime" seclabel = virtinst.Seclabel(g.conn) seclabel.type = seclabel.SECLABEL_TYPE_STATIC seclabel.model = "selinux" seclabel.label = "foolabel" seclabel.imagelabel = "imagelabel" g.seclabel = seclabel self._compare(g, "boot-many-devices", False)