Active file management (AFM) fileset creation

Create an Active file management (AFM) fileset according to this procedure.

  1. Create Active file management (AFM) fileset with IBM Storage Scale server and NFS or with any other NFS server
    Prerequisite
    • An NFS export is available from the home cluster with no_root_squash. The NFS export must have read/write permissions. See the following snippet:
      /test *(rw,nohide,insecure,no_subtree_check,sync,no_root_squash,fsid=101)
    • To retrieve the route, run the following OC command:
      oc get route -n ibm-spectrum-scale
      Example output:
      NAME                     HOST/PORT                                                                      PATH   SERVICES                 PORT    TERMINATION   WILDCARD
      ibm-spectrum-scale-gui   ibm-spectrum-scale-gui-ibm-spectrum-scale.apps.isf.ibm.com          ibm-spectrum-scale-gui   <all>   reencrypt     None
    • To retrieve the authorization token, run the following curl command:
      curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -u '<userName>:<password>' -d '{"type":"USER", "clusterName":"<clusterName>", "requestingUser":"<userName>", "accessToken":"access-token-1","authData": { "userName":"<userName>", "roles": {"<userName>": "PENDING"},"status": "PENDING" } }' https://<Scale Route URL>/scalemgmt/v2/access -k

      Where, <"userName">:<"password"> or<"userName"> are the username and password that is retrieved from the Retrieving credentials topic.

      "clusterName" is the OpenShift® cluster name.

      Example command:
      curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -u 'admin:passw0rd' -d '{"type": "USER","clusterName": "fus0.sdi.dmz","requestingUser": "admin","accessToken": "access-token-1","authData": { "userName": "admin", "roles": {"admin": "PENDING"},"status": "PENDING" } }' https://ibm-spectrum-scale-gui-ibm-spectrum-scale.apps.fus0.sdi.dmz/scalemgmt/v2/access -k
      Example output:

      { "clusterName" : "ibm-spectrum-scale.fus0.sdi.dmz", "status" : { "code" : 200, "message" : "The request finished successfully." }, "token" : "0ccfb637-d46c-dead-beef-f8438c2842d5" }

    • Retrieve the filesystem name (filesystem_name) that is mounted on the OpenShift Container Platform cluster. Example command:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X GET --header 'content-type:application/json' https://<spectrum_scale_gui_route>/scalemgmt/v2/filesystems
      Example output:

      { "filesystems" : [ { "name" : "ibmspectrum-fs" } ], "status" : { "code" : 200, "message" : "The request finished successfully." }

      For more information about the REST API, see Filesystems: GET.
    Procedure
    Run the REST API to create the Active file management (AFM) fileset in IBM Storage Fusion as follows:
    curl -k -H "Authorization:Token <token retreived from the previous command>" -X POST --header 'content-type:application/json' --header 'accept:application/json' -d '{
    "filesetName": "<afm_fileset_name>",
    "path": "/mnt/<filesystem_name>/<afm_fileset_name>",
    "afmTarget": "nfs://<nfs_home_ip>/<export_path_on_home>",
    "afmMode": "independent-writer"
    }' https://<spectrum_scale_gui_route>/scalemgmt/v2/filesystems/<filesystem_name>/filesets
    
    An example is as follows:
    curl -k -H "Authorization:Token <token retreived from the previous command>" -X POST --header 'content-type:application/json' --header 'accept:application/json' -d '{
    > "filesetName": "afmfsetnfs",
    > "path": "/mnt/ibmspectrum-fs/afmfsetnfs",
    > "afmTarget": "nfs://9.9.9.9/mnt/fs1/fset1",
    > "afmMode": "independent-writer"
    > }' https://ibm-spectrum-scale-gui-ibm-spectrum-scale.apps.isf.ibm.com/scalemgmt/v2/filesystems/ibmspectrum-fs/filesets
  2. Create AFM fileset with Object store as home
    Prerequisite
    • A bucket is available on an S3 compliant object store.
    • Access key and secret key are available to access the bucket.
    • Configure the AFM to Cloud Object Storage by using the keys that are created or generated on the Cloud Object Storage.

      For more information, see Configuring AFM to cloud object storage.

    Procedure
    • Run the REST API to create Active file management (AFM) fileset in IBM Storage Fusion as follows:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X POST --header 'content-type:application/json' --header 'accept:application/json' -d '{
       "filesetName": "<afm_fileset_name",
       "endpoint": "<s3_endpoint>",
       "useObjectFs": true, 
       "bucket": "<bucket_name>",
       "mode": "<iw/ro>",
       "accessKey": "<access_key>",
       "secretKey": "<secret_key>"
       }' 'https://<spectrum_scale_gui_route>/scalemgmt/v2/filesystems/<filesystem_name>/filesets/cos'
      
      An example is as follows:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X POST --header 'content-type:application/json' --header 'accept:application/json' -d '{
       "filesetName": "cosfset1",
       "endpoint": "http://us-east-2@s3.us-east-2.amazonaws.com",
       "useObjectFs": true, 
       "bucket": "mybucket",
       "mode": "iw",
       "accessKey": "xxxxxxxx",
      "secretKey": "xxxxxxxxxxxxx"
       }' 'https://ibm-spectrum-scale-gui-ibm-spectrum-scale.apps.fusion.cp.fyre.ibm.com/scalemgmt/v2/filesystems/ibmspectrum-fs/filesets/cos'
    • Make note of the job ID. See the following sample text:
      {
        "jobs" : [ {
          "jobId" : 5000000000543,
          "status" : "RUNNING",
          "submitted" : "2021-11-08 05:57:02,375",
          "completed" : "N/A",
          "runtime" : 2,
          "request" : {
            "data" : {
              "afmMode" : "read-only",
              "afmTarget" : "nfs://<ip_address>/gpfs/fs1/tgt1",
              "filesetName" : "roCacheFileset",
              "path" : "/mnt/rackhscale/roCacheFileset"
            },
            "type" : "POST",
            "url" : "/scalemgmt/v2/filesystems/rackhscale/filesets"
          },
          "result" : { },
          "pids" : [ ]
        } ],
        "status" : {
          "code" : 202,
          "message" : "The request was accepted for processing."
        }
      }
  3. Verification of Active file management (AFM) fileset creation configuration
    Procedure
    1. Check that the fileset creation job is successful as follows:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X GET --header 'content-type:application/json' https://<spectrum_scale_gui_route>/scalemgmt/v2/jobs/<job_id>
    2. Verify that Active file management (AFM) cache fileset is created and cache is active as follows:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X GET --header 'content-type:application/json' https://<spectrum_scale_gui_route>/scalemgmt/v2/filesystems/<filesystem_name>/afm/state
      An example is as follows:
      curl -k -H "Authorization:Token <token retreived from the previous command>" -X GET --header 'content-type:application/json' https://ibm-spectrum-scale-gui-ibm-spectrum-scale.apps.fusion.cp.fyre.ibm.com/scalemgmt/v2/filesystems/ibmspectrum-fs/afm/state
      {
        "filesetAfmStateList" : [ {
          "cacheState" : "Active",
          "filesetName" : "afmfsetnfs",
          "filesystemName" : "ibmspectrum-fs"
        }, {
          "cacheState" : "Active",
          "filesetName" : "afmpall",
          "filesystemName" : "ibmspectrum-fs"
        }, {
          "cacheState" : "Active",
          "filesetName" : "afms",
          "filesystemName" : "ibmspectrum-fs"
        } ],
        "status" : {
          "code" : 200,
          "message" : "The request finished successfully."
        }
      }
Note: For the container logs, go to /var/log/cnlog/mgtsrv. To view the last few lines of the container log file, run the following tail command:
tail -f mgtsrv-trace-log in ibm-spectrum-scale-gui-0 pod
If you face errors, then it can be in the container log file of any of the two GUI pods. Check the log of ibm-spectrum-scale-gui-1 as well.