Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openstack/compute/v2/servers/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ type Server struct {

// Fault contains failure information about a server.
Fault Fault `json:"fault"`

// VolumeAttached includes the volumes that attached to the server.
VolumesAttached []map[string]string `json:"os-extended-volumes:volumes_attached"`
}

type Fault struct {
Expand Down
45 changes: 40 additions & 5 deletions openstack/compute/v2/servers/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ const ServerListBody = `
"created": "2014-09-25T13:10:02Z",
"tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
"OS-DCF:diskConfig": "MANUAL",
"os-extended-volumes:volumes_attached": [],
"os-extended-volumes:volumes_attached": [
{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e"
}
],
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
Expand Down Expand Up @@ -148,7 +152,11 @@ const ServerListBody = `
"created": "2014-09-25T13:04:41Z",
"tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
"OS-DCF:diskConfig": "MANUAL",
"os-extended-volumes:volumes_attached": [],
"os-extended-volumes:volumes_attached": [
{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e"
}
],
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
Expand Down Expand Up @@ -210,7 +218,11 @@ const ServerListBody = `
"created": "2014-09-25T13:04:41Z",
"tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
"OS-DCF:diskConfig": "MANUAL",
"os-extended-volumes:volumes_attached": [],
"os-extended-volumes:volumes_attached": [
{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e"
}
],
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
Expand Down Expand Up @@ -287,7 +299,11 @@ const SingleServerBody = `
"created": "2014-09-25T13:04:41Z",
"tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
"OS-DCF:diskConfig": "MANUAL",
"os-extended-volumes:volumes_attached": [],
"os-extended-volumes:volumes_attached": [
{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e"
}
],
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
Expand Down Expand Up @@ -364,7 +380,11 @@ const FaultyServerBody = `
"created": "2014-09-25T13:04:41Z",
"tenant_id": "fcad67a6189847c4aecfa3c81a05783b",
"OS-DCF:diskConfig": "MANUAL",
"os-extended-volumes:volumes_attached": [],
"os-extended-volumes:volumes_attached": [
{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e"
}
],
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
Expand Down Expand Up @@ -448,6 +468,11 @@ var (
"name": "default",
},
},
VolumesAttached: []map[string]string{
map[string]string{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e",
},
},
}

derpTimeCreated, _ = time.Parse(time.RFC3339, "2014-09-25T13:04:41Z")
Expand Down Expand Up @@ -506,6 +531,11 @@ var (
"name": "default",
},
},
VolumesAttached: []map[string]string{
map[string]string{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e",
},
},
}

ConsoleOutput = "abc"
Expand Down Expand Up @@ -558,6 +588,11 @@ var (
"name": "default",
},
},
VolumesAttached: []map[string]string{
map[string]string{
"id": "cfb68a5e-203f-446d-9fd7-74b7e1f9722e",
},
},
}

faultTimeCreated, _ = time.Parse(time.RFC3339, "2017-11-11T07:58:39Z")
Expand Down
6 changes: 6 additions & 0 deletions openstack/ecs/v1/block_devices/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "github.com/huaweicloud/golangsdk"

type VolumeAttachment struct {
PciAddress string `json:"pciAddress"`
Size int `json:"size"`
BootIndex int `json:"bootIndex"`
}

type GetResult struct {
Expand All @@ -14,3 +16,7 @@ func (r GetResult) Extract() (*VolumeAttachment, error) {
s := &VolumeAttachment{}
return s, r.ExtractInto(s)
}

func (r GetResult) ExtractInto(v interface{}) error {
return r.Result.ExtractIntoStructPtr(v, "volumeAttachment")
}