CloudStack

Builder type: cloudstack-ovf, cloudstack-qcow2 or cloudstack-vhd

Require Cloud Account: Yes cloudstack.apache.org

The CloudStack builder provides information for building and publishing the machine image to the CloudStack cloud platform. This builder supports KVM (cloudstack-qcow2), Xen (cloudstack-vhd) or VMware (cloudstack-ova) based images for CloudStack.

The CloudStack builder requires cloud account information to upload and register the machine image to the CloudStack platform.

The CloudStack builder section has the following definition:

{
  "builders": [
    {
      "type": "cloudstack-qcow2",
      ...the rest of the definition goes here.
    }
  ]
}

Building a Machine Image

For building an image, the valid keys are:

  • hardwareSettings (mandatory): an object providing hardware settings to be used for the machine image. If an OVF machine image is being built, then the hardware settings are mandatory. The following valid keys for hardware settings are:
  • memory (mandatory): an integer providing the amount of RAM to provide to an instance provisioned from the machine image (in MB).
  • installation (optional): an object providing low-level installation or first boot options. These override any installation options in the Stack section. The following valid keys for installation are:
  • diskSize (mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the stack. This cannot be used if an advanced partitioning table is defined in the stack.
  • type (mandatory): a string providing the machine image type to build. For CloudStack: cloudstack-qcow2, cloudstack-vhd or cloudstack-ova.

Publishing a Machine Image

To publish an image, the valid keys are:

  • account (mandatory): an object providing the CloudStack cloud account information required to publish the built machine image.
  • featured (optional): a boolean flag to determine in the machine image is to be “featured”
  • imageName (mandatory): a string providing the displayed name of the machine image.
  • publicImage (optional): a boolean flag to determine in the machine image is to be public
  • type (mandatory): a string providing the machine image type to build. For CloudStack: cloudstack-qcow2, cloudstack-vhd or cloudstack-ova.
  • zone (mandatory): a string providing the zone to publish the machine image

CloudStack Cloud Account

Key: account Used to authenticate the CloudStack platform.

The CloudStack cloud account has the following valid keys:

  • endpoint (mandatory): a string providing the API URL endpoint of the cloudstack management console to upload the machine image to. For example: http://cloudstackhostname:8080/client/api
  • file (optional): a string providing the location of the account information. This can be a pathname (relative or absolute) or an URL.
  • name (mandatory): a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information.
  • publicKey (mandatory): a string providing your public API key. If you do not have a public/secret key pair, please refer to the CloudStack documentation to generate them, or contact your cloud administrator
  • secretKey (mandatory): a string providing your secret API key. If you do not have a public/secret key pair, please refer to the CloudStack documentation to generate them, or contact your cloud administrator
  • type (mandatory): a string providing the cloud account type: cloudstack.

Note

In the case where name or file is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder.

Example

The following example shows a CloudStack builder with all the information to build and publish a machine image to CloudStack.

{
  "builders": [
    {
      "type": "cloudstack-qcow2",
      "account": {
        "type": "cloudstack",
        "name": "My CloudStack Account",
        "endpoint": "http://10.1.2.214:8080/client/api",
        "publicKey": "cqFaVLNrVzWDP3IsP7o8lYITDQL0WKuKVh_5S30brobdFG6Wv1aD-zEWYALxFYGOBXrUXYmilnvsK4cFgnaZwg",
        "secretKey": "YjqaHb8rfqQ1fHgs_FAaLNchu3pssESEk2AcI09klFCgF6t_znV3a-NeU6BSbCYHLhCqhKBzMGQrWoI1oUztVg"
      },
      "imageName": "CentOS Core",
      "zone": "zone1"
    }
  ]
}

Referencing the Cloud Account

To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a json file cloudstack-account.json.

{
  "accounts": [
    {
      "type": "cloudstack",
      "name": "My CloudStack Account",
      "endpoint": "http://10.1.2.214:8080/client/api",
      "publicKey": "cqFaVLNrVzWDP3IsP7o8lYITDQL0WKuKVh_5S30brobdFG6Wv1aD-zEWYALxFYGOBXrUXYmilnvsK4cFgnaZwg",
      "secretKey": "YjqaHb8rfqQ1fHgs_FAaLNchu3pssESEk2AcI09klFCgF6t_znV3a-NeU6BSbCYHLhCqhKBzMGQrWoI1oUztVg"
    }
  ]
}

The builder section can either reference by using file or name.

Reference by file:

{
  "builders": [
    {
      "type": "cloudstack-qcow2",
      "account": {
        "file": "/home/joris/accounts/cloudstack-account.json"
      },
      "imageName": "CentOS Core",
      "zone": "zone1"
    }
  ]
}

Reference by name, note the cloud account must already be created by using account create.

{
  "builders": [
    {
      "type": "cloudstack-qcow2",
      "account": {
        "name": "My CloudStack Account"
      },
      "imageName": "CentOS Core",
      "zone": "zone1"
    }
  ]
}