[PATCH 3/3] virNodeDeviceCapStorageDefFormatBlocksize: Report sector size and count together

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux