use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getCifServers.
private List<VNXCifsServer> getCifServers(final StorageSystem system) throws VNXException {
List<VNXCifsServer> cifsServers;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get(VNXFileConstants.VNX_FILE_CIFS_CONFIG));
cifsServers = (List<VNXCifsServer>) _discExecutor.getKeyMap().get(VNXFileConstants.CIFS_SERVERS);
} catch (BaseCollectionException e) {
throw new VNXException("Get CifServers op failed", e);
}
return cifsServers;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getStoragePools.
private List<VNXStoragePool> getStoragePools(final StorageSystem system) throws VNXException {
List<VNXStoragePool> storagePools = null;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_logger.info("{}", _discExecutor);
_discExecutor.setKeyMap(reqAttributeMap);
_logger.info("{}", _discNamespaces.getNsList().get("vnxfileStoragePool"));
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePool"));
storagePools = (ArrayList<VNXStoragePool>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGEPOOLS);
} catch (BaseCollectionException e) {
throw new VNXException("Get control station op failed", e);
}
return storagePools;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getControlStation.
private VNXControlStation getControlStation(final StorageSystem system) throws VNXException {
VNXControlStation station = null;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileControlStation"));
station = (VNXControlStation) _discExecutor.getKeyMap().get(VNXFileConstants.CONTROL_STATION_INFO);
} catch (BaseCollectionException e) {
throw new VNXException("Get control station op failed", e);
}
return station;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommApi method createQuotaDirectory.
public XMLApiResult createQuotaDirectory(final StorageSystem system, final String fsName, final String quotaDirName, final String securityStyle, final Long size, final Boolean oplocks, Boolean isMountRequired) throws VNXException {
_log.info("Create VNX File System Quota dir: {} on file system {}", quotaDirName, fsName);
XMLApiResult result = new XMLApiResult();
Map<String, Object> reqAttributeMap = new ConcurrentHashMap<String, Object>();
try {
if (isMountRequired) {
// means there is no fs export in Vipr and mount is needed.
// just cross check with array fs have mount.
isMountRequired = !isMountPresentOnArray(fsName, system);
}
updateAttributes(reqAttributeMap, system);
reqAttributeMap.put(VNXFileConstants.FILESYSTEM_NAME, fsName);
reqAttributeMap.put(VNXFileConstants.QUOTA_DIR_NAME, quotaDirName);
reqAttributeMap.put(VNXFileConstants.HARD_QUOTA, size);
reqAttributeMap.put(VNXFileConstants.SECURITY_STYLE, securityStyle);
reqAttributeMap.put(VNXFileConstants.OPLOCKS, oplocks);
reqAttributeMap.put(VNXFileConstants.MOUNT_PATH, "/" + fsName);
_provExecutor.setKeyMap(reqAttributeMap);
if (isMountRequired) {
_provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_FILE_QUOTA_DIR_CREATE_MOUNT));
} else {
_provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_FILE_QUOTA_DIR_CREATE));
}
String cmdResult = (String) _provExecutor.getKeyMap().get(VNXFileConstants.CMD_RESULT);
if (cmdResult != null && cmdResult.equals(VNXFileConstants.CMD_SUCCESS)) {
String quotaDirId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.QUOTA_DIR_ID);
String fsysId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FILESYSTEM_ID);
if (quotaDirId != null) {
int fsId = Integer.parseInt(fsysId);
int qdId = Integer.parseInt(quotaDirId);
VNXQuotaTree vnxQuotaTree = new VNXQuotaTree(quotaDirName, -1, fsId);
vnxQuotaTree.setId(qdId);
result.setObject(vnxQuotaTree);
result.setCommandSuccess();
} else {
result.setCommandFailed();
result.setMessage((String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_DESC));
}
} else {
String errMsg = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_DESC);
result.setCommandFailed();
result.setMessage(errMsg);
}
} catch (Exception e) {
throw new VNXException("Failure", e);
}
return result;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommApi method createSnapshot.
public XMLApiResult createSnapshot(final StorageSystem system, final String fsName, final String snapshotName, final FileShare fileShare) throws VNXException {
_log.info("Create Snap for file sys : {} snap name : {}", fsName, snapshotName);
XMLApiResult result = new XMLApiResult();
Map<String, Object> reqAttributeMap = new ConcurrentHashMap<String, Object>();
try {
// get the data mover
StorageHADomain dataMover = this.getDataMover(fileShare);
if (null != dataMover) {
sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
Map<String, String> existingMounts = sshApi.getFsMountpathMap(dataMover.getAdapterName());
if (existingMounts.get(fileShare.getName()) == null) {
String mountCmdArgs = sshApi.formatMountCmd(dataMover.getAdapterName(), fileShare.getName(), fileShare.getMountPath());
result = sshApi.executeSshRetry(VNXFileSshApi.SERVER_MOUNT_CMD, mountCmdArgs);
_log.info("filesystem mount is successful for filesystem: {} mount path: {}", fileShare.getName(), fileShare.getMountPath());
}
} else {
Exception e = new Exception("VNX File snapshot creation failed because suitable Data mover to mount the File System not found");
throw VNXException.exceptions.createExportFailed("VNX File Snapshot create is Failed", e);
}
updateAttributes(reqAttributeMap, system);
reqAttributeMap.put(VNXFileConstants.FILESYSTEM_NAME, fsName);
reqAttributeMap.put(VNXFileConstants.SNAPSHOT_NAME, snapshotName);
_provExecutor.setKeyMap(reqAttributeMap);
_provExecutor.execute((Namespace) _provNamespaces.getNsList().get(PROV_CREATE_SNAP));
String cmdResult = (String) _provExecutor.getKeyMap().get(VNXFileConstants.CMD_RESULT);
if (cmdResult != null && cmdResult.equals(VNXFileConstants.CMD_SUCCESS)) {
String snapId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.SNAPSHOT_ID);
String fsysId = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FILESYSTEM_ID);
if (snapId != null) {
int fsId = Integer.parseInt(fsysId);
int snId = Integer.parseInt(snapId);
VNXSnapshot vnxSnap = new VNXSnapshot(snapshotName, -1, fsId);
vnxSnap.setId(snId);
result.setObject(vnxSnap);
result.setCommandSuccess();
} else {
result.setCommandFailed();
result.setMessage((String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_MSG));
}
} else {
String errMsg = (String) _provExecutor.getKeyMap().get(VNXFileConstants.FAULT_MSG);
result.setCommandFailed();
result.setMessage(errMsg);
}
} catch (Exception e) {
throw new VNXException("Failure", e);
}
return result;
}
Aggregations