use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileStorageDeviceXML method doCreateFS.
@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
Map<String, String> autoExtendAtts = getAutoExtendAttrs(args);
Long fsSize = args.getFsCapacity() / BYTESPERMB;
if (fsSize < 1) {
// Invalid size throw an error
String errMsg = "doCreateFS failed : FileSystem size in bytes is not valid " + args.getFsCapacity();
_log.error(errMsg);
return BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(errMsg));
}
_log.info("FileSystem size translation : {} : {} ", args.getFsCapacity(), fsSize);
XMLApiResult result = null;
ApplicationContext context = null;
try {
context = loadContext();
VNXFileCommApi vnxComm = loadVNXFileCommunicationAPIs(context);
if (null == vnxComm) {
throw VNXException.exceptions.communicationFailed(VNXCOMM_ERR_MSG);
}
result = vnxComm.createFileSystem(storage, args.getFsName(), // This will be used for CLI create FS
args.getPoolName(), "1", fsSize, args.getThinProvision(), args.getNativeDeviceFsId(), autoExtendAtts);
if (result.isCommandSuccess()) {
VNXFileSystem vnxFS = (VNXFileSystem) result.getObject();
args.setFsNativeId(String.valueOf(vnxFS.getFsId()));
String path = "/" + args.getFsName();
// Set path & mountpath
args.setFsMountPath(path);
args.setFsPath(path);
}
} catch (VNXException e) {
throw DeviceControllerException.exceptions.unableToCreateFileSystem(e.getMessage(Locale.getDefault()));
} finally {
clearContext(context);
}
BiosCommandResult cmdResult = null;
if (result.isCommandSuccess()) {
cmdResult = BiosCommandResult.createSuccessfulResult();
} else {
cmdResult = BiosCommandResult.createErrorResult(DeviceControllerErrors.vnx.unableToCreateFileSystem(result.getMessage()));
}
return cmdResult;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getPorts.
private List<VNXDataMoverIntf> getPorts(final StorageSystem system) throws VNXException {
List<VNXDataMoverIntf> dataMovers = null;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePort"));
dataMovers = (ArrayList<VNXDataMoverIntf>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGE_PORTS);
} catch (BaseCollectionException e) {
throw new VNXException("Get Port op failed", e);
}
return dataMovers;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getAllQuotaTrees.
private List<TreeQuota> getAllQuotaTrees(final StorageSystem system) throws VNXException {
List<TreeQuota> quotaTrees = new ArrayList<TreeQuota>();
List<TreeQuota> tempQuotaTrees = null;
try {
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxallquotas"));
tempQuotaTrees = (ArrayList<TreeQuota>) _discExecutor.getKeyMap().get(VNXFileConstants.QUOTA_DIR_LIST);
if (null != tempQuotaTrees && !tempQuotaTrees.isEmpty()) {
quotaTrees.addAll(tempQuotaTrees);
_logger.info("Found {} Quota directories ", tempQuotaTrees.size());
} else {
_logger.info("No Quota directories found ");
}
} catch (BaseCollectionException e) {
throw new VNXException("Get QuotaTrees op failed", e);
}
return quotaTrees;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getVdmPorts.
private List<VNXDataMoverIntf> getVdmPorts(final StorageSystem system, final List<VNXVdm> vdms) throws VNXException {
List<VNXDataMoverIntf> dataMoverInterfaces = null;
List<VNXDataMoverIntf> vdmInterfaces = new ArrayList<VNXDataMoverIntf>();
Map<String, VNXDataMoverIntf> dmIntMap = new HashMap();
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePort"));
dataMoverInterfaces = (ArrayList<VNXDataMoverIntf>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGE_PORTS);
// Make map
for (VNXDataMoverIntf intf : dataMoverInterfaces) {
dmIntMap.put(intf.getName(), intf);
}
VNXFileSshApi sshDmApi = new VNXFileSshApi();
sshDmApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
// collect VDM interfaces
for (VNXVdm vdm : vdms) {
for (String vdmIF : vdm.getInterfaces()) {
VNXDataMoverIntf vdmInterface = dmIntMap.get(vdmIF);
vdmInterfaces.add(vdmInterface);
_logger.info("Use this VDM interface {}", vdmIF);
}
// Collect NFS/CIFS interfaces from nas_server -info command. This will return
// Interfaces assigned to VDM and not thru CIFS servers
Map<String, String> vdmIntfs = sshDmApi.getVDMInterfaces(vdm.getVdmName());
for (String vdmNFSIf : vdmIntfs.keySet()) {
VNXDataMoverIntf vdmInterface = dmIntMap.get(vdmNFSIf);
if (vdmInterface != null) {
_logger.info("Use this NFS VDM interface {} for {}", vdmInterface, vdmNFSIf);
vdmInterfaces.add(vdmInterface);
// Check if the interface is already on the VDM, if not, add it.
if (!vdm.getInterfaces().contains(vdmInterface.getName())) {
vdm.getInterfaces().add(vdmInterface.getName());
}
} else {
_logger.info("No interface found for {}", vdmNFSIf);
}
}
}
} catch (BaseCollectionException e) {
throw new VNXException("Get VDM Port op failed", e);
}
return vdmInterfaces;
}
use of com.emc.storageos.vnx.xmlapi.VNXException in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getAllFileSystem.
private List<VNXFileSystem> getAllFileSystem(final StorageSystem system) throws VNXException {
List<VNXFileSystem> fileSystems = null;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileSystem"));
fileSystems = (ArrayList<VNXFileSystem>) _discExecutor.getKeyMap().get(VNXFileConstants.FILESYSTEMS);
} catch (BaseCollectionException e) {
throw new VNXException("Get FileSystems op failed", e);
}
return fileSystems;
}
Aggregations