use of com.cloud.legacymodel.communication.command.CreateStoragePoolCommand in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResourceTest method testCreateStoragePoolCommand.
@Test
public void testCreateStoragePoolCommand() {
final StoragePool pool = Mockito.mock(StoragePool.class);
final CreateStoragePoolCommand command = new CreateStoragePoolCommand(true, pool);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, this.libvirtComputingResource);
assertTrue(answer.getResult());
}
use of com.cloud.legacymodel.communication.command.CreateStoragePoolCommand in project cosmic by MissionCriticalCloud.
the class CloudStackPrimaryDataStoreLifeCycleImpl method createStoragePool.
protected boolean createStoragePool(final long hostId, final StoragePool pool) {
s_logger.debug("creating pool " + pool.getName() + " on host " + hostId);
if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.LVM && pool.getPoolType() != StoragePoolType.SMB && pool.getPoolType() != StoragePoolType.Gluster) {
s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType());
return false;
}
final CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool);
final Answer answer = agentMgr.easySend(hostId, cmd);
if (answer != null && answer.getResult()) {
return true;
} else {
primaryDataStoreDao.expunge(pool.getId());
String msg = "";
if (answer != null) {
msg = "Can not create storage pool through host " + hostId + " due to " + answer.getDetails();
s_logger.warn(msg);
} else {
msg = "Can not create storage pool through host " + hostId + " due to CreateStoragePoolCommand returns null";
s_logger.warn(msg);
}
throw new CloudRuntimeException(msg);
}
}
use of com.cloud.legacymodel.communication.command.CreateStoragePoolCommand in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testCreateStoragePoolCommand.
@Test
public void testCreateStoragePoolCommand() {
final StoragePoolVO poolVO = Mockito.mock(StoragePoolVO.class);
final XsHost xsHost = Mockito.mock(XsHost.class);
final CreateStoragePoolCommand createStorageCommand = new CreateStoragePoolCommand(false, poolVO);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(this.citrixResourceBase.getHost()).thenReturn(xsHost);
final Answer answer = wrapper.execute(createStorageCommand, this.citrixResourceBase);
verify(this.citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
Aggregations