use of com.emc.nas.vnxfile.xmlapi.NewFileSystem in project coprhd-controller by CoprHD.
the class VNXFileArgsCreator method createFileSystem.
public InputStream createFileSystem(final Argument argument, final Map<String, Object> keyMap, int index) throws VNXFilePluginException {
_logger.info("Creating a new VNX File file system");
InputStream iStream = null;
try {
// Verify that the prior command executed properly.
verifyPreviousResults(keyMap);
Task task = new Task();
NewFileSystem newFs = new NewFileSystem();
String fsName = (String) keyMap.get(VNXFileConstants.FILESYSTEM_NAME);
String poolName = (String) keyMap.get(VNXFileConstants.POOL_NAME);
Long fsSize = (Long) keyMap.get(VNXFileConstants.FS_INIT_SIZE);
Set<String> movers = (Set<String>) keyMap.get(VNXFileConstants.MOVERLIST);
Boolean virtualProvisioning = (Boolean) keyMap.get(VNXFileConstants.FILESYSTEM_VIRTUAL_PROVISIONING);
if (isInValid(fsName) || isInValid(poolName) || null == fsSize || null == movers || (movers.isEmpty())) {
throw new VNXFilePluginException("Prior command did not execute successfully", VNXFilePluginException.ERRORCODE_ILLEGALARGUMENTEXCEPTION);
}
String dataMover = null;
if (!movers.isEmpty()) {
Iterator<String> iter = movers.iterator();
dataMover = iter.next();
}
_logger.debug("new file system name: {}", fsName);
_logger.debug("using virtual prov: {}", virtualProvisioning);
newFs.setName(fsName);
StoragePool pool = new StoragePool();
pool.setPool(poolName);
pool.setVirtualProvisioning(virtualProvisioning);
if (virtualProvisioning) {
EnableAutoExt autoExt = new EnableAutoExt();
autoExt.setAutoExtensionMaxSize(fsSize);
autoExt.setHighWaterMark(EXT_HW_MARK);
pool.setEnableAutoExt(autoExt);
pool.setSize(MIN_FILESYSTEM_SIZE);
} else {
pool.setSize(fsSize);
}
newFs.setStoragePool(pool);
newFs.setType(FileSystemType.UXFS);
MoverRef mvRef = new MoverRef();
mvRef.setMover(dataMover);
newFs.setMover(mvRef);
task.setNewFileSystem(newFs);
iStream = _vnxFileInputRequestBuilder.getTaskParamPacket(task, true);
} catch (JAXBException jaxbException) {
throw new VNXFilePluginException("Exception occurred while generating input xml for creating new file system", jaxbException.getCause());
}
return iStream;
}
Aggregations