emc-openstack / storops

Python storage management library for VNX and Unity.
Apache License 2.0
53 stars 29 forks source link

Absolute Path of filesystem for nfs_share #372

Closed mukeshguptakc closed 2 years ago

mukeshguptakc commented 2 years ago

Hi We are working on EMC Unity NAS and in one of our use-case we need to extract the the absolute path of the NFS Share. Now while fetching the share details we only get the mount path and not the actual local filesystem absolute path. Which is available in the Web Console of EMC Unity though. Absolute or Local filesystem path.

conn.get_nfs_share(name="Mukesh_NFS_Share02")
{
    "UnityNfsShare": {
        "anonymous_gid": 4294967294,
        "anonymous_uid": 4294967294,
        "creation_time": "2022-06-01 10:12:39.838000+00:00",
        "default_access": "NFSShareDefaultAccessEnum.ROOT",
        "description": "",
        "existed": true,
        "export_option": 0,
        "export_paths": [
            "10.221.146.214:/Mukesh_NFS_Share02"
        ],
        "filesystem": {

            "UnityFileSystem": {
                "hash": 8779704689592,
                "id": "fs_106"
            }
        },
        "hash": 8779704689583,
        "id": "NFSShare_2127",
        "min_security": "NFSShareSecurityEnum.SYS",
        "modification_time": "2022-06-01 10:12:39.838000+00:00",
        "name": "Mukesh_NFS_Share02",
        "path": "/Mukesh_Share02",
        "role": "NFSShareRoleEnum.PRODUCTION",
        "type": "NFSTypeEnum.NFS_SHARE"
    }
}

If someone could please help me in fetching the same using filter or something that we can fetch the absolute path of NFS / SMB share. Screenshot 2022-06-01 at 3 50 10 PM

yong-huang commented 2 years ago

In Unity REST model, the localPath is not a property of NFS share object, we can't query it directly. In Unisphere, the localPath is calculated when calling REST API, the URL is:

name,description,nasServerName::filesystem.nasServer.name,filesystemName::filesystem.name,snapshotName::snap.name,localPath::((snap ne null) ? @concat("/", snap.name, path) : @concat("/", filesystem.name, path)),exportPaths,type,storageResource::filesystem.storageResource.id,filesystem.nasServer.isReplicationDestination,anonymousUID,anonymousGID,exportOption

The formula is: localPath::((snap ne null) ? @concat("/", snap.name, path) : @concat("/", filesystem.name, path)). storops won't support query with formula, you could query nfsshare and its filesystem, then conjunct the localPath with: / + nfsshare.filesystem.name + nfsshare.path.

yong-huang commented 2 years ago

Close this ticket.