use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.
the class VdcConfigHelper method addVdcToCassandraStrategyOptions.
public void addVdcToCassandraStrategyOptions(List<VdcConfig> vdcConfigs, VirtualDataCenter vdc, boolean wait) throws Exception {
log.info("add vdc {} to strategy options");
for (VdcConfig vdcCfg : vdcConfigs) {
if (vdcCfg.getId().equals(vdc.getId())) {
log.info("find the vdc cfg {}", vdcCfg);
// update the VirtualDataCenter object of the vdc
mergeVdcConfig(vdcCfg);
vdc = dbClient.queryObject(VirtualDataCenter.class, vdc.getId());
addStrategyOption(vdc, wait);
break;
}
}
}
use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.
the class ConnectVdcTaskOp method configMerge.
private VdcConfigSyncParam configMerge(VdcPreCheckResponse operatedVdcInfo, String ipsecKey) {
// step 2: merge the vdc config info of all sites, as the initiator, we should has all current vdc config info
VdcConfigSyncParam vdcConfigList = new VdcConfigSyncParam();
vdcConfigList.setVdcConfigVersion(DrUtil.newVdcConfigVersion());
List<VdcConfig> list = vdcConfigList.getVirtualDataCenters();
for (VirtualDataCenter vdc : getAllVdc()) {
if (vdc.getShortId().equals(vdcInfo.getProperty(GeoServiceJob.VDC_SHORT_ID))) {
continue;
}
log.info("add {} to the merged vdc config", vdc.getShortId());
VdcConfig vdcConfig = helper.toConfigParam(vdc);
list.add(vdcConfig);
}
VdcConfig operatedConfig = mergeVdcInfo(operatedVdcInfo);
list.add(operatedConfig);
vdcConfigList.setIpsecKey(ipsecKey);
return vdcConfigList;
}
use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.
the class DBClient method recoverVdcConfigFromRecoverFile.
/**
* Recover the system after add/remove vdc failures from recover file
*
* @param recoverFileName
*/
public void recoverVdcConfigFromRecoverFile(String recoverFileName) {
List<VdcConfig> newVdcConfigList = loadRecoverFileToRecoverInfo(recoverFileName);
InternalDbClient geoDbClient = (InternalDbClient) ctx.getBean("geodbclient");
geoDbClient.stopClusterGossiping();
// Don't recover version and ipsec key. Need to reconsider once all vdc data moving to ZK.
vdcConfHelper.syncVdcConfig(newVdcConfigList, null, true, DrUtil.newVdcConfigVersion(), "");
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
log.error("Error in recover Vdc Config, e=" + e);
}
System.out.println("Recover successfully, please wait for the whole vdc reboot.");
}
use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.
the class DBClient method readRecoverBackupInfo.
private List<VdcConfig> readRecoverBackupInfo() {
List<VdcConfig> newVdcConfigList = new ArrayList<VdcConfig>();
List<URI> ids = _dbClient.queryByType(VdcOpLog.class, true);
VdcOpLog latestOp = null;
for (URI id : ids) {
if (latestOp == null) {
latestOp = _dbClient.queryObject(VdcOpLog.class, id);
} else {
VdcOpLog thisOp = _dbClient.queryObject(VdcOpLog.class, id);
if (thisOp.getCreationTime().getTimeInMillis() > latestOp.getCreationTime().getTimeInMillis()) {
latestOp = thisOp;
}
}
}
if (latestOp != null) {
byte[] vdcConfigInfo = latestOp.getVdcConfigInfo();
try {
List<VirtualDataCenter> vdcList = (List<VirtualDataCenter>) SerializerUtils.deserialize(vdcConfigInfo);
if (vdcList != null) {
for (VirtualDataCenter vdc : vdcList) {
newVdcConfigList.add(vdcConfHelper.toConfigParam(vdc));
}
}
} catch (Exception e) {
log.error("error in recovervdcinfo: " + e);
}
}
return newVdcConfigList;
}
use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.
the class ConnectVdcTaskOp method sendVdcNodeCheckRequest.
/**
* Send node check request to target vdc.
*
* @param vdcProp vdc to send msg to
* @param vdcsToCheck list of vdc's with nodes to check
* @return
* @throws Exception
*/
private VdcNodeCheckResponse sendVdcNodeCheckRequest(Properties vdcProp, Collection<VirtualDataCenter> vdcsToCheck) {
List<VdcConfig> virtualDataCenters = new ArrayList<VdcConfig>();
for (VirtualDataCenter vdc : vdcsToCheck) {
VdcConfig vdcConfig = new VdcConfig();
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
vdcConfig.setId(vdc.getId());
vdcConfig.setShortId(vdc.getShortId());
if (activeSite.getHostIPv4AddressMap() != null && !activeSite.getHostIPv4AddressMap().isEmpty() && activeSite.isUsingIpv4()) {
HashMap<String, String> ipv4AddrMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
vdcConfig.setHostIPv4AddressesMap(ipv4AddrMap);
} else if (activeSite.getHostIPv6AddressMap() != null && !activeSite.getHostIPv6AddressMap().isEmpty()) {
HashMap<String, String> ipv6AddrMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
vdcConfig.setHostIPv6AddressesMap(ipv6AddrMap);
} else {
throw GeoException.fatals.cannotPerformOperation(vdc.getId().toString(), " no nodes were found on VirtualDataCenter object");
}
virtualDataCenters.add(vdcConfig);
}
return sendVdcNodeCheckRequest(vdcProp, virtualDataCenters);
}
Aggregations