use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method checkNoHost.
@Test
public void checkNoHost() {
StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
parameters.setStorageServerConnection(newNFSConnection);
parameters.setVdsId(null);
parameters.setStorageServerConnection(newNFSConnection);
when(storageConnDao.get(newNFSConnection.getId())).thenReturn(oldNFSConnection);
ValidateTestUtils.runAndAssertValidateSuccess(command);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method succeedUpdateNFSCommandWithDomain.
@Test
public void succeedUpdateNFSCommandWithDomain() {
StorageServerConnections newNFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
parameters.setStorageServerConnection(newNFSConnection);
VDSReturnValue returnValueConnectSuccess = new VDSReturnValue();
StoragePoolIsoMap map = new StoragePoolIsoMap();
returnValueConnectSuccess.setSucceeded(true);
StorageDomain domain = createDomain();
doReturn(Collections.singletonList(map)).when(command).getStoragePoolIsoMap(domain);
returnValueConnectSuccess.setReturnValue(domain);
doReturn(returnValueConnectSuccess).when(command).getStatsForDomain(domain);
doReturn(true).when(command).connectToStorage();
List<StorageDomain> domains = Collections.singletonList(domain);
doReturn(domains).when(command).getStorageDomainsByConnId(newNFSConnection.getId());
doNothing().when(command).changeStorageDomainStatusInTransaction(StorageDomainStatus.Locked);
doNothing().when(command).disconnectFromStorage();
doNothing().when(command).updateStorageDomain(domains);
command.executeCommand();
CommandAssertUtils.checkSucceeded(command, true);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method isConnWithSameDetailsExistBlockDomains.
@Test
public void isConnWithSameDetailsExistBlockDomains() {
StorageServerConnections newISCSIConnection = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3260", "user1", "mypassword123");
StorageServerConnections connection1 = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3260", "user1", "mypassword123");
when(iscsiStorageHelper.findConnectionWithSameDetails(newISCSIConnection)).thenReturn(connection1);
boolean isExists = command.isConnWithSameDetailsExists(newISCSIConnection, null);
assertTrue(isExists);
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class AddStorageDomainCommonTest method setUp.
@Before
public void setUp() {
Guid vdsId = Guid.newGuid();
spId = Guid.newGuid();
connId = Guid.newGuid();
sd = new StorageDomainStatic();
sd.setId(Guid.newGuid());
sd.setStorageType(StorageType.NFS);
sd.setStorageDomainType(StorageDomainType.Data);
sd.setStorageName("newStorage");
sd.setStorageFormat(StorageFormatType.V3);
sd.setStorage(connId.toString());
VDS vds = new VDS();
vds.setId(vdsId);
vds.setStatus(VDSStatus.Up);
vds.setStoragePoolId(spId);
when(vdsDao.get(vdsId)).thenReturn(vds);
sp = new StoragePool();
sp.setId(spId);
sp.setCompatibilityVersion(Version.getLast());
when(spDao.get(spId)).thenReturn(sp);
StorageServerConnections conn = new StorageServerConnections();
conn.setId(connId.toString());
conn.setStorageType(StorageType.NFS);
when(sscDao.get(connId.toString())).thenReturn(conn);
cmd.getParameters().setStorageDomainId(sd.getId());
cmd.getParameters().setStorageDomain(sd);
cmd.getParameters().setVdsId(vdsId);
cmd.setVdsId(vdsId);
cmd.init();
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class UpdateStorageServerConnectionCommandTest method failDomainIsActive.
@Test
public void failDomainIsActive() {
StorageServerConnections NFSConnection = createNFSConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data2", StorageType.NFS, NfsVersion.V4, 300, 0);
when(command.getConnection()).thenReturn(NFSConnection);
doReturn(oldNFSConnection).when(storageConnDao).get(any());
// Create an active domain.
StorageDomain domain = new StorageDomain();
domain.setStatus(StorageDomainStatus.Active);
domain.setStorageDomainSharedStatus(StorageDomainSharedStatus.Active);
initDomainListForConnection(NFSConnection.getId(), domain);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_ACTION_DOMAIN_MUST_BE_IN_MAINTENANCE_OR_UNATTACHED);
}
Aggregations