use of com.emc.storageos.model.block.BlockConsistencyGroupCreate in project coprhd-controller by CoprHD.
the class ApiSystemTestUtil method createConsistencyGroup.
public URI createConsistencyGroup(String cgName, URI project) {
BlockConsistencyGroupCreate input = new BlockConsistencyGroupCreate();
input.setName(cgName);
input.setProject(project);
try {
BlockConsistencyGroupRestRep rep = client.blockConsistencyGroups().create(input);
return rep.getId();
} catch (ServiceErrorException ex) {
log.error("Exception creating consistency group: " + cgName, ex);
throw ex;
}
}
use of com.emc.storageos.model.block.BlockConsistencyGroupCreate in project coprhd-controller by CoprHD.
the class ConsistencyGroups method save.
@FlashException(referrer = { "create", "edit" })
public static void save(ConsistencyGroupForm consistencyGroup) {
flash.put(ACTIVE_PROJECT_ID, consistencyGroup.projectId);
consistencyGroup.validate("consistencyGroup");
if (Validation.hasErrors()) {
Common.handleError();
}
// NOTE : Only Create is supported at this time
if (consistencyGroup.isNew()) {
BlockConsistencyGroupCreate createParam = new BlockConsistencyGroupCreate();
createParam.setName(consistencyGroup.name);
createParam.setProject(uri(consistencyGroup.projectId));
createParam.setArrayConsistency(consistencyGroup.arrayConsistency);
BlockConsistencyGroupUtils.create(createParam);
}
flash.success(MessagesUtils.get("consistencyGroups.saved", consistencyGroup.name));
if (StringUtils.isNotBlank(consistencyGroup.referrerUrl)) {
redirect(consistencyGroup.referrerUrl);
} else {
list();
}
}
use of com.emc.storageos.model.block.BlockConsistencyGroupCreate in project coprhd-controller by CoprHD.
the class ApiTest method checkCreateConsistencyGroup.
private void checkCreateConsistencyGroup(BalancedWebResource user, boolean good) throws InterruptedException {
final BlockConsistencyGroupCreate param = new BlockConsistencyGroupCreate();
param.setName("test_group_" + System.currentTimeMillis());
param.setProject(_testProject);
if (good) {
TaskList resp = user.path("/block/consistency-groups").post(TaskList.class, param);
Assert.assertTrue(resp.getTaskList().size() == 1);
Assert.assertNotNull(resp.getTaskList().get(0).getOpId());
Assert.assertNotNull(resp.getTaskList().get(0).getResource().getId());
_group = resp.getTaskList().get(0).getResource().getId();
String groupId = _group.toString();
String opId = resp.getTaskList().get(0).getOpId();
int checkCount = 1200;
String status;
do {
// wait upto ~2 minute for group creation
Thread.sleep(100);
TaskResourceRep taskResp = user.path(String.format("/block/consistency-groups/%s/tasks/%s", groupId, opId)).get(TaskResourceRep.class);
status = taskResp.getState();
} while (status.equals("pending") && checkCount-- > 0);
if (!status.equals("ready")) {
Assert.assertTrue("ConsistencyGroup create timed out", false);
}
} else {
ClientResponse resp = user.path("/block/consistency-groups").post(ClientResponse.class, param);
Assert.assertEquals(403, resp.getStatus());
}
}
Aggregations