All,
When refreshing a storage pool (say, an iSCSI pool), one of the things it
does is to generate the stable path for each of the LUNs via
virStorageBackendStablePath. That, in turn, has the following code:
/* 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
*/
if ((dh = opendir(pool->def->target.path)) == NULL) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot read dir %s: %s"),
pool->def->target.path,
strerror(errno));
return NULL;
}
For a normal machine, that code is totally legit; /dev/disk/by-{id,path} almost
certainly exists because of your hard drive, etc. However, this may not be the
case in the stateless ovirt environment, since /dev/disk/by-{id,path} is created
on-demand by udev. It's basically a race between udev creating the directory
and libvirt scanning the directory.
The following patch just adds a retry to the code above so that if it
doesn't exist when we first get there, we give it time to come into being. If
it still hasn't shown up 5 seconds after we started, we give up and throw the error.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>