Duplicate WebUI storage layout


#1

Hi guys,

Is there a way to duplicate a storage layout made into the Web Interface for an other node ? I have 32 new servers made identical and replicate the storage layout manually is time consuming.
I don’t want to play with storage in curtin file too.
Did you try to use something like Selenium or Kantu to register the creation ? I did without full success :confused:
I was wondering if the storage layout was stored somewhere and could be possibly duplicate to others machine.
Thank you,
Ludwig


#2

You can’t copy it through web UI so there are two possibilities:

  • partitioning through preseed files using curtin
  • script that uses API to set storage on every host in state READY:

IyEvYmluL2Jhc2gKClBST0ZJTEU9ZGVmYXVsdAoKaWYgWyAteiAiJCoiIF07IHRoZW4KICAgICAg
ICBzeXN0ZW1faWRzPWBtYWFzICRQUk9GSUxFIG1hY2hpbmVzIHJlYWQgfCBqcSAiLltdIHwgc2Vs
ZWN0KC5zdGF0dXMgPT0gNCkgfCAuc3lzdGVtX2lkIiAtTXJgCmVsc2UKICAgICAgICBzeXN0ZW1f
aWRzPSQqCmZpCmZvciBTWVNURU1fSUQgaW4gJHN5c3RlbV9pZHMKZG8KCXJvb3RfZGV2aWQ9YG1h
YXMgJFBST0ZJTEUgYmxvY2stZGV2aWNlcyByZWFkICRTWVNURU1fSUQgfCBqcSAiLltdIHwgc2Vs
ZWN0KC5tb2RlbCA9PSBcIkxPR0lDQUwgVk9MVU1FXCIpLmlkIiAtLWNvbXBhY3Qtb3V0cHV0YAoJ
aWYgW1sgISAiJHJvb3RfZGV2aWQiID1+IFswLTldKyBdXTsgdGhlbgoJCWVjaG8gTm8gcm9vdCBk
ZXZpY2UgZm91bmQgZm9yIHN5c3RlbSAkU1lTVEVNX0lECgkJY29udGludWUKCWZpCgltYWFzICRQ
Uk9GSUxFIGJsb2NrLWRldmljZSBzZXQtYm9vdC1kaXNrICRTWVNURU1fSUQgJHJvb3RfZGV2aWQK
CWJvb3RlZmlwYXJ0X2lkPWBtYWFzICRQUk9GSUxFIHBhcnRpdGlvbnMgY3JlYXRlICRTWVNURU1f
SUQgJHJvb3RfZGV2aWQgc2l6ZT01MTJNIHwganE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dCAk
U1lTVEVNX0lEICRsdmxvZ19pZCBmc3R5cGU9ZXh0NAoJbWFhcyAkUFJPRklMRSBibG9jay1kZXZp
Y2UgbW91bnQgJFNZU1RFTV9JRCAkbHZsb2dfaWQgbW91bnRfcG9pbnQ9L3Zhci9sb2cKCgkjIExW
IHZhcmxpYmRvY2tlcgoJbHZkb2NrZXJfaWQ9YG1hYXMgJFBST0ZJTEUgdm9sdW1lLWdyb3VwIGNy
ZWF0ZS1sb2dpY2FsLXZvbHVtZSAkU1lTVEVNX0lEICR2ZzAwX2lkIG5hbWU9ZG9ja2VyIHNpemU9
MTAwRyB8IGpxIC5pZGAKCW1hYXMgJFBST0ZJTEUgYmxvY2stZGV2aWNlIGZvcm1hdCAkU1lTVEVN
X0lEICRsdmRvY2tlcl9pZCBmc3R5cGU9ZXh0NAoJbWFhcyAkUFJPRklMRSBibG9jay1kZXZpY2Ug
bW91bnQgJFNZU1RFTV9JRCAkbHZkb2NrZXJfaWQgbW91bnRfcG9pbnQ9L3Zhci9saWIvZG9ja2Vy
CmRvbmUK

decode it with
base64 -d - > maas_setup_storage.sh

this script probably wont work for you but use it as a inspiration.


#3

Thank you for your answer, I’ll give a try to the cloud init option.


#4

Hi ludww,

Unfortunately you can’t duplicate the storage layout of a machine through the UI currently but you might find this API call useful:

PPOST /MAAS/api/2.0/machines/?op=clone

You can see more details about it in the API docs.

Best,

Lilyana