Using TrueNAS CORE 13 U3.1
I've been trying to write a script to create an extent and target from a pre-existing (automatic) snapshot. Getting the snapshot "name" is not a problem. Where I've hit a wall is trying to use the API to clone said snapshot, so it can be used to create the extent and target.
I took it out to the command line, and it's failing:
The error that comes back is:
I got the name "bigpool/spinners-iscsi-auto-2023-04-14_21-09-2w" directly from querying the snapshot list, out of the JSON data, so if there's a formatting issue, I'm in the dark about it.
The documentation doesn't seem to help, and even the interactive RESTful API page at https://<SERVERNAME>/api/docs/ fails at this. I've looked through the TrueNAS github python REST API tests - no luck.
Any help at all would be greatly appreciated.
I've been trying to write a script to create an extent and target from a pre-existing (automatic) snapshot. Getting the snapshot "name" is not a problem. Where I've hit a wall is trying to use the API to clone said snapshot, so it can be used to create the extent and target.
I took it out to the command line, and it's failing:
Code:
curl -X POST https://<SERVERNAME>/api/v2.0/zfs/snapshot/clone \ -H "Authorization: Bearer ReallyLongAPIKeyGoesHere" \ -H "Content-Type: application/json" \ -d '{ \ "snapshot": "bigpool/spinners-iscsi-auto-2023-04-14_21-09-2w", \ "dataset_dst": "bigpool/spinners-iscsi-auto-2023-04-14_21-09-2w-clone" \ }'
The error that comes back is:
Code:
"message": "Failed to clone snapshot: Snapshot bigpool/spinners-iscsi-auto-2023-04-14_21-09-2w not found", "errno": 14
I got the name "bigpool/spinners-iscsi-auto-2023-04-14_21-09-2w" directly from querying the snapshot list, out of the JSON data, so if there's a formatting issue, I'm in the dark about it.
The documentation doesn't seem to help, and even the interactive RESTful API page at https://<SERVERNAME>/api/docs/ fails at this. I've looked through the TrueNAS github python REST API tests - no luck.
Any help at all would be greatly appreciated.