def testInstallParavirtDiskDrvTapQCow(self):
     g = utils.get_basic_paravirt_guest()
     disk = utils.get_filedisk()
     disk.driver_name = VirtualDisk.DRIVER_TAP
     disk.driver_type = VirtualDisk.DRIVER_TAP_QCOW
     g.disks.append(disk)
     self._compare(g, "install-paravirt-disk-drv-tap-qcow", True)
Beispiel #2
0
    def _image2XMLhelper(self, image_xml, output_xmls, qemu=False):
        image2guestdir = self.basedir + "image2guest/"
        image = virtinst.ImageParser.parse_file(self.basedir + image_xml)
        if type(output_xmls) is not list:
            output_xmls = [output_xmls]

        conn = qemu and self.qemuconn or self.conn
        caps = qemu and self.qemucaps or self.caps
        gtype = qemu and "qemu" or "xen"

        for idx in range(len(output_xmls)):
            fname = output_xmls[idx]
            inst = virtinst.ImageInstaller(image,
                                           caps,
                                           boot_index=idx,
                                           conn=conn)

            utils.set_conn(conn)

            if inst.is_hvm():
                g = utils.get_basic_fullyvirt_guest(typ=gtype)
            else:
                g = utils.get_basic_paravirt_guest()

            g.installer = inst
            g._prepare_install(None)

            actual_out = g.get_config_xml(install=False)
            expect_file = os.path.join(image2guestdir + fname)
            expect_out = utils.read_file(expect_file)
            expect_out = expect_out.replace("REPLACEME", os.getcwd())

            utils.diff_compare(actual_out, expect_file, expect_out=expect_out)

            utils.reset_conn()
Beispiel #3
0
    def _image2XMLhelper(self, image_xml, output_xmls, qemu=False):
        image2guestdir = self.basedir + "image2guest/"
        image = virtinst.ImageParser.parse_file(self.basedir + image_xml)
        if type(output_xmls) is not list:
            output_xmls = [output_xmls]

        conn = qemu and self.qemuconn or self.conn
        caps = qemu and self.qemucaps or self.caps
        gtype = qemu and "qemu" or "xen"

        for idx in range(len(output_xmls)):
            fname = output_xmls[idx]
            inst = virtinst.ImageInstaller(image, caps, boot_index=idx,
                                           conn=conn)

            utils.set_conn(conn)

            if inst.is_hvm():
                g = utils.get_basic_fullyvirt_guest(typ=gtype)
            else:
                g = utils.get_basic_paravirt_guest()

            g.installer = inst
            g._prepare_install(None)

            actual_out = g.get_config_xml(install=False)
            expect_file = os.path.join(image2guestdir + fname)
            expect_out = utils.read_file(expect_file)
            expect_out = expect_out.replace("REPLACEME", os.getcwd())

            utils.diff_compare(actual_out,
                               expect_file,
                               expect_out=expect_out)

            utils.reset_conn()
 def testBootParavirtDiskFileBlktapCapable(self):
     oldblktap = virtinst._util.is_blktap_capable
     try:
         virtinst._util.is_blktap_capable = lambda: True
         g = utils.get_basic_paravirt_guest()
         g.disks.append(utils.get_filedisk())
         self._compare(g, "boot-paravirt-disk-drv-tap", False)
     finally:
         virtinst._util.is_blktap_capable = oldblktap
    def testInstallParavirtManyDisks(self):
        g = utils.get_basic_paravirt_guest()
        disk = utils.get_filedisk("/tmp/test2.img")
        disk.driver_name = VirtualDisk.DRIVER_TAP
        disk.driver_type = VirtualDisk.DRIVER_TAP_QCOW

        g.disks.append(utils.get_filedisk("/tmp/test1.img"))
        g.disks.append(disk)
        g.disks.append(utils.get_blkdisk())
        self._compare(g, "install-paravirt-many-disks", True)
    def testBootParavirtDiskFile(self):
        g = utils.get_basic_paravirt_guest()
        g.disks.append(utils.get_filedisk("/tmp/somerandomfilename.img"))
        self._compare(g, "boot-paravirt-disk-file", False)

        # Just cram some post_install_checks in here
        try:
            g.post_install_check()
            raise AssertionError("Expected OSError, none caught.")
        except OSError:
            pass

        g.disks[0].path = "virt-install"
        self.assertEquals(g.post_install_check(), False)

        g.disks[0].driver_type = "raw"
        self.assertEquals(g.post_install_check(), False)

        g.disks[0].driver_type = "foobar"
        self.assertEquals(g.post_install_check(), True)
    def testInstallPVImport(self):
        i = utils.make_import_installer("xen")
        g = utils.get_basic_paravirt_guest(installer=i)

        g.disks.append(utils.get_filedisk())
        self._compare(g, "install-paravirt-import", False)
 def testInstallParavirtDiskDrvFile(self):
     g = utils.get_basic_paravirt_guest()
     disk = utils.get_filedisk()
     disk.driver_name = VirtualDisk.DRIVER_FILE
     g.disks.append(disk)
     self._compare(g, "install-paravirt-disk-drv-file", True)
 def testInstallParavirtDiskDrvPhy(self):
     g = utils.get_basic_paravirt_guest()
     disk = utils.get_blkdisk()
     disk.driver_name = VirtualDisk.DRIVER_PHY
     g.disks.append(disk)
     self._compare(g, "install-paravirt-disk-drv-phy", True)
 def testInstallParavirtDiskBlock(self):
     g = utils.get_basic_paravirt_guest()
     g.disks.append(utils.get_blkdisk())
     self._compare(g, "install-paravirt-disk-block", True)
 def testInstallParavirtDiskFile(self):
     g = utils.get_basic_paravirt_guest()
     g.disks.append(utils.get_filedisk())
     self._compare(g, "install-paravirt-disk-file", True)
 def testBootParavirtDiskDrvTap(self):
     g = utils.get_basic_paravirt_guest()
     disk = utils.get_filedisk()
     disk.driver_name = VirtualDisk.DRIVER_TAP
     g.disks.append(disk)
     self._compare(g, "boot-paravirt-disk-drv-tap", False)
 def testBootParavirtDiskDrvPhy(self):
     g = utils.get_basic_paravirt_guest()
     disk = utils.get_blkdisk()
     disk.driver_name = VirtualDisk.DRIVER_PHY
     g.disks.append(disk)
     self._compare(g, "boot-paravirt-disk-drv-phy", False)
 def testBootParavirtDiskBlock(self):
     g = utils.get_basic_paravirt_guest()
     g.disks.append(utils.get_blkdisk())
     self._compare(g, "boot-paravirt-disk-block", False)