From: Peter Krempa Date: Wed, 5 Feb 2020 17:08:55 +0000 (+0100) Subject: qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice X-Git-Tag: v6.1.0-rc1~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4818812831967b8f882b2c33780aab129e245a2;p=thirdparty%2Flibvirt.git qemuBlockStorageSourceGetFormatRawProps: format 'offset' and 'size' for slice If we have a 'format' type slice for a raw driver we can directly format the values. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 710ddfd2cf..b408d4c81f 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1194,16 +1194,21 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src, secretalias = srcPriv->encinfo->s.aes.alias; } - /* currently unhandled properties for the 'raw' driver: - * 'offset' - * 'size' - */ - if (virJSONValueObjectAdd(props, "s:driver", driver, "S:key-secret", secretalias, NULL) < 0) return -1; + /* Currently only storage slices are supported. We'll have to calculate + * the union of the slices here if we don't want to be adding needless + * 'raw' nodes. */ + if (src->sliceStorage && + virJSONValueObjectAdd(props, + "U:offset", src->sliceStorage->offset, + "U:size", src->sliceStorage->size, + NULL) < 0) + return -1; + return 0; }