use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SetupUtils method markSetupComplete.
public static void markSetupComplete() {
if (complete) {
return;
}
if (StorageOsPlugin.isEnabled()) {
CoordinatorClient coordinatorClient = StorageOsPlugin.getInstance().getCoordinatorClient();
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(CONFIG_KIND);
config.setId(CONFIG_ID);
config.setConfig(COMPLETE, Boolean.TRUE.toString());
coordinatorClient.persistServiceConfiguration(config);
complete = true;
} else if (Play.mode.isDev()) {
complete = true;
}
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class StorageOsPlugin method onApplicationStart.
/**
* Called at application start (and at each reloading) Time to start stateful things.
*/
@Override
public void onApplicationStart() {
// NOSONAR
instance = this;
// ("Suppressing Sonar violation of Lazy initialization of static fields should be synchronized for field instance")
if (!isEnabled()) {
return;
}
try {
Logger.info("Connecting to Coordinator Service");
// To using Spring profile feature
context = new GenericXmlApplicationContext();
context.getEnvironment().setActiveProfiles(System.getProperty("buildType"));
context.load(getContextFiles());
context.refresh();
Logger.info("Connected to Coordinator Service");
zkConnection = getBean("zkconn", ZkConnection.class);
coordinatorClient = getBean("coordinator", CoordinatorClient.class);
encryptionProvider = getBean("encryptionProvider", EncryptionProvider.class);
authSvcEndPointLocator = getBean("authSvcEndpointLocator", AuthSvcEndPointLocator.class);
Validator.setAuthSvcEndPointLocator(authSvcEndPointLocator);
Validator.setCoordinator(coordinatorClient);
// need reference to local-security-conf.xml to load this
Validator.setStorageOSUserRepository(null);
coordinatorClient.start();
encryptionProvider.start();
Logger.info("Started ViPR connection, version: %s", version);
KeyStoreExporter keystoreExporter = getBean("keystoreExporter", KeyStoreExporter.class);
keystoreExporter.export();
// register node listener for catalog acl change
coordinatorClient.addNodeListener(new CatalogAclListener());
Logger.info("added CatalogAclListener");
} catch (Exception e) {
Logger.error(e, "Error initializing ViPR Connection");
shutdown();
}
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class Maintenance method getClusterStateFromCoordinator.
private static ClusterInfo getClusterStateFromCoordinator() {
if (StorageOsPlugin.isEnabled()) {
CoordinatorClient coordinatorClient = StorageOsPlugin.getInstance().getCoordinatorClient();
ClusterInfo.ClusterState clusterState = coordinatorClient.getControlNodesState();
if (clusterState != null) {
ClusterInfo clusterInfo = new ClusterInfo();
clusterInfo.setCurrentState(clusterState.toString());
return clusterInfo;
}
}
return null;
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class DrZkHealthMonitor method start.
@Override
public void start() {
CoordinatorClient coordinator = getCoordinator().getCoordinatorClient();
String barrierPath = String.format("%s/%s%s", ZkPath.SITES, coordinator.getSiteId(), DR_SWITCH_TO_ZK_OBSERVER_BARRIER);
switchToZkObserverBarrier = coordinator.getDistributedDoubleBarrier(barrierPath, coordinatorExt.getNodeCount());
super.start();
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method getSofttwareWithRetry.
private void getSofttwareWithRetry() throws Exception, InterruptedException {
int retryTimes = 0;
RepositoryInfo targetInfo = null;
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
while (retryTimes <= MAX_VERSION_RETRY_TIMES) {
retryTimes++;
targetInfo = coordinatorClient.getTargetInfo(RepositoryInfo.class);
if (targetInfo == null) {
log.info("can't get version, try {} seconds later", MAX_VERSION_RETRY_INTERVAL / 1000);
Thread.sleep(MAX_VERSION_RETRY_INTERVAL);
continue;
}
this.softwareVersion = targetInfo.getCurrentVersion().toString();
log.info("Version: {}", softwareVersion);
break;
}
if (targetInfo == null) {
throw new Exception("Can't get version information from coordinator client");
}
}
Aggregations