Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/config_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ For file systems (shared directories or custom volumes), this is one of:
:required: "yes"
:shortdesc: "Path inside the instance where the disk will be mounted (only for file system disk devices)"
:type: "string"
This controls which path inside the instance the disk should be mounted on.

With containers, this option supports mounting file system disk devices, and paths and single files within them.

With VMs, this option supports mounting file system disk devices and paths within them. Mounting single files is not supported.
```

```{config:option} pool devices-disk
Expand Down
9 changes: 9 additions & 0 deletions internal/server/device/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ func (d *disk) validateConfig(instConf instance.ConfigReader) error {
"boot.priority": validate.Optional(validate.IsUint32),

// gendoc:generate(entity=devices, group=disk, key=path)
// This controls which path inside the instance the disk should be mounted on.
//
// With containers, this option supports mounting file system disk devices, and paths and single files within them.
//
// With VMs, this option supports mounting file system disk devices and paths within them. Mounting single files is not supported.
// ---
// type: string
// required: yes
Expand Down Expand Up @@ -1402,6 +1406,11 @@ func (d *disk) startVM() (*deviceConfig.RunConfig, error) {
mount.Opts = append(mount.Opts, "bus=virtiofs")
}
} else {
// Forbid mounting files to FS paths.
if d.config["path"] != "" {
return nil, errors.New(`The "path" setting is not supported on VMs for non-directory sources`)
}

// Confirm we're dealing with block options.
err := validate.Optional(validate.IsOneOf("nvme", "virtio-blk", "virtio-scsi", "usb"))(d.config["io.bus"])
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/server/metadata/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
},
{
"path": {
"longdesc": "",
"longdesc": "This controls which path inside the instance the disk should be mounted on.\n\nWith containers, this option supports mounting file system disk devices, and paths and single files within them.\n\nWith VMs, this option supports mounting file system disk devices and paths within them. Mounting single files is not supported.",
"required": "yes",
"shortdesc": "Path inside the instance where the disk will be mounted (only for file system disk devices)",
"type": "string"
Expand Down