Attach storage to a virtual machine
POST
/vm/{rid}/storage
const url = 'https://sylve.lan:8181/api/vm/1/storage';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"attachType":"import","bootOrder":1,"dataset":"example","downloadUUID":"example","emulation":"virtio-blk","filesystemTarget":"example","name":"example","pool":"example","rawPath":"example","readOnly":true,"recordSize":1,"size":1,"storageType":"raw","volBlockSize":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://sylve.lan:8181/api/vm/1/storage \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "attachType": "import", "bootOrder": 1, "dataset": "example", "downloadUUID": "example", "emulation": "virtio-blk", "filesystemTarget": "example", "name": "example", "pool": "example", "rawPath": "example", "readOnly": true, "recordSize": 1, "size": 1, "storageType": "raw", "volBlockSize": 1 }'Create or import and attach a storage device to a shut-off virtual machine
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”rid
required
integer
Virtual Machine RID
Request Body
Section titled “Request Body”Storage attachment
Media typeapplication/json
object
attachType
required
string
bootOrder
integer
dataset
string
downloadUUID
string
emulation
required
string
filesystemTarget
string
name
string
pool
string
rawPath
string
readOnly
boolean
recordSize
integer
size
integer
storageType
required
string
volBlockSize
integer
Responses
Section titled “Responses”Created
Media typeapplication/json
object
data
object
bootOrder
integer
dataset
object
guid
string
id
integer
name
string
pool
string
datasetId
integer
emulation
string
enable
boolean
filesystemTarget
string
id
integer
name
string
pool
string
readOnly
boolean
recordSize
integer
size
integer
type
string
uuid
string
vmId
integer
volBlockSize
integer
error
string
message
string
status
string
Example
{ "data": { "emulation": "virtio-blk", "type": "raw" }}Bad Request
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Unauthorized
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Forbidden
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Not Found
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Conflict
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Request Entity Too Large
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Internal Server Error
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}Service Unavailable
Media typeapplication/json
object
data
error
string
message
string
status
string
Examplegenerated
{ "data": "example", "error": "example", "message": "example", "status": "example"}