On Wed, Aug 31, 2011 at 09:31:58PM +0800, Osier Yang wrote:
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:
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.
Your API proprosal looks reasonable, but unfortunately the QEMU
command 'block_resize' is either broken, or incomplete since it
does not have a way to notify the guest that a block device has
been resized, independantly of actually resizing the host file.
This is required in order for guest disk resize to work on LVM,
SCSI, iSCSI, etc block devices, since QEMU cannot itself do a
resize of the block devices. The resize has to be done either
by libvirt using host commands, or by the SAN administrator on
the remote storage appliance.
IMHO, we should not commit to the libvirt API design, until we
can get confirmation from QEMU about whether they will fix the
block_resize command to work for block devices, or add a new
command for just notifying guests of external block device