use of com.emc.storageos.security.geo.exceptions.FatalGeoException in project coprhd-controller by CoprHD.
the class VdcControllerTest method testRemoveVdcInUsePreCheck.
/**
* Remove vdc2 from vdc1
*/
// Test hanging in IDE and "gradlew test"
@Test
public void testRemoveVdcInUsePreCheck() throws Exception {
// create a mock db with 2 existing vdc
dbClient.buildInitData(2);
VirtualDataCenter vdc1 = dbClient.vdcList.get(0);
VirtualDataCenter vdc2 = dbClient.vdcList.get(1);
log.info("Testing precheck for removing vdc2 {} from vdc1 {}", vdc2.getId(), vdc1.getId());
VirtualDataCenterInUse vdcInUse = new VirtualDataCenterInUse();
vdcInUse.setId(vdc2.getId());
vdcInUse.setInUse(true);
dbClient.createObject(vdcInUse);
// Start execute vdc remove
try {
String reqId = "remove-taskid-0003";
addTask(reqId, vdc2.getId());
vdcController.removeVdc(vdc2, reqId, null);
Assert.assertTrue("Precheck should throw an exception", false);
} catch (Exception ex) {
log.error("precheck error ", ex);
Assert.assertTrue(ex instanceof FatalGeoException);
}
}
use of com.emc.storageos.security.geo.exceptions.FatalGeoException in project coprhd-controller by CoprHD.
the class RemoveVdcTaskOp method updateConfigForRemovedVdc.
/**
* Update new vdc config for the site to be remove - only include itself
*/
private void updateConfigForRemovedVdc(boolean ignoreException) {
operatedVdc.setConnectionStatus(ConnectionStatus.ISOLATED);
operatedVdc.setRepStatus(GeoReplicationStatus.REP_NONE);
operatedVdc.setVersion(new Date().getTime());
List<VirtualDataCenter> localVdcList = new ArrayList<>(1);
localVdcList.add(operatedVdc);
VdcConfigSyncParam syncParam = buildConfigParam(localVdcList);
log.info("send {} to removed vdc {}", syncParam, operatedVdc.getShortId());
try {
geoClientCache.getGeoClient(operatedVdc.getShortId()).syncVdcConfig(syncParam, operatedVdc.getLabel());
} catch (FatalGeoException e) {
if (!ignoreException) {
throw e;
}
}
}
use of com.emc.storageos.security.geo.exceptions.FatalGeoException in project coprhd-controller by CoprHD.
the class VdcControllerTest method testAddVdcPrecheckFailure.
// Test hanging in IDE and "gradlew test"
@Test
public void testAddVdcPrecheckFailure() throws Exception {
// create a mock db with 2 existing vdc
dbClient.buildInitData(2);
VirtualDataCenter vdc1 = dbClient.vdcList.get(0);
vdc1.setConnectionStatus(VirtualDataCenter.ConnectionStatus.CONNECTING);
VirtualDataCenter newVdc = newVdcForAdding("vdc2");
log.info("Testing connect vdc2 {} to vdc1 {}", newVdc.getShortId(), vdc1.getId());
// Start execute vdc connect
try {
Properties vdcInfo = GeoServiceHelper.getVDCInfo(newVdc);
String reqId = "taskid-0003";
addTask(reqId, vdc1.getId());
// Start execute vdc connect
vdcController.connectVdc(vdc1, reqId, Arrays.asList(new Object[] { vdcInfo }));
Assert.assertTrue("Precheck should throw an exception", false);
} catch (Exception ex) {
log.error("precheck error ", ex);
Assert.assertTrue(ex instanceof FatalGeoException);
}
}
use of com.emc.storageos.security.geo.exceptions.FatalGeoException in project coprhd-controller by CoprHD.
the class VdcControllerTest method testRemoveVdcPreCheck.
/**
* Remove vdc2 from vdc1
*/
// Test hanging in IDE and "gradlew test"
@Test
public void testRemoveVdcPreCheck() throws Exception {
// create a mock db with 2 existing vdc
dbClient.buildInitData(2);
VirtualDataCenter vdc1 = dbClient.vdcList.get(0);
VirtualDataCenter vdc2 = dbClient.vdcList.get(1);
log.info("Testing precheck for removing vdc2 {} from vdc1 {}", vdc2.getId(), vdc1.getId());
// create a geo object referencing a geo visible object in vdc2
TestGeoObject obj = new TestGeoObject();
obj.setId(URIUtil.createId(TestGeoObject.class));
String varrayId = URIUtil.createId(VirtualArray.class).toString();
varrayId = varrayId.replace("vdc1", "vdc2");
obj.setVarray(new URI(varrayId));
dbClient.testGeoList.add(obj);
// Start execute vdc remove
try {
String reqId = "remove-taskid-0002";
addTask(reqId, vdc2.getId());
vdcController.removeVdc(vdc2, reqId, null);
Assert.assertTrue("Precheck should throw an exception", false);
} catch (Exception ex) {
log.error("precheck error ", ex);
Assert.assertTrue(ex instanceof FatalGeoException);
}
}
Aggregations