use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommand method updateMemberDomainsFormat.
private void updateMemberDomainsFormat(StorageFormatType targetFormat) {
Guid spId = getStoragePool().getId();
List<StorageDomainStatic> domains = storageDomainStaticDao.getAllForStoragePool(spId);
for (StorageDomainStatic domain : domains) {
StorageDomainType sdType = domain.getStorageDomainType();
if (sdType == StorageDomainType.Data || sdType == StorageDomainType.Master) {
log.info("Setting storage domain '{}' (type '{}') to format '{}'", domain.getId(), sdType, targetFormat);
domain.setStorageFormat(targetFormat);
storageDomainStaticDao.update(domain);
}
}
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class AddStoragePoolWithStoragesCommand method isStorageDomainAttachedToStoragePool.
private boolean isStorageDomainAttachedToStoragePool(StorageDomain storageDomain) {
try {
VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.HSMGetStorageDomainInfo, new HSMGetStorageDomainInfoVDSCommandParameters(getVdsId(), storageDomain.getId()));
if (!vdsReturnValue.getSucceeded()) {
logErrorMessage(storageDomain);
}
Pair<StorageDomainStatic, Guid> domainFromIrs = (Pair<StorageDomainStatic, Guid>) vdsReturnValue.getReturnValue();
if (domainFromIrs.getSecond() != null) {
return true;
}
} catch (RuntimeException e) {
logErrorMessage(storageDomain);
}
return false;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class StorageDomainStaticDaoTest method testGetByNameWithInvalidName.
/**
* Ensures that null is returned when the name is invalid.
*/
@Test
public void testGetByNameWithInvalidName() {
StorageDomainStatic result = dao.getByName("farkle");
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class GetGeoRepSessionsForStorageDomainQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
StorageDomainStatic domain = storageDomainDao.get(getParameters().getId());
StorageServerConnections connection = storageServerConnectionDao.get(domain.getStorage());
getQueryReturnValue().setReturnValue(new ArrayList<GlusterGeoRepSession>());
if (connection.getStorageType() != StorageType.GLUSTERFS) {
// return empty
getQueryReturnValue().setSucceeded(false);
return;
}
Guid glusterVolumeId = connection.getGlusterVolumeId();
if (glusterVolumeId == null) {
// retrieve the gluster volume associated with path
String path = connection.getConnection();
String[] pathElements = path.split(StorageConstants.GLUSTER_VOL_SEPARATOR);
String volumeName = pathElements[1];
String hostName = pathElements[0];
List<VDS> vdsList = vdsDao.getAll();
VDS vds = vdsList.stream().filter(v -> v.getName().equals(hostName) || interfaceDao.getAllInterfacesForVds(v.getId()).stream().anyMatch(iface -> iface.getIpv4Address().equals(hostName))).findFirst().orElse(null);
if (vds == null) {
// return empty
getQueryReturnValue().setSucceeded(false);
return;
}
GlusterVolumeEntity vol = glusterVolumeDao.getByName(vds.getClusterId(), volumeName);
if (vol == null) {
getQueryReturnValue().setSucceeded(false);
return;
}
glusterVolumeId = vol.getId();
}
getQueryReturnValue().setReturnValue(glusterGeoRepDao.getGeoRepSessions(glusterVolumeId));
getQueryReturnValue().setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class ImportVmTemplateCommandTest method mockStorageDomainStatic.
private void mockStorageDomainStatic(StorageType storageType) {
final StorageDomainStatic domain = new StorageDomainStatic();
domain.setStorageType(storageType);
when(storageDomainStaticDao.get(any())).thenReturn(domain);
}
Aggregations