[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/37] hmp: Use blockdev-change-medium for change com
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 13/37] hmp: Use blockdev-change-medium for change command |
Date: |
Thu, 5 Nov 2015 19:17:41 +0100 |
From: Max Reitz <address@hidden>
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>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hmp.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/hmp.c b/hmp.c
index a15d00c..5e5358f 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1338,22 +1338,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);
}
--
1.8.3.1
- [Qemu-devel] [PULL 02/37] block: Add blk_remove_bs(), (continued)
- [Qemu-devel] [PULL 02/37] block: Add blk_remove_bs(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 01/37] block: Don't call blk_bs() twice in bdrv_lookup_bs(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 03/37] block: Make bdrv_states public, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 05/37] blockdev: Add blockdev-open-tray, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 06/37] blockdev: Add blockdev-close-tray, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 07/37] blockdev: Add blockdev-remove-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 08/37] blockdev: Add blockdev-insert-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 04/37] block: Add functions for inheriting a BBRS, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 11/37] block: Inquire tray state before tray-moved events, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 09/37] blockdev: Implement eject with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 13/37] hmp: Use blockdev-change-medium for change command,
Kevin Wolf <=
- [Qemu-devel] [PULL 15/37] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 10/37] blockdev: Implement change with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 14/37] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 19/37] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 12/37] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 17/37] block: check for existing device IDs in external_snapshot_prepare(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 18/37] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 22/37] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 21/37] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 26/37] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/05