Skip to content

Instantly share code, notes, and snippets.

@amcrn
Last active May 4, 2019 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amcrn/c4ae2210e9d9864c21fd to your computer and use it in GitHub Desktop.
Save amcrn/c4ae2210e9d9864c21fd to your computer and use it in GitHub Desktop.

Problem Statement

how to create a cluster of heterogenous (in terms of flavor, disk, configuration, region, type, etc.) instances via the python-troveclient.

Homogenous Nodes

$ trove help create-cluster
usage: trove create-cluster <name> <cluster_size> <datastore> <datastore_version> <flavor_id> <disk_size>
                            [--configuration <configuration>]

Creates a new cluster.

Positional arguments:
  <name>                Name of the cluster
  <cluster_size>        Size of the cluster (number of instances)
  <datastore>           A datastore name or UUID
  <datastore_version>   A datastore version name or UUID
  <flavor_id>           Flavor of the instance.
  <disk_size>           Size of the instance disk in GB

Optional arguments:
  --configuration <configuration>
                        UUID of the configuration group to attach to the
                        instance.
$ trove create-cluster products 3 mongodb "2.4.10" 12 50 --configuration 1-2-3-4

Heterogenous Nodes

Option #1: Inlining Differing Instances

$ trove create-cluster products 3 mongodb "2.4.10" 12 50 --configuration 1-2-3-4
  --instances '[{"flavorRef": "7",
                 "volume": {"size": 1},
                 "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
                 "type": "arbiter"},
                {"flavorRef": "7",
                 "volume": {"size": 1},
                 "configuration": "b9c8a3f8-7ace-4aea-9908-7b555586d7b6",
                 "type": "arbiter"}
               ]'

The above would create 3 nodes with flavor=12, disk-size=50, config=1-2-3-4, and 2 nodes with flavor=7, disk-size=1, type=arbiter (a cluster of 5)

Option #2: ?

Thoughts

  • Do any of the other python clients support providing a raw json request, and/or is there an example of an openstack project issuing raw json requests? If so, perhaps the official python client can officially support homogenous clusters, but horizon and others provide the raw request to the client (or curl it).
@amcrn
Copy link
Author

amcrn commented May 21, 2014

option #9

$ trove create-cluster products 5 mongodb "2.4.10" 12 100 \
    --configuration e0a6a893-1e41-4a05-8252-3c2cb934dd79 \
    --instance flavor=7:disk=1:config=b9c8a3f8-7ace-4aea-9908-7b555586d7b6:type=arbiter \
    --instance flavor=7:disk=1:config=b9c8a3f8-7ace-4aea-9908-7b555586d7b6:type=arbiter

option 10: multi-non-uniform instances with block-device-mapping-style colons, but with labels, repeatable --instance flag

option #10:

trove create-cluster products mongodb "2.4.10" \
    --instance count=2:flavor=12:disk=100:config=e0a6a893-1e41-4a05-8252-3c2cb934dd79:region=EAST \
    --instance count=3:flavor=12:disk=100:config=e0a6a893-1e41-4a05-8252-3c2cb934dd79:region=WEST \
    --instance flavor=12:disk=100:config=e0a6a893-1e41-4a05-8252-3c2cb934dd79:region=CENTRAL \
    --instance count=2:flavor=7:disk=1:config=b9c8a3f8-7ace-4aea-9908-7b555586d7b6:type=arbiter:region=EAST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment