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 da9417f

Browse filesBrowse files
committed
Added support for hypervisor_hostname
1 parent a5a70f7 commit da9417f
Copy full SHA for da9417f

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
@@ -511,6 +511,9 @@ type CreateOpts struct {
511511

512512
// KeyName is the name of the key pair.
513513
KeyName string `json:"key_name,omitempty"`
514+
515+
// HypervisorHostname is the name of the hypervisor to which the server is scheduled.
516+
HypervisorHostname string `json:"hypervisor_hostname,omitempty"`
514517
}
515518

516519
// 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
@@ -1161,3 +1161,25 @@ func TestCreateServerWithTags(t *testing.T) {
11611161
th.AssertNoErr(t, err)
11621162
th.CheckDeepEquals(t, ServerDerpTags, *actualServer)
11631163
}
1164+
1165+
func TestCreateServerWithHypervisorHostname(t *testing.T) {
1166+
opts := servers.CreateOpts{
1167+
Name: "createdserver",
1168+
FlavorRef: "performance1-1",
1169+
ImageRef: "asdfasdfasdf",
1170+
HypervisorHostname: "test-hypervisor",
1171+
}
1172+
expected := `
1173+
{
1174+
"server": {
1175+
"name":"createdserver",
1176+
"flavorRef":"performance1-1",
1177+
"imageRef":"asdfasdfasdf",
1178+
"hypervisor_hostname":"test-hypervisor"
1179+
}
1180+
}
1181+
`
1182+
actual, err := opts.ToServerCreateMap()
1183+
th.AssertNoErr(t, err)
1184+
th.CheckJSONEquals(t, expected, actual)
1185+
}

0 commit comments

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