libopenstorage / openstorage

A multi-host clustered implementation of the open storage specification
Apache License 2.0
526 stars 118 forks source link

[PWX-36750] Added NFS Proxy Endpoint to VolumeUpdateSpec #2436

Closed vinayakshnd closed 7 months ago

vinayakshnd commented 7 months ago

What this PR does / why we need it:
Added pure_nfs_endpoint string field to VolumeUpdateSpec, so that for existing Pure File Direct Access volumes, nfs endpoint can be changed though VolumeUpdate API call.

Which issue(s) this PR fixes (optional)
PWX-36750

Testing Notes

Initially, volume was using 10.13.29.150 as NFS endpoint for mount.

pxctl v i pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
    Volume               :  146318499704549562
    Name                 :  pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
    Size                 :  10 GiB
    Format               :  none
    HA                   :  1
    IO Priority          :  LOW
    Creation time        :  Apr 19 10:07:02 UTC 2024
    Shared               :  no
    Flashblade           :
          Type           : nfs
          Endpoint       : 10.13.29.150
    Status               :  up
    State                :  Consumed from 10.13.29.150
    Last Attached        :  Jan 1 00:00:00 UTC 1970
    Labels               :  namespace=default,pure_export_rules=*(rw),pure_nfs_endpoint=10.13.29.150,pvc=pure-claim-file-v3-new-150,backend=pure_file
    Bytes used           :  0 B
    Replica sets on nodes:
    Replication Status   :
df -h
Filesystem                                                          Size  Used Avail Use% Mounted on
10.13.29.150:/px_41293619-pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd   10G     0   10G   0% /var/lib/osd/mounts/n2

Then, updated volume to use 10.13.42.13 as new nfs endpoint while volume was in use/mounted.

pxctl volume update --pure_nfs_endpoint "10.13.42.13" pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
Update Volume: Volume update successful for volume pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd

Volume inspect reflected the new change:

 pxctl v i pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
    Volume               :  146318499704549562
    Name                 :  pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
    Size                 :  10 GiB
    Format               :  none
    HA                   :  1
    IO Priority          :  LOW
    Creation time        :  Apr 19 10:07:02 UTC 2024
    Shared               :  no
    Flashblade           :
          Type           : nfs
          Endpoint       : 10.13.42.13
    Status               :  up
    State                :  Consumed from 10.13.42.13
    Last Attached        :  Jan 1 00:00:00 UTC 1970
    Labels               :  backend=pure_file,namespace=default,pure_export_rules=*(rw),pure_nfs_endpoint=10.13.29.150,pvc=pure-claim-file-v3-new-150
    Bytes used           :  0 B
    Replica sets on nodes:
    Replication Status   :

Performed, unmount+mount

pxctl host unmount --path /var/lib/osd/mounts/n2 pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
Volume pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd successfully unmounted at /var/lib/osd/mounts/n2
/var/cores/pxctl host mount --path /var/lib/osd/mounts/n2 pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd
Volume pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd successfully mounted at /var/lib/osd/mounts/n2

Next mount took new NFS endpoint

df -h
Filesystem                                                         Size  Used Avail Use% Mounted on
10.13.42.13:/px_41293619-pvc-80406c8d-3ce0-4800-aa82-ec0d42d842fd   10G     0   10G   0% /var/lib/osd/mounts/n2

Special notes for your reviewer:
Add any notes for the reviewer here.