diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2025-02-04 22:13:58 +0100 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2025-02-06 14:26:51 +0100 |
| commit | faecd16fe5c65a25b5b55b5edbe4322cec5a9d96 (patch) | |
| tree | 9b1dd4b5b9df09206ec2cfec167b8e760abfcfc4 /block.c | |
| parent | 8c2c72a33581987af8d8c484d03af3cd69b9e10a (diff) | |
| download | focaccia-qemu-faecd16fe5c65a25b5b55b5edbe4322cec5a9d96.tar.gz focaccia-qemu-faecd16fe5c65a25b5b55b5edbe4322cec5a9d96.zip | |
block: Add option to create inactive nodes
In QEMU, nodes are automatically created inactive while expecting an incoming migration (i.e. RUN_STATE_INMIGRATE). In qemu-storage-daemon, the notion of runstates doesn't exist. It also wouldn't necessarily make sense to introduce it because a single daemon can serve multiple VMs that can be in different states. Therefore, allow the user to explicitly open images as inactive with a new option. The default is as before: Nodes are usually active, except when created during RUN_STATE_INMIGRATE. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20250204211407.381505-8-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
| -rw-r--r-- | block.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/block.c b/block.c index 73d0de12cf..7f6eca392f 100644 --- a/block.c +++ b/block.c @@ -1573,6 +1573,10 @@ static void update_flags_from_options(int *flags, QemuOpts *opts) if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) { *flags |= BDRV_O_AUTO_RDONLY; } + + if (!qemu_opt_get_bool_del(opts, BDRV_OPT_ACTIVE, true)) { + *flags |= BDRV_O_INACTIVE; + } } static void update_options_from_flags(QDict *options, int flags) @@ -1800,6 +1804,11 @@ QemuOptsList bdrv_runtime_opts = { .help = "Ignore flush requests", }, { + .name = BDRV_OPT_ACTIVE, + .type = QEMU_OPT_BOOL, + .help = "Node is activated", + }, + { .name = BDRV_OPT_READ_ONLY, .type = QEMU_OPT_BOOL, .help = "Node is opened in read-only mode", |