use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class PasswordServiceTest method initPasswordHandler.
private void initPasswordHandler(LocalPasswordHandler ph) {
Properties properties = generateProperties();
PasswordUtils.setDefaultProperties(properties);
PasswordUtils passUtils = new PasswordUtils();
try {
CoordinatorClient client = getCoordinatorClient();
passUtils.setCoordinator(client);
} catch (Exception e) {
log.error("Failed to set coordinator client e=", e);
throw new RuntimeException(e);
}
passUtils.setEncryptionProvider(provider);
passUtils.setDbClient(new DummyDbClient());
ph.setPasswordUtils(passUtils);
ph.setConfigService(_cfg);
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class VdcManager method updateSiteErrors.
// TODO - let's see if we can move it to VdcOpHandler later
private void updateSiteErrors() {
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
if (!drUtil.isActiveSite()) {
log.info("Step3: current site is a standby, nothing to do");
return;
}
for (Site site : drUtil.listSites()) {
SiteError error = getSiteError(site);
if (error != null) {
log.info("set site {} state to STANDBY_ERROR, set lastState to {}", site.getName(), site.getState());
coordinatorClient.setTargetInfo(site.getUuid(), error);
site.setLastState(site.getState());
site.setState(SiteState.STANDBY_ERROR);
coordinatorClient.persistServiceConfiguration(site.toConfiguration());
}
}
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class TestSysServiceBeacon method testBeacon.
@Test
@Ignore("This references a configuration that doesn't exist (syssvc-config.xml), either fix or delete this test")
public void testBeacon() throws Exception {
String curVersion = "current_version";
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/syssvc-config.xml");
SysSvcImpl sysservice = (SysSvcImpl) ctx.getBean(SERVICE_BEAN);
sysservice.start();
ServiceImpl svc = (ServiceImpl) ctx.getBean(SERVICE_INFO);
CoordinatorClient client = connectClient();
SysSvcBeaconImpl beacon = (SysSvcBeaconImpl) ctx.getBean(BEACON_BEAN);
List<Service> found = client.locateAllServices(svc.getName(), svc.getVersion(), (String) null, null);
Assert.assertNotNull(found);
Assert.assertEquals(found.size(), 1);
Service first = found.get(0);
Assert.assertEquals(first.getId(), svc.getId());
Assert.assertEquals(first.getEndpoint(), svc.getEndpoint());
Assert.assertEquals(first.getAttribute(curVersion), null);
svc.setAttribute(curVersion, "2");
beacon.publish();
found = client.locateAllServices(svc.getName(), svc.getVersion(), (String) null, null);
Assert.assertNotNull(found);
Assert.assertEquals(found.size(), 1);
first = found.get(0);
Assert.assertEquals(first.getId(), svc.getId());
Assert.assertEquals(first.getEndpoint(), svc.getEndpoint());
Assert.assertEquals(first.getAttribute(curVersion), "2");
sysservice.stop();
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class DbSvcRunner method isStarted.
/**
* Check if service is started
*
* @return
*/
public boolean isStarted() {
try {
CoordinatorClient coordinator = getCoordinator();
List<Service> service = coordinator.locateAllServices(serviceName, SVC_VERSION, null, null);
if (service.iterator().hasNext()) {
Service svc = service.iterator().next();
URI hostUri = svc.getEndpoint();
log.info("Found " + svc.getName() + "; host = " + hostUri.getHost() + "; port = " + hostUri.getPort());
return true;
}
} catch (RetryableCoordinatorException e) {
log.warn("no {} instance running. Coordinator exception message: {}", serviceName, e.getMessage());
} catch (Exception e) {
log.error("service lookup failure", e);
}
return false;
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class GeoDbSvcStartupTest method getDbClient.
protected static DbClient getDbClient() throws URISyntaxException, IOException {
if (dbClient == null) {
dbClient = new DbClientImpl();
CoordinatorClient coordinator = runner.getCoordinator();
dbClient.setCoordinatorClient(coordinator);
DbVersionInfo dbVersionInfo = new DbVersionInfo();
dbVersionInfo.setSchemaVersion(DbSvcRunner.SVC_VERSION);
dbClient.setDbVersionInfo(dbVersionInfo);
dbClient.setBypassMigrationLock(true);
EncryptionProviderImpl encryptionProvider = new EncryptionProviderImpl();
encryptionProvider.setCoordinator(coordinator);
dbClient.setEncryptionProvider(encryptionProvider);
EncryptionProviderImpl geoEncryptionProvider = new EncryptionProviderImpl();
geoEncryptionProvider.setCoordinator(coordinator);
geoEncryptionProvider.setEncryptId("geoid");
dbClient.setGeoEncryptionProvider(geoEncryptionProvider);
DbClientContext geoCtx = new DbClientContext();
geoCtx.setClusterName("GeoStorageOS");
geoCtx.setKeyspaceName("GeoStorageOS");
dbClient.setGeoContext(geoCtx);
dbClient.start();
}
return dbClient;
}
Aggregations