iXsystems / cinder

Other
35 stars 18 forks source link

Driver does not support datasets other than the "root" one #20

Closed dmcgrandle closed 4 years ago

dmcgrandle commented 4 years ago

Currently this driver cannot handle a path to a nested dataset such as "tank/sub1/sub2", but rather must be used with the highest level dataset on the FreeNAS system.

dmcgrandle commented 4 years ago

Looking into this in more detail, it looks like REST API v1.0 will not support this. However, API v2.0 does support it. Any objections if I submit a PR that upgrades the API to v2.0 and adds this functionality? If so I have a question:

Would it be better to simply upgrade the existing code to use the REST API 2.0 only (easier), or better to give the user the option of using either one (through a keypair option in cinder.conf)? The second would be more difficult but if not done would prevent older versions of FreeNAS to work with the driver. This could also be accomplished through versions of the driver, perhaps a new v2.0.0 to support the new v2.0 API, then they could simply download the version they want.

Thoughts?

william-gr commented 4 years ago

FreeNAS version that only support API v1.0 is quite out of date.

PR Upgrading to use API v2.0 would be very much welcome.

dmcgrandle commented 4 years ago

Ok, spent some time working on this today. Ran into a snag though, the old API reports on the space available and total size with a call like this:

GET /api/v1.0/storage/volume/tank

However, the new API does not return space available or total size for a dataset, at least not in the standard calls:

GET /api/v2.0/pool/dataset/id/tank

GET /api/v2.0/pool/id/1

This Cinder driver needs to report back space available for creating volumes, so any idea how I can query for free space and total capacity in a particular dataset in the new API?

william-gr commented 4 years ago

Which version are you using? 11.3-U3 should have used and available keys in /api/v2.0/pool/dataset/id/tank

dmcgrandle commented 4 years ago

I was running 11.3-U3.1, so I upgraded to 11.3-U3.2, but still no joy. Here is the output I am seeing from GET http://elisha/api/v2.0/pool/dataset/id/ElishaStorage%2FOS-Cinder


{
 "id": "ElishaStorage/OS-Cinder",
 "name": "ElishaStorage/OS-Cinder",
 "pool": "ElishaStorage",
 "type": "FILESYSTEM",
 "mountpoint": "/mnt/ElishaStorage/OS-Cinder",
 "children": [],
 "deduplication": {
  "value": "OFF",
  "rawvalue": "off",
  "parsed": "off",
  "source": "DEFAULT"
 },
 "aclmode": {
  "value": "PASSTHROUGH",
  "rawvalue": "passthrough",
  "parsed": "passthrough",
  "source": "LOCAL"
 },
 "atime": {
  "value": "ON",
  "rawvalue": "on",
  "parsed": true,
  "source": "DEFAULT"
 },
 "casesensitivity": {
  "value": "SENSITIVE",
  "rawvalue": "sensitive",
  "parsed": "sensitive",
  "source": "NONE"
 },
 "exec": {
  "value": "ON",
  "rawvalue": "on",
  "parsed": true,
  "source": "DEFAULT"
 },
 "sync": {
  "value": "STANDARD",
  "rawvalue": "standard",
  "parsed": "standard",
  "source": "DEFAULT"
 },
 "compression": {
  "value": "LZ4",
  "rawvalue": "lz4",
  "parsed": "lz4",
  "source": "INHERITED"
 },
 "compressratio": {
  "value": "1.00x",
  "rawvalue": "1.00x",
  "parsed": "1.00x",
  "source": "NONE"
 },
 "origin": {
  "value": "",
  "rawvalue": "",
  "parsed": "",
  "source": "NONE"
 },
 "quota": {
  "value": null,
  "rawvalue": "0",
  "parsed": null,
  "source": "LOCAL"
 },
 "refquota": {
  "value": null,
  "rawvalue": "0",
  "parsed": null,
  "source": "LOCAL"
 },
 "reservation": {
  "value": null,
  "rawvalue": "0",
  "parsed": null,
  "source": "LOCAL"
 },
 "refreservation": {
  "value": null,
  "rawvalue": "0",
  "parsed": null,
  "source": "LOCAL"
 },
 "copies": {
  "value": "1",
  "rawvalue": "1",
  "parsed": 1,
  "source": "LOCAL"
 },
 "snapdir": {
  "value": "HIDDEN",
  "rawvalue": "hidden",
  "parsed": null,
  "source": "DEFAULT"
 },
 "readonly": {
  "value": "OFF",
  "rawvalue": "off",
  "parsed": false,
  "source": "DEFAULT"
 },
 "recordsize": {
  "value": "128K",
  "rawvalue": "131072",
  "parsed": 131072,
  "source": "DEFAULT"
 }
}
dmcgrandle commented 4 years ago

Just for reference, here is the same dataset using the v1.0 API (I snipped out the relevant section):


{
    "avail": 13143759465792,
    "id": 102,
    "mountpoint": "/mnt/ElishaStorage/OS-Cinder",
    "name": "OS-Cinder",
    "path": "ElishaStorage/OS-Cinder",
    "status": "-",
    "type": "dataset",
    "used": 130944,
    "used_pct": 0
}
william-gr commented 4 years ago

My bad, this is slated for 11.3-U4, it was merged recently to stable branches.

dmcgrandle commented 4 years ago

Ah, thanks. Ok - I will leave this section of the driver using API v1.0 for now then.

dmcgrandle commented 4 years ago

PR #21 fixes this issue, so it is closed.