On Fri, Aug 25, 2023 at 13:52:15 +0200, Kristina Hanicova wrote:
This commit adds building of `discard_granularity` disk option
for qemu commandline.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1849570
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
src/qemu/qemu_command.c | 2 ++
src/vz/vz_utils.c | 3 ++-
tests/qemuxml2argvdata/disk-blockio.x86_64-latest.args | 2 +-
tests/qemuxml2argvdata/disk-blockio.xml | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
[...]
diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c
index 7db7dbd419..de707df883 100644
--- a/src/vz/vz_utils.c
+++ b/src/vz/vz_utils.c
@@ -279,7 +279,8 @@ vzCheckDiskUnsupportedParams(virDomainDiskDef *disk)
}
if (disk->blockio.logical_block_size ||
- disk->blockio.physical_block_size) {
+ disk->blockio.physical_block_size ||
+ disk->blockio.discard_granularity) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Setting disk block sizes is not "
"supported by vz driver."));
This hunk doesn't belong to this patch.
diff --git a/tests/qemuxml2argvdata/disk-blockio.xml
b/tests/qemuxml2argvdata/disk-blockio.xml
index 170728371f..84943719d4 100644
--- a/tests/qemuxml2argvdata/disk-blockio.xml
+++ b/tests/qemuxml2argvdata/disk-blockio.xml
Please also enable this test case in qemuxml2xmltest.
@@ -23,7 +23,7 @@
<source file='/tmp/idedisk.img'/>
<target dev='hdc' bus='ide'/>
<address type='drive' controller='0' bus='0'
target='0' unit='2'/>
- <blockio logical_block_size='512'
physical_block_size='512'/>
+ <blockio logical_block_size='512' physical_block_size='512'
discard_granularity='4096'/>
</disk>
<controller type='usb' index='0'/>
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>