summary refs log tree commit diff stats
path: root/hmp-commands.hx
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-01-24 13:32:33 +0100
committerKevin Wolf <kwolf@redhat.com>2011-01-31 10:03:00 +0100
commit6d4a2b3a47959f02e7f307f50396e70e8464f95e (patch)
tree6be8245970b9b4b505bfc2b9cc5cb260dfd85834 /hmp-commands.hx
parent2be22ca5a8dd96c68ef0e90fd916aa6555ae915b (diff)
downloadfocaccia-qemu-6d4a2b3a47959f02e7f307f50396e70e8464f95e.tar.gz
focaccia-qemu-6d4a2b3a47959f02e7f307f50396e70e8464f95e.zip
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>
Diffstat (limited to 'hmp-commands.hx')
-rw-r--r--hmp-commands.hx19
1 files changed, 19 insertions, 0 deletions
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 1cea572b15..8df4adf831 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -53,6 +53,25 @@ Quit the emulator.
 ETEXI
 
     {
+        .name       = "block_resize",
+        .args_type  = "device:B,size:o",
+        .params     = "device size",
+        .help       = "resize a block image",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_block_resize,
+    },
+
+STEXI
+@item block_resize
+@findex block_resize
+Resize a block image while a guest is running.  Usually requires guest
+action to see the updated size.  Resize to a lower size is supported,
+but should be used with extreme caution.  Note that this command only
+resizes image files, it can not resize block devices like LVM volumes.
+ETEXI
+
+
+    {
         .name       = "eject",
         .args_type  = "force:-f,device:B",
         .params     = "[-f] device",