本文整理匯總了Python中virtinst.VirtualDisk.num_to_target方法的典型用法代碼示例。如果您正苦於以下問題:Python VirtualDisk.num_to_target方法的具體用法?Python VirtualDisk.num_to_target怎麽用?Python VirtualDisk.num_to_target使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類virtinst.VirtualDisk
的用法示例。
在下文中一共展示了VirtualDisk.num_to_target方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testDiskNumbers
# 需要導入模塊: from virtinst import VirtualDisk [as 別名]
# 或者: from virtinst.VirtualDisk import num_to_target [as 別名]
def testDiskNumbers(self):
self.assertEquals("a", VirtualDisk.num_to_target(1))
self.assertEquals("b", VirtualDisk.num_to_target(2))
self.assertEquals("z", VirtualDisk.num_to_target(26))
self.assertEquals("aa", VirtualDisk.num_to_target(27))
self.assertEquals("ab", VirtualDisk.num_to_target(28))
self.assertEquals("az", VirtualDisk.num_to_target(52))
self.assertEquals("ba", VirtualDisk.num_to_target(53))
self.assertEquals("zz", VirtualDisk.num_to_target(27 * 26))
self.assertEquals("aaa", VirtualDisk.num_to_target(27 * 26 + 1))
self.assertEquals(VirtualDisk.target_to_num("hda"), 0)
self.assertEquals(VirtualDisk.target_to_num("hdb"), 1)
self.assertEquals(VirtualDisk.target_to_num("sdz"), 25)
self.assertEquals(VirtualDisk.target_to_num("sdaa"), 26)
self.assertEquals(VirtualDisk.target_to_num("vdab"), 27)
self.assertEquals(VirtualDisk.target_to_num("vdaz"), 51)
self.assertEquals(VirtualDisk.target_to_num("xvdba"), 52)
self.assertEquals(VirtualDisk.target_to_num("xvdzz"), 26 * (25 + 1) + 25)
self.assertEquals(VirtualDisk.target_to_num("xvdaaa"), 26 * 26 * 1 + 26 * 1 + 0)
disk = virtinst.VirtualDisk(utils.get_conn())
disk.bus = "ide"
self.assertEquals("hda", disk.generate_target([]))
self.assertEquals("hdb", disk.generate_target(["hda"]))
self.assertEquals("hdc", disk.generate_target(["hdb", "sda"]))
self.assertEquals("hdb", disk.generate_target(["hda", "hdd"]))
disk.bus = "virtio-scsi"
self.assertEquals("sdb", disk.generate_target(["sda", "sdg", "sdi"], 0))
self.assertEquals("sdh", disk.generate_target(["sda", "sdg"], 1))
示例2: testDiskNumbers
# 需要導入模塊: from virtinst import VirtualDisk [as 別名]
# 或者: from virtinst.VirtualDisk import num_to_target [as 別名]
def testDiskNumbers(self):
self.assertEquals("a", VirtualDisk.num_to_target(1))
self.assertEquals("b", VirtualDisk.num_to_target(2))
self.assertEquals("z", VirtualDisk.num_to_target(26))
self.assertEquals("aa", VirtualDisk.num_to_target(27))
self.assertEquals("ab", VirtualDisk.num_to_target(28))
self.assertEquals("az", VirtualDisk.num_to_target(52))
self.assertEquals("ba", VirtualDisk.num_to_target(53))
self.assertEquals("zz", VirtualDisk.num_to_target(27 * 26))
self.assertEquals("aaa", VirtualDisk.num_to_target(27 * 26 + 1))
disk = virtinst.VirtualDisk(utils.get_conn())
disk.bus = "ide"
self.assertEquals("hda", disk.generate_target([]))
self.assertEquals("hdb", disk.generate_target(["hda"]))
self.assertEquals("hdc", disk.generate_target(["hdb", "sda"]))
self.assertEquals("hdb", disk.generate_target(["hda", "hdd"]))