use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SiteTest method test.
@Test
public void test() {
site.setNodeCount(3);
site.setUuid("uuid-1");
site.setVip("10.247.101.158");
site.getHostIPv4AddressMap().put("node1", "10.247.101.157");
site.getHostIPv4AddressMap().put("node2", "10.247.101.156");
site.getHostIPv4AddressMap().put("node3", "10.247.101.155");
site.getHostIPv4AddressMap().put("node4", "10.247.101.154");
site.getHostIPv4AddressMap().put("node5", "10.247.101.153");
Configuration configuration = site.toConfiguration();
Site target = new Site(configuration);
for (int i = 1; i <= site.getNodeCount(); i++) {
assertEquals(site.getHostIPv4AddressMap().get("node" + i), target.getHostIPv4AddressMap().get("node" + i));
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class DrPostFailoverHandler method updateStatus.
/**
* Update execution status for current handler
*
* @param status
*/
protected void updateStatus(Status status) {
Configuration config = coordinator.queryConfiguration(CONFIG_KIND, CONFIG_ID);
if (config == null) {
ConfigurationImpl configImpl = new ConfigurationImpl();
configImpl.setKind(CONFIG_KIND);
configImpl.setId(CONFIG_ID);
config = configImpl;
}
config.setConfig(name, status.toString());
coordinator.persistServiceConfiguration(config);
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class DrUtil method listSites.
/**
* List all sites in given vdc
*
* @return list of all sites
*/
public List<Site> listSites(String vdcShortId) {
List<Site> result = new ArrayList<>();
String siteKind = String.format("%s/%s", Site.CONFIG_KIND, vdcShortId);
for (Configuration siteConfig : coordinator.queryAllConfiguration(siteKind)) {
result.add(new Site(siteConfig));
}
return result;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method getMigrationStatus.
public MigrationStatus getMigrationStatus() {
log.debug("getMigrationStatus: target version: \"{}\"", getTargetDbSchemaVersion());
// TODO support geodbsvc
Configuration config = queryConfiguration(_zkConnection.getSiteId(), getVersionedDbConfigPath(Constants.DBSVC_NAME, getTargetDbSchemaVersion()), GLOBAL_ID);
if (config == null || config.getConfig(MIGRATION_STATUS) == null) {
log.debug("config is null");
return null;
}
MigrationStatus status = MigrationStatus.valueOf(config.getConfig(MIGRATION_STATUS));
log.debug("status: {}", status);
return status;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method loadInetAddressFromCoordinator.
/**
* Try to look up the node in zk configuration - this is called ONLY if map does not have it.
*
* @param nodeId
* the node in the lookup, any node
* @return DualInetAddress of the node
*/
public DualInetAddress loadInetAddressFromCoordinator(String nodeId) {
DualInetAddress dualAddress = null;
// grab the lock
InterProcessLock lock = null;
try {
lock = getLock(NODE_DUALINETADDR_CONFIG + nodeId);
lock.acquire();
Configuration config = queryConfiguration(Constants.NODE_DUALINETADDR_CONFIG, nodeId);
if (config != null) {
dualAddress = parseInetAddressConfig(config);
}
} catch (Exception e) {
log.warn("Unexpected exception during loadInetAddressFromCoordinator()", e);
} finally {
if (lock != null) {
try {
lock.release();
} catch (Exception e) {
log.warn("Unexpected exception unlocking loadInetAddressFromCoordinator()", e);
}
}
}
// Add it to the map
if (dualAddress != null) {
inetAddressLookupMap.put(nodeId, dualAddress);
}
return dualAddress;
}
Aggregations