Re: [PATCH] block: add more commands to preconfig mode
On Tue, May 11, 2021 at 11:39:49AM -0400, Paolo Bonzini wrote: > Most block device commands do not require a fully constructed machine. > Allow running them before machine initialization has concluded. > > Signed-off-by: Paolo Bonzini > --- > hmp-commands.hx| 14 + > qapi/block-core.json | 117 +++-- > qapi/block-export.json | 21 +--- > qapi/block.json| 6 ++- > 4 files changed, 110 insertions(+), 48 deletions(-) Reviewed-by: Daniel P. Berrangé Regards, Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|
Re: [PATCH] block: add more commands to preconfig mode
On 11/05/21 17:39, Paolo Bonzini wrote: Most block device commands do not require a fully constructed machine. Allow running them before machine initialization has concluded. Signed-off-by: Paolo Bonzini --- hmp-commands.hx| 14 + qapi/block-core.json | 117 +++-- qapi/block-export.json | 21 +--- qapi/block.json| 6 ++- 4 files changed, 110 insertions(+), 48 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 146a13c896..901a50ebd1 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -78,6 +78,7 @@ ERST .help = "resize a block image", .cmd= hmp_block_resize, .coroutine = true, +.flags = "p", }, SRST @@ -94,6 +95,7 @@ ERST .params = "device [speed [base]]", .help = "copy data from a backing file into a block device", .cmd= hmp_block_stream, +.flags = "p", }, SRST @@ -107,6 +109,7 @@ ERST .params = "device speed", .help = "set maximum speed for a background block operation", .cmd= hmp_block_job_set_speed, +.flags = "p", }, SRST @@ -122,6 +125,7 @@ ERST "\n\t\t\t if you want to abort the operation immediately" "\n\t\t\t instead of keep running until data is in sync)", .cmd= hmp_block_job_cancel, +.flags = "p", }, SRST @@ -135,6 +139,7 @@ ERST .params = "device", .help = "stop an active background block operation", .cmd= hmp_block_job_complete, +.flags = "p", }, SRST @@ -149,6 +154,7 @@ ERST .params = "device", .help = "pause an active background block operation", .cmd= hmp_block_job_pause, +.flags = "p", }, SRST @@ -162,6 +168,7 @@ ERST .params = "device", .help = "resume a paused background block operation", .cmd= hmp_block_job_resume, +.flags = "p", }, SRST @@ -1396,6 +1403,7 @@ ERST .params = "nbd_server_start [-a] [-w] host:port", .help = "serve block devices on the given host and port", .cmd= hmp_nbd_server_start, +.flags = "p", }, SRST ``nbd_server_start`` *host*:*port* @@ -1411,6 +1419,7 @@ ERST .params = "nbd_server_add [-w] device [name]", .help = "export a block device via NBD", .cmd= hmp_nbd_server_add, +.flags = "p", }, SRST ``nbd_server_add`` *device* [ *name* ] @@ -1426,6 +1435,7 @@ ERST .params = "nbd_server_remove [-f] name", .help = "remove an export previously exposed via NBD", .cmd= hmp_nbd_server_remove, +.flags = "p", }, SRST ``nbd_server_remove [-f]`` *name* @@ -1442,6 +1452,7 @@ ERST .params = "nbd_server_stop", .help = "stop serving block devices using the NBD protocol", .cmd= hmp_nbd_server_stop, +.flags = "p", }, SRST ``nbd_server_stop`` @@ -1471,6 +1482,7 @@ ERST .params = "getfd name", .help = "receive a file descriptor via SCM rights and assign it a name", .cmd= hmp_getfd, +.flags = "p", }, SRST @@ -1486,6 +1498,7 @@ ERST .params = "closefd name", .help = "close a file descriptor previously passed via SCM rights", .cmd= hmp_closefd, +.flags = "p", }, SRST @@ -1501,6 +1514,7 @@ ERST .params = "device bps bps_rd bps_wr iops iops_rd iops_wr", .help = "change I/O throttle limits for a block drive", .cmd= hmp_block_set_io_throttle, +.flags = "p", }, SRST diff --git a/qapi/block-core.json b/qapi/block-core.json index 6d227924d0..8bbc06ac86 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -680,7 +680,8 @@ #} # ## -{ 'command': 'query-block', 'returns': ['BlockInfo'] } +{ 'command': 'query-block', 'returns': ['BlockInfo'], + 'allow-preconfig': true } ## @@ -1056,7 +1057,8 @@ ## { 'command': 'query-blockstats', 'data': { '*query-nodes': 'bool' }, - 'returns': ['BlockStats'] } + 'returns': ['BlockStats'], + 'allow-preconfig': true } ## # @BlockdevOnError: @@ -1205,7 +1207,8 @@ # # Since: 1.1 ## -{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] } +{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'], + 'allow-preconfig': true } ## # @block_resize: @@ -1236,7 +1239,8 @@ 'data': { '*device': 'str', '*node-name': 'str', 'size': 'int' }, - 'coroutine': true } +
[PATCH] block: add more commands to preconfig mode
Most block device commands do not require a fully constructed machine. Allow running them before machine initialization has concluded. Signed-off-by: Paolo Bonzini --- hmp-commands.hx| 14 + qapi/block-core.json | 117 +++-- qapi/block-export.json | 21 +--- qapi/block.json| 6 ++- 4 files changed, 110 insertions(+), 48 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 146a13c896..901a50ebd1 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -78,6 +78,7 @@ ERST .help = "resize a block image", .cmd= hmp_block_resize, .coroutine = true, +.flags = "p", }, SRST @@ -94,6 +95,7 @@ ERST .params = "device [speed [base]]", .help = "copy data from a backing file into a block device", .cmd= hmp_block_stream, +.flags = "p", }, SRST @@ -107,6 +109,7 @@ ERST .params = "device speed", .help = "set maximum speed for a background block operation", .cmd= hmp_block_job_set_speed, +.flags = "p", }, SRST @@ -122,6 +125,7 @@ ERST "\n\t\t\t if you want to abort the operation immediately" "\n\t\t\t instead of keep running until data is in sync)", .cmd= hmp_block_job_cancel, +.flags = "p", }, SRST @@ -135,6 +139,7 @@ ERST .params = "device", .help = "stop an active background block operation", .cmd= hmp_block_job_complete, +.flags = "p", }, SRST @@ -149,6 +154,7 @@ ERST .params = "device", .help = "pause an active background block operation", .cmd= hmp_block_job_pause, +.flags = "p", }, SRST @@ -162,6 +168,7 @@ ERST .params = "device", .help = "resume a paused background block operation", .cmd= hmp_block_job_resume, +.flags = "p", }, SRST @@ -1396,6 +1403,7 @@ ERST .params = "nbd_server_start [-a] [-w] host:port", .help = "serve block devices on the given host and port", .cmd= hmp_nbd_server_start, +.flags = "p", }, SRST ``nbd_server_start`` *host*:*port* @@ -1411,6 +1419,7 @@ ERST .params = "nbd_server_add [-w] device [name]", .help = "export a block device via NBD", .cmd= hmp_nbd_server_add, +.flags = "p", }, SRST ``nbd_server_add`` *device* [ *name* ] @@ -1426,6 +1435,7 @@ ERST .params = "nbd_server_remove [-f] name", .help = "remove an export previously exposed via NBD", .cmd= hmp_nbd_server_remove, +.flags = "p", }, SRST ``nbd_server_remove [-f]`` *name* @@ -1442,6 +1452,7 @@ ERST .params = "nbd_server_stop", .help = "stop serving block devices using the NBD protocol", .cmd= hmp_nbd_server_stop, +.flags = "p", }, SRST ``nbd_server_stop`` @@ -1471,6 +1482,7 @@ ERST .params = "getfd name", .help = "receive a file descriptor via SCM rights and assign it a name", .cmd= hmp_getfd, +.flags = "p", }, SRST @@ -1486,6 +1498,7 @@ ERST .params = "closefd name", .help = "close a file descriptor previously passed via SCM rights", .cmd= hmp_closefd, +.flags = "p", }, SRST @@ -1501,6 +1514,7 @@ ERST .params = "device bps bps_rd bps_wr iops iops_rd iops_wr", .help = "change I/O throttle limits for a block drive", .cmd= hmp_block_set_io_throttle, +.flags = "p", }, SRST diff --git a/qapi/block-core.json b/qapi/block-core.json index 6d227924d0..8bbc06ac86 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -680,7 +680,8 @@ #} # ## -{ 'command': 'query-block', 'returns': ['BlockInfo'] } +{ 'command': 'query-block', 'returns': ['BlockInfo'], + 'allow-preconfig': true } ## @@ -1056,7 +1057,8 @@ ## { 'command': 'query-blockstats', 'data': { '*query-nodes': 'bool' }, - 'returns': ['BlockStats'] } + 'returns': ['BlockStats'], + 'allow-preconfig': true } ## # @BlockdevOnError: @@ -1205,7 +1207,8 @@ # # Since: 1.1 ## -{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] } +{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'], + 'allow-preconfig': true } ## # @block_resize: @@ -1236,7 +1239,8 @@ 'data': { '*device': 'str', '*node-name': 'str', 'size': 'int' }, - 'coroutine': true } + 'coroutine': true, + 'allow-preconfig': true } ## # @NewImageMode: @@ -1447,7 +1451,8 @@ # ## { 'command': 'blockdev-snapshot-sync', - 'data': 'BlockdevSnapshotSync'