Skip to content

Commit

Permalink
lxd/device: Mount snapshot disks readonly
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins committed Feb 6, 2025
1 parent 2d3ebe1 commit 52455e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lxd/device/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func (d *disk) startContainer() (*deviceConfig.RunConfig, error) {
}

options := []string{}
if isReadOnly {
if isReadOnly || d.config["snapshot"] != "" {
options = append(options, "ro")
}

Expand Down Expand Up @@ -1227,7 +1227,7 @@ func (d *disk) startVM() (*deviceConfig.RunConfig, error) {
mount.Opts = append(mount.Opts, d.detectVMPoolMountOpts()...)
}

if shared.IsTrue(d.config["readonly"]) {
if shared.IsTrue(d.config["readonly"]) || d.config["snapshot"] != "" {
mount.Opts = append(mount.Opts, "ro")
}

Expand Down

0 comments on commit 52455e2

Please sign in to comment.