use of com.emc.storageos.hds.model.StorageArray in project coprhd-controller by CoprHD.
the class HDSBatchApiExportManager method constructISCSINamesQuery.
/**
* Constructs a batch query for given HSD's and each with a set of
* WorldWideName's to add. This query should be used to add FC initiators to
* the FC HSD.
*
* @param systemId
* - Represents the storage system objectID.
* @param hsdList
* - List of HostStorageDomain objects.
* @return
*/
private String constructISCSINamesQuery(String systemId, List<HostStorageDomain> hsdList, 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);
attributeMap.put(HDSConstants.HOSTGROUP_LIST, hsdList);
String addWWNQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.BATCH_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.StorageArray in project coprhd-controller by CoprHD.
the class HDSBatchApiExportManager method constructWWNQuery.
/**
* Constructs a batch query for given HSD's and the WorldWideName's to add.
* This query should be used to add FC initiators to the FC HSD. This
* constructs the xml input string for multiple HSD's and each HSD with
* multiple WWN's.
*
* @param systemId
* - StorageSystem ObjectID.
* @param hsdList
* - List of HSD objects.
* @return - XML String to add HSD's with WWN's.
*/
private String constructWWNQuery(String systemId, List<HostStorageDomain> hsdList, 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);
attributeMap.put(HDSConstants.HOSTGROUP_LIST, hsdList);
return InputXMLGenerationClient.getInputXMLString(HDSConstants.BATCH_ADD_WWN_TO_HSD_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
}
use of com.emc.storageos.hds.model.StorageArray in project coprhd-controller by CoprHD.
the class HDSBatchApiExportManager method addHostStorageDomains.
/**
* This method makes http POST call with a payload of bulk
* HostStorageDomains.
*
* @param systemId
* - SystemObjectID.
* @param hostGroups
* - List of HostStorageDomain objects.
* @return - Returns a List of created HostStorageDomain on Array.
* @throws Exception
* - In case processing errors.
*/
public List<HostStorageDomain> addHostStorageDomains(String systemId, List<HostStorageDomain> hostGroups, String model) throws Exception {
InputStream responseStream = null;
List<HostStorageDomain> hsdList = 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);
attributeMap.put(HDSConstants.HOSTGROUP_LIST, hostGroups);
String addHSDToSystemQuery = InputXMLGenerationClient.getInputXMLString(HDSConstants.BATCH_ADD_HSDS_TO_SYSTEM_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
log.info("Batch query to create HostStorageDomains: {}", 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);
hsdList = (List<HostStorageDomain>) javaResult.getBean(HDSConstants.HSD_RESPONSE_BEAN_ID);
if (null == hsdList || hsdList.isEmpty()) {
throw HDSException.exceptions.notAbleToAddHSD(systemId);
}
} else {
throw HDSException.exceptions.invalidResponseFromHDS(String.format("Not able to add HostStorageDomains 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 addHostStorageDomains");
}
}
}
return hsdList;
}
use of com.emc.storageos.hds.model.StorageArray in project coprhd-controller by CoprHD.
the class HDSApiDiscoveryManager method getStoragePoolTierInfo.
/**
* Returns all storage system information.
*
* @return
* @throws Exception
*/
public Pool getStoragePoolTierInfo(String systemObjectID, String poolObjectID) throws Exception {
InputStream responseStream = null;
Pool pool = null;
URI endpointURI = hdsApiClient.getBaseURI();
Map<String, Object> attributeMap = new HashMap<String, Object>();
StorageArray inputStorageArray = new StorageArray(systemObjectID);
Get getOp = new Get(HDSConstants.STORAGEARRAY);
attributeMap.put(HDSConstants.STORAGEARRAY, inputStorageArray);
Pool inputPool = new Pool(poolObjectID);
attributeMap.put(HDSConstants.JOURNAL_POOL, inputPool);
attributeMap.put(HDSConstants.GET, getOp);
String getPoolTieringInfoInputXML = InputXMLGenerationClient.getInputXMLString(HDSConstants.GET_STORAGE_POOL_TIERING_INFO_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
log.info("Get StoragePool Tiering info query payload :{}", getPoolTieringInfoInputXML);
ClientResponse response = hdsApiClient.post(endpointURI, getPoolTieringInfoInputXML);
if (HttpStatus.SC_OK == response.getStatus()) {
responseStream = response.getEntityInputStream();
JavaResult result = SmooksUtil.getParsedXMLJavaResult(responseStream, HDSConstants.SMOOKS_CONFIG_FILE);
verifyErrorPayload(result);
pool = result.getBean(Pool.class);
} else {
log.error("Get pool tiering info failed with invalid response code {}", response.getStatus());
throw HDSException.exceptions.invalidResponseFromHDS(String.format("Not able to query pool tiering info due to invalid response %1$s from server", response.getStatus()));
}
return pool;
}
use of com.emc.storageos.hds.model.StorageArray in project coprhd-controller by CoprHD.
the class HDSApiDiscoveryManager method getStorageSystemDetails.
/**
* Returns all storage system information.
*
* @return
* @throws Exception
*/
public StorageArray getStorageSystemDetails(String systemObjectID) throws Exception {
InputStream responseStream = null;
StorageArray storageArray = null;
URI endpointURI = hdsApiClient.getBaseURI();
Map<String, Object> attributeMap = new HashMap<String, Object>();
StorageArray inputStorageArray = new StorageArray(systemObjectID);
Get getOp = new Get(HDSConstants.STORAGEARRAY);
attributeMap.put(HDSConstants.STORAGEARRAY, inputStorageArray);
attributeMap.put(HDSConstants.GET, getOp);
String getSystemDetailsInputXML = InputXMLGenerationClient.getInputXMLString(HDSConstants.GET_SYSTEM_DETAILS_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
log.info("Get system details query payload :{}", getSystemDetailsInputXML);
ClientResponse response = hdsApiClient.post(endpointURI, getSystemDetailsInputXML);
if (HttpStatus.SC_OK == response.getStatus()) {
responseStream = response.getEntityInputStream();
JavaResult result = SmooksUtil.getParsedXMLJavaResult(responseStream, HDSConstants.SMOOKS_CONFIG_FILE);
verifyErrorPayload(result);
storageArray = result.getBean(StorageArray.class);
} else {
log.error("Get system details failed with invalid response code {}", response.getStatus());
throw HDSException.exceptions.invalidResponseFromHDS(String.format("Not able to query system details due to invalid response %1$s from server", response.getStatus()));
}
return storageArray;
}
Aggregations