Blog

Since most of the currently existing libretto drivers mainly do the provisioning I did the same thing for the first addition of gridscale support and concentrated on the provisioning of an instance.

I now went back and started(!) to add support for retrieving for complete set of items. Gridscale has the notion of relations. Relations relate objects within the gridscale stack with one another.

Example (shortened for readability):

{
  "server": {
    "name": "my awesome server",
    "location_country": "de",
    "status": "active",
    "memory": 4,
    "cores": 2,
    "object_uuid": "3e63d1792231-49c9-34a1-ac32-9197de37",
    "relations": {
      "isoimages": [],
      "networks": [],
      "storages": [],
      "public_ips": []
    },
  }
}

Each of the Relations contains an array of the associated objects of that type. Example: Within the storage-relation, the associated storage is present:

{
  "server": {
    "name": "my awesome server",
	"object_uuid": "3e63d1792231-49c9-34a1-ac32-9197de37",
    [...]
	"relations": {
	  "isoimages": [],
      "networks": [],
	  "storages": [
        {
          "bus": 0,
          "storage_type": "storage",
          "capacity": 10,
          "target": 0,
          "server_uuid": "3e63d1792231-49c9-34a1-ac32-9197de37",
          "lun": 0,
          "object_uuid": "9197de37-ac32-bd23-ad42-32a1c937",
          "create_time": "2018-04-03T11:11:38Z",
          "bootdevice": true,
          "last_used_template": " ",
          "license_product_no": null,
          "controller": 0,
          "object_name": "awesome server template Storage"
        }
      ],
      "public_ips": []
    },
  }
} 

Next step is to add the relations not only to the server part but sprinkle them elsewhere. The code can be found here: g.hazardous.org/fkr/libretto. Beware: I use this as an excercise to learn some golang - so the code is not perfect in regard to being idiomatic golang code.

Blog RSS feed
Read more posts in this category
blog archive
All available categories