Search in sources :

Example 6 with VNXeCifsShare

use of com.emc.storageos.vnxe.models.VNXeCifsShare in project coprhd-controller by CoprHD.

the class VNXeApiClient method getCifsSharesForFileSystem.

/**
 * Find cifsShares for filesystem Id
 *
 * @param fsId
 *            file system Id
 * @return list of cifsShare
 */
public List<VNXeCifsShare> getCifsSharesForFileSystem(String fsId) {
    _logger.info("finding cifsShares for filesystem id: {} ", fsId);
    CifsShareRequests req = new CifsShareRequests(_khClient);
    List<VNXeCifsShare> shares = req.getSharesForFileSystem(fsId);
    return shares;
}
Also used : CifsShareRequests(com.emc.storageos.vnxe.requests.CifsShareRequests) VNXeCifsShare(com.emc.storageos.vnxe.models.VNXeCifsShare)

Example 7 with VNXeCifsShare

use of com.emc.storageos.vnxe.models.VNXeCifsShare in project coprhd-controller by CoprHD.

the class VNXeApiClient method findCifsShareByName.

/**
 * find CIFS share by its name
 *
 * @param shareName
 *            CIFS share name
 * @return
 */
public VNXeCifsShare findCifsShareByName(String shareName) {
    CifsShareRequests req = new CifsShareRequests(_khClient);
    List<VNXeCifsShare> shares = req.getCifsShareByName(shareName);
    if (shares != null && !shares.isEmpty()) {
        return shares.get(0);
    } else {
        return null;
    }
}
Also used : CifsShareRequests(com.emc.storageos.vnxe.requests.CifsShareRequests) VNXeCifsShare(com.emc.storageos.vnxe.models.VNXeCifsShare)

Example 8 with VNXeCifsShare

use of com.emc.storageos.vnxe.models.VNXeCifsShare in project coprhd-controller by CoprHD.

the class VNXUnityUnManagedObjectDiscoverer method discoverAllCifsShares.

public void discoverAllCifsShares(AccessProfile accessProfile, DbClient dbClient, PartitionManager partitionManager) {
    StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
    VNXeApiClient apiClient = getVnxUnityClient(accessProfile);
    log.info("discoverAllCifsShares for storage system {} - start", storageSystem.getId());
    unManagedCifsAclInsert = new ArrayList<UnManagedCifsShareACL>();
    unManagedCifsAclUpdate = new ArrayList<UnManagedCifsShareACL>();
    List<VNXeCifsShare> cifsExports = apiClient.getAllCifsShares();
    for (VNXeCifsShare exp : cifsExports) {
        log.info("Discovered fS share {}", exp.toString());
        VNXeFileSystem fs = null;
        if (exp.getFilesystem() != null) {
            fs = apiClient.getFileSystemByFSId(exp.getFilesystem().getId());
            String fsNativeGuid = NativeGUIDGenerator.generateNativeGuid(storageSystem.getSystemType(), storageSystem.getSerialNumber(), fs.getId());
            try {
                if (checkStorageFileSystemExistsInDB(fsNativeGuid, dbClient)) {
                    log.info("Skipping file system {} as it is already managed by ViPR", fsNativeGuid);
                    continue;
                }
                // Create UnManaged FS
                String fsUnManagedFsNativeGuid = NativeGUIDGenerator.generateNativeGuidForPreExistingFileSystem(storageSystem.getSystemType(), storageSystem.getSerialNumber().toUpperCase(), fs.getId());
                UnManagedFileSystem unManagedFs = checkUnManagedFileSystemExistsInDB(dbClient, fsUnManagedFsNativeGuid);
                StoragePort storagePort = getStoragePortPool(storageSystem, dbClient, apiClient, fs);
                String mountPath = extractValueFromStringSet(SupportedFileSystemInformation.MOUNT_PATH.toString(), unManagedFs.getFileSystemInformation());
                String exportPath = exp.getPath();
                if (!exportPath.equalsIgnoreCase("/")) {
                    mountPath = mountPath + exportPath;
                }
                // String mountPoint = storagePort.getPortNetworkId() + ":" + mountPath;
                String mountPoint = "\\\\" + storagePort.getPortNetworkId() + "\\" + exp.getName();
                String cifsShareId = exp.getId();
                associateCifsExportWithUMFS(unManagedFs, mountPoint, exp, storagePort);
                List<UnManagedCifsShareACL> cifsACLs = applyCifsSecurityRules(unManagedFs, mountPoint, exp, storagePort);
                log.info("Number of export rules discovered for file system {} is {}", unManagedFs.getId() + ":" + unManagedFs.getLabel(), cifsACLs.size());
                for (UnManagedCifsShareACL cifsAcl : cifsACLs) {
                    log.info("Unmanaged File share acls : {}", cifsAcl);
                    String fsShareNativeId = cifsAcl.getFileSystemShareACLIndex();
                    log.info("UMFS Share ACL index {}", fsShareNativeId);
                    String fsUnManagedFileShareNativeGuid = NativeGUIDGenerator.generateNativeGuidForPreExistingFileShare(storageSystem, fsShareNativeId);
                    log.info("Native GUID {}", fsUnManagedFileShareNativeGuid);
                    cifsAcl.setNativeGuid(fsUnManagedFileShareNativeGuid);
                    // Check whether the CIFS share ACL was present in ViPR DB.
                    UnManagedCifsShareACL existingACL = checkUnManagedFsCifsACLExistsInDB(dbClient, cifsAcl.getNativeGuid());
                    if (existingACL == null) {
                        unManagedCifsAclInsert.add(cifsAcl);
                    } else {
                        unManagedCifsAclInsert.add(cifsAcl);
                        existingACL.setInactive(true);
                        unManagedCifsAclUpdate.add(existingACL);
                    }
                }
                // Persist the UMFS as it changed the SMB Share Map.
                unManagedFs.setHasShares(true);
                unManagedFs.putFileSystemCharacterstics(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString(), Boolean.TRUE.toString());
                dbClient.updateObject(unManagedFs);
            } catch (IOException e) {
                log.error("IOException occured in discoverAllCifsShares()", e);
            }
        }
    }
    if (!unManagedCifsAclInsert.isEmpty()) {
        // Add UnManagedFileSystem
        partitionManager.insertInBatches(unManagedCifsAclInsert, Constants.DEFAULT_PARTITION_SIZE, dbClient, UNMANAGED_CIFS_SHARE_ACL);
        unManagedCifsAclInsert.clear();
    }
    if (!unManagedCifsAclUpdate.isEmpty()) {
        // Update UnManagedFilesystem
        partitionManager.updateInBatches(unManagedCifsAclUpdate, Constants.DEFAULT_PARTITION_SIZE, dbClient, UNMANAGED_CIFS_SHARE_ACL);
        unManagedCifsAclUpdate.clear();
    }
}
Also used : UnManagedCifsShareACL(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedCifsShareACL) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) StoragePort(com.emc.storageos.db.client.model.StoragePort) IOException(java.io.IOException) VNXeCifsShare(com.emc.storageos.vnxe.models.VNXeCifsShare) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 9 with VNXeCifsShare

use of com.emc.storageos.vnxe.models.VNXeCifsShare in project coprhd-controller by CoprHD.

the class VNXeApiClient method getCifsSharesForSnap.

/**
 * Find cifsShares for snapshot Id
 *
 * @param snapId
 *            file system snapshot Id
 * @return list of cifsShare
 */
public List<VNXeCifsShare> getCifsSharesForSnap(String snapId) {
    _logger.info("finding cifsShares for snap id: {} ", snapId);
    CifsShareRequests req = new CifsShareRequests(_khClient);
    List<VNXeCifsShare> shares = req.getSharesForFileSystemSnap(snapId);
    return shares;
}
Also used : CifsShareRequests(com.emc.storageos.vnxe.requests.CifsShareRequests) VNXeCifsShare(com.emc.storageos.vnxe.models.VNXeCifsShare)

Aggregations

VNXeCifsShare (com.emc.storageos.vnxe.models.VNXeCifsShare)9 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)3 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)3 VNXeFileSystem (com.emc.storageos.vnxe.models.VNXeFileSystem)3 CifsShareRequests (com.emc.storageos.vnxe.requests.CifsShareRequests)3 SMBShareMap (com.emc.storageos.db.client.model.SMBShareMap)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 UnManagedCifsShareACL (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedCifsShareACL)2 UnManagedFileSystem (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem)2 VNXeFileSystemSnap (com.emc.storageos.vnxe.models.VNXeFileSystemSnap)2 VNXeNfsShare (com.emc.storageos.vnxe.models.VNXeNfsShare)2 IOException (java.io.IOException)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 FileShare (com.emc.storageos.db.client.model.FileShare)1 Snapshot (com.emc.storageos.db.client.model.Snapshot)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 VNXeException (com.emc.storageos.vnxe.VNXeException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1