<source> as child element of <disk>

Specifies the host view of a device configuration.

Text content

None.

Selected attributes

dev
Must be specified for disk type="block". Specifies a host device node of the block device.
file
Must be specified for disk type="file". Specifies the fully qualified host file name.
pool
Must be specified for disk type="volume". Specifies the name of the defined pool.
volume
Must be specified for disk type="volume". Specifies the name of the defined volume, which must be part of the specified pool.
startupPolicy=mandatory | requisite | optional
For disk type file that represents a CD or diskette, you may define a policy what to do with the disk if the source file is not accessible:
mandatory
fail if missing for any reason
requisite
fail if missing on boot up, drop if missing on migrate/restore/revert
optional
drop if missing at any start attempt

Usage

Parent elements

<disk>

Child elements

<seclabel>

Examples

  • This example configures a SCSI disk as virtual block device:
    <disk type="block" device="disk">
        <driver name="qemu" type="raw" cache="none" io="native" iothread="1"/>
        <source dev="/dev/mapper/36005076305ffc1ae00000000000021d5"/>
        <target dev="vdb" bus="virtio"/>
    </disk>
  • This example configures an NVMe device as virtual block device:
    <disk type="block" device="disk">
        <driver name="qemu" type="raw" cache="none" io="native" iothread="1"/>
        <source dev="/dev/disk/by-path/pci-1003:00:00.0-nvme-1"/>
        <target dev="vdc" bus="virtio"/>
    </disk>
  • This example configures a file as virtual block device:
    <disk type="file" device="disk">
        <driver name="qemu" type="raw" cache="none" io="native"/>
        <source file="/var/lib/libvirt/images/disk.img"/>
        <target dev="vda1" bus="virtio"/>
    </disk>
  • This example configures a storage pool as virtual block device:
    <disk type="volume" device="disk">
        <driver name="qemu" type="raw" io="native" cache="none"/>
        <source pool="blk-pool0" volume="blk-pool0-vol0"/>
        <target dev="vdb" bus="virtio"/>
        <address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0009"/>
    </disk>