Esempio n. 1
0
 /**
  * Check if storage_domains item with specified Guid exist in List
  *
  * @param items
  * @param id
  * @return
  */
 public static boolean IsSDItemExistInList(ArrayList<storage_domains> items, Guid id) {
   for (storage_domains b : items) {
     if (b.getId().equals(id)) {
       return true;
     }
   }
   return false;
 }
Esempio n. 2
0
 public static storage_domains getStorageById(
     Guid storageId, ArrayList<storage_domains> storageDomains) {
   for (storage_domains storage : storageDomains) {
     if (storage.getId().equals(storageId)) {
       return storage;
     }
   }
   return null;
 }
 /**
  * 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;
 }
Esempio n. 4
0
 @Override
 public boolean Match(storage_domains source) {
   return id.equals(source.getId());
 }