python-libmaas icon indicating copy to clipboard operation
python-libmaas copied to clipboard

Ability to apply default storage configuration?

Open tomkivlin opened this issue 5 years ago • 0 comments

The problem I'm trying to solve is that I would like to configure the default storage layout for a machine as part of a wider python script.

I can see there appears to be a way to do so here: https://github.com/maas/python-libmaas/blob/bc1d76ae5fbb550924d63ec2655759d1eb130ca3/maas/client/viscera/maas.py#L268-L270

However, I'm not sure what I need to import in order to use this function. I've tried the following:

from maas.client import viscera
from maas.client.viscera import maas

But can't figure out how to make use of the function, e.g.

client = connect("http://maas-server:5240/MAAS/", apikey="key")
machine = client.machines.get(system_id='te7gwc')
machine.get_default_storage_layout()
machine.set_default_storage_layout(storage_layout='lvm')

Am I missing something obvious?

tomkivlin avatar Nov 25 '20 13:11 tomkivlin