Repository: gophercloud/gophercloud

Issue:
Please include [GH-3301] hypervisor_hostname support in the next release candidate.
I have merged GH-3301 (Added support for hypervisor_hostname), and since I personally need to use this feature in my project (via Terraform), I would like to ask if you could consider including this change in the next release candidate.
If there are any further adjustments required or other requirements for the release, I would appreciate your guidance.

Discussion:
@github-actions: Thank you for reporting your first issue! Be sure that we will be looking at it, but keep in mind
this sometimes takes a while.
Please let the maintainers know if your issue has not got enough attention after a few days.
If any doubt, please consult our issue [tutorial](https://github.com/gophercloud/gophercloud/blob/main/docs/contributor-tutorial/step-02-issues.md).@pierreprinetti: That's a fair request. @EmilienM any reason not to backport?@EmilienM: please submit manually, the bot didn't because it's semver minor and the bot does it automatically when it's semver patch.@ngin8-beta: OK. I attempted to perform a manual release, but a large number of items appeared. Could you please explain what is happening?
```
❯ for commit_sha in $(git log --pretty=format:"%h" v2.5.0..HEAD); do
        gh pr list --search "$commit_sha" --state merged --json number,title,labels,url
done | jq '.[]' | jq --slurp 'unique_by(.number)' > prs.json
❯ jq 'map(select(contains({labels: [{name: "semver:minor"}]}) ))' prs.json
[
  {
    "labels": [
      {
        "id": "LA_kwDOAmyfXM8AAAABUn0WWw",
        "name": "semver:minor",
        "description": "Backwards-compatible change",
        "color": "FBCA04"
      },
      {
        "id": "LA_kwDOAmyfXM8AAAABrc4nHg",
        "name": "backport-v2",
        "description": "This PR will be backported to v2",
        "color": "E99695"
      },
 ~~~~~~~~~~~~~~~~~~~~~~
❯ jq -r '.[] | "* [GH-\(.number)](\(.url)) \(.title)"' prs.json
* [GH-2387](https://github.com/gophercloud/gophercloud/pull/2387) Add missing fields in Objectstorage and compute API
* [GH-2873](https://github.com/gophercloud/gophercloud/pull/2873) Fix panic in ExtractIntoStructPtr
* [GH-3028](https://github.com/gophercloud/gophercloud/pull/3028) Handle nova api version > 2.87 for hypervisor
* [GH-3065](https://github.com/gophercloud/gophercloud/pull/3065) Misc cleanups
* [GH-3085](https://github.com/gophercloud/gophercloud/pull/3085) MIGRATING.md: Provide a migration script
 ~~~~~~~~~~~~~~~~~~~~~
❯ jq -r '.[] | "* [GH-\(.number)](\(.url)) \(.title)"' prs.json | wc -l
78
```@EmilienM: Wait, you can't do a release yourself. I was thinking you needed to backport https://github.com/gophercloud/gophercloud/pull/3301 to v2 or v1.
We don't have any release on current main for now, it'll be a v3 when we are ready.

What do you need exactly?@ngin8-beta: Ah, so it's not possible to send a pull request for the release. I assumed that my #3301 would be included in v2.6.0.

I plan to use it via Terraform, but does this mean that the hypervisor_hostname option cannot be used until v3 is released?@EmilienM: If you need it in a 2.x.x release, please cherry-pick the PR to the v2 branch. Then it'll be included in the next v2 release (can do it this week).@ngin8-beta: Thank you for the merge. When is the release expected?@EmilienM: https://github.com/gophercloud/gophercloud/pull/3316
once this merges, I'll tag.

Solution patch:
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index dd3b132d1..44e8cccae 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -508,6 +508,9 @@ type CreateOpts struct {
 
 	// DiskConfig [optional] controls how the created server's disk is partitioned.
 	DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"`
+
+	// HypervisorHostname is the name of the hypervisor to which the server is scheduled.
+	HypervisorHostname string `json:"hypervisor_hostname,omitempty"`
 }
 
 // ToServerCreateMap assembles a request body based on the contents of a



Test patch:
diff --git a/openstack/compute/v2/servers/testing/requests_test.go b/openstack/compute/v2/servers/testing/requests_test.go
index b50ea185c..66a33dd68 100644
--- a/openstack/compute/v2/servers/testing/requests_test.go
+++ b/openstack/compute/v2/servers/testing/requests_test.go
@@ -1160,3 +1160,25 @@ func TestCreateServerWithTags(t *testing.T) {
 	th.AssertNoErr(t, err)
 	th.CheckDeepEquals(t, ServerDerpTags, *actualServer)
 }
+
+func TestCreateServerWithHypervisorHostname(t *testing.T) {
+	opts := servers.CreateOpts{
+		Name:               "createdserver",
+		FlavorRef:          "performance1-1",
+		ImageRef:           "asdfasdfasdf",
+		HypervisorHostname: "test-hypervisor",
+	}
+	expected := `
+    {
+        "server": {
+            "name":"createdserver",
+            "flavorRef":"performance1-1",
+            "imageRef":"asdfasdfasdf",
+            "hypervisor_hostname":"test-hypervisor"
+        }
+    }
+    `
+	actual, err := opts.ToServerCreateMap()
+	th.AssertNoErr(t, err)
+	th.CheckJSONEquals(t, expected, actual)
+}