Creating multiple provider instances

If you want to use multiple cloud accounts for provisioning from a cloud provider in your cluster or if your applications require provisioning from different sets of host templates, you can create multiple provider instances in host factory. The provider instances can be configured to use different cloud account credentials, different template configurations, or both. Requestor instances must be configured to use one or more of the desired provider instances.

Before you begin

You must be a cluster administrator to create and register provider instances and requestor instances.

Procedure

  1. Log on as the cluster administrator to the management host on which the HostFactory service is running.
  2. Create multiple provider instances (for example, awsinst1 and awsinst2 for AWS), each with a different set of configuration files:
    1. Edit the hostProviders.json file to add provider instances "awsinst1" and "awsinst2" using provider plug-in "aws", for example:
      {
          "version": 2,
          "providers":[
              {
                  "name": "awsinst1",
                  "plugin": "aws",
                  "enabled": 1,
                  "confPath": "${HF_CONFDIR}/providers/awsinst1/",
                  "workPath": "${HF_WORKDIR}/providers/awsinst1/",
                  "logPath": "${HF_LOGDIR}/"
              },
              {
                  "name": "awsinst2",
                  "plugin": "aws",
                  "enabled": 1,
                  "confPath": "${HF_CONFDIR}/providers/awsinst2/",
                  "workPath": "${HF_WORKDIR}/providers/awsinst2/",
                  "logPath": "${HF_LOGDIR}/"
              },

      For more information, see the hostProviders.json reference topic.

    2. Create directories for each provider as specified by the confPath parameter in hostProviders.json. For the preceding example, create the ${HF_CONFDIR}/providers/awsinst1/ and ${HF_CONFDIR}/providers/awsinst2/ directories.
    3. Copy and rename the $HF_TOP/$HF_VERSION/providerplugins/aws/sampleconf/awsprov_config.json file as ${HF_CONFDIR}/providers/awsinst1/awsinst1prov_config.json and ${HF_CONFDIR}/providers/awsinst2/awsinst2prov_config.json files.
    4. Copy and rename the $HF_TOP/$HF_VERSION/providerplugins/aws/sampleconf/awsprov_templates.json file as ${HF_CONFDIR}/providers/awsinst1/awsinst1prov_templates.json and ${HF_CONFDIR}/providers/awsinst2/awsinst2prov_templates.json files.
    5. Add AWS credentials to the awsinst1prov_config.json file in the ${HF_CONFDIR}/providers/awsinst1/ directory. Repeat for awsinst2prov_config.json in the ${HF_CONFDIR}/providers/awsinst2/ directory.
    6. Define provisioning templates in the ${HF_CONFDIR}/providers/awsinst1/awsinst1prov_templates.json file and ${HF_CONFDIR}/providers/awsinst2/awsinst2prov_templates.json file. For example, configure the ${HF_CONFDIR}/providers/awsinst1/awsinst1prov_templates.json file with On-Demand instance templates and configure the ${HF_CONFDIR}/providers/awsinst2/conf/awsinst2prov_templates.json file with Spot-instance templates.
  3. Create multiple requestor instances (for example, symAinst1) (see Creating requestors based on symAinst). Then, configure each requestor instance to provision from a desired provider instance (for example, awsinst1 or awsinst2).
  4. Configure the applications to be monitored by each requestor instance (for example, symAinst1 and symAinst2):
    1. Edit the symAinst1req_config.json file at the ${HF_CONFDIR}/requestors/symAinst1/ directory and specify the applications to be monitored by symAinst1 in the cloud_apps parameter.
    2. Edit the symAinst2req_config.json file at the ${HF_CONFDIR}/requestors/symAinst2/ directory and specify the applications to be monitored by symAinst2 in the cloud_apps parameter.

Results

Based on the specified configuration, the symAinst1 requestor instance provisions On-Demand instances using the awsinst1 provider for this set of cloud-enabled applications. The symAinst2 requestor instance provisions Spot instances using the awsinst2 provider for the other set of cloud-enabled applications.