Use the Network Storage API to expand storage capacity through a private network. You can create a storage network and add volumes to it. Add a server to the same private network to grant access to the storage.
All API requests in this guide are relative to:
https://api.phoenixnap.com/network-storage/v1Code language: HTTP (http)
Prerequisites
BMC API access token with the networkstorage scope (see API credentials). If you are adding an server to the private network or creating a new server in the private network, you will also need the bmc scope.
Create Storage Network and Volume
Note
Each network can have only one storage and volume.
Send a request to:
POST /storage-networksCode language: HTTP (http)
For example:
{
"name": "my-network-storage",
"location": "PHX",
"description": "Example network storage",
"volumes": [
{
"name": "my-volume",
"capacityInGb": 1000,
"description": "1TB capacity for My Network Storage",
"pathSuffix": "/my-documents"
}
]
}Code language: JSON / JSON with Comments (json)
The output prints the object with the status BUSY. Note the storage network ID, network ID, and path.
Use the network ID to connect BMC servers to the network and view private network details.
Use the path from the output to mount the network storage.
Find out more
Create Additional Volumes
Send a request to:
POST /storage-networks/[STORAGE_ID]/volumesCode language: HTTP (http)
For example, add a 1TB volume:
{
"name": "my-volume",
"capacityInGb": 1000,
"description": "1TB capacity for my network storage",
"pathSuffix": "/my-documents",
"permissions": {
"nfs": {
"readWrite": ["1.1.1.1"],
"rootSquash": ["1.1.1.1"]
}
}
}Code language: JSON / JSON with Comments (json)
The volume capacity cannot exceed the total quota for all volumes.
Connect a Server to a Storage
A storage and server must be in the same private network to enable access. There are two ways to create that connection:
- Add a new BMC server to the storage private network during server creation (see Deploy a server).
- Add an existing server to the storage private network (see Add a server to a private network).
Both cases require the private network ID (networkId).
View Network Storage Details
To view all storage networks, use:
GET /storage-networksCode language: HTTP (http)
Filter the result by location with the location query parameter:
GET /storage-networks?location=PHXCode language: HTTP (http)
To show the details for a single network storage, send a GET request to:
GET /storage-networks/[STORAGE_ID]Code language: HTTP (http)
Note
The storage network has IPs (x.x.x.4 and x.x.x.5) for accessing and mounting the volumes. To optimize the NFS and achieve load balancing, add a hostname (A record) with both IP addresses.
Find out more
Network Storage API - GET /storage-networks
Network Storage API - GET /storage-networks/[STORAGE_ID]
View Volume Details
To show the storage network volume array, send a GET request to:
GET /storage-networks/[STORAGE_ID]/volumesCode language: HTTP (http)
To see a specific volume belonging to a storage network, use:
GET /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]Code language: HTTP (http)
Find out more
Network Storage API - GET /storage-networks/[STORAGE_ID]/volumes
Network Storage API - GET /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]
Update Network Storage and Volume Details
To update network storage details, send a request to:
PATCH /storage-networks/[STORAGE_ID]Code language: HTTP (http)
For example:
{
"name": "Updated storage network name",
"description": "Updated description for storage network"
}Code language: JSON / JSON with Comments (json)
To update volume information, send a request to:
PATCH /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]Code language: HTTP (http)
For example:
{
"name": "updated-volume-name",
"description": "Updated description for the volume",
"capacityInGb": 2000,
"pathsuffix": "/my-directory",
"permissions": {
"nfs": {
[PERMISSIONS]
}
}
}Code language: JSON / JSON with Comments (json)
Configure NFS Permissions
NFS permissions control read/write access and the squash policy for servers accessing a volume. Specify at least one read/write operation and one squash policy.
The available read/write fields are:
readWritereadyOnly
The available squash policy fields are:
rootSquashnoSquashallSquash
You can use the following formats to define permissions:
- CIDR notation (
192.168.0.0/24). - Wildcard notation (
192.168.*.*). - Empty array (
[]).
Find out more
Network Storage API - PATCH /storage-networks/[STORAGE_ID]
Network Storage API - PATCH /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]
Manage Volume Tags
Send a PUT request to:
PUT /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]/tagsCode language: HTTP (http)
For example:
[
{
"name": "Environment",
"value": "PROD"
}
]Code language: JSON / JSON with Comments (json)
The request overwrites tags assigned to a volume. Any existing tag omitted from the request is unassigned.
Delete Network Storage and Volume
Warning
Before deleting a storage network and volume, remove all servers from the network and backup any critical data. Deleting the storage and volume removes all information from the network storage.
To delete a storage and its volumes, send a request to:
DELETE /storage-networks/[STORAGE_ID]Code language: HTTP (http)
To delete a specific volume from a storage network, send a DELETE request to:
DELETE /storage-networks/[STORAGE_ID]/volumes/[VOLUME_ID]Code language: HTTP (http)