Typically, you provide an image file as storage device when you intend to boot the virtual server
from a boot image file.
Before you begin
Make sure that the image file exists, is
initialized and accessible for the virtual server. You can
provide raw image files or qcow2 image files. qcow2 image files occupy only the amount of storage
that is really in use.
Use the QEMU command qemu-img create to create a qcow2 image file. See QEMU image command for examples.
Procedure
-
Configure the image file.
-
Configure the image file as virtual
disk.
|
raw image file: |
qcow2 image file: |
| disk type attribute: |
file |
file |
| disk device attribute: |
disk |
disk |
(see
<disk>)
-
Specify the user space process that implements the device.
|
raw image file: |
qcow2 image file: |
| driver name attribute: |
qemu |
qemu |
| driver io attribute: |
native |
native |
| driver type attribute: |
raw |
qcow2 |
| driver cache attribute: |
<cache-mode> |
<cache-mode> |
(see
<driver> as child element of <disk>)
Where
<cache-mode> determines the QEMU caching strategy.
Tip: For most configurations, the "none" value is appropriate.
- For guests that are to run in IBM® Secure Execution
mode
and cannot use the launchSecurity element in the virtual server configuration, ensure that the device uses the
guest's bounce buffer, see Preparing the virtual server.
-
Specify virtio as the virtual server disk device
type.
-
Identify the image file on the host.
Specify the image file name.
- Identify the device on the virtual server.
- Specify a unique logical device name.
Logical
device names are of the form vd<x>, where <x> can
be one or more letters. Do not confuse the logical device name with
the standard device name. The standard device name is assigned to
the device on the virtual server in
the order the device is detected. It is not persistent across guest reboots.
- Optional: Specify a device number.
You
specify a device bus-ID of the form
fe.n.dddd
where
n is
the subchannel set-ID and
dddd is the device number.
The channel subsystem-ID
0xfe is reserved to the
virtual channel.
The virtual server sees the channel
subsystem-ID 0x0 instead.
Example: KVM host device
bus-ID fe.0.0009 is seen by the virtual server as device bus-ID 0.0.0009.
If
you do not specify a device number, a device bus-ID is automatically
generated by using the first available device bus-ID starting with
subchannel set-ID 0x0 and device number 0x0000.
Example
This example configures the image file
/var/lib/libvirt/images/disk.img as storage device. This image
might as well be the volume of a storage pool.
<disk type="file" device="disk">
<driver name="qemu" type="raw" io="native" cache="none"/>
<source file="/var/lib/libvirt/images/disk.img"/>
<target dev="vdb" bus="virtio"/>
<address type="ccw" cssid="0xfe" ssid="0x0" devno="0x0009"/>
</disk>