Skip to content
jguiditta edited this page Jul 22, 2013 · 3 revisions

Demo Data Script

Beginnings of the walk through script for openstack-m demo

To use, clear DB and run commands below, the result should be a HEAT template with 6 compute nodes and 1 non compute node.

N.B. The HEAT template does not define availability zones for the nodes, therefore the nodes could be deployed onto any rack. To be fixed in subsequent patch.

Note: The commands below are useful for experimenting with different creation scenarios, but the exact data center described therein can also now be created by running:

python tools/sample_data/py

from your development environment.

Create Racks

Creates 3 Racks.

2 Racks are assigned to compute resource class and contain 3 bare metal nodes each. 1 Rack is designated to non compute resource class and contains 1 bare metal node only.

curl -vX POST -H 'Content-Type: application/json' -H 'Accept: application/json' -v -d  '
{
  "subnet": "192.168.1.0/255",
  "name": "compute_1",
  "capacities": [{
    "name": "total_cpu",
    "value": "64"
  }, {
    "name": "total_memory",
    "value": "1024"
  }],
  "nodes": [
  {
    "id": "nova_bare_metal_1"
  },
  {
    "id": "nova_bare_metal_2"
  }, 
  {
    "id": "nova_bare_metal_3"
  }
  ],
  "slots": 3
}
' http://0.0.0.0:6385/v1/racks

curl -vX POST -H 'Content-Type: application/json' -H 'Accept: application/json' -v -d  '
{
  "subnet": "192.168.2.0/255",
  "name": "compute_2",
  "capacities": [{
    "name": "total_cpu",
    "value": "64"
  }, {
    "name": "total_memory",
    "value": "1024"
  }],
  "nodes": [
  {
    "id": "nova_bare_metal_4"
  },
  {
    "id": "nova_bare_metal_5"
  }, 
  {
    "id": "nova_bare_metal_6"
  }
  ],
  "slots": 3
}
' http://0.0.0.0:6385/v1/racks

curl -vX POST -H 'Content-Type: application/json' -H 'Accept: application/json' -v -d  '
{
  "subnet": "192.168.2.0/255",
  "name": "non_compute",
  "capacities": [{
    "name": "total_cpu",
    "value": "64"
  }, {
    "name": "total_memory",
    "value": "1024"
  }],
  "nodes": [
  {
    "id": "nova_bare_metal_7"
  }],
  "slots": 3
}
' http://0.0.0.0:6385/v1/racks

Create Resource Classes

Creates 2 resource classes

Compute: This contains 2 racks, totally 6 nodes Not Compuite: Contains 1 Rack, 1 Node

curl -iX POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
    {
          "name": "compute-rc", 
          "service_type":"compute",
          "racks": [
              { 
                "id":1,
                "links":[{"href":"http://0.0.0.0:6385/v1/racks/1","rel":"self"}]
              },
              { 
                "id":2,
                "links":[{"href":"http://0.0.0.0:6385/v1/racks/2","rel":"self"}]
              }
           ],
           "flavors": [
                { "name" : "x-large",
                  "capacities" : [
                     {   "name": "cpu", 
                         "value" : "4",
                          "unit" : "count" }, 
                     {   "name": "memory",
                         "value" : "8192",
                         "unit" : "MiB" },
                     {   "name": "storage", 
                         "value" : "1024",
                         "unit" : "GiB" }
                  ]
                }
           ]
      }
' http://0.0.0.0:6385/v1/resource_classes

curl -iX POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
    {
          "name": "non-compute-rc", 
          "service_type":"not_compute",
          "racks": [
              { 
                "id":3,
                "links":[{"href":"http://0.0.0.0:6385/v1/racks/3","rel":"self"}]
              }
           ]
      }
' http://0.0.0.0:6385/v1/resource_classes

GET HEAT Template

Generates HEAT template based on Tuskar description.

curl http://0.0.0.0:6385/v1/data_centres