Comment 3 for bug 2039614

Revision history for this message
Jeff Lane  (bladernr) wrote (last edit ):

So what this came from was a need from SQA to create custom partition layouts for some of their testing (setting up ceph, bcache, etc). Unfortunately, the only way to do that is to specify the desired layout to MAAS prior to deployment, which permanently changes the partition layout for the machine. This causes the problem where WE need the layouts to be basic and flat, with all secondary disks with simple single partitions for cert testing needs. BUT if SQA runs a test it permanently rewrites the disk layout until you re-write it again (e.g there's no way in MAAS to do a one-time-only partition layout for a deployment).

SO Testflinger agents (the things that issue commands to MAAS to allocate and deploy nodes using MAAS CLI commands) do one of two things:

1: If you submit a job that includes a custom partition layout, testflinger will apply your custom layout to the machine during provisioning so that if you desire a ... MD RAID layout, that's what you get.

or 2: If you submit a job with NO custom partition layout, the testflinger agent has a copy of what the default layout should be (our simple flat layouts for cert purposes) and will tell MAAS to configure the drives that way.

(EDIT to add that the "default storage definition" that we store in the config for each testflinger agent (now called device connectors?) is pulled directly from maas using some MAAS CLI commands)

We had to implement #2 because of the aforementioned gap where you can't specify a one-time-only partition layout while preserving the original layout during deployment.

We briefly considered retrieving the "current layout" from MAAS on the fly, deploying with the custom layout, and then re-configuring the node using the previously retrieved "current" layout but decided against that because it leads easily to a case where a job could change the partition scheme, then fail, and never return the original partition layout, leaving a machine in a permanently altered state.

Attached is one of the agent config files that includes the "default" partition layout.

Additionally, all of this is defined in the testflinger source:
https://github.com/canonical/snappy-device-agents/tree/main/src/testflinger_device_connectors/devices/maas2

in maas2-storage.py and called from maas2.py