From c0b914f82f425097284f5072f79e828eba071ede Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Fri, 15 Apr 2016 21:07:27 +0000 Subject: [PATCH] List and get Compute image metadata. --- openstack/compute/v2/images/requests_test.go | 24 ++++++++++++++++++-- openstack/compute/v2/images/results.go | 2 ++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/openstack/compute/v2/images/requests_test.go b/openstack/compute/v2/images/requests_test.go index 93a97bdc..c02b66f6 100644 --- a/openstack/compute/v2/images/requests_test.go +++ b/openstack/compute/v2/images/requests_test.go @@ -50,7 +50,11 @@ func TestListImages(t *testing.T) { "minDisk": 0, "progress": 100, "minRam": 0, - "metadata": {} + "metadata": { + "string": "string", + "true": true, + "nil": null + } } ] } @@ -82,6 +86,7 @@ func TestListImages(t *testing.T) { MinRAM: 0, Progress: 100, Status: "ACTIVE", + Metadata: map[string]interface{}{}, }, Image{ ID: "f90f6034-2570-4974-8351-6b49732ef2eb", @@ -92,6 +97,11 @@ func TestListImages(t *testing.T) { MinRAM: 0, Progress: 100, Status: "ACTIVE", + Metadata: map[string]interface{}{ + "string": "string", + "true": true, + "nil": nil, + }, }, } @@ -131,7 +141,12 @@ func TestGetImage(t *testing.T) { "minDisk": 0, "progress": 100, "minRam": 0, - "metadata": {} + "metadata": { + "string": "string", + "true": true, + "nil": null + } + } } `) @@ -151,6 +166,11 @@ func TestGetImage(t *testing.T) { MinDisk: 0, Progress: 100, MinRAM: 0, + Metadata: map[string]interface{}{ + "string": "string", + "true": true, + "nil": nil, + }, } if !reflect.DeepEqual(expected, actual) { diff --git a/openstack/compute/v2/images/results.go b/openstack/compute/v2/images/results.go index 40e814d1..fd0bca29 100644 --- a/openstack/compute/v2/images/results.go +++ b/openstack/compute/v2/images/results.go @@ -38,6 +38,8 @@ type Image struct { Created string + Metadata map[string]interface{} + // MinDisk and MinRAM specify the minimum resources a server must provide to be able to install the image. MinDisk int MinRAM int