Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 654a387

Browse filesBrowse files
authored
Merge pull request #3309 from ngin8-beta/v2
Backport: Added support for hypervisor_hostname to v2
2 parents 2e6154e + e47eabd commit 654a387
Copy full SHA for 654a387

File tree

2 files changed

+25
-0
lines changed
Filter options

2 files changed

+25
-0
lines changed

‎openstack/compute/v2/servers/requests.go

Copy file name to clipboardExpand all lines: openstack/compute/v2/servers/requests.go
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ type CreateOpts struct {
508508

509509
// DiskConfig [optional] controls how the created server's disk is partitioned.
510510
DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"`
511+
512+
// HypervisorHostname is the name of the hypervisor to which the server is scheduled.
513+
HypervisorHostname string `json:"hypervisor_hostname,omitempty"`
511514
}
512515

513516
// ToServerCreateMap assembles a request body based on the contents of a

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

Copy file name to clipboardExpand all lines: openstack/compute/v2/servers/testing/requests_test.go
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,3 +1160,25 @@ func TestCreateServerWithTags(t *testing.T) {
11601160
th.AssertNoErr(t, err)
11611161
th.CheckDeepEquals(t, ServerDerpTags, *actualServer)
11621162
}
1163+
1164+
func TestCreateServerWithHypervisorHostname(t *testing.T) {
1165+
opts := servers.CreateOpts{
1166+
Name: "createdserver",
1167+
FlavorRef: "performance1-1",
1168+
ImageRef: "asdfasdfasdf",
1169+
HypervisorHostname: "test-hypervisor",
1170+
}
1171+
expected := `
1172+
{
1173+
"server": {
1174+
"name":"createdserver",
1175+
"flavorRef":"performance1-1",
1176+
"imageRef":"asdfasdfasdf",
1177+
"hypervisor_hostname":"test-hypervisor"
1178+
}
1179+
}
1180+
`
1181+
actual, err := opts.ToServerCreateMap()
1182+
th.AssertNoErr(t, err)
1183+
th.CheckJSONEquals(t, expected, actual)
1184+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.