use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class StorageDriverMetaData method toConfiguration.
// configuration converters
public Configuration toConfiguration() {
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(KIND);
config.setId(driverName);
if (driverName != null) {
config.setConfig(KEY_DRIVER_NAME, driverName);
}
if (driverVersion != null) {
config.setConfig(KEY_DRIVER_VERSION, driverVersion);
}
if (storageName != null) {
config.setConfig(KEY_STORAGE_NAME, storageName);
}
if (storageDisplayName != null) {
config.setConfig(KEY_STORAGE_DISPLAY_NAME, storageDisplayName);
}
if (providerName != null) {
config.setConfig(KEY_PROVIDER_NAME, providerName);
}
if (providerDisplayName != null) {
config.setConfig(KEY_PROVIDER_DISPLAY_NAME, providerDisplayName);
}
if (metaType != null) {
config.setConfig(KEY_META_TYPE, metaType);
}
config.setConfig(KEY_ENABLE_SSL, String.valueOf(enableSsl));
config.setConfig(KEY_SSL_PORT, String.valueOf(sslPort));
config.setConfig(KEY_NON_SSL_PORT, String.valueOf(nonSslPort));
config.setConfig(KEY_SUPPORT_AUTOTIER_POLICY, String.valueOf(supportAutoTierPolicy));
if (driverClassName != null) {
config.setConfig(KEY_DRIVER_CLASS_NAME, driverClassName);
}
if (driverFileName != null) {
config.setConfig(KEY_DRIVER_FILE_NAME, driverFileName);
}
return config;
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class DrUtil method setLocalVdcShortId.
/**
* Update current vdc short id to zk
*
* @param vdcShortId
*/
public void setLocalVdcShortId(String vdcShortId) {
ConfigurationImpl localVdc = new ConfigurationImpl();
localVdc.setKind(Constants.CONFIG_GEO_LOCAL_VDC_KIND);
localVdc.setId(Constants.CONFIG_GEO_LOCAL_VDC_ID);
localVdc.setConfig(Constants.CONFIG_GEO_LOCAL_VDC_SHORT_ID, vdcShortId);
coordinator.persistServiceConfiguration(localVdc);
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class DrUtil method removeSite.
/**
* Will remove 3 ZNodes:
* 1. /config/disasterRecoverySites/${vdc_shortid}/${uuid} node
* 2. /sites/${uuid} node
* 3. /config/upgradetargetpropertyoverride/${uuid} node
* @param site
*/
public void removeSite(Site site) {
coordinator.removeServiceConfiguration(site.toConfiguration());
coordinator.deletePath(getSitePath(site.getUuid()));
ConfigurationImpl sitePropsCfg = new ConfigurationImpl();
sitePropsCfg.setId(site.getUuid());
sitePropsCfg.setKind(PropertyInfoExt.TARGET_PROPERTY);
coordinator.removeServiceConfiguration(sitePropsCfg);
log.info("Removed site {} configuration from ZK", site.getUuid());
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method setNodeDualInetAddressInfo.
/**
* Set node info to zk so that it can be available for lookup in coordinatorclient.
*
* @param nodeId the node_id to be persisted
* @param addresses A string of ip addresses(v4/v6) with ',' as separator
*/
public void setNodeDualInetAddressInfo(String nodeId, String addresses) {
// grab a lock and verifyPublishedDualInetAddress first
InterProcessLock lock = null;
try {
lock = getLock(Constants.NODE_DUALINETADDR_CONFIG + nodeId);
lock.acquire();
if (!verifyPublishedDualInetAddress(nodeId)) {
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setId(nodeId);
cfg.setKind(Constants.NODE_DUALINETADDR_CONFIG);
cfg.setConfig(Constants.CONFIG_DUAL_INETADDRESSES, addresses);
persistServiceConfiguration(cfg);
}
} catch (Exception e) {
log.warn("Unexpected exception during setNodeDualInetAddressInfo()", e);
} finally {
if (lock != null) {
try {
lock.release();
} catch (Exception e) {
log.warn("Unexpected exception unlocking in setNodeDualInetAddressInfo()", e);
}
}
}
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method createSiteSpecificSection.
private void createSiteSpecificSection() throws Exception {
// create VDC parent ZNode for site config in ZK
ConfigurationImpl vdcConfig = new ConfigurationImpl();
vdcConfig.setKind(Site.CONFIG_KIND);
vdcConfig.setId(vdcShortId);
persistServiceConfiguration(vdcConfig);
// insert DR active site info to ZK
Site site = new Site();
site.setUuid(getSiteId());
site.setName("Default Site");
site.setVdcShortId(vdcShortId);
site.setSiteShortId(Constants.CONFIG_DR_FIRST_SITE_SHORT_ID);
site.setState(SiteState.ACTIVE);
site.setCreationTime(System.currentTimeMillis());
if (StringUtils.isBlank(vip)) {
site.setVip(PropertyConstants.IPV4_ADDR_DEFAULT);
} else {
site.setVip(vip);
}
if (StringUtils.isBlank(vip6)) {
site.setVip6(PropertyConstants.IPV6_ADDR_DEFAULT);
} else {
site.setVip6(DualInetAddress.normalizeInet6Address(vip6));
}
site.setNodeCount(getNodeCount());
Map<String, DualInetAddress> controlNodes = getInetAddessLookupMap().getControllerNodeIPLookupMap();
Map<String, String> ipv4Addresses = new HashMap<>();
Map<String, String> ipv6Addresses = new HashMap<>();
String nodeId;
int nodeIndex = 1;
for (Map.Entry<String, DualInetAddress> cnode : controlNodes.entrySet()) {
nodeId = VDC_NODE_PREFIX + nodeIndex++;
DualInetAddress addr = cnode.getValue();
if (addr.hasInet4()) {
ipv4Addresses.put(nodeId, addr.getInet4());
} else {
ipv4Addresses.put(nodeId, PropertyConstants.IPV4_ADDR_DEFAULT);
}
if (addr.hasInet6()) {
ipv6Addresses.put(nodeId, DualInetAddress.normalizeInet6Address(addr.getInet6()));
} else {
ipv6Addresses.put(nodeId, PropertyConstants.IPV6_ADDR_DEFAULT);
}
}
site.setHostIPv4AddressMap(ipv4Addresses);
site.setHostIPv6AddressMap(ipv6Addresses);
persistServiceConfiguration(site.toConfiguration());
new DrUtil(this).setLocalVdcShortId(vdcShortId);
// update Site version in ZK
SiteInfo siteInfo = new SiteInfo(System.currentTimeMillis(), SiteInfo.NONE);
setTargetInfo(siteInfo);
addSite(site.getUuid());
log.info("Create site specific section for {} successfully", site.getUuid());
}
Aggregations