block: add block_resize monitor command
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Jan 2011 12:32:33 +0000 (13:32 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 31 Jan 2011 09:03:00 +0000 (10:03 +0100)
commit8f12799d10cf521847ba024da22f54845f984820
tree6be8245970b9b4b505bfc2b9cc5cb260dfd85834
parent817223efee106c6a49fcc589378c9258dc3403df
block: add block_resize monitor command

Add a monitor command that allows resizing of block devices while
qemu is running.  It uses the existing bdrv_truncate method already
used by qemu-img to do it's work.  Compared to qemu-img the size
parsing is very simplicistic, but I think having a properly numering
object is more useful for non-humand monitor users than having
the units and relative resize parsing.

For SCSI devices the new size can be updated in Linux guests by
doing the following shell command:

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

For ATA devices I don't know of a way to update the block device
size in Linux system, and for virtio-blk the next two patches
will provide an automatic update of the size when this command
is issued on the host.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c
blockdev.h
hmp-commands.hx
qmp-commands.hx