Skip to content

Commit b5aa339

Browse files
Merge pull request #3273 from gophercloud/bp-v2-4d5dc13-cec507c
[v2] Add missing fields in Objectstorage and compute API
2 parents e3bceef + 39e8a0a commit b5aa339

File tree

6 files changed

+17
-2
lines changed

6 files changed

+17
-2
lines changed

openstack/compute/v2/servers/results.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ type Server struct {
279279

280280
// AvailabilityZone is the availabilty zone the server is in.
281281
AvailabilityZone string `json:"OS-EXT-AZ:availability_zone"`
282+
283+
// Locked indicates the lock status of the server
284+
// This requires microversion 2.9 or later
285+
Locked *bool `json:"locked"`
282286
}
283287

284288
type AttachedVolume struct {

openstack/compute/v2/servers/testing/fixtures_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ const ServerListBody = `
158158
"progress": 0,
159159
"OS-EXT-STS:power_state": 1,
160160
"config_drive": "",
161-
"metadata": {}
161+
"metadata": {},
162+
"locked": true
162163
},
163164
{
164165
"status": "ACTIVE",
@@ -297,7 +298,8 @@ const SingleServerBody = `
297298
"progress": 0,
298299
"OS-EXT-STS:power_state": 1,
299300
"config_drive": "",
300-
"metadata": {}
301+
"metadata": {},
302+
"locked": true
301303
}
302304
}
303305
`
@@ -631,6 +633,7 @@ var (
631633
TerminatedAt: time.Time{},
632634
DiskConfig: servers.Manual,
633635
AvailabilityZone: "nova",
636+
Locked: func() *bool { b := true; return &b }(),
634637
}
635638

636639
ConsoleOutput = "abc"

openstack/compute/v2/servers/testing/requests_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ func TestGetFaultyServer(t *testing.T) {
774774

775775
FaultyServer := ServerDerp
776776
FaultyServer.Fault = DerpFault
777+
FaultyServer.Locked = nil
777778
th.CheckDeepEquals(t, FaultyServer, *actual)
778779
}
779780

@@ -1145,6 +1146,7 @@ func TestCreateServerWithTags(t *testing.T) {
11451146
tags := []string{"foo", "bar"}
11461147
ServerDerpTags := ServerDerp
11471148
ServerDerpTags.Tags = &tags
1149+
ServerDerpTags.Locked = nil
11481150

11491151
createOpts := servers.CreateOpts{
11501152
Name: "derp",

openstack/objectstorage/v1/containers/results.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ type GetHeader struct {
111111
TempURLKey2 string `json:"X-Container-Meta-Temp-URL-Key-2"`
112112
Timestamp float64 `json:"X-Timestamp,string"`
113113
VersionsEnabled bool `json:"-"`
114+
SyncKey string `json:"X-Sync-Key"`
115+
SyncTo string `json:"X-Sync-To"`
114116
}
115117

116118
func (r *GetHeader) UnmarshalJSON(b []byte) error {

openstack/objectstorage/v1/containers/testing/fixtures.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ func HandleGetContainerSuccessfully(t *testing.T, options ...option) {
258258
w.Header().Set("X-Trans-Id", "tx554ed59667a64c61866f1-0057b4ba37")
259259
w.Header().Set("X-Storage-Policy", "test_policy")
260260
w.Header().Set("X-Versions-Enabled", "True")
261+
w.Header().Set("X-Sync-Key", "272465181849")
262+
w.Header().Set("X-Sync-To", "anotherContainer")
261263
w.WriteHeader(http.StatusNoContent)
262264
})
263265
}

openstack/objectstorage/v1/containers/testing/requests_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ func TestGetContainer(t *testing.T) {
244244
StoragePolicy: "test_policy",
245245
Timestamp: 1471298837.95721,
246246
VersionsEnabled: true,
247+
SyncKey: "272465181849",
248+
SyncTo: "anotherContainer",
247249
}
248250
actual, err := res.Extract()
249251
th.AssertNoErr(t, err)

0 commit comments

Comments
 (0)