Bunch of fixes
Change-Id: Ic5cd50226b67cb05d755288529c631c4686bbee6
diff --git a/openstack/compute/v2/hypervisors/results.go b/openstack/compute/v2/hypervisors/results.go
index 5c7041d..46638cb 100644
--- a/openstack/compute/v2/hypervisors/results.go
+++ b/openstack/compute/v2/hypervisors/results.go
@@ -3,6 +3,7 @@
import (
"encoding/json"
"fmt"
+
"gerrit.mcp.mirantis.net/debian/gophercloud.git/pagination"
)
@@ -71,11 +72,10 @@
VCPUsUsed int `json:"vcpus_used"`
}
-type Aggregate struct{
- Name string `json:name`
- Hosts []string `json:hosts`
- ID int `json:id`
-
+type Aggregate struct {
+ Name string `json:name`
+ Hosts []string `json:hosts`
+ ID int `json:id`
}
func (r *Hypervisor) UnmarshalJSON(b []byte) error {
@@ -99,7 +99,7 @@
// Newer versions pass the CPU into around as the correct types, this just needs
// converting and copying into place. Older versions pass CPU info around as a string
// and can simply be unmarshalled by the json parser
- var tmpb []byte;
+ var tmpb []byte
switch t := s.CPUInfo.(type) {
case string:
@@ -154,8 +154,8 @@
}
func (page HypervisorPage) IsEmpty() (bool, error) {
- va, err := ExtractHypervisors(page)
- return len(va) == 0, err
+ va, err := ExtractHypervisors(page)
+ return len(va) == 0, err
}
func ExtractHypervisors(p pagination.Page) ([]Hypervisor, error) {
@@ -170,11 +170,10 @@
var h struct {
Aggregates []Aggregate `json:"aggregates"`
}
- fmt.Printf("AA: %s\n", p)
err := (p.(AggregatePage)).ExtractInto(&h)
return h.Aggregates, err
}
type AggregatePage struct {
- pagination.SinglePageBase
+ pagination.SinglePageBase
}
diff --git a/openstack/identity/v3/roles/requests.go b/openstack/identity/v3/roles/requests.go
index 3d7c179..aa932c6 100644
--- a/openstack/identity/v3/roles/requests.go
+++ b/openstack/identity/v3/roles/requests.go
@@ -5,11 +5,10 @@
"gerrit.mcp.mirantis.net/debian/gophercloud.git/pagination"
)
-
func List(client *gophercloud.ServiceClient) pagination.Pager {
url := listURL(client)
return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {
- return RolePage{pagination.LinkedPageBase{PageResult: r}}
+ return RolePage{pagination.SinglePageBase(r)}
})
}
diff --git a/openstack/identity/v3/roles/results.go b/openstack/identity/v3/roles/results.go
index 9439ea9..ff5a653 100644
--- a/openstack/identity/v3/roles/results.go
+++ b/openstack/identity/v3/roles/results.go
@@ -41,7 +41,7 @@
}
type RolePage struct {
- pagination.LinkedPageBase
+ pagination.SinglePageBase
}
// IsEmpty returns true if the page contains no results.
@@ -71,7 +71,7 @@
}
func ExtractRoles(r pagination.Page) ([]Role, error) {
var s struct {
- Roles []Role`json:"roles"`
+ Roles []Role `json:"roles"`
}
err := (r.(RolePage)).ExtractInto(&s)
return s.Roles, err
diff --git a/openstack/networking/v2/extensions/agents/results.go b/openstack/networking/v2/extensions/agents/results.go
index 3ed1487..cf01449 100644
--- a/openstack/networking/v2/extensions/agents/results.go
+++ b/openstack/networking/v2/extensions/agents/results.go
@@ -4,7 +4,7 @@
type Agent struct {
Host string `json:"host"`
- Service string `json:"service"`
+ Binary string `json:"binary"`
AvailabilityZone string `json:"availability_zone"`
AdminStateUp string `json:"admin_state_up"`
Alive bool `json:"alive"`
diff --git a/openstack/networking/v2/extensions/agents/urls.go b/openstack/networking/v2/extensions/agents/urls.go
index e4fac8d..198032b 100644
--- a/openstack/networking/v2/extensions/agents/urls.go
+++ b/openstack/networking/v2/extensions/agents/urls.go
@@ -3,5 +3,5 @@
import gophercloud "gerrit.mcp.mirantis.net/debian/gophercloud.git"
func listURL(c *gophercloud.ServiceClient) string {
- return c.ServiceURL("agents")
+ return c.ServiceURL("v2.0/agents")
}