[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 35/38] hmp: Use blockdev-change-medium for change
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v5 35/38] hmp: Use blockdev-change-medium for change command |
Date: |
Fri, 18 Sep 2015 17:23:10 +0200 |
Use separate code paths for the two overloaded functions of the 'change'
HMP command, and invoke the 'blockdev-change-medium' QMP command if used
on a block device (by calling qmp_blockdev_change_medium()).
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
hmp.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/hmp.c b/hmp.c
index 3f807b7..a753a0f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1317,22 +1317,25 @@ void hmp_change(Monitor *mon, const QDict *qdict)
const char *arg = qdict_get_try_str(qdict, "arg");
Error *err = NULL;
- if (strcmp(device, "vnc") == 0 &&
- (strcmp(target, "passwd") == 0 ||
- strcmp(target, "password") == 0)) {
- if (!arg) {
- monitor_read_password(mon, hmp_change_read_arg, NULL);
+ if (strcmp(device, "vnc") == 0) {
+ if (strcmp(target, "passwd") == 0 ||
+ strcmp(target, "password") == 0) {
+ if (!arg) {
+ monitor_read_password(mon, hmp_change_read_arg, NULL);
+ return;
+ }
+ }
+ qmp_change("vnc", target, !!arg, arg, &err);
+ } else {
+ qmp_blockdev_change_medium(device, target, !!arg, arg, &err);
+ if (err &&
+ error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {
+ error_free(err);
+ monitor_read_block_device_key(mon, device, NULL, NULL);
return;
}
}
- qmp_change(device, target, !!arg, arg, &err);
- if (err &&
- error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {
- error_free(err);
- monitor_read_block_device_key(mon, device, NULL, NULL);
- return;
- }
hmp_handle_error(mon, &err);
}
--
2.5.2
- [Qemu-devel] [PATCH v5 26/38] block: Add blk_remove_bs(), (continued)
- [Qemu-devel] [PATCH v5 26/38] block: Add blk_remove_bs(), Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 24/38] blockdev: Pull out blockdev option extraction, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 25/38] blockdev: Allow more options for BB-less BDS tree, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 27/38] blockdev: Add blockdev-open-tray, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 28/38] blockdev: Add blockdev-close-tray, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 29/38] blockdev: Add blockdev-remove-medium, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 31/38] blockdev: Implement eject with basic operations, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 32/38] blockdev: Implement change with basic operations, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 33/38] block: Inquire tray state before tray-moved events, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 30/38] blockdev: Add blockdev-insert-medium, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 35/38] hmp: Use blockdev-change-medium for change command,
Max Reitz <=
- [Qemu-devel] [PATCH v5 34/38] qmp: Introduce blockdev-change-medium, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 37/38] hmp: Add read-only-mode option to change command, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 38/38] iotests: Add test for change-related QMP commands, Max Reitz, 2015/09/18
- [Qemu-devel] [PATCH v5 36/38] blockdev: read-only-mode for blockdev-change-medium, Max Reitz, 2015/09/18
- Re: [Qemu-devel] [PATCH v5 00/38] blockdev: BlockBackend and media, Kevin Wolf, 2015/09/22