[libvirt] [PATCH] storage: Fix any VolLookupByPath if we have an empty logical pool

On F16 at least, empty volume groups don't have a directory under /dev. The directory only appears once a logical volume is created. This tickles some behavior in BackendStablePath which ends with libvirt sleeping for 5 seconds while waiting for the directory to appear. This causes all sorts of problems for the virStorageVolLookupByPath API which virtinst uses, even if trying to resolve a path that is independent of the logical pool. In reality we don't even need to do that checking since logical pools always have a stable target path. Short circuit the polling in that case. Fixes bug 782261 --- src/storage/storage_backend.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index d7394e0..306e487 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1347,6 +1347,10 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool, if (!STRPREFIX(pool->def->target.path, "/dev")) goto ret_strdup; + /* Logical pools are under /dev but already have stable paths */ + if (pool->def->type == VIR_STORAGE_POOL_LOGICAL) + goto ret_strdup; + /* We loop here because /dev/disk/by-{id,path} may not have existed * before we started this operation, so we have to give it some time to * get created. -- 1.7.7.5

On 01/25/2012 11:15 AM, Cole Robinson wrote:
On F16 at least, empty volume groups don't have a directory under /dev. The directory only appears once a logical volume is created.
This tickles some behavior in BackendStablePath which ends with libvirt sleeping for 5 seconds while waiting for the directory to appear. This causes all sorts of problems for the virStorageVolLookupByPath API which virtinst uses, even if trying to resolve a path that is independent of the logical pool.
In reality we don't even need to do that checking since logical pools always have a stable target path. Short circuit the polling in that case.
Fixes bug 782261 --- src/storage/storage_backend.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
ACK. Isn't it funny how small a patch can be in proportion to the time it took you to analyze why that one if statement is needed? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 01/25/2012 01:23 PM, Eric Blake wrote:
On 01/25/2012 11:15 AM, Cole Robinson wrote:
On F16 at least, empty volume groups don't have a directory under /dev. The directory only appears once a logical volume is created.
This tickles some behavior in BackendStablePath which ends with libvirt sleeping for 5 seconds while waiting for the directory to appear. This causes all sorts of problems for the virStorageVolLookupByPath API which virtinst uses, even if trying to resolve a path that is independent of the logical pool.
In reality we don't even need to do that checking since logical pools always have a stable target path. Short circuit the polling in that case.
Fixes bug 782261 --- src/storage/storage_backend.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
ACK. Isn't it funny how small a patch can be in proportion to the time it took you to analyze why that one if statement is needed?
:) Thanks Eric, pushed now. - Cole
participants (2)
-
Cole Robinson
-
Eric Blake