Skip to content

Commit

Permalink
Merge pull request #12938 from masnax/volume-fs
Browse files Browse the repository at this point in the history
lxd/storage/drivers: Always use default block.filesysem for VM volumes
  • Loading branch information
tomponline authored Feb 22, 2024
2 parents b0c038b + ae91b8f commit caa6535
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
21 changes: 13 additions & 8 deletions lxd/storage/drivers/driver_ceph_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,15 +805,20 @@ func (d *ceph) FillVolumeConfig(vol Volume) error {
// Only validate filesystem config keys for filesystem volumes or VM block volumes (which have an
// associated filesystem volume).
if vol.ContentType() == ContentTypeFS || vol.IsVMBlock() {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
// VM volumes will always use the default filesystem.
if vol.IsVMBlock() {
vol.config["block.filesystem"] = DefaultFilesystem
} else {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
vol.config["block.filesystem"] = DefaultFilesystem
}
}

// Inherit filesystem mount options from pool if not set.
Expand Down
21 changes: 13 additions & 8 deletions lxd/storage/drivers/driver_lvm_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,20 @@ func (d *lvm) FillVolumeConfig(vol Volume) error {
// Only validate filesystem config keys for filesystem volumes or VM block volumes (which have an
// associated filesystem volume).
if vol.ContentType() == ContentTypeFS || vol.IsVMBlock() {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
// VM volumes will always use the default filesystem.
if vol.IsVMBlock() {
vol.config["block.filesystem"] = DefaultFilesystem
} else {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
vol.config["block.filesystem"] = DefaultFilesystem
}
}

// Inherit filesystem mount options from pool if not set.
Expand Down
21 changes: 13 additions & 8 deletions lxd/storage/drivers/driver_powerflex_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,20 @@ func (d *powerflex) FillVolumeConfig(vol Volume) error {
// Only validate filesystem config keys for filesystem volumes or VM block volumes (which have an
// associated filesystem volume).
if vol.ContentType() == ContentTypeFS || vol.IsVMBlock() {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
// VM volumes will always use the default filesystem.
if vol.IsVMBlock() {
vol.config["block.filesystem"] = DefaultFilesystem
} else {
// Inherit filesystem from pool if not set.
if vol.config["block.filesystem"] == "" {
vol.config["block.filesystem"] = d.config["volume.block.filesystem"]
}

// Default filesystem if neither volume nor pool specify an override.
if vol.config["block.filesystem"] == "" {
// Unchangeable volume property: Set unconditionally.
vol.config["block.filesystem"] = DefaultFilesystem
}
}

// Inherit filesystem mount options from pool if not set.
Expand Down

0 comments on commit caa6535

Please sign in to comment.