Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5041,8 +5041,8 @@ protected String getDiskPathFromDiskDef(DiskDef disk) {
}
}

// for example, path = /mnt/pool_uuid/disk_path/
return token[3];
// for example, path = /mnt/pool_uuid/disk_path/ or, for local storage, /var/lib/libvirt/images/disk_path
return token[token.length - 1];
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5979,6 +5979,14 @@ public void testGetDiskPathFromDiskDefForNFS() {
Assert.assertEquals("filepath", diskPath);
}

@Test
public void testGetDiskPathFromDiskDefForLocalStorage() {
DiskDef diskDef = new DiskDef();
diskDef.defFileBasedDisk("/var/lib/libvirt/images/filepath", 0, DiskDef.DiskBus.VIRTIO, DiskDef.DiskFmtType.QCOW2);
String diskPath = libvirtComputingResourceSpy.getDiskPathFromDiskDef(diskDef);
Assert.assertEquals("filepath", diskPath);
}

@Test
public void testGetDiskPathFromDiskDefForNFSWithNullPath() {
DiskDef diskDef = new DiskDef();
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/java/com/cloud/server/StatsCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
List<VolumeVO> volumes = _volsDao.search(sc_volume, null);

if (CollectionUtils.isEmpty(volumes))
break;
continue;

VolumeVO volume = volumes.get(0);
VmDiskStatisticsVO previousVmDiskStats = _vmDiskStatsDao.findBy(vm.getAccountId(), vm.getDataCenterId(), vmId, volume.getId());
Expand Down Expand Up @@ -1682,7 +1682,7 @@ protected void runInContext() {
if (!List.of(ImageFormat.QCOW2, ImageFormat.VHD, ImageFormat.OVA, ImageFormat.RAW).contains(volume.getFormat()) &&
!List.of(Storage.StoragePoolType.PowerFlex, Storage.StoragePoolType.FiberChannel).contains(pool.getPoolType())) {
logger.warn("Volume stats not implemented for this format type " + volume.getFormat());
break;
continue;
}
}
try {
Expand Down
Loading