monitor: Use traditional command interface for HMP drive_del
All QMP commands use the "new" handler interface (mhandler.cmd_new). Most HMP commands still use the traditional interface (mhandler.cmd), but a few use the "new" one. Complicates handle_user_command() for no gain, so I'm converting these to the traditional interface. For drive_del, that's easy: hmp_drive_del() sheds its unused last parameter, and its return value, which the caller ignored anyway. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
b8a185bc9a
commit
072ebe6b03
@ -2113,7 +2113,7 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
|
|||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
void hmp_drive_del(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
const char *id = qdict_get_str(qdict, "id");
|
const char *id = qdict_get_str(qdict, "id");
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
@ -2124,14 +2124,14 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||||||
blk = blk_by_name(id);
|
blk = blk_by_name(id);
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_report("Device '%s' not found", id);
|
error_report("Device '%s' not found", id);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
bs = blk_bs(blk);
|
bs = blk_bs(blk);
|
||||||
|
|
||||||
if (!blk_legacy_dinfo(blk)) {
|
if (!blk_legacy_dinfo(blk)) {
|
||||||
error_report("Deleting device added with blockdev-add"
|
error_report("Deleting device added with blockdev-add"
|
||||||
" is not supported");
|
" is not supported");
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aio_context = bdrv_get_aio_context(bs);
|
aio_context = bdrv_get_aio_context(bs);
|
||||||
@ -2140,7 +2140,7 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) {
|
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, &local_err)) {
|
||||||
error_report_err(local_err);
|
error_report_err(local_err);
|
||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* quiesce block driver; prevent further io */
|
/* quiesce block driver; prevent further io */
|
||||||
@ -2163,7 +2163,6 @@ int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
aio_context_release(aio_context);
|
aio_context_release(aio_context);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qmp_block_resize(bool has_device, const char *device,
|
void qmp_block_resize(bool has_device, const char *device,
|
||||||
|
@ -178,8 +178,7 @@ ETEXI
|
|||||||
.args_type = "id:B",
|
.args_type = "id:B",
|
||||||
.params = "device",
|
.params = "device",
|
||||||
.help = "remove host block device",
|
.help = "remove host block device",
|
||||||
.user_print = monitor_user_noop,
|
.mhandler.cmd = hmp_drive_del,
|
||||||
.mhandler.cmd_new = hmp_drive_del,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
STEXI
|
STEXI
|
||||||
|
@ -66,5 +66,5 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
|
|||||||
void qmp_change_blockdev(const char *device, const char *filename,
|
void qmp_change_blockdev(const char *device, const char *filename,
|
||||||
const char *format, Error **errp);
|
const char *format, Error **errp);
|
||||||
void hmp_commit(Monitor *mon, const QDict *qdict);
|
void hmp_commit(Monitor *mon, const QDict *qdict);
|
||||||
int hmp_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
|
void hmp_drive_del(Monitor *mon, const QDict *qdict);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user