emc-openstack / storops

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

Is there any way we can find the snapshot belong to which Nas FileSystem from snapshot data? #327

Closed nehatomar12 closed 4 years ago

nehatomar12 commented 4 years ago

when we create snaphsot (storops.unity.resource.nfs_share.UnityNfsShare).create_snap(name="XYZ") then snapshot gets created and we get the below info { "UnitySnap": { "access_type": "FilesystemSnapAccessTypeEnum.PROTOCOL", "creation_time": "2020-10-23 12:35:53.960000+00:00", "creator_type": "SnapCreatorTypeEnum.USER_CUSTOM", "creator_user": { "id": "user_admin" }, "description": "", "existed": true, "hash": 8767263526625, "id": "171798691863", "is_auto_delete": true, "is_modifiable": true, "is_modified": true, "is_read_only": false, "is_system_snap": false, "name": "XYZ", "size": 5368709120, "state": "SnapStateEnum.READY", "storage_resource": { "UnityStorageResource": { "hash": -9223363269591444322, "id": "res_3" } } } }

for the above information, it is not cleared that it belongs to which NAS server

The same applies when we fetch the snapshots() for lun we get lun info in snapshot data, but for nas file system we didn't get the information

How to Map snapshot to NAS filesystem

Murray-LIANG commented 4 years ago

The snapshot can only be taken from the storage resource. For example, the snapshot you created is from:

"UnityStorageResource": {
"hash": -9223363269591444322,
"id": "res_3"
}

The storage resource in Unity could be LUN or filesystem. Nas server is not a storage resource though.

If the snapshot is taken from a filesystem, you can use filesystem property of snapshot to get its filesystem.

u = storops.UnitySystem(......)
snap = create_snap(......)
# or snap = u.get_snap(name='......')
fs = snap.filesystem 

Then you can get the nas server of the filesystem.

fs.nas_server
nehatomar12 commented 4 years ago

Thanks @Murray-LIANG