Windows VMs on MaaS, Ubuntu Host: How to import Windows image?


#1

I’m new to MaaS, and I have a cluster of 12 machines running under control of MaaS 2.6.1. All machines are running Ubuntu 18.04 LTS.

I’d like to run some Windows VMs, and I haven’t been able to find information on how to create and import a Windows image. I’d also like to point out that this question has been asked on this forum a few times, without being answered: Removed since apparently new users have a links-in-their-post limitation

I have created a qemu Windows image, converted the file from qcow2 to raw, uploaded it to the MaaS head node. I found this article showing how to add an image, which provides this example:

maas $profile boot-resources create name=custom/$imagedisplayname architecture=amd64/generic content=@$filepath

I figured out that size= and sha256= are required extra parameters, and added them accordingly. However, I get an error saying str object not callable. I was sure to have the content=@path.raw, making there the @ sign was present, and tried the import command without it too, which provided the same error. Interestingly enough, content= is supposedly an optional parameter, but omitting it shows an error saying “Missing content”.

Traceback (most recent call last):
  File "/usr/bin/maas", line 12, in <module>
    sys.exit(maascli.main())
  File "/usr/lib/python3/dist-packages/maascli/__init__.py", line 29, in main
    options.execute(options)
  File "/usr/lib/python3/dist-packages/maascli/actions/boot_resources_create.py", line 45, in __call__
    content = self.initial_request(uri, options)
  File "/usr/lib/python3/dist-packages/maascli/actions/boot_resources_create.py", line 66, in initial_request
    body, headers = self.prepare_initial_payload(options.data)
  File "/usr/lib/python3/dist-packages/maascli/actions/boot_resources_create.py", line 109, in prepare_initial_payload
    size, sha256 = self.calculate_size_and_sha256(content)
  File "/usr/lib/python3/dist-packages/maascli/actions/boot_resources_create.py", line 122, in calculate_size_and_sha256
    with content() as fd:
TypeError: 'str' object is not callable

It’s interesting that boot-resources create wants size= and sha256= given that the function calculate_size_and_sha256() returns those values.

Any thoughts on how to add a Windows image, and what needs to be done to the image (if anything) before being imported? It would be nice to have an image import page on the web interface.
Thank you.


#2

I’ve realized the article I used as a reference was wrong, the correct syntax is content@= not content=@. Second, I found a nice Wiki article from Cloudbase which describes the process of running Windows with MaaS: https://wiki.cloudbase.it/maas, which looks promising.