[libvirt] [PATCH 0/6] Support online block resizing

Osier Yang jyang at redhat.com
Wed Aug 31 13:31:58 UTC 2011


Upstream QEMU introduced online block resizing to resize the
block device when domain is running since commit 6d4a2b3a4795.
It simply reuses existing "bdrv_truncate" method which is used
by "qemu-img" to resize the images. This means it supports to
resize all the format that "qemu-img resize" supports. E.g.
qcow2, raw, qed, qcow, etc. (NB, it doesn't support to shrink
size of qcow2 image, and QEMU reports "An undefined error
has ocurred" in this case).

For block device of virtio bus, the guest can update the device
size automatically, needs kernel support, since kernel-2.6.32-117:

  http://patchwork.usersys.redhat.com/patch/33040/

For block device of SCSI bus, one needs to execute command like
below in the guest (linux) to update the size:

  % echo > /sys/class/scsi_device/0:0:0:0/device/rescan

For block device of IDE bus, seems there is no way to let guest
update the size after resizing.

The new API is defined as:

    int virDomainBlockResize (virDomainPtr dom,
                              const char *device,
                              unsigned long long size,
                              unsigned int flags)

    * @device is the name of block device, E.g. vda, vdb.
    
    * Units for @size is KB.

[PATCH 1/6] block_resize: Define the new API
[PATCH 2/6] block_resize: Implemente the public API
[PATCH 3/6] block_resize: Wire up the remote protocol
[PATCH 4/6] block_resize: Implemente the qemu monitor functions
[PATCH 5/6] block_resize: Implemente the internal API for qemu
[PATCH 6/6] block_resize: Expose the new API in virsh

Regards,
Osier




More information about the libvir-list mailing list