Filesystems/{filesystemName}/snapshotCopy/{snapshotName}: PUT

Copies a snapshot on a file system.

Availability

Available on all IBM Storage Scale editions.

Description

The PUT filesystems/{filesystemName}/snapshotCopy/{snapshotName} request copies a directory from a source path relative to a snapshot, to a target path on a file system. For more information about the fields in the data structures that are returned, see the topics mmcrfs command, mmchfs command, and mmlsfs command.

Request URL

https://<IP or host name of API server>:port/scalemgmt/v2/filesystems/{filesystemName}/snapshotCopy/{snapshotName}
where:
filesystems/filesystemName
Specifies the file system to which the snapshot belongs. Required.
snapshotCopy
Action to be performed on the snapshot. Required.
snapshotName
Name of the snapshot to be copied. Required.

Request headers

Accept: application/json

Request parameters

The following parameters can be used in the request URL to customize the request:
Table 1. List of request parameters
Parameter name Description and applicable keywords Required/optional
filesystemName The file system name. You can also use keywords such as :all:, :all_local:, or :all_remote: Required.
snapshotName Name of the snapshot to be copied. Required.

Request data

{    
"targetFilesystem": "File system name",
"targetFileset": "Fileset name",
"targetPath": "Directory path",
"nodeclassName": "Name of the node class",
"force": "True | False",
}
"targetFilesystem": "File system name"
The name of the file system where the snapshot is located.
"targetFileset": "Fileset name"
The name of the fileset where the snapshot is located. This is optional.
"targetPath": "Directory path"
The name of the file system where the snapshot is located.
"nodeclassName": "Name of the node class"
The name of the node class.
"force": "File system name"
Specifies whether the cp command is used with --force option.

Response data

{
    "status": {
      "code":ReturnCode",
      "message":"ReturnMessage"
   },
   jobs: [
      {
         "result":"", 
           { 
             "commands":"String",
             "progress":"String,
             "exitCode":"Exit code",
             "stderr":"Error",
             "stdout":"String",
           },
         "request":" ",
           {
             "type":"{GET | POST | PUT | DELETE}",
             "url":"URL",
             "data":""",
           }
         "jobId":"ID",
         "submitted":"Time",
         "completed":Time",
         "status":"Job status",
         }   
        ],
   }
For more information about the fields in the following data structures, see the links at the end of this topic.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"jobs":
An array of elements that describe jobs. Each element describes one job.
"result"
"commands":"String'
Array of commands that are run in this job.
"progress":"String'
Progress information for the request.
"exitCode":"Exit code"
Exit code of command. Zero is success and nonzero denotes failure.
"stderr":"Error"
CLI messages from stderr.
"stdout":"String"
CLI messages from stdout.
"request"
"type":"{GET | POST | PUT | DELETE}"
HTTP request type.
"url":"URL"
The URL through which the job is submitted.
"data":" "
Optional.
"jobId":"ID",
The unique ID of the job.
"submitted":"Time"
The time at which the job was submitted.
"completed":Time"
The time at which the job was completed.
"status":"RUNNING | COMPLETED | FAILED"
Status of the job.

Examples

The following example shows how to copy a snapshot that belongs to the file system gpfs0.

Request data:
curl -k -u admin:admin001 -X PUT --header 'content-type:application/json' --header 'accept:application/json' 
-d '{
  "targetFilesystem": "objfs","nodeclassName": "cesNodes", "force": true}' 'https://198.51.100.1:443/scalemgmt/v2/filesystems/gpfs0/snapshotCopy/snap1'
Response data:
Note: In the JSON data that is returned, the return code indicates whether the command is successful. The response code 200 indicates that the command successfully retrieved the information. Error code 400 represents an invalid request and 500 represents internal server error.
{
  "jobs" : [ {
    "jobId" : 1000000000024,
    "status" : "COMPLETED",
    "submitted" : "2020-09-29 21:25:25,513",
    "completed" : "2020-09-29 21:25:41,217",
    "runtime" : 15704,
    "request" : {
      "type" : "PUT",
      "url" : "/scalemgmt/v2/filesystems/fs1/snapshotCopy/snap1"
    },
    "result" : {
      "progress" : [ ],
      "commands" : [ "tscp --snapshot 'fs1:snap1' --target '/mnt/objfs/dir1' --nodeclass 'cesNodes' --force " ],
      "stdout" : [ ],
      "stderr" : [ ],
      "exitCode" : 0
    },
    "pids" : [ ]
  } ],
  "status" : {
    "code" : 200,
    "message" : "The request finished successfully."
  }
}

See also