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 4f7baad

Browse filesBrowse files
EmilienMngin8-beta
authored andcommitted
Merge pull request #3301 from ngin8-beta/hypervisor_hostname
Backport: Added support for hypervisor_hostname to v2
1 parent 2e6154e commit 4f7baad
Copy full SHA for 4f7baad

File tree

2 files changed

+28
-0
lines changed
Filter options

2 files changed

+28
-0
lines changed

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

Copy file name to clipboardExpand all lines: openstack/compute/v2/servers/requests.go
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,12 @@ 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+
// KeyName is the name of the key pair.
513+
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"`
511517
}
512518

513519
// 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.