use of com.emc.storageos.db.client.model.FileExport in project coprhd-controller by CoprHD.
the class FileDeviceController method deleteQDExportsAndShares.
/**
* Delete NFS exports and shares file system quota directory
*
* @param storage
* @param fs
* @param quotaDirObj
* @param task
*/
private void deleteQDExportsAndShares(URI storage, FileShare fs, QuotaDirectory quotaDirObj, String task) {
FSExportMap fsExportMap = fs.getFsExports();
String quotaName = quotaDirObj.getName();
boolean isExported = false;
// delete export
if (fsExportMap != null && !fsExportMap.isEmpty()) {
// check the quota directory is exported
for (FileExport fileExport : fsExportMap.values()) {
if (quotaName.equals(fileExport.getSubDirectory()) && fileExport.getPath().endsWith(quotaName)) {
isExported = true;
_log.info("Delete the nfs sub directory export path {} and key {}", fileExport.getPath(), fileExport.getFileExportKey());
}
}
if (true == isExported) {
// delete the export of quota directory
this.deleteExportRules(storage, fs.getId(), false, quotaName, task);
}
}
// delete fileshare of quota directory
SMBShareMap smbShareMap = fs.getSMBFileShares();
if (smbShareMap != null && !smbShareMap.isEmpty()) {
FileSMBShare fileSMBShare = null;
List<FileSMBShare> fileSMBShares = new ArrayList<FileSMBShare>();
for (SMBFileShare smbFileShare : smbShareMap.values()) {
// check for quotaname in native fs path
if (true == (smbFileShare.getPath().endsWith(quotaName))) {
fileSMBShare = new FileSMBShare(smbFileShare);
_log.info("Delete the cifs sub directory path of quota directory {}", smbFileShare.getPath());
fileSMBShares.add(fileSMBShare);
}
}
if (fileSMBShares != null && !fileSMBShares.isEmpty()) {
// delete shares
for (FileSMBShare tempFileSMBShare : fileSMBShares) {
this.deleteShare(storage, fs.getId(), tempFileSMBShare, task);
_log.info("Delete SMB Share Name{} for quota ", tempFileSMBShare.getName());
}
}
}
}
Aggregations