use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class GetUnregisteredBlockStorageDomainsQuery method getStorageDomainById.
/**
* Retrieve a storage domain using a specified storage domain ID.
*
* @param storageDomainId the domain's ID
* @return the storage domain
*/
@SuppressWarnings("unchecked")
protected StorageDomain getStorageDomainById(Guid storageDomainId) {
VDSReturnValue returnValue;
try {
returnValue = executeHSMGetStorageDomainInfo(new HSMGetStorageDomainInfoVDSCommandParameters(getParameters().getVdsId(), storageDomainId));
} catch (RuntimeException e) {
log.error("Could not get info for storage domain ID: '{}': {}", storageDomainId, e.getMessage());
log.debug("Exception", e);
return null;
}
Pair<StorageDomainStatic, SANState> result = (Pair<StorageDomainStatic, SANState>) returnValue.getReturnValue();
StorageDomainStatic storageDomainStatic = result.getFirst();
storageDomainStatic.setStorageType(getParameters().getStorageType());
StorageDomain storageDomain = new StorageDomain();
storageDomain.setStorageStaticData(storageDomainStatic);
return storageDomain;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommandTest method hasLocalDomain.
@Test
public void hasLocalDomain() {
StorageDomainStatic sdc = new StorageDomainStatic();
sdc.setStorageType(StorageType.LOCALFS);
StoragePool existingSp = createStoragePool();
existingSp.setIsLocal(true);
when(spDao.get(any())).thenReturn(existingSp);
when(sdDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(sdc));
ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_LOCAL);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommandTest method hasSharedDomain.
@Test
public void hasSharedDomain() {
StorageDomainStatic sdc = new StorageDomainStatic();
sdc.setStorageType(StorageType.NFS);
when(sdDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(sdc));
ValidateTestUtils.runAndAssertValidateSuccess(cmd);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeProvidersResource method getStoragePoolIdByStorageDomainName.
private StoragePool getStoragePoolIdByStorageDomainName(String storageDomainName) {
StorageDomainStatic storageDomain = getEntity(StorageDomainStatic.class, QueryType.GetStorageDomainByName, new NameQueryParameters(storageDomainName), "StorageDomain: name=" + storageDomainName);
List<StoragePool> storagePools = getEntity(List.class, QueryType.GetStoragePoolsByStorageDomainId, new IdQueryParameters(storageDomain.getId()), "Datacenters");
if (!storagePools.isEmpty()) {
return storagePools.get(0);
}
// The storage domain is unattached
return null;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare5.
private void prepare5() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
ActionReturnValue returnValue = context.addStorageServerConnectionReturnValue;
if (returnValue == null || !returnValue.getSucceeded()) {
// Don't rollback.
context.enlistment = null;
enlistment.done();
} else {
StorageDomainStatic storage = new StorageDomainStatic();
storage.setStorageType(StorageType.LOCALFS);
storage.setStorageDomainType(StorageDomainType.Data);
storage.setStorageName(configureModel.getFormattedStorageName().getEntity());
storage.setStorage((String) returnValue.getActionReturnValue());
StorageDomainManagementParameter parameters = new StorageDomainManagementParameter(storage);
parameters.setVdsId(context.host.getId());
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddLocalStorageDomain, parameters, result -> {
ActionReturnValue returnValue1 = result.getReturnValue();
context.addLocalStorageDomainReturnValue = returnValue1;
prepare6();
});
}
}
Aggregations