Resource configuration
In order for Atomia to be able to contact the OpenStack API:s correctly you need to configure the OpenStack module in the Atomia resource file. The resource file is found at “C:\Program Files (x86)\Atomia\AutomationServer\Common\Resources.xml” on the server hosting Atomia Automation Server. In order to edit this file we will create a new transformation file in the folder “C:\Program Files (x86)\Atomia\AutomationServer\Common\Transformation Files” and call it “Resources.OpenStack.xml”
<?xml version="1.0" encoding="utf-8"?> <resourceDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <bindings xdt:Locator="XPath(//bindings[moduleList/module/@name='Atomia.Provisioning.Modules.OpenStack.OpenStack'])"> <moduleList> <module name="Atomia.Provisioning.Modules.OpenStack.OpenStack" resourceAsignmentPolicy="RoundRobin" /> </moduleList> <resourceList> <resource name="OpenStack1" xdt:Transform="Insert"> <property name="Provider">openstack</property> <property name="AdminUser">admin</property> <property name="AdminPassword">admin</property> <property name="OSDomain">Default</property> <property name="IdentityUri">http://hostname-of-keystone:35357</property> <property name="ComputeUri">http://hostname-of-nova:8774</property> <property name="NetworkUri">http://hostname-of-neutron:9696</property> <property name="CinderUri">http://hostname-of-cinder:8776</property> <property name="GnocchiUri">http://hostname-of-gnocchi:8041</property> <property name="Meter">gnocchi</property> <property name="Hypervisor">kvm</property> <property name="ExternalGatewayId">2185b388-f4ad-4925-a1a0-155ea17aac66</property> </resource> </resourceList> </bindings> </resourceDescription>
- Provider: The provider name.
- AdminUser: A user in OpenStack keystone which is a member of the Administrator role or have the necessery permissions to perform all api commands required by Atomia.
- AdminPassword: The password for the Administrator user.
- OSDomain: The OpenStack domain (for most installations this should remain at Default).
- IdentityUri: The Uri of the OpenStack Identity (Keystone) api endpoint.
- ComputeUri: The Uri of the OpenStack Compute (Nova) api endpoint.
- NetworkUri: The Uri of the OpenStack Network (Neutron) api endpoint.
- CinderUri: The Uri of the OpenStack Storage (Cinder) api endpoint.
- GnocchiUri: The Uri of the OpenStack Telemetry (Gnocchi) api endpoint.
- Meter: Selects which service will be used for usage data collection:
gnocchi – gnocchi version 4.3+
gnocchiv3 – gnocchi version 3 (no longer supported)
ceilometer – ceilometer (no longer supported) - Hypervisor: The Hypervisor to use, currently the only accepted value is KVM.
- ExternalGatewayId: The OpenStack UID of the external network that tenants should route traffic to.
Configure the values to fit your environment and save the file. In order to transform the resource file and make these changes active run the shortcut “Recreate config files” in “C:\Program Files (x86)\Atomia\AutomationServer” on the Automation Server machine.
Provisioning description configuration
The provisioning of OpenStack services is defined in the ProvisioningDescription.xml file which is located at “C:\Program Files (x86)\Atomia\AutomationServer\Common\ProvisioningDescriptions\ProvisioningDescription.xml” on the Automation server machine. We need to do some simple changes to it in order to enable OpenStack to work correctly. As with the resource file we create a transformation file called “ProvisioningDescription.EnableOpenStack.xml” and place it in “C:\Program Files (x86)\Atomia\AutomationServer\Common\ProvisioningDescriptions\Transformation Files ”
<?xml version="1.0" encoding="utf-8"?> <provisioningDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <complexServiceProperty name="EnableOpenStack" description="If set to true OpenStack services will be provisioned" defaultValue="true" xdt:Locator="XPath(//*[@name='EnableOpenStack'])" xdt:Transform="SetAttributes(defaultValue)" /> </provisioningDescription>
These changes will set the CsCloud service to provision the default structure for OpenStack and make it ready for provisioning additional services from Atomia. When you are done run the same “Recreate config files” script as above. You should also restart IIS and the two services “Atomia Automation Server Periodic Updater” and “Atomia Automation Server Provisioning Engine”.
Configure images in Atomia Automation Server
In order for Automation Server to know how to provision your virtual machines there are some configuration needed to be done. This configuration is done in the file C:\Program Files (x86)\Atomia\AutomationServer\Common\ModulesAtomia.Provisioning.Modules.OpenStack.dll.config.
We are interested in changing the configuration option “cloudInfo”. By default it looks something like below.
{ "AvailableImages": [ { "name": { "default": "Linux Ubuntu Trusty 14.04" }, "description": { "default": "Ubuntu is a fast, secure and easy-to-use operating system used by millions of people around the world.", "sv": "Ubuntu ar ett fritt operativsystem baserat pa linuxkarnan. Ubuntus malsattning ar bland annat att vara ett aktuellt, stabilt operativsystem for den genomsnittlige anvandaren, med ett starkt fokus pa anvandarvanlighet och enkel installation." }, "image_id": "ff80f383-aa0b-4a74-9d41-1c20ddab327e", "product_id": "VPS-LINUX", "admin_password_set": true, "ssh_username": "ubuntu", "ssh_port": "22", "enable_password_reset": "false" }, { "name": { "default": "Windows Server 2008 R2" }, "description": { "default": "Windows Server 2008 R2", "sv": "Windows Server 2008 R2" }, "image_id": "ami-0000000a", "product_id": "VPS-WINDOWS", "enable_password_reset": "false" } ], . . .
This section defines all images you want to be able to offer through Atomia, you need to modify this section and add a new entry for each of your images. Most options is probably self explanitory just make sure that image_id matches the id of the image in OpenStack and product_id is the id/name/article id of the product in Atomia Billing. In our previous example we added an image for Ubuntu 16.04 so let’s modify the configuration to include this image.
{ "AvailableImages": [ { "name": { "default": "Linux Ubuntu Xenial 16.04" }, "description": { "default": "Ubuntu is a fast, secure and easy-to-use operating system used by millions of people around the world.", "sv": "Ubuntu ar ett fritt operativsystem baserat pa linuxkarnan. Ubuntus malsattning ar bland annat att vara ett aktuellt, stabilt operativsystem for den genomsnittlige anvandaren, med ett starkt fokus pa anvandarvanlighet och enkel installation." }, "image_id": "fa0314a73-4db6-447e-b95b-aefd023bc751", "product_id": "VPS-LINUX", "admin_password_set": true, "ssh_username": "ubuntu", "ssh_port": "22", "enable_password_reset": "false" }, { "name": { "default": "Linux Ubuntu Trusty 14.04" }, "description": { "default": "Ubuntu is a fast, secure and easy-to-use operating system used by millions of people around the world.", "sv": "Ubuntu ar ett fritt operativsystem baserat pa linuxkarnan. Ubuntus malsattning ar bland annat att vara ett aktuellt, stabilt operativsystem for den genomsnittlige anvandaren, med ett starkt fokus pa anvandarvanlighet och enkel installation." }, "image_id": "ff80f383-aa0b-4a74-9d41-1c20ddab327e", "product_id": "VPS-LINUX", "admin_password_set": true, "ssh_username": "ubuntu", "ssh_port": "22", "enable_password_reset": "false" }, { "name": { "default": "Windows Server 2008 R2" }, "description": { "default": "Windows Server 2008 R2", "sv": "Windows Server 2008 R2" }, "image_id": "ami-0000000a", "product_id": "VPS-WINDOWS", "enable_password_reset": "false" } ], . . .
If you want to support password reset your image need to be prepared with a script that should run on each boot or in a short interval in crontab you can find an example of this script at page.
Configure flavors in Atomia Automation Server
In the same file and section as with images above there is configuration options for defining what flavors can be used with what images. It looks like this by default.
"AvailableInstanceTypes": [ { "name": { "default": "Tiny instance", "sv": "Miniatyr-VPS" }, "description": { "default": "Our smallest instance type. 512 MB of RAM.", "sv": "Var allra minsta VPS. 512 MB RAM-minne." }, "instance_type": "m1.tiny", "available_images": [ "ff80f383-aa0b-4a74-9d41-1c20ddab327e" ] }, { "name": { "default": "Small instance", "sv": "Lagom-VPS" }, "description": { "default": "Small VPS instance suitable for most tasks. 2 GB of RAM.", "sv": "Lagom VPS med 2 GB RAM-minne." }, "instance_type": "m1.small", "available_images": [ "ami-00000002", "ami-0000000a" ] }, { "name": { "default": "Large instance", "sv": "Jatte-VPS" }, "description": { "default": "Large VPS instance suitable for active websites. 8 GB of RAM.", "sv": "Stor VPS med 8 GB RAM-minne." }, "instance_type": "m1.large", "available_images": [ "ami-00000002", "ami-0000000a" ] } ],
The instance_type option should match the id of the flavor that is available in OpenStack and available_images is a list of what images can take advantage of this flavor (or instance type).
Troubleshooting
Some configurations of OpenStack require modifications to the default Atomia Provisioning Description. In this section we list the current know issues. Should you come across an issue not described here, please report it to us!
IP pool name is different than default
Error message: ID400026: Service EC2Address: Caught unhandled exception: System.Exception: Could not allocate a new IP address to project 9cd15004ec2a4044b1c27cfea0c235f4. The error was: {“itemNotFound”: {“message”: “Floating ip pool not found.”, “code”: 404}}
This issue happens if your pool of ip addresses is different than the default in Atomia which is “public”. It is easily changed with a transformation of ProvisioningDescription
<?xml version="1.0" encoding="utf-8"?> <provisioningDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <serviceProperty name="Pool" xdt:Locator="XPath(//*/complexService[@name='CsVPSInstance']//*/add[@condition='$CsVPSInstance::SecurityGroup neq null']//*/serviceProperty[@name='Pool'])" xdt:Transform="Replace"> <expression>ext-net</expression> </serviceProperty> <serviceProperty name="Pool" xdt:Locator="XPath(//*/complexService[@name='CsVPSInstance']//*/add[@condition='$CsVPSInstance::SecurityGroup eq null']//*/serviceProperty[@name='Pool'])" xdt:Transform="Replace"> <expression>ext-net</expression> </serviceProperty> </provisioningDescription>
Just change “ext-net” in the example to the name of your ip pool.
Updating resource property
After you update the OpenStack resource properties in the resource file, you need to update them on the existing CsOpenStackResource
services in the database. For example, if you want to change the IP address for the CidnerUri
property, you can use the query like below:
update params set params.param_value = 'http://192.168.170.104:8776' from ucp_services u inner join service_logical_struct s on s.fk_sid=u.service_id inner join params p on p.fk_sid=s.fk_sid where u.name='CsOpenStackResource' and u.status='Ok' and s.status='Ok' and p.param_name='CinderUri' and p.param_value='http://192.168.170.107:8776'
The query will change CinderUri
value from http://192.168.170.107:8776
to http://192.168.170.104:8776
.