private boolean ActivateStorageDomains() {
    boolean returnValue = true;
    for (final Guid storageDomainId : getParameters().getStorages()) {
      StorageDomainPoolParametersBase activateParameters =
          new StorageDomainPoolParametersBase(storageDomainId, getStoragePool().getId());
      activateParameters.setSessionId(getParameters().getSessionId());
      activateParameters.setTransactionScopeOption(TransactionScopeOption.RequiresNew);
      returnValue =
          Backend.getInstance()
              .runInternalAction(VdcActionType.ActivateStorageDomain, activateParameters)
              .getSucceeded();

      // if activate domain failed then set domain status to inactive
      if (!returnValue) {
        TransactionSupport.executeInNewTransaction(
            new TransactionMethod<Void>() {
              @Override
              public Void runInTransaction() {
                DbFacade.getInstance()
                    .getStoragePoolIsoMapDao()
                    .updateStatus(
                        new StoragePoolIsoMapId(storageDomainId, getStoragePool().getId()),
                        StorageDomainStatus.InActive);
                return null;
              }
            });
      }
    }

    return returnValue;
  }
Exemplo n.º 2
0
 @Override
 public EventResult storageDomainNotOperational(Guid storageDomainId, Guid storagePoolId) {
   StorageDomainPoolParametersBase parameters =
       new StorageDomainPoolParametersBase(storageDomainId, storagePoolId);
   parameters.setIsInternal(true);
   parameters.setInactive(true);
   boolean isSucceeded =
       backend
           .runInternalAction(
               VdcActionType.DeactivateStorageDomain,
               parameters,
               ExecutionHandler.createInternalJobContext())
           .getSucceeded();
   return new EventResult(isSucceeded, EventType.DOMAINNOTOPERATIONAL);
 }