use of org.ovirt.engine.core.common.businessentities.StorageDomain 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.StorageDomain in project ovirt-engine by oVirt.
the class GetStorageDomainListByIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<StorageDomain> result = storageDomainDao.getAllForStorageDomain(getParameters().getId());
ArrayList<StorageDomain> temp = new ArrayList<>(result);
for (StorageDomain domain : temp) {
if (domain.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Unattached) {
result.remove(domain);
}
}
getQueryReturnValue().setReturnValue(result);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class GetStorageDomainsByVmTemplateIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
vmTemplate = vmTemplateDao.get(getParameters().getId(), getUserID(), getParameters().isFiltered());
ArrayList<StorageDomain> result = new ArrayList<>();
if (vmTemplate != null && vmTemplate.getStoragePoolId() != null) {
List<Disk> templateDisks = getTemplateDisks();
if (templateDisks.size() > 0) {
Set<Guid> domains = new HashSet<>();
for (Disk templateDisk : templateDisks) {
domains.addAll(((DiskImage) templateDisk).getStorageIds());
}
for (Guid domainId : domains) {
StorageDomain domain = getStorageDomain(domainId);
if (domain != null) {
result.add(domain);
}
}
}
}
getQueryReturnValue().setReturnValue(result);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AutoRecoveryManagerTest method setup.
@Before
public void setup() {
final VDS vds = new VDS();
vdss.add(vds);
when(vdsDaoMock.listFailedAutorecoverables()).thenReturn(vdss);
StorageDomain domain = new StorageDomain();
domain.setStoragePoolId(Guid.newGuid());
storageDomains.add(domain);
when(storageDomainDaoMock.listFailedAutorecoverables()).thenReturn(storageDomains);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class SyncStorageDomainsLunsCommandTest method validateStorageTypeOfStorageDomainsToSyncFails.
@Test
public void validateStorageTypeOfStorageDomainsToSyncFails() {
StorageDomain blockDomain = new StorageDomain();
blockDomain.setStorageType(StorageType.ISCSI);
StorageDomain fileDomain = new StorageDomain();
fileDomain.setStorageType(StorageType.NFS);
doReturn(Stream.of(blockDomain, fileDomain)).when(command).getStorageDomainsToSync();
assertFalse(command.validateStorageTypeOfStorageDomainsToSync());
}
Aggregations