Default storage size for LXD VMs

Hi all, the default storage size is 8GB, which is fine when using UI as you can override it, but when using tools that don’t provide a way to specify storage, it would be great if we could alter the default size for a LXD host in MAAS.

E.g. under LXD host settings, being able to change the default from 8 GB to something else, such as 50GB.

Thoughts?

Hi @anton5mith ,

I hope you are doing well!
You are right, by default we have 8GB. What do you mean by “tools that don’t provide a way to specify storage”? ATM you can specify the storage size in the CLI and in the REST API as well using the parameter storage=root:50(local) for 50GB for example

I am using a tool that is calling the API, but that I cannot alter - i.e. I have no way to influence the way it is calling the API. Therefore, since there is a default, it would be great if that were configurable, since in some cases we don’t have the ability to alter the way we call MAAS.

This is primarily related to the awesome feature of MAAS spawning LXD VMs dynamically. I note that there are defaults for CPU, memory, and storage and while I agree that it’s possible to override those with API, it would still be useful to have the ability to alter those defaults under the LXD host settings - similar to the way you can choose a resource pool, tag etc. to add to those machines.

For reference, Mr Troyanov helped me find this, in case it is useful:
https://github.com/maas/maas/blob/master/src/maasserver/forms/pods.py#L86-L90

sure, if you can’t change the tool that is using MAAS then the only way is to change MAAS itself :slight_smile:
Let’s see what we can do, if we don’t find the time for that this request will go into our feature backlog.

Out of curiosity: is the tool you are using open source?

good question, no it isn’t :(. We are actually using it for Spectro Cloud (Palette). Although our MAAS integration does specify CPU and memory, it doesn’t make sense for us to add disk in the request since we normally target bare metal machines and then we use a CSI configuration to do things like storage. So, adding “disk” to Palette for MAAS would confuse our users as they would normally assume they are using bare metal.

The use case we are seeing though (starting with us) is in labs where container VMs are attractive, and MAAS actually provides a great way to do that, particularly since we use our CAPI provider to get machines from MAAS. It means that labs can be easily spun up/down without even defining machines thanks to the ability of MAAS to create the machines on the fly.

I understand if this doesn’t seem a priority. Even if it were possible to “hack” MAAS to alter the default would be enough to satisfy our use case. I just wondered why the defaults are what they are, and why they aren’t configurable - since 8 GB meant I couldn’t use it out of the box for our usecase.

I can’t say why they were hardcoded when the feature was implemented. IMO they should be configurable by the user, it makes perfect sense in general.

In the meantime, if you are using deb you can actually change these values right now. I can provide you the instructions in case

That would be awesome, thank you! can leave the instructions here for others?

sure thing.

Once you install, for example, maas 3.3 from deb you can then edit the file

sudo nano /usr/lib/python3/dist-packages/maasserver/forms/pods.py

at line 90 with the new default values. Then you have to restart maas with

sudo systemctl restart maas-regiond.service
1 Like

@anton5mith on a MAAS snap you can find this same file at

/snap/maas/current/lib/python3.10/site-packages/maasserver/forms/pods.py

So you can probably just edit that to achieve the same outcome.

Snaps are squashfs images and they are read only by definition: you can’t do it.

Technically it is still possible tho, but that will be a different snap and requires re-install.

root@maas:/var/lib/snapd/snaps$ snap install maas
root@maas:/var/lib/snapd/snaps$ unsquashfs maas_xxx.snap
# do the changes and pack things back
root@maas:/var/lib/snapd/snaps$ snap pack ./squashfs-root
root@maas:/var/lib/snapd/snaps$ sudo snap install --dangerous maas_xxx.snap
root@maas:/var/lib/snapd/snaps$ snap connections maas | awk '$1 != "content" && $3 == "-" {print $2}' | xargs -r -n1 sudo snap connect
root@maas:/var/lib/snapd/snaps$ sudo maas init region+rack --database-ur
1 Like

Thanks for this everyone, excellent help. <3 MAAS team!

I may be using this or mentioning this in some marketing materials I’m working on, will let you know.

1 Like