Repository: cloudstack Updated Branches: refs/heads/master fbcab01ff -> 4ee82f1f4
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. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ee82f1f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ee82f1f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ee82f1f Branch: refs/heads/master Commit: 4ee82f1f40f6a384619323698d3f59e3cdda3c9c Parents: fbcab01 Author: Wido den Hollander <[email protected]> Authored: Fri Oct 10 00:57:21 2014 +0200 Committer: Wido den Hollander <[email protected]> Committed: Fri Oct 10 01:00:54 2014 +0200 ---------------------------------------------------------------------- .../kvm/storage/LibvirtStorageAdaptor.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ee82f1f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index 3cac3d3..af7a0e0 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -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; }
