配置池。有关创建池所需的参数,请参见 CLI 配置存储命令。可执行用于创建池的模拟运行请求,该请求会返回可用的属性名称和值。这是通过将 props 查询参数属性设置为 true 来执行的。
请求示例:
POST /api/storage/v1/pools?props=true HTTP/1.1 Host: zfs-storage.example.com Authorization: Basic abhadbfsMWE= Content-Type: application/json Accept: application/json { "name": "p1", }
响应示例:
HTTP/1.1 200 OK Content-Type: application/json "props": [{ "choices": ["custom" ], "label": "Chassis 0", "name": "0", "type": "ChooseOne" }, { "choices": ["custom"], "label": "Chassis 1", "name": "1", "type": "ChooseOne" }, { "choices": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "label": "Chassis 1 data", "name": "1-data", "type": "ChooseOne" }, { "choices": ["mirror", "mirror3", "raidz1", "raidz2", "raidz3_max", "stripe"], "label": "Data Profile", "name": "profile", "type": "ChooseOne" }] }
请求示例(创建使用机箱 [1] 中 8 个磁盘的池):
POST /api/storage/v1/pools HTTP/1.1 Host: zfs-storage.example.com Authorization: Basic abhadbfsMWE= Content-Type: application/json Accept: application/json { "name": "p1", "profile": "stripe", "1-data": 8 }
响应示例:
HTTP/1.1 201 Created Content-Type: application/json { "pool": { "asn": "314d252e-c42b-e844-dab1-a3bca680b563", "errors": [], "name": "p1", "owner": "zfs-storage", "peer": "00000000-0000-0000-0000-000000000000", "profile": "stripe", "status": "online", "usage": { "available": 1194000466944.0, "dedupratio": 100, "total": 1194000908288.0, "used": 441344.0 } } }