本文整理匯總了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)
示例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])