[lxc-users] Error: The [size] properties cannot be changed for "lvm" storage volumes

Kees Bakker keesb at ghs.com
Tue Sep 25 14:59:42 UTC 2018


Hey,

In my quest to find out how to change volume sizes I ran into this
error message.

# lxc init ubuntu:bionic testvolsize4
# lxc storage volume set local testvolsize4 size 20GB
Error: not found
# lxc storage volume set local container/testvolsize4 size 20GB
Error: The [size] properties cannot be changed for "lvm" storage volumes

(Only by looking at the source code I figured out that I could
prefix the volume name.)

Hmm, LXD does not like to change the size of an LVM volume if
it is not "custom". Is there a reason for that?

lxd/storage_lvm.go:
func (s *storageLvm) StoragePoolVolumeUpdate(writable *api.StorageVolumePut,
        changedConfig []string) error {
        logger.Infof(`Updating LVM storage volume "%s"`, s.pool.Name)

        changeable := changeableStoragePoolVolumeProperties["lvm"]
        unchangeable := []string{}
        for _, change := range changedConfig {
                if !shared.StringInSlice(change, changeable) {
                        unchangeable = append(unchangeable, change)
                }
        }

        if len(unchangeable) > 0 {
                return updateStoragePoolVolumeError(unchangeable, "lvm")
        }

        if shared.StringInSlice("size", changedConfig) {
                if s.volume.Type != storagePoolVolumeTypeNameCustom {
                        return updateStoragePoolVolumeError([]string{"size"}, "lvm")
                }
-- 
Kees


More information about the lxc-users mailing list