本文整理汇总了Python中virtinst.VirtualDisk.get_parent_pool方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualDisk.get_parent_pool方法的具体用法?Python VirtualDisk.get_parent_pool怎么用?Python VirtualDisk.get_parent_pool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类virtinst.VirtualDisk
的用法示例。
在下文中一共展示了VirtualDisk.get_parent_pool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_guest
# 需要导入模块: from virtinst import VirtualDisk [as 别名]
# 或者: from virtinst.VirtualDisk import get_parent_pool [as 别名]
def _make_guest(installer=None, conn=None):
if conn is None:
conn = _default_conn
g = virtinst.Guest(conn)
g.type = "kvm"
g.name = "TestGuest"
g.memory = int(200 * 1024)
g.maxmemory = int(400 * 1024)
g.uuid = "12345678-1234-1234-1234-123456789012"
gdev = virtinst.VirtualGraphics(conn)
gdev.type = "vnc"
gdev.keymap = "ja"
g.add_device(gdev)
g.features.pae = False
g.vcpus = 5
if not installer:
installer = _make_installer(conn=conn)
g.installer = installer
g.emulator = "/usr/lib/xen/bin/qemu-dm"
g.os.arch = "i686"
g.os.os_type = "hvm"
g.add_default_input_device()
g.add_default_console_device()
g.add_device(virtinst.VirtualAudio(g.conn))
# Floppy disk
path = "/dev/default-pool/testvol1.img"
d = VirtualDisk(conn)
d.path = path
d.device = d.DEVICE_FLOPPY
d.validate()
g.add_device(d)
# File disk
path = "/dev/default-pool/new-test-suite.img"
d = virtinst.VirtualDisk(conn)
d.path = path
if d.wants_storage_creation():
parent_pool = d.get_parent_pool()
vol_install = virtinst.VirtualDisk.build_vol_install(conn,
os.path.basename(path), parent_pool, .0000001, True)
d.set_vol_install(vol_install)
d.validate()
g.add_device(d)
# Block disk
path = "/dev/disk-pool/diskvol1"
d = virtinst.VirtualDisk(conn)
d.path = path
d.validate()
g.add_device(d)
# Network device
dev = virtinst.VirtualNetworkInterface(conn)
dev.macaddr = "22:22:33:44:55:66"
dev.type = virtinst.VirtualNetworkInterface.TYPE_VIRTUAL
dev.source = "default"
g.add_device(dev)
return g