[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command |
Date: |
Tue, 10 Nov 2015 15:09:13 +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-block] [PULL v2 01/40] block: Don't call blk_bs() twice in bdrv_lookup_bs(), (continued)
- [Qemu-block] [PULL v2 01/40] block: Don't call blk_bs() twice in bdrv_lookup_bs(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 04/40] block: Add functions for inheriting a BBRS, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 05/40] blockdev: Add blockdev-open-tray, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 06/40] blockdev: Add blockdev-close-tray, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 09/40] blockdev: Implement eject with basic operations, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 08/40] blockdev: Add blockdev-insert-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 07/40] blockdev: Add blockdev-remove-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 11/40] block: Inquire tray state before tray-moved events, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 10/40] blockdev: Implement change with basic operations, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 12/40] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 13/40] hmp: Use blockdev-change-medium for change command,
Kevin Wolf <=
- [Qemu-block] [PULL v2 15/40] hmp: Add read-only-mode option to change command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 14/40] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 17/40] block: check for existing device IDs in external_snapshot_prepare(), Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 18/40] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 19/40] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 16/40] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 20/40] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 21/40] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 22/40] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/10
- [Qemu-block] [PULL v2 23/40] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/10