Report both block count and size together when either one of them is
present equivalently to what the schema type 'blockData' in
'schemas/nodedev.rng' defines.
Resolves:
https://issues.redhat.com/browse/RHEL-18165
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/node_device_conf.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 3af5c3b7ed..4826be6f42 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -540,13 +540,14 @@ static void
virNodeDeviceCapStorageDefFormatBlocksize(virBuffer *buf,
const virNodeDevCapData *data)
{
- if (data->storage.logical_block_size > 0)
- virBufferAsprintf(buf,
"<logical_block_size>%llu</logical_block_size>\n",
- data->storage.logical_block_size);
+ if (data->storage.logical_block_size == 0 &&
+ data->storage.num_blocks == 0)
+ return;
- if (data->storage.num_blocks > 0)
- virBufferAsprintf(buf, "<num_blocks>%llu</num_blocks>\n",
- data->storage.num_blocks);
+ virBufferAsprintf(buf,
"<logical_block_size>%llu</logical_block_size>\n",
+ data->storage.logical_block_size);
+ virBufferAsprintf(buf, "<num_blocks>%llu</num_blocks>\n",
+ data->storage.num_blocks);
}
--
2.43.0