Stephan,

That's amazing, thanks for sharing!

---
Nux
www.nux.ro

On 2023-01-06 20:23, Stephan Bienek wrote:
Hello Cloudstack Users,

following the blog of Rohit about how to install and run Cloudstack on
an Raspberry 4 using Ubuntu on arm64/aarch64
( https://www.shapeblue.com/apache-cloudstack-on-raspberrypi4-with-kvm/ )
and Rohits commits to cloudstack to support arm64 (thx Rohit!) i tried
it myself.

For my setup i decided to use the latest release of Cloudstack without
any modifications, as Rohits commits were already merged.
Instead of using a Raspberry Pi4 i am using an Odroid M1, which shares
the arm64 architecture with the rpi4.

The installation following the ACS documentation and/or Rohits blog
(without the special modifications required at that time) went quite
smooth.

Missing automatic systemvmtemplate build
----------------------------------------

One thing i felt still missing was how to build the required
systemvmtemplate (Consoleproxy, SSVM and VRs) for arm64.
Building the same automatic way on both - a x86_64 host, being able to
build the amd64 systemvmtemplate and the arm64 systemvmtemplate,
and/or directly building on the arm64 host would be great.

After quite some work i figured the required changes and thought i'd
share them here to see if it helps someone else and if it's useful,
maybe the changes could contribute to cloudstack.

All the existing logic using packer was kept, which is available for
amd64 and arm64.

I created a fork and applied the changes in a branch at
https://github.com/StepBee/cloudstack/tree/add_systemvmtemplate_arm64_support

The changes in code
-------------------

- changing debian preseed files
tools/appliance/systemvmtemplate/http/preseed.cfg to create an EFI
partition and instruct debian to copy /EFI/debian/grubaa64.efi to
/EFI/BOOT/BOOTAA64.efi

Detailed changes can be found at
https://github.com/apache/cloudstack/commit/8f406e7fd1bcf9b71202fe526f0adaff40402884

- changing tools/appliance/systemvmtemplate/template.json packer
builder template(s) to provide the right qemuargs and adjust the
boot_commands, as these are quite different from amd64 builds,
increasing ssh_timeout and boot_wait

Detailed changes can be found at
https://github.com/apache/cloudstack/commit/a7077a8453dc944048a236bb44e19beeffaec7f9

- changing tools/appliance/build.sh to support providing the target
architecture as first parameter and skip all non-kvm builds when
building for arm64 - building arm64 systemvmtemplate on x86_64 and
arm64 hosts is supported
- changing
tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh
to handle repository additions etc for arm64

Detailed changes can be found at
https://github.com/apache/cloudstack/commit/fbacf5b2caed958e90ed4c134948aa4eb8dafed1

Required packages are based on the amd64 requirements plus, of course,
the arm/aarch64 qemu packages
- packer (
https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli
)
- qemu-utils
- qemu-system-arm
- qemu-efi-aarch64

To build the arm64 systemvmtemplate:
- Cloning the branch from my fork
- cd tools/appliance/
- ./build.sh aarch64 systemvmtemplate


Running Cloudstack
------------------
On arm64 i noticed the log was complaining about a missing
/etc/cloudstack/agent/uefi.properties

Which could look like this one:

guest.nvram.template.secure=/usr/share/AAVMF/AAVMF_VARS.snakeoil.fd
guest.nvram.template.legacy=/usr/share/AAVMF/AAVMF_VARS.fd
guest.loader.secure=/usr/share/AAVMF/AAVMF_CODE.snakeoil.fd
guest.nvram.path=/var/lib/libvirt/qemu/nvram/
guest.loader.legacy=/usr/share/AAVMF/AAVMF_CODE.fd

An additional hint for using cloud images:
Where most of the cloud images for amd64 work with cloudstack userdata
out of the box, i noticed most of the arm64/aarch64 cloud images are
missing the cloudstack datasource within the built-in cloud-init
config.

Modification of the cloud images by placing the file
/etc/cloud/cloud.cfg.d/cloudstack.cfg with content:
datasource_list: ['CloudStack']
datasource:
  CloudStack:
    max_wait: 120
    timeout: 50

in the qcow2 or raw images solves the issue.

I hope it's helping the cloudstack community.

Best regards,
Stephan

Reply via email to