[PATCH] qemu: fix crash on getting block stats for empty cdrom

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

 



Looks like it was introduced in c5f61513. Before this commit handling empty cdrom
was correct becase physical sizes of non block disks are not updated.
Now when all types are supported we need to check for empty drives.

[1] crash backtrace

0  __strrchr_sse42 () at ../sysdeps/x86_64/multiarch/strrchr.S:138
1  0x00007ffff7242192 in virFileIsSharedFSType (path=0x0, fstypes=63) at util/virfile.c:3351
2  0x00007ffff7242a5b in virFileIsSharedFS (path=0x0) at util/virfile.c:3557
3  0x00007fffdb835443 in qemuOpenFileAs (fallback_uid=0, fallback_gid=107, dynamicOwnership=true, path=0x0,
   oflags=0, needUnlink=0x0, bypassSecurityDriver=0x0) at qemu/qemu_driver.c:2927
4  0x00007fffdb83539b in qemuOpenFile (driver=0x7fffcc1062f0, vm=0x7fffcc25aa50, path=0x0, oflags=0,
   needUnlink=0x0, bypassSecurityDriver=0x0) at qemu/qemu_driver.c:2908
5  0x00007fffdb84d2d3 in qemuDomainStorageOpenStat (driver=0x7fffcc1062f0, cfg=0x7fffcc188880, vm=0x7fffcc25aa50,
   src=0x7fffcc256920, ret_fd=0x7fffe6a49488, ret_sb=0x7fffe6a49490) at qemu/qemu_driver.c:11266
6  0x00007fffdb84d4ff in qemuDomainStorageUpdatePhysical (driver=0x7fffcc1062f0, cfg=0x7fffcc188880,
   vm=0x7fffcc25aa50, src=0x7fffcc256920) at qemu/qemu_driver.c:11319
7  0x00007fffdb8661e7 in qemuDomainGetStatsOneBlock (driver=0x7fffcc1062f0, cfg=0x7fffcc188880, dom=0x7fffcc25aa50,
   record=0x7fffa8000e70, maxparams=0x7fffe6a49790, disk=0x7fffcc2565a0, src=0x7fffcc256920, block_idx=7,
   backing_idx=0, stats=0x7fffa8000e90) at qemu/qemu_driver.c:19223
8  0x00007fffdb86652b in qemuDomainGetStatsBlock (driver=0x7fffcc1062f0, dom=0x7fffcc25aa50, record=0x7fffa8000e70,
   maxparams=0x7fffe6a49790, privflags=1) at qemu/qemu_driver.c:19282
9  0x00007fffdb8669f7 in qemuDomainGetStats (conn=0x7fffb80009a0, dom=0x7fffcc25aa50, stats=127,
   record=0x7fffe6a49870, flags=1) at qemu/qemu_driver.c:19444
10 0x00007fffdb866dc8 in qemuConnectGetAllDomainStats (conn=0x7fffb80009a0, doms=0x0, ndoms=0, stats=127,
   retStats=0x7fffe6a499a0, flags=1) at qemu/qemu_driver.c:19534
11 0x00007ffff7388376 in virConnectGetAllDomainStats (conn=0x7fffb80009a0, stats=0, retStats=0x7fffe6a499a0,
   flags=1) at libvirt-domain.c:11311
---
 src/qemu/qemu_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bc5e448..16b435a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19170,6 +19170,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
 
     QEMU_ADD_NAME_PARAM(record, maxparams, "block", "name", block_idx,
                         disk->dst);
+
     if (virStorageSourceIsLocalStorage(src) && src->path)
         QEMU_ADD_NAME_PARAM(record, maxparams, "block", "path",
                             block_idx, src->path);
@@ -19216,7 +19217,7 @@ qemuDomainGetStatsOneBlock(virQEMUDriverPtr driver,
     if (entry->capacity)
         QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx,
                                  "capacity", entry->capacity);
-    if (entry->physical) {
+    if (entry->physical || virStorageSourceIsEmpty(src)) {
         QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx,
                                  "physical", entry->physical);
     } else {
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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