public static boolean IsActiveStorageDomain(storage_domains storageDomain) { boolean isActive = storageDomain.getstatus() != null && storageDomain.getstatus() == StorageDomainStatus.Active; return isActive; }
/** * Checks if Any StorageDomain Is Matser And Active * * @param sdl * @return */ public static boolean IsAnyStorageDomainIsMatserAndActive(List<storage_domains> sdl) { for (storage_domains a : sdl) { if (a.getstorage_domain_type() == StorageDomainType.Master && a.getstatus() != null && a.getstatus() == StorageDomainStatus.Active) { return true; } } return false; }
/** * The new master must be a data domain which is in Active status and not reported by any vdsm as * problematic. In case that all domains reported as problematic a first Active data domain will * be returned * * @return an elected master domain or null */ protected storage_domains electNewMaster(boolean duringReconstruct) { storage_domains newMaster = null; if (getStoragePool() != null) { List<storage_domains> storageDomains = getStorageDomainDAO().getAllForStoragePool(getStoragePool().getId()); Collections.sort(storageDomains, new LastTimeUsedAsMasterComp()); if (storageDomains.size() > 0) { storage_domains storageDomain = getStorageDomain(); for (storage_domains dbStorageDomain : storageDomains) { if ((storageDomain == null || (duringReconstruct || !dbStorageDomain.getId().equals(storageDomain.getId()))) && (dbStorageDomain.getstatus() == StorageDomainStatus.Active || dbStorageDomain.getstatus() == StorageDomainStatus.Unknown) && dbStorageDomain.getstorage_domain_type() == StorageDomainType.Data) { newMaster = dbStorageDomain; break; } } } } return newMaster; }