NFS

NFS, or Network File System, allows users to view, store, update, or share files on a remote system as if it were a local system.

Basic Operations

NFS shares may be created, read, updated, and destroyed via the API.

List NFS Shares

Send this request to get back a list of NFS shares.

Request Object

+ URL
  /api/v2/nfs

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

Sending this should get you back a valid response, if you’ve sent correct credentials.

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "/P01/fs_001": {
        "path": "/P01/fs_001",
        "default_options": [
            "rw",
            "insecure",
            "root_squash",
            "async",
            "sec=sys",
            "no_subtree_check",
            "available=true"
        ],
        "connections": [
            {
                "connection": "*",
                "options": []
            },
            {
                "connection": "10.10.10.100",
                "options": [
                  "ro",
                  "sync"
                ]
            }
        ],
        "raw": "/P01/fs_001 -rw,insecure,root_squash,async,sec=sys,no_subtree_check * 10.10.10.100(ro,sync)",
        "pool": "P01",
        "fs": "fs_001"
    },
  }

Create NFS Share

NFS shares can be created with a set of defualt options that can optionally be overridden for individual connections by specifying specific options on each additional connection.

Request Object

+ URL
  /api/v2/nfs/create

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001",
    "defaultOptions": ["rw", "insecure"],
    "connections": [
      {
        "connection": "*",
        "options": []
      },
      {
        "connection": "10.10.10.100",
        "options": ["ro","secure","async"]
      }
    ],
    "enable": "true"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Edit NFS Share

NFS shares can be edited with a set of defualt options that can optionally be overridden for individual connections by specifying specific options on each additional connection.

Request Object

+ URL
  /api/v2/nfs/edit

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001",
    "defaultOptions": ["rw", "insecure"],
    "connections": [
      {
        "connection": "*",
        "options": []
      },
      {
        "connection": "10.10.10.100",
        "options": ["ro","secure","async"]
      }
    ],
    "enable": "true"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Advanced Create NFS Share

NFS shares can be created with a set of defualt options that can optionally be overridden for individual connections by specifying specific options on each additional connection. This advanced api route allows for the creation of an NFS share simply by providing its configuration string. Only use this route if you really know what you are doing. Errors here can result in a compromised NFS service.

Request Object

+ URL
  /api/v2/nfs/adv/create

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "config": "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async)"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
    "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Advanced Edit NFS Share

NFS shares can be edited with a set of defualt options that can optionally be overridden for individual connections by specifying specific options on each additional connection. This advanced api route allows for the modification of an existing NFS share simply by providing its configuration string. Only use this route if you really know what you are doing. Errors here can result in a compromised NFS service.

Request Object

+ URL
  /api/v2/nfs/adv/edit

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001",
    "config": "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async)"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Remove NFS Share

Removing an NFS share with the API does not have the usual safeguards utilized by the UI (i.e. an "Are you sure?" type dialog). Please take extreme care when using this route.

Request Object

+ URL
  /api/v2/nfs/remove

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Activate NFS Share

NFS shares can be made either active or inactive. This modifies the availability of the share while retaining the share’s configuration.

Request Object

+ URL
  /api/v2/nfs/activate

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Deactivate NFS Share

NFS shares can be made either active or inactive. This modifies the availability of the share while retaining the share’s configuration.

Request Object

+ URL
  /api/v2/nfs/deactivate

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "path": "/P01/fs_001"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "#/P01/fs_001 -rw,insecure * 10.10.10.100(ro,secure,async) \n/P01/fs_004 -rw,insecure,root_squash,async,sec=sys,no_subtree_check *"

Your OpenDrives system comes with a recommended default template as well as the ability to set settings templates for NFS shares. This route returns those templates.

Request Object

+ URL
  /api/v2/nfs/defaults

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "basic": "rw,insecure,root_squash,async,sec=sys,no_subtree_check"
  }

You can add an NFS recommended settings file with this route.

Request Object

+ URL
  /api/v2/nfs/defaults

+ Method
  POST

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "name": "my_cool_nfs_settings",
    "contents": "ro,secure,root_squash,sync,sec=sys,no_subtree_check"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  {
    "name": "my_cool_nfs_settings",
    "contents": "ro,secure,root_squash,sync,sec=sys,no_subtree_check"
  }

Global Operations

List Global NFS Configuration Files

NFS has a number of files for configuring system-wide NFS settings. This route informs you of those files and the keys by which to view their contents via the Get Global NFS Configuration File route.

Request Object

+ URL
  /api/v2/nfs/global

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "kernelServer": "/default/nfs-kernel-server",
    "common": "/default/nfs-common",
    "portmap": "/default/portmap",
    "exports": "/exports",
    "idmapd": "/idmapd.conf",
    "deny": "/hosts.deny",
    "allow": "/hosts.allow"
  }

Get Global NFS Configuration File

NFS has a number of files for configuring system-wide NFS settings. Use this route to view the contents of those files. Provide the config key for the desired file in the URL of the request. Keys can be found via the List Global NFS Configuration Files route.

Request Object

+ URL
  /api/v2/nfs/global/$CONFIG_KEY

+ Method
  GET

+ Parameters
  config key (string, required, URL param) - the key of the file you would like to view

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/string; charset=utf-8

+ Body
  "# Number of servers to start up\nRPCNFSDCOUNT=64\n\n# Runtime priority of server (see nice(1))\nRPCNFSDPRIORITY=0\n\n# Options for rpc.mountd.\n# If you have a port-based firewall, you might want to set up\n# a fixed port here using the --port option. For more information, \n# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS\n# To disable NFSv4 on the server, specify '--no-nfs-version 4' here\nRPCMOUNTDOPTS=\"--manage-gids\"\n\n# Do you want to start the svcgssd daemon? It is only required for Kerberos\n# exports. Valid alternatives are \"yes\" and \"no\"; the default is \"no\".\nNEED_SVCGSSD=\"\"\n\n# Options for rpc.svcgssd.\nRPCSVCGSSDOPTS=\"\"\n"

Write Global NFS Configuration File

NFS has a number of files for configuring system-wide NFS settings. Use this route to edit the contents of those files. Provide the config key for the desired file in the URL of the request. Keys can be found via the List Global NFS Configuration Files route.

Request Object

+ URL
  /api/v2/nfs/global/$CONFIG_KEY/write

+ Method
  POST

+ Parameters
  config key (string, required, URL param) - the key of the file you would like to write

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {
    "config": "This will become the new contents of the global config file. Please be very careful and only edit these if you really know what you are doing"
  }

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {}

List RDMA Devices

Provides a list of RDMA capable devices on this system. Route will return an empty string if no RDMA capable devices are present.

Request Object

+ URL
  /api/v2/nfs/rdma/devices

+ Method
  GET

+ Headers
  Content-Type: application/json
  token: ThisIsNotARealTokenGenerateYourOwnToken

+ Body
  {}

Response Object

+ Headers
  X-Powered-By: OpenDrives
  Access-Control-Allow-Origin: *
  Content-Type: application/json; charset=utf-8

+ Body
  {
    "devices": "Switch ’is4_0’/nSwitch type: MT48436/nNumber of ports: 0/nFirmware version: 7.3.0/nHardware version: a0/nNode GUID: 0x00212856cfe2c0a0/nSystem image GUID: 0x00212856cfe2c0a3/nPort 0:/nState: Active/nPhysical state: LinkUp/nRate: 40/nBase lid: 16/nLMC: 0/nSM lid: 16/nCapability mask: 0x4250084a/nPort GUID: 0x00212856cfe2c0a0"
  }