use of org.ovirt.engine.core.common.utils.Pair in project ovirt-engine by oVirt.
the class FCPStorageHelper method runConnectionStorageToDomain.
@Override
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) {
VDSReturnValue returnValue = backend.getResourceManager().runVdsCommand(VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, storagePoolId, StorageType.FCP, Collections.singletonList(getFCPConnection())));
boolean isSuccess = returnValue.getSucceeded();
EngineFault engineFault = null;
if (!isSuccess && returnValue.getVdsError() != null) {
engineFault = new EngineFault();
engineFault.setError(returnValue.getVdsError().getCode());
}
return new Pair<>(isSuccess, engineFault);
}
use of org.ovirt.engine.core.common.utils.Pair in project ovirt-engine by oVirt.
the class GLUSTERFSStorageHelper method runConnectionStorageToDomain.
@Override
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) {
VDS vds = vdsDao.get(vdsId);
if (!canVDSConnectToGlusterfs(vds)) {
log.error("Couldn't find glusterfs-cli package on vds {} (needed for connecting storage domain {}).", vds.getName(), storageDomain.getName());
addMessageToAuditLog(AuditLogType.VDS_CANNOT_CONNECT_TO_GLUSTERFS, null, vds);
return new Pair<>(false, null);
}
return super.runConnectionStorageToDomain(storageDomain, vdsId, type);
}
use of org.ovirt.engine.core.common.utils.Pair in project ovirt-engine by oVirt.
the class RemoveCinderDiskCommand method freeVmSnapshotsWithWait.
private void freeVmSnapshotsWithWait() {
if (getParameters().getVmId() != null) {
EngineLock snapshotsEngineLock = new EngineLock();
Map<String, Pair<String, String>> snapshotsExclusiveLockMap = Collections.singletonMap(getParameters().getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_SNAPSHOTS, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED));
snapshotsEngineLock.setExclusiveLocks(snapshotsExclusiveLockMap);
lockManager.releaseLock(snapshotsEngineLock);
}
}
use of org.ovirt.engine.core.common.utils.Pair in project ovirt-engine by oVirt.
the class GetStorageDomainsWithAttachedStoragePoolGuidQueryTest method testStoragePoolIdReturnNullStoragePool.
@Test
public void testStoragePoolIdReturnNullStoragePool() {
mockStoragePoolDao(null);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
when(paramsMock.isCheckStoragePoolStatus()).thenReturn(Boolean.TRUE);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), Guid.newGuid());
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.utils.Pair in project ovirt-engine by oVirt.
the class GetStorageDomainsWithAttachedStoragePoolGuidQueryTest method testUninitializedStoragePool.
@Test
public void testUninitializedStoragePool() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Uninitialized);
mockStoragePoolDao(storagePool);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
when(paramsMock.isCheckStoragePoolStatus()).thenReturn(Boolean.TRUE);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), Guid.newGuid());
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
Aggregations