kvm: fix CloudRuntimeException in volume stats for migrated volume (#3949)

When you migrate volume between data stores CS keeps the original UUID and changes the path of the volume.
When volume is not found by the given path the agent throws CloudRuntimeException but it's not catched in LibvirtGetVolumeStatsCommandWrapper.java
This commit is contained in:
slavkap 2020-06-12 08:02:01 +03:00 committed by GitHub
parent f433db9881
commit 8b234bd14f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
import com.cloud.resource.CommandWrapper;
import com.cloud.resource.ResourceWrapper;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.agent.api.GetVolumeStatsAnswer;
import com.cloud.agent.api.GetVolumeStatsCommand;
import com.cloud.agent.api.VolumeStatsEntry;
@ -52,7 +53,7 @@ public final class LibvirtGetVolumeStatsCommandWrapper extends CommandWrapper<Ge
statEntry.put(volumeUuid, getVolumeStat(libvirtComputingResource, conn, volumeUuid, storeUuid, poolType));
}
return new GetVolumeStatsAnswer(cmd, "", statEntry);
} catch (LibvirtException e) {
} catch (LibvirtException | CloudRuntimeException e) {
return new GetVolumeStatsAnswer(cmd, "Can't get vm disk stats: " + e.getMessage(), null);
}
}