[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic blo
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change |
Date: |
Mon, 4 Jul 2011 13:29:13 +0100 |
On Mon, Jul 4, 2011 at 11:43 AM, Supriya Kannery
<address@hidden> wrote:
> +/*
> + * Handle changes to block device settings, like hostcache,
> + * while guest is running.
> +*/
> +int do_block_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
> +{
> + const char *device = qdict_get_str(qdict, "device");
> + const char *name = qdict_get_str(qdict, "name");
> + int enable = qdict_get_bool(qdict, "enable");
> + BlockDriverState *bs;
> +
> + bs = bdrv_find(device);
> + if (!bs) {
> + qerror_report(QERR_DEVICE_NOT_FOUND, device);
> + return -1;
> + }
> +
> + if (!strcmp(name, "hostcache")) {
> + return bdrv_change_hostcache(bs, enable);
> + }
> +
> + return 0;
No error for unknown "name" argument?
> #endif
> Index: qemu/hmp-commands.hx
> ===================================================================
> --- qemu.orig/hmp-commands.hx
> +++ qemu/hmp-commands.hx
> @@ -70,6 +70,21 @@ but should be used with extreme caution.
> resizes image files, it can not resize block devices like LVM volumes.
> ETEXI
>
> + {
> + .name = "block_set",
> + .args_type = "device:B,name:s,enable:b",
> + .params = "device name enable",
> + .help = "On/Off block device parameters like hostcache",
> + .user_print = monitor_user_noop,
> + .mhandler.cmd_new = do_block_set,
> + },
> +
> +STEXI
> address@hidden block_set
> address@hidden block_set
> +Change block device params (eg:"hostcache"=on/off) while guest is running.
> +ETEXI
See QMP comments below.
> +
>
> {
> .name = "eject",
> Index: qemu/qmp-commands.hx
> ===================================================================
> --- qemu.orig/qmp-commands.hx
> +++ qemu/qmp-commands.hx
> @@ -694,6 +694,34 @@ Example:
> EQMP
>
> {
> + .name = "block_set",
> + .args_type = "device:B,name:s,enable:b",
> + .params = "device name enable",
Perhaps:
.args_type = "device:B,name:s,enable:b?",
.params = "device name [enable]",
But I am not sure what the best way to express this is.
> + .help = "Enable/Disable block device params like hostcache",
Arguments (like "enable") should depend on the block parameter that is
being set:
.help = "Set block device parameter"
If there is no good way to support different optional arguments and
types then a json-string "value" argument would be best.
> + .user_print = monitor_user_noop,
> + .mhandler.cmd_new = do_block_set,
> + },
> +
> +SQMP
> +block_set
> +---------
> +
> +Change various block device parameters like hostcache.
> +
> +Arguments:
> +
> +- "device": the device's ID, must be unique (json-string)
> +- "name": name of the parameter to be changed" (json-string)
Trailing '"'.
> +- "enable": value to be set for the parameter, 'true' or 'false' (json-bool)
The relevant arguments depend on which block parameter you are
changing. I think "enable" should be documented specifically for
"hostcache":
Block parameters:
- "hostcache": Enable/disable host buffer cache
- "enable": 'true' or 'false' (json-bool)
Stefan
- [Qemu-devel] [V4 Patch 0/4]Qemu: Hostcache setting from cmdline and monitor, Supriya Kannery, 2011/07/04
- [Qemu-devel] [V4 Patch 2/4]Qemu: Error classes for file reopen and data sync failure, Supriya Kannery, 2011/07/04
- [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/04
- Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/05
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/13
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/20
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Stefan Hajnoczi, 2011/07/25
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/25
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Stefan Hajnoczi, 2011/07/25
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Kevin Wolf, 2011/07/25
- Re: [Qemu-devel] [V4 Patch 3/4 - Updated]Qemu: Command "block_set" for dynamic block params change, Supriya Kannery, 2011/07/26
Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change, Stefan Hajnoczi, 2011/07/04
[Qemu-devel] [V4 Patch 4/4]Qemu: Add commandline -drive option 'hostcache', Supriya Kannery, 2011/07/04