typedef virStoragePoolFCRefreshInfo *virStoragePoolFCRefreshInfoPtr;
struct _virStoragePoolFCRefreshInfo {
char *fchost_name;
- virStoragePoolObjPtr pool;
+ unsigned char pool_uuid[VIR_UUID_BUFLEN];
};
/* Function to check if the type file in the given sysfs_path is a
{
virStoragePoolFCRefreshInfoPtr cbdata = opaque;
const char *fchost_name = cbdata->fchost_name;
- virStoragePoolObjPtr pool = cbdata->pool;
+ const unsigned char *pool_uuid = cbdata->pool_uuid;
+ virStoragePoolObjPtr pool = NULL;
unsigned int host;
int found = 0;
int tries = 2;
do {
sleep(5); /* Give it time */
- /* Lock the pool, if active, we can get the host number, successfully
- * rescan, and find LUN's, then we are happy
+ /* Let's see if the pool still exists - */
+ if (!(pool = virStoragePoolObjFindPoolByUUID(pool_uuid)))
+ break;
+
+ /* Return with pool lock, if active, we can get the host number,
+ * successfully, rescan, and find LUN's, then we are happy
*/
VIR_DEBUG("Attempt FC Refresh for pool='%s' name='%s' tries='%d'",
pool->def->name, fchost_name, tries);
- virStoragePoolObjLock(pool);
if (virStoragePoolObjIsActive(pool) &&
virGetSCSIHostNumber(fchost_name, &host) == 0 &&
virStorageBackendSCSITriggerRescan(host) == 0) {
virStoragePoolObjUnlock(pool);
} while (!found && --tries);
- if (!found)
+ if (pool && !found)
VIR_DEBUG("FC Refresh Thread failed to find LU's");
virStoragePoolFCRefreshDataFree(cbdata);
if ((name = virGetFCHostNameByWWN(NULL, adapter->data.fchost.wwnn,
adapter->data.fchost.wwpn))) {
if (VIR_ALLOC(cbdata) == 0) {
- cbdata->pool = pool;
+ memcpy(cbdata->pool_uuid, pool->def->uuid, VIR_UUID_BUFLEN);
cbdata->fchost_name = name;
name = NULL;