kvm: fix exception in volume statts after storage migration (#3884)

On kvm, the 'path' of volume is the file name on primary storage. we should use 'path' instead of 'uuid' in volume statistics.

Fixes: #3878
This commit is contained in:
Wei Zhou 2020-02-19 08:36:19 +01:00 committed by GitHub
parent bbe2bf1a6e
commit 649ed45965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -928,13 +928,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
List<VolumeVO> volumes = _volsDao.findByPoolId(pool.getId(), null);
List<String> volumeLocators = new ArrayList<String>();
for (VolumeVO volume : volumes) {
if (volume.getFormat() == ImageFormat.QCOW2) {
if (pool.isManaged()) {
volumeLocators.add(volume.getPath());
} else {
volumeLocators.add(volume.getUuid());
}
} else if (volume.getFormat() == ImageFormat.VHD) {
if (volume.getFormat() == ImageFormat.QCOW2 || volume.getFormat() == ImageFormat.VHD) {
volumeLocators.add(volume.getPath());
} else if (volume.getFormat() == ImageFormat.OVA) {
volumeLocators.add(volume.getChainInfo());