Message ID | 20200608094030.670121-12-mlevitsk@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | LUKS: encryption slot management using amend interface | expand |
On Mon, Jun 08, 2020 at 12:40:27PM +0300, Maxim Levitsky wrote: > blockdev-amend will be used similiar to blockdev-create > to allow on the fly changes of the structure of the format based block devices. This one breaks the build: In file included from /home/kraxel/projects/qemu/include/block/throttle-groups.h:29, from /home/kraxel/projects/qemu/include/sysemu/block-backend.h:17, from /home/kraxel/projects/qemu/qemu-img.c:46: /home/kraxel/projects/qemu/include/block/block_int.h:154:39: error: unknown type name ‘BlockdevAmendOptions’; did you mean ‘BlockdevAioOptions’? BlockdevAmendOptions *opts, ^~~~~~~~~~~~~~~~~~~~ BlockdevAioOptions make: *** [/home/kraxel/projects/qemu/rules.mak:69: qemu-img.o] Error 1 take care, Gerd
On Wed, 2020-07-08 at 14:33 +0200, Gerd Hoffmann wrote: > On Mon, Jun 08, 2020 at 12:40:27PM +0300, Maxim Levitsky wrote: > > blockdev-amend will be used similiar to blockdev-create > > to allow on the fly changes of the structure of the format based block devices. > > This one breaks the build: > > In file included from /home/kraxel/projects/qemu/include/block/throttle-groups.h:29, > from /home/kraxel/projects/qemu/include/sysemu/block-backend.h:17, > from /home/kraxel/projects/qemu/qemu-img.c:46: > /home/kraxel/projects/qemu/include/block/block_int.h:154:39: error: unknown type name ‘BlockdevAmendOptions’; did you mean ‘BlockdevAioOptions’? > BlockdevAmendOptions *opts, > ^~~~~~~~~~~~~~~~~~~~ > BlockdevAioOptions > make: *** [/home/kraxel/projects/qemu/rules.mak:69: qemu-img.o] Error 1 > > take care, > Gerd > Apparently I didn't add #include of qapi-types-block-core.h in block_int.h (I'll fix this in a patch soon), but it looks like throttle-groups.h includes "qemu/throttle.h" which includes "qapi/qapi-types-block-core.h", so it should be included explicitly here. Could you share your configure.sh options? Best regards, Maxim Levitsky
On Wed, Jul 08, 2020 at 04:06:45PM +0300, Maxim Levitsky wrote: > On Wed, 2020-07-08 at 14:33 +0200, Gerd Hoffmann wrote: > > On Mon, Jun 08, 2020 at 12:40:27PM +0300, Maxim Levitsky wrote: > > > blockdev-amend will be used similiar to blockdev-create > > > to allow on the fly changes of the structure of the format based block devices. > > > > This one breaks the build: > > > > In file included from /home/kraxel/projects/qemu/include/block/throttle-groups.h:29, > > from /home/kraxel/projects/qemu/include/sysemu/block-backend.h:17, > > from /home/kraxel/projects/qemu/qemu-img.c:46: > > /home/kraxel/projects/qemu/include/block/block_int.h:154:39: error: unknown type name ‘BlockdevAmendOptions’; did you mean ‘BlockdevAioOptions’? > > BlockdevAmendOptions *opts, > > ^~~~~~~~~~~~~~~~~~~~ > > BlockdevAioOptions > > make: *** [/home/kraxel/projects/qemu/rules.mak:69: qemu-img.o] Error 1 > > > > take care, > > Gerd > > > > Apparently I didn't add #include of qapi-types-block-core.h in block_int.h (I'll fix this in a patch soon), > but it looks like throttle-groups.h includes "qemu/throttle.h" which includes "qapi/qapi-types-block-core.h", > so it should be included explicitly here. > > Could you share your configure.sh options? > > Best regards, > Maxim Levitsky ---------- config.status ---------- #!/bin/sh # Generated by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. unset AR unset AS unset CC unset CPP unset CXX unset INSTALL unset LD LD_LIBRARY_PATH='/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/rh-ruby25/root/usr/local/lib64:/opt/rh/rh-ruby25/root/usr/lib64:/opt/rh/httpd24/root/usr/lib64' export LD_LIBRARY_PATH unset LIBTOOL unset MAKE unset NM unset OBJCOPY PATH='/opt/rh/devtoolset-8/root/usr/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/opt/rh/rh-ruby25/root/usr/local/bin:/opt/rh/rh-ruby25/root/usr/bin:/opt/rh/rh-git218/root/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin/bz:/home/kraxel/bin:/home/kraxel/bin/bz:/home/kraxel/.local/bin' export PATH unset PKG_CONFIG unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH='/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig' export PKG_CONFIG_PATH unset PYTHON unset SDL2_CONFIG unset SMBD unset STRIP unset WINDRES exec '/home/kraxel/projects/qemu/build/default/../../configure' '--prefix=/home/kraxel' '--target-list= x86_64-softmmu aarch64-softmmu ppc64-softmmu sparc64-softmmu s390x-softmmu riscv64-softmmu ppc-softmmu arm-softmmu mips-softmmu x86_64-linux-user ppc64-linux-user' '--enable-debug' '--enable-modules' '--enable-sanitizers' "$@" ---------- config-host.h ---------- /* Automatically generated by create_config - do not modify */ #define CONFIG_QEMU_CONFDIR "/home/kraxel/etc/qemu" #define CONFIG_QEMU_DATADIR "/home/kraxel/share/qemu" #define CONFIG_QEMU_FIRMWAREPATH "/home/kraxel/share/qemu-firmware" #define CONFIG_QEMU_DOCDIR "/home/kraxel/share/doc/qemu" #define CONFIG_QEMU_MODDIR "/home/kraxel/lib/qemu" #define CONFIG_QEMU_LOCALSTATEDIR "/home/kraxel/var" #define CONFIG_QEMU_HELPERDIR "/home/kraxel/libexec" #define CONFIG_QEMU_LOCALEDIR "/home/kraxel/share/locale" #define CONFIG_QEMU_ICONDIR "/home/kraxel/share/icons" #define CONFIG_QEMU_DESKTOPDIR "/home/kraxel/share/applications" #define HOST_X86_64 1 #define CONFIG_MINIKCONF_MODE --defconfig #define CONFIG_DEBUG_TCG 1 #define CONFIG_POSIX 1 #define CONFIG_LINUX 1 #define CONFIG_TOOLS 1 #define CONFIG_SLIRP 1 #define CONFIG_SMBD_COMMAND "/usr/sbin/smbd" #define CONFIG_L2TPV3 1 #define CONFIG_LIBCAP_NG 1 #define CONFIG_AUDIO_DRIVERS \ "pa",\ "oss",\ #define CONFIG_AUDIO_PA m #define CONFIG_AUDIO_OSS m #define CONFIG_BDRV_RW_WHITELIST\ NULL #define CONFIG_BDRV_RO_WHITELIST\ NULL #define CONFIG_VNC 1 #define CONFIG_VNC_SASL 1 #define CONFIG_VNC_JPEG 1 #define CONFIG_VNC_PNG 1 #define QEMU_VERSION "5.0.50" #define QEMU_VERSION_MAJOR 5 #define QEMU_VERSION_MINOR 0 #define QEMU_VERSION_MICRO 50 #define CONFIG_STAMP _85ffce29f2848aafe2dd62142dd02ea2af85190f #define CONFIG_MODULES 1 #define CONFIG_X11 1 #define CONFIG_SDL m #define CONFIG_ICONV 1 #define CONFIG_CURSES m #define CONFIG_PIPE2 1 #define CONFIG_ACCEPT4 1 #define CONFIG_SPLICE 1 #define CONFIG_EVENTFD 1 #define CONFIG_USBFS 1 #define CONFIG_FALLOCATE 1 #define CONFIG_FALLOCATE_PUNCH_HOLE 1 #define CONFIG_FALLOCATE_ZERO_RANGE 1 #define CONFIG_POSIX_FALLOCATE 1 #define CONFIG_SYNC_FILE_RANGE 1 #define CONFIG_FIEMAP 1 #define CONFIG_DUP3 1 #define CONFIG_PPOLL 1 #define CONFIG_PRCTL_PR_SET_TIMERSLACK 1 #define CONFIG_EPOLL 1 #define CONFIG_EPOLL_CREATE1 1 #define CONFIG_SENDFILE 1 #define CONFIG_TIMERFD 1 #define CONFIG_SETNS 1 #define CONFIG_CLOCK_ADJTIME 1 #define CONFIG_SYNCFS 1 #define CONFIG_INOTIFY 1 #define CONFIG_INOTIFY1 1 #define CONFIG_SEM_TIMEDWAIT 1 #define HAVE_STRCHRNUL 1 #define HAVE_STRUCT_STAT_ST_ATIM 1 #define CONFIG_BYTESWAP_H 1 #define CONFIG_CURL m #define CONFIG_BRLAPI 1 #define CONFIG_GTK m #define CONFIG_GTK_GL 1 #define CONFIG_GIO 1 #define CONFIG_TLS_PRIORITY "NORMAL" #define CONFIG_GNUTLS 1 #define CONFIG_NETTLE 1 #define CONFIG_NETTLE_VERSION_MAJOR 2 #define CONFIG_QEMU_PRIVATE_XTS 1 #define CONFIG_TASN1 1 #define HAVE_IFADDRS_H 1 #define CONFIG_VTE 1 #define CONFIG_VIRGL 1 #define CONFIG_LINUX_AIO 1 #define CONFIG_ATTR 1 #define CONFIG_VIRTFS 1 #define CONFIG_MPATH 1 #define CONFIG_VHOST_SCSI 1 #define CONFIG_VHOST_NET 1 #define CONFIG_VHOST_NET_USER 1 #define CONFIG_VHOST_CRYPTO 1 #define CONFIG_VHOST_VSOCK 1 #define CONFIG_VHOST_USER_VSOCK 1 #define CONFIG_VHOST_KERNEL 1 #define CONFIG_VHOST_USER 1 #define CONFIG_VHOST_USER_FS 1 #define CONFIG_IOVEC 1 #define CONFIG_PREADV 1 #define CONFIG_FDT 1 #define CONFIG_SIGNALFD 1 #define CONFIG_TCG 1 #define CONFIG_FDATASYNC 1 #define CONFIG_MADVISE 1 #define CONFIG_POSIX_MADVISE 1 #define CONFIG_POSIX_MEMALIGN 1 #define CONFIG_SPICE 1 #define CONFIG_SMARTCARD 1 #define CONFIG_USB_LIBUSB 1 #define CONFIG_USB_REDIR 1 #define CONFIG_OPENGL 1 #define CONFIG_OPENGL_DMABUF 1 #define CONFIG_GBM 1 #define CONFIG_MALLOC_TRIM 1 #define CONFIG_AVX2_OPT 1 #define CONFIG_LZO 1 #define CONFIG_SNAPPY 1 #define CONFIG_BZIP2 1 #define CONFIG_LIBISCSI m #define CONFIG_SECCOMP 1 #define CONFIG_QOM_CAST_DEBUG 1 #define CONFIG_RBD m #define CONFIG_COROUTINE_BACKEND ucontext #define CONFIG_COROUTINE_POOL 1 #define CONFIG_OPEN_BY_HANDLE 1 #define CONFIG_LINUX_MAGIC_H 1 #define CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE 1 #define CONFIG_HAS_ENVIRON 1 #define CONFIG_CPUID_H 1 #define CONFIG_INT128 1 #define CONFIG_CMPXCHG128 1 #define CONFIG_ATOMIC64 1 #define CONFIG_ATTRIBUTE_ALIAS 1 #define CONFIG_GETAUXVAL 1 #define CONFIG_GLUSTERFS m #define CONFIG_GLUSTERFS_XLATOR_OPT 1 #define CONFIG_GLUSTERFS_DISCARD 1 #define CONFIG_GLUSTERFS_FALLOCATE 1 #define CONFIG_GLUSTERFS_ZEROFILL 1 #define CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT 1 #define CONFIG_GLUSTERFS_IOCB_HAS_STAT 1 #define CONFIG_LIVE_BLOCK_MIGRATION 1 #define CONFIG_TPM 1 #define CONFIG_TRACE_LOG 1 #define CONFIG_TRACE_FILE trace #define CONFIG_RDMA 1 #define CONFIG_PVRDMA 1 #define CONFIG_RTNETLINK 1 #define CONFIG_LIBXML2 1 #define CONFIG_REPLICATION 1 #define CONFIG_AF_VSOCK 1 #define CONFIG_SYSMACROS 1 #define CONFIG_STATIC_ASSERT 1 #define HAVE_UTMPX 1 #define CONFIG_IVSHMEM 1 #define CONFIG_CAPSTONE 1 #define CONFIG_DEBUG_MUTEX 1 #define CONFIG_THREAD_SETNAME_BYTHREAD 1 #define CONFIG_PTHREAD_SETNAME_NP_W_TID 1 #define CONFIG_BOCHS 1 #define CONFIG_CLOOP 1 #define CONFIG_DMG 1 #define CONFIG_QCOW1 1 #define CONFIG_VDI 1 #define CONFIG_VVFAT 1 #define CONFIG_QED 1 #define CONFIG_PARALLELS 1 #define CONFIG_SHEEPDOG 1 #define HAVE_GDB_BIN /opt/rh/devtoolset-8/root/usr/bin/gdb #define CONFIG_SECRET_KEYRING 1 #define CONFIG_TEST_SECRET_KEYRING 1 #define CONFIG_IASL iasl #define HOST_DSOSUF ".so" #define CONFIG_LIBUDEV 1 #define CONFIG_NUMA 1
On Wed, Jul 08, 2020 at 04:06:45PM +0300, Maxim Levitsky wrote: > On Wed, 2020-07-08 at 14:33 +0200, Gerd Hoffmann wrote: > > On Mon, Jun 08, 2020 at 12:40:27PM +0300, Maxim Levitsky wrote: > > > blockdev-amend will be used similiar to blockdev-create > > > to allow on the fly changes of the structure of the format based block devices. > > > > This one breaks the build: > > > > In file included from /home/kraxel/projects/qemu/include/block/throttle-groups.h:29, > > from /home/kraxel/projects/qemu/include/sysemu/block-backend.h:17, > > from /home/kraxel/projects/qemu/qemu-img.c:46: > > /home/kraxel/projects/qemu/include/block/block_int.h:154:39: error: unknown type name ‘BlockdevAmendOptions’; did you mean ‘BlockdevAioOptions’? > > BlockdevAmendOptions *opts, > > ^~~~~~~~~~~~~~~~~~~~ > > BlockdevAioOptions > > make: *** [/home/kraxel/projects/qemu/rules.mak:69: qemu-img.o] Error 1 > > > > take care, > > Gerd > > > > Apparently I didn't add #include of qapi-types-block-core.h in block_int.h (I'll fix this in a patch soon), > but it looks like throttle-groups.h includes "qemu/throttle.h" which includes "qapi/qapi-types-block-core.h", > so it should be included explicitly here. Ok, scratch that. Seems this came from stale files still being around from an in-tree build. Dunno how that happened, usually I do out-of-tree builds exclusively. sorry for the extra work, Gerd
On Wed, 2020-07-08 at 16:23 +0200, Gerd Hoffmann wrote: > On Wed, Jul 08, 2020 at 04:06:45PM +0300, Maxim Levitsky wrote: > > On Wed, 2020-07-08 at 14:33 +0200, Gerd Hoffmann wrote: > > > On Mon, Jun 08, 2020 at 12:40:27PM +0300, Maxim Levitsky wrote: > > > > blockdev-amend will be used similiar to blockdev-create > > > > to allow on the fly changes of the structure of the format based block devices. > > > > > > This one breaks the build: > > > > > > In file included from /home/kraxel/projects/qemu/include/block/throttle-groups.h:29, > > > from /home/kraxel/projects/qemu/include/sysemu/block-backend.h:17, > > > from /home/kraxel/projects/qemu/qemu-img.c:46: > > > /home/kraxel/projects/qemu/include/block/block_int.h:154:39: error: unknown type name ‘BlockdevAmendOptions’; did you mean ‘BlockdevAioOptions’? > > > BlockdevAmendOptions *opts, > > > ^~~~~~~~~~~~~~~~~~~~ > > > BlockdevAioOptions > > > make: *** [/home/kraxel/projects/qemu/rules.mak:69: qemu-img.o] Error 1 > > > > > > take care, > > > Gerd > > > > > > > Apparently I didn't add #include of qapi-types-block-core.h in block_int.h (I'll fix this in a patch soon), > > but it looks like throttle-groups.h includes "qemu/throttle.h" which includes "qapi/qapi-types-block-core.h", > > so it should be included explicitly here. > > Ok, scratch that. > > Seems this came from stale files still being around from an in-tree > build. Dunno how that happened, usually I do out-of-tree builds > exclusively. > > sorry for the extra work, > Gerd > No problem! I will send a patch to fix the include anyway though in few days. Best regards, Maxim levitsky
diff --git a/block/Makefile.objs b/block/Makefile.objs index 3635b6b4c1..a0988638d5 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -19,7 +19,7 @@ block-obj-$(CONFIG_WIN32) += file-win32.o win32-aio.o block-obj-$(CONFIG_POSIX) += file-posix.o block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o block-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o -block-obj-y += null.o mirror.o commit.o io.o create.o +block-obj-y += null.o mirror.o commit.o io.o create.o amend.o block-obj-y += throttle-groups.o block-obj-$(CONFIG_LINUX) += nvme.o diff --git a/block/amend.c b/block/amend.c new file mode 100644 index 0000000000..f4612dcf08 --- /dev/null +++ b/block/amend.c @@ -0,0 +1,113 @@ +/* + * Block layer code related to image options amend + * + * Copyright (c) 2018 Kevin Wolf <kwolf@redhat.com> + * Copyright (c) 2020 Red Hat. Inc + * + * Heavily based on create.c + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "block/block_int.h" +#include "qemu/job.h" +#include "qemu/main-loop.h" +#include "qapi/qapi-commands-block-core.h" +#include "qapi/qapi-visit-block-core.h" +#include "qapi/clone-visitor.h" +#include "qapi/error.h" + +typedef struct BlockdevAmendJob { + Job common; + BlockdevAmendOptions *opts; + BlockDriverState *bs; + bool force; +} BlockdevAmendJob; + +static int coroutine_fn blockdev_amend_run(Job *job, Error **errp) +{ + BlockdevAmendJob *s = container_of(job, BlockdevAmendJob, common); + int ret; + + job_progress_set_remaining(&s->common, 1); + ret = s->bs->drv->bdrv_co_amend(s->bs, s->opts, s->force, errp); + job_progress_update(&s->common, 1); + qapi_free_BlockdevAmendOptions(s->opts); + return ret; +} + +static const JobDriver blockdev_amend_job_driver = { + .instance_size = sizeof(BlockdevAmendJob), + .job_type = JOB_TYPE_AMEND, + .run = blockdev_amend_run, +}; + +void qmp_x_blockdev_amend(const char *job_id, + const char *node_name, + BlockdevAmendOptions *options, + bool has_force, + bool force, + Error **errp) +{ + BlockdevAmendJob *s; + const char *fmt = BlockdevDriver_str(options->driver); + BlockDriver *drv = bdrv_find_format(fmt); + BlockDriverState *bs = bdrv_find_node(node_name); + + + if (!drv) { + error_setg(errp, "Block driver '%s' not found or not supported", fmt); + return; + } + + /* + * If the driver is in the schema, we know that it exists. But it may not + * be whitelisted. + */ + if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, false)) { + error_setg(errp, "Driver is not whitelisted"); + return; + } + + if (bs->drv != drv) { + error_setg(errp, + "x-blockdev-amend doesn't support changing the block driver"); + return; + } + + /* Error out if the driver doesn't support .bdrv_co_amend */ + if (!drv->bdrv_co_amend) { + error_setg(errp, "Driver does not support x-blockdev-amend"); + return; + } + + /* Create the block job */ + s = job_create(job_id, &blockdev_amend_job_driver, NULL, + bdrv_get_aio_context(bs), JOB_DEFAULT | JOB_MANUAL_DISMISS, + NULL, NULL, errp); + if (!s) { + return; + } + + s->bs = bs, + s->opts = QAPI_CLONE(BlockdevAmendOptions, options), + s->force = has_force ? force : false; + job_start(&s->common); +} diff --git a/include/block/block_int.h b/include/block/block_int.h index ed335519cc..1b86b59af1 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -141,12 +141,27 @@ struct BlockDriver { int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags, Error **errp); void (*bdrv_close)(BlockDriverState *bs); + + int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts, Error **errp); int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv, const char *filename, QemuOpts *opts, Error **errp); + + int coroutine_fn (*bdrv_co_amend)(BlockDriverState *bs, + BlockdevAmendOptions *opts, + bool force, + Error **errp); + + int (*bdrv_amend_options)(BlockDriverState *bs, + QemuOpts *opts, + BlockDriverAmendStatusCB *status_cb, + void *cb_opaque, + bool force, + Error **errp); + int (*bdrv_make_empty)(BlockDriverState *bs); /* @@ -441,12 +456,6 @@ struct BlockDriver { BdrvCheckResult *result, BdrvCheckMode fix); - int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts, - BlockDriverAmendStatusCB *status_cb, - void *cb_opaque, - bool force, - Error **errp); - void (*bdrv_debug_event)(BlockDriverState *bs, BlkdebugEvent event); /* TODO Better pass a option string/QDict/QemuOpts to add any rule? */ diff --git a/qapi/block-core.json b/qapi/block-core.json index 0e1c6a59f2..c22996282f 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4674,6 +4674,48 @@ 'data': { 'job-id': 'str', 'options': 'BlockdevCreateOptions' } } +## +# @BlockdevAmendOptions: +# +# Options for amending an image format +# +# @driver: Block driver of the node to amend. +# +# Since: 5.1 +## +{ 'union': 'BlockdevAmendOptions', + 'base': { + 'driver': 'BlockdevDriver' }, + 'discriminator': 'driver', + 'data': { + } } + +## +# @x-blockdev-amend: +# +# Starts a job to amend format specific options of an existing open block device +# The job is automatically finalized, but a manual job-dismiss is required. +# +# @job-id: Identifier for the newly created job. +# +# @node-name: Name of the block node to work on +# +# @options: Options (driver specific) +# +# @force: Allow unsafe operations, format specific +# For luks that allows erase of the last active keyslot +# (permanent loss of data), +# and replacement of an active keyslot +# (possible loss of data if IO error happens) +# +# Since: 5.1 +## +{ 'command': 'x-blockdev-amend', + 'data': { 'job-id': 'str', + 'node-name': 'str', + 'options': 'BlockdevAmendOptions', + '*force': 'bool' } } + ## # @BlockErrorAction: # diff --git a/qapi/job.json b/qapi/job.json index 5e658281f5..c48a0c3e34 100644 --- a/qapi/job.json +++ b/qapi/job.json @@ -19,10 +19,12 @@ # # @create: image creation job type, see "blockdev-create" (since 3.0) # +# @amend: image options amend job type, see "x-blockdev-amend" (since 5.1) +# # Since: 1.7 ## { 'enum': 'JobType', - 'data': ['commit', 'stream', 'mirror', 'backup', 'create'] } + 'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] } ## # @JobStatus: