當前位置: 首頁>>代碼示例>>Python>>正文


Python VirtualDisk.target方法代碼示例

本文整理匯總了Python中virtinst.VirtualDisk.target方法的典型用法代碼示例。如果您正苦於以下問題:Python VirtualDisk.target方法的具體用法?Python VirtualDisk.target怎麽用?Python VirtualDisk.target使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在virtinst.VirtualDisk的用法示例。


在下文中一共展示了VirtualDisk.target方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _make_disks

# 需要導入模塊: from virtinst import VirtualDisk [as 別名]
# 或者: from virtinst.VirtualDisk import target [as 別名]
    def _make_disks(self):
        for drive in self.boot_caps.drives:
            path = self.image.abspath(drive.disk.file)
            size = None
            if drive.disk.size is not None:
                size = float(drive.disk.size) / 1024

            # FIXME: This is awkward; the image should be able to express
            # whether the disk is expected to be there or not independently
            # of its classification, especially for user disks
            # FIXME: We ignore the target for the mapping in m.target
            if (drive.disk.use == Disk.USE_SYSTEM and
                not os.path.exists(path)):
                raise RuntimeError(_("System disk %s does not exist") % path)

            device = VirtualDisk.DEVICE_DISK
            if drive.disk.format == Disk.FORMAT_ISO:
                device = VirtualDisk.DEVICE_CDROM

            disk = VirtualDisk(self.conn)
            disk.path = path
            disk.device = device
            disk.target = drive.target

            disk.set_create_storage(size=size, fmt=drive.disk.format)
            disk.validate()
            self.install_devices.append(disk)
開發者ID:aurex-linux,項目名稱:virt-manager,代碼行數:29,代碼來源:virtimage.py

示例2: testManyVirtio

# 需要導入模塊: from virtinst import VirtualDisk [as 別名]
# 或者: from virtinst.VirtualDisk import target [as 別名]
    def testManyVirtio(self):
        d = VirtualDisk(conn=utils.get_conn(), bus="virtio",
                        path="/default-pool/testvol1.img")

        targetlist = []
        for ignore in range(0, (26 * 2) + 1):
            d.target = None
            d.generate_target(targetlist)
            targetlist.append(d.target)

        self.assertEquals("vdaa", targetlist[26])
        self.assertEquals("vdba", targetlist[26 * 2])
開發者ID:aliceinwire,項目名稱:virt-manager,代碼行數:14,代碼來源:xmlconfig.py


注:本文中的virtinst.VirtualDisk.target方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。