[libvirt] [PATCH] storage: Add timeout for iscsi volume's stable path discovery

Eric Blake eblake at redhat.com
Mon Sep 24 16:42:31 UTC 2012


On 09/24/2012 02:44 AM, Osier Yang wrote:
> It might need some time till the LUN's stable path shows up on
> initiator host, and although the time window is not foreseeable,
> as a better than nothing fix, this patch adds timeout for the
> stable path discovery process.
> ---
>  src/storage/storage_backend.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)


> @@ -1384,8 +1385,12 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
>      /* The pool is pointing somewhere like /dev/disk/by-path
>       * or /dev/disk/by-id, so we need to check all symlinks in
>       * the target directory and figure out which one points
> -     * to this device node
> +     * to this device node.
> +     *
> +     * And it might need some time till the stabe path shows

s/stabe/stable/

> +     * up, so add timeout to retry here.
>       */
> + retry:
>      while ((dent = readdir(dh)) != NULL) {
>          if (dent->d_name[0] == '.')
>              continue;
> @@ -1406,6 +1411,11 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
>          VIR_FREE(stablepath);
>      }
>  
> +    if (++retry < 100) {

Why a magic number of 100?  Not even a comment mentioning the maximum
time we are waiting?

> +        usleep(100 * 1000);

This says up to 100ms * 100, or 10 seconds.  I guess that seems
reasonable enough.

ACK if you fix those issues.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120924/7fb48606/attachment-0001.sig>


More information about the libvir-list mailing list