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

[libvirt] [PATCH 4/4] domblkinfo: Check for NFS FS Type



Similar to the vol-info code, check if the target device for the
blkinfo fetch is an NFS volume and return the st_size value rather than
calculating the size based on st_blksize and DEV_BSIZE.

Prior to the change a 40M target device would display:

Capacity:       41943040
Allocation:     126976
Physical:       126976

With the change it will display:

Capacity:       41943040
Allocation:     41943040
Physical:       41943040
Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/qemu/qemu_driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8eba8e8..f5d31f6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10432,8 +10432,11 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
     /* Get info for normal formats */
     if (S_ISREG(sb.st_mode) || fd == -1) {
 #ifndef WIN32
-        info->physical = (unsigned long long)sb.st_blocks *
-            (unsigned long long)DEV_BSIZE;
+        if (virFileIsNFSFSType(disk->src->path))
+            info->physical = sb.st_size;
+        else
+            info->physical = (unsigned long long)sb.st_blocks *
+                (unsigned long long)DEV_BSIZE;
 #else
         info->physical = sb.st_size;
 #endif
-- 
1.9.3


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