mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
kvm: Add better logging when fetching a volume from libvirt
Clearly show if a volume is found and if not, that the pool is being refreshed and the fetch is tried again. Due to my commit b53a9dcc9f3ee95d40761b9c2c860f821595a661 the chance of a volume not being found is slightly bigger, but the performance gain is enormous on larger deployments. This is why we clearly have to log that we are refreshing the pool information when a volume is not found. It could be that a volume is created on host A and a few seconds later host B tries to access the volume. In that case host B's libvirt doesn't know about the volume yet and has to refresh the pool before it does. (cherry picked from commit 4ee82f1f40f6a384619323698d3f59e3cdda3c9c)
This commit is contained in:
parent
da73d735b2
commit
3b65a5928b
@ -94,21 +94,30 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
||||
try {
|
||||
vol = pool.storageVolLookupByName(volName);
|
||||
} catch (LibvirtException e) {
|
||||
s_logger.debug("Can't find volume: " + e.toString());
|
||||
s_logger.debug("Could not find volume " + volName + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* The volume was not found in the storage pool
|
||||
* This can happen when a volume has just been created on a different host and
|
||||
* since then the libvirt storage pool has not been refreshed.
|
||||
*/
|
||||
if (vol == null) {
|
||||
try {
|
||||
s_logger.debug("Refreshing storage pool " + pool.getName());
|
||||
refreshPool(pool);
|
||||
} catch (LibvirtException e) {
|
||||
s_logger.debug("failed to refresh pool: " + e.toString());
|
||||
s_logger.debug("Failed to refresh storage pool: " + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
vol = pool.storageVolLookupByName(volName);
|
||||
s_logger.debug("Found volume " + volName + " in storage pool " + pool.getName() + " after refreshing the pool");
|
||||
} catch (LibvirtException e) {
|
||||
throw new CloudRuntimeException(e.toString());
|
||||
throw new CloudRuntimeException("Could not find volume " + volName + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return vol;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user