- CLOUDSTACK-9913Getting issue details... STATUS
Metal-as-a-Service (MaaS) is a project by Canonical to enable provisioning of baremetal servers. MaaS has plenty of features which make it very lucrative to be used as a baremetal orchestrator in Cloudstack. Some of the features of MaaS include
This feature aims to add MaaS as an external baremetal provisioner in Advanced networks in Cloudstack. This does not replace the existing baremetal offering by Cloudstack.
Version | Author | Date | Changes |
---|---|---|---|
v1.0 | Syed Ahmed | 09-May-2017 | Initial Draft |
There are two settings to enable MaaS in Cloudstack. The first setting defines which class to use for the baremetal resource
external.baremetal.resource.classname = org.apache.cloudstack.compute.maas.MaasResourceProvider
This setting will enable MaaS as the handler for baremetal resources instead of <DEFAULT_BAREMETAL_CLASS>
The MaasResourceProvider is configured via the following setting
external.baremetal.system.url = MaasIP=172.31.0.75;MaasKey=fGWswZhpUQrrKUxprD;MaasSecret=CUaKSPXngrtRGRACtLLQKCYLqrQxPgTC;MaasConsumerKey=6sxtWH3XCfKgkspC8J
A typical MaaS key is of the form <MaasConsumerKey>:<MaasKey>:<MaasSecret> for example, the above URL is derived from the following MaaS key
6sxtWH3XCfKgkspC8J:fGWswZhpUQrrKUxprD:CUaKSPXngrtRGRACtLLQKCYLqrQxPgTC
Before adding hosts. We will setup the rack configuration. This is a JSON describing the layout of the hosts and how they are connected to the ToR switch. A sample rack config looks something like this:
{ "racks": [ { "l2Switch": { "ip": "172.31.0.109", "username": "admin", "password": "password", "type": "Force10" }, "hosts": [ { "mac": "00:18:8b:52:79:80", "port": "1/1/1" } ] } ] }
The rack config can be added from the Global Settings -> Baremetal Rack Configuration tab. Once this is done, the hosts are added using the Infrastructure -> Hosts -> Add button. Make sure that the baremetal cluster is selected (if no baremetal cluster exists, create one first)
The IP/user/password/MAC are the IPMI credentials. CPU, # of Cores and Memory define the dimensions of the physical server. Cloudstack periodically checks the power of the host using IPMI.
Adding MaaS templates is similar to adding any other template except the URL field reflects the name of MaaS image. In the screenshot, centos7 is the name of the image in MaaS. This Doesn't download the image as it would do in a traditional image but creates a DB entry and the URL is passed to MaaS when the host is provisioned.
When creating a compute offering, make sure that BareMetalPlanner is selected and the CPU/Memory details match the host that was added
When a host is provisioned, a StartCommand is issued by cloud-server. This command is handled by the MaasResourceProvider. The provider verifies a list of constraints like
The host exists in the DB, a default NIC is present on the host, the default NIC belongs to a valid network, the node is already discovered by MaaS. The plugin proceeds to the provisioning stage.There are two possible cases
This is very simple. When a user stops a Baremetal VM, cloud-server sends the StopCommand to the MaaS plugin. The plugin will just issue an IPMI shutdown command and return back.
A new command call DestroyCommand is added to Cloudstack. MaaS plugin handles this command and does the following
Bonding support is currently only tested for CentOS. Bonding is only done if there are more than one interface that are connected to the ToR from the physical host. The bonding mode is set to active-backup.
You can modify the default template from MaaS by using preseed scripts. Below is an example of a script that removes cloud-init and sets the root password to "password".
root@coe-hq-maas01: /etc/maas/preseeds # cat curtin_userdata_centos #cloud-config debconf_selections: maas: | {{for line in str(curtin_preseed).splitlines()}} {{line}} {{endfor}} syed-test: - &myscript | #/bin/bash SCRIPT=$(readlink -f "$0"); if [ -f "/root/.init_done" ] then sed -i 's/yum remove -y cloud-init//' /etc/rc.local echo "Done done" > /root/.init_message exit fi # yum remove -y cloud-init echo "############### REMOVE CLOUD INIT ############ " echo "yum remove -y cloud-init" >> /etc/rc.local touch /root/.init_done echo "echo "password" | passwd root --stdin" >> /etc/rc.local late_commands: maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null'] test_syed_script: ['curtin', 'in-target', '--', 'sh', '-c', *myscript ] power_state: mode: reboot
No external dependecies are being added for this feature. All code will be developed within Cloudstack’s scope.