Hello everyone,
I am trying to set up a custom storage configuration for a machine in MAAS, following the guide provided here: How to create custom storage.
I created the following commissioning script:
#!/usr/bin/env python3
#
# 41-custom-storage-cluster-k8s-partitioned-2
#
# --- Start MAAS 1.0 script metadata ---
# name: 41-custom-storage-cluster-k8s-partitioned-2
# title: Configure custom storage for k8s cluster
# description: Configure custom storage for k8s cluster
# script_type: commissioning
# timeout: 60
# --- End MAAS 1.0 script metadata ---
import json
import os
import sys
def read_json_file(path):
try:
with open(path) as fd:
return json.load(fd)
except OSError as e:
sys.exit(f"Failed to read {path}: {e}")
except json.JSONDecodeError as e:
sys.exit(f"Failed to parse {path}: {e}")
def main():
maas_resources_file = os.environ.get("MAAS_RESOURCES_FILE")
maas_storage_config_file = os.environ.get("MAAS_STORAGE_CONFIG_FILE")
machine_resources = read_json_file(maas_resources_file)
storage_config = {
"layout": {
"raid_root": {
"type": "raid",
"level": 1,
"members": [
"nvme0n1",
"nvme1n1"
]
},
"lvm": {
"type": "lvm",
"members": [
"raid_root"
],
"volumes": [
{
"name": "root",
"size": "800G",
"fs": "ext4"
}
]
}
},
"mounts": {
"/": {
"device": "root"
}
}
}
with open(maas_storage_config_file, "w") as f:
json.dump(storage_config, f, indent=4, sort_keys=True)
print(f"Custom storage configuration has been written to {maas_storage_config_file}")
return 0
if __name__ == "__main__":
sys.exit(main())
However, when I commission the machine, I receive the following error in the MAAS GUI:
Despite this error, the machine is marked as “Ready” in MAAS.
Could someone guide me on how to modify my script to ensure that the boot disks are properly configured?
Any insights or suggestions would be greatly appreciated!
Thank you!