use of com.emc.storageos.hds.model.Add in project coprhd-controller by CoprHD.
the class HDSApiExportManager method constructAddiSCSIInitiatorHostQuery.
/**
* Constructs the addHostQuery.
*
* @param hostName
* @param ipAddress
* @param portWWNList
* @return
*/
private String constructAddiSCSIInitiatorHostQuery(HDSHost hdshost, List<String> portWWNList) {
Map<String, Object> attributeMap = new HashMap<String, Object>();
List<ISCSIName> wwnList = new ArrayList<ISCSIName>();
Add addOp = new Add(HDSConstants.HOST);
attributeMap.put(HDSConstants.HOST, hdshost);
attributeMap.put(HDSConstants.ADD, addOp);
if (null != portWWNList && !portWWNList.isEmpty()) {
for (String portWWN : portWWNList) {
ISCSIName wwn = new ISCSIName(portWWN, null);
wwnList.add(wwn);
}
}
attributeMap.put(HDSConstants.ISCSINAME_LIST, wwnList);
String addHostWithISCSINamesQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.ADD_HOST_WITH_ISCSINAMES_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
return addHostWithISCSINamesQuery;
}
use of com.emc.storageos.hds.model.Add in project coprhd-controller by CoprHD.
the class HDSApiExportManager method constructWWNQuery.
/**
* Construct the WWN Query by adding multiple WWNs.
* This query should be used to add FC initiators to the FC HSD.
*
* @param systemId
* @param hsdId
* @param wwnList
* @return
*/
private String constructWWNQuery(String systemId, String hsdId, List<String> wwnList, String model) {
Map<String, Object> attributeMap = new HashMap<String, Object>();
StorageArray array = new StorageArray(systemId);
Add addOp = new Add(HDSConstants.ADD_WWN_TO_HSD_TARGET);
attributeMap.put(HDSConstants.STORAGEARRAY, array);
attributeMap.put(HDSConstants.ADD, addOp);
attributeMap.put(HDSConstants.MODEL, model);
HostStorageDomain hsd = new HostStorageDomain(hsdId);
attributeMap.put(HDSConstants.HOST_STORAGE_DOMAIN, hsd);
List<WorldWideName> wwnObjList = new ArrayList<WorldWideName>();
if (null != wwnList && !wwnList.isEmpty()) {
for (String initiatorWWN : wwnList) {
WorldWideName wwn = new WorldWideName(initiatorWWN);
wwnObjList.add(wwn);
}
}
attributeMap.put(HDSConstants.WWN_LIST, wwnObjList);
String addWWNQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.ADD_WWN_TO_HSD_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
return addWWNQuery;
}
use of com.emc.storageos.hds.model.Add in project coprhd-controller by CoprHD.
the class HDSApiExportManager method addHostStorageDomain.
/**
* Add new HostStorageDomain.
*
* @param systemId
* @param targetPortID
* @param hsdNickName
* @param hostMode.
* @param hostModeOption
* @param model
* @return
* @throws Exception
*/
public HostStorageDomain addHostStorageDomain(String systemId, String targetPortID, String domainType, String hsdName, String hsdNickName, String hostMode, String hostModeOption, String model) throws Exception {
InputStream responseStream = null;
HostStorageDomain hsd = null;
try {
Map<String, Object> attributeMap = new HashMap<String, Object>();
StorageArray array = new StorageArray(systemId);
Add addOp = new Add(HDSConstants.HOST_STORAGE_DOMAIN);
attributeMap.put(HDSConstants.STORAGEARRAY, array);
attributeMap.put(HDSConstants.ADD, addOp);
attributeMap.put(HDSConstants.MODEL, model);
HostStorageDomain inputHsd = new HostStorageDomain(targetPortID, hsdName, domainType, hsdNickName);
inputHsd.setHostMode(hostMode);
inputHsd.setHostModeOption(hostModeOption);
attributeMap.put(HDSConstants.HOST_STORAGE_DOMAIN, inputHsd);
String addHSDToSystemQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.ADD_HSD_TO_SYSTEM_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
log.info("Query to create HostStorageDomain: {}", addHSDToSystemQuery);
URI endpointURI = hdsApiClient.getBaseURI();
ClientResponse response = hdsApiClient.post(endpointURI, addHSDToSystemQuery);
if (HttpStatus.SC_OK == response.getStatus()) {
responseStream = response.getEntityInputStream();
JavaResult javaResult = SmooksUtil.getParsedXMLJavaResult(responseStream, HDSConstants.SMOOKS_CONFIG_FILE);
verifyErrorPayload(javaResult);
hsd = javaResult.getBean(HostStorageDomain.class);
if (null == hsd) {
throw HDSException.exceptions.notAbleToAddHSD(systemId);
}
} else {
throw HDSException.exceptions.invalidResponseFromHDS(String.format("Not able to add HostStorageDomain due to invalid response %1$s from server", response.getStatus()));
}
} finally {
if (null != responseStream) {
try {
responseStream.close();
} catch (IOException e) {
log.warn("IOException occurred while closing the response stream");
}
}
}
return hsd;
}
use of com.emc.storageos.hds.model.Add in project coprhd-controller by CoprHD.
the class HDSApiExportManager method constructISCSIQuery.
/**
* Construct the iSCSINames Query by adding multiple WWNs.
* This query should be used to add the iSCSI initiators to the iSCSI HSD.
*
* @param systemId
* @param hsdId
* @param wwnList
* @return
*/
private String constructISCSIQuery(String systemId, String hsdId, List<String> scsiNameList, String model) {
Map<String, Object> attributeMap = new HashMap<String, Object>();
StorageArray array = new StorageArray(systemId);
Add addOp = new Add(HDSConstants.ISCSI_NAME_FOR_HSD_TARGET);
attributeMap.put(HDSConstants.STORAGEARRAY, array);
attributeMap.put(HDSConstants.ADD, addOp);
attributeMap.put(HDSConstants.MODEL, model);
HostStorageDomain hsd = new HostStorageDomain(hsdId);
attributeMap.put(HDSConstants.HOST_STORAGE_DOMAIN, hsd);
List<ISCSIName> iSCSIObjList = new ArrayList<ISCSIName>();
if (null != scsiNameList && !scsiNameList.isEmpty()) {
for (String iScsiName : scsiNameList) {
ISCSIName iSCSIName = new ISCSIName(iScsiName, null);
iSCSIObjList.add(iSCSIName);
}
}
attributeMap.put(HDSConstants.ISCSINAME_LIST, iSCSIObjList);
String addISCSINamesToHSDQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.ADD_ISCSI_NAME_TO_HSD_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
return addISCSINamesToHSDQuery;
}
use of com.emc.storageos.hds.model.Add in project coprhd-controller by CoprHD.
the class HDSApiVolumeManager method constructAddLUSEQuery.
private String constructAddLUSEQuery(String systemId, String metaHead, List<String> ldevIds) {
Map<String, Object> attributeMap = new HashMap<String, Object>();
List<LDEV> ldevsList = new LinkedList<LDEV>();
StorageArray storageArray = new StorageArray(systemId);
attributeMap.put(HDSConstants.STORAGEARRAY, storageArray);
Add addOp = new Add(HDSConstants.LUSE_TARGET, true);
attributeMap.put(HDSConstants.ADD, addOp);
if (null != ldevIds && !ldevIds.isEmpty()) {
LDEV metaHeadLDEV = new LDEV(metaHead);
ldevsList.add(metaHeadLDEV);
for (String ldevId : ldevIds) {
LDEV metaMemberLDEV = new LDEV(ldevId);
ldevsList.add(metaMemberLDEV);
}
}
attributeMap.put("LDEV_List", ldevsList);
String addLUSEVolumeInputXML = InputXMLGenerationClient.getInputXMLString(HDSConstants.ADD_LUSE_VOLUME_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
return addLUSEVolumeInputXML;
}
Aggregations