当前位置: 首页>>代码示例>>Python>>正文


Python VirtualDisk.device方法代码示例

本文整理汇总了Python中virtinst.VirtualDisk.device方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualDisk.device方法的具体用法?Python VirtualDisk.device怎么用?Python VirtualDisk.device使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在virtinst.VirtualDisk的用法示例。


在下文中一共展示了VirtualDisk.device方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testManyDisks2

# 需要导入模块: from virtinst import VirtualDisk [as 别名]
# 或者: from virtinst.VirtualDisk import device [as 别名]
    def testManyDisks2(self):
        i = utils.make_pxe_installer()
        g = utils.get_basic_fullyvirt_guest(installer=i)

        g.add_device(utils.get_filedisk())
        g.add_device(utils.get_blkdisk())

        d = VirtualDisk(g.conn)
        d.path = "/dev/loop0"
        d.device = d.DEVICE_CDROM
        d.driver_type = "raw"
        d.validate()
        g.add_device(d)

        d = VirtualDisk(g.conn)
        d.path = "/dev/loop0"
        d.device = d.DEVICE_DISK
        d.driver_name = "qemu"
        d.validate()
        g.add_device(d)

        d = VirtualDisk(g.conn)
        d.path = None
        d.device = d.DEVICE_CDROM
        d.bus = "scsi"
        d.validate()
        g.add_device(d)

        d = VirtualDisk(g.conn)
        d.path = None
        d.device = d.DEVICE_FLOPPY
        d.iotune_tbs = 1
        d.iotune_tis = 2
        d.validate()
        g.add_device(d)

        d = VirtualDisk(g.conn)
        d.path = "/dev/loop0"
        d.device = d.DEVICE_FLOPPY
        d.driver_name = "phy"
        d.driver_cache = "none"
        d.iotune_rbs = 5555
        d.iotune_ris = 1234
        d.iotune_wbs = 3
        d.iotune_wis = 4
        d.validate()
        g.add_device(d)

        d = VirtualDisk(g.conn)
        d.path = "/dev/loop0"
        d.bus = "virtio"
        d.driver_name = "qemu"
        d.driver_type = "qcow2"
        d.driver_cache = "none"
        d.driver_io = "threads"
        d.validate()
        g.add_device(d)

        self._compare(g, "boot-many-disks2", False)
开发者ID:TelekomCloud,项目名称:virt-manager,代码行数:61,代码来源:xmlconfig.py

示例2: _make_disks

# 需要导入模块: from virtinst import VirtualDisk [as 别名]
# 或者: from virtinst.VirtualDisk import device [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

示例3: get_floppy

# 需要导入模块: from virtinst import VirtualDisk [as 别名]
# 或者: from virtinst.VirtualDisk import device [as 别名]
def get_floppy(path=None):
    if not path:
        path = "/dev/default-pool/testvol1.img"
    d = VirtualDisk(_conn)
    d.path = path
    d.device = d.DEVICE_FLOPPY
    d.validate()
    return d
开发者ID:DanLipsitt,项目名称:virt-manager,代码行数:10,代码来源:utils.py

示例4: _make_guest

# 需要导入模块: from virtinst import VirtualDisk [as 别名]
# 或者: from virtinst.VirtualDisk import device [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
开发者ID:aenertia,项目名称:virt-manager,代码行数:67,代码来源:xmlconfig.py


注:本文中的virtinst.VirtualDisk.device方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。