github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/schedulerhints/doc.go (about) 1 /* 2 Package schedulerhints extends the server create request with the ability to 3 specify additional parameters which determine where the server will be 4 created in the OpenStack cloud. 5 6 Example to Add a Server to a Server Group 7 8 schedulerHints := schedulerhints.SchedulerHints{ 9 Group: "servergroup-uuid", 10 } 11 12 serverCreateOpts := servers.CreateOpts{ 13 Name: "server_name", 14 ImageRef: "image-uuid", 15 FlavorRef: "flavor-uuid", 16 } 17 18 createOpts := schedulerhints.CreateOptsExt{ 19 CreateOptsBuilder: serverCreateOpts, 20 SchedulerHints: schedulerHints, 21 } 22 23 server, err := servers.Create(computeClient, createOpts).Extract() 24 if err != nil { 25 panic(err) 26 } 27 28 Example to Place Server B on a Different Host than Server A 29 30 schedulerHints := schedulerhints.SchedulerHints{ 31 DifferentHost: []string{ 32 "server-a-uuid", 33 } 34 } 35 36 serverCreateOpts := servers.CreateOpts{ 37 Name: "server_b", 38 ImageRef: "image-uuid", 39 FlavorRef: "flavor-uuid", 40 } 41 42 createOpts := schedulerhints.CreateOptsExt{ 43 CreateOptsBuilder: serverCreateOpts, 44 SchedulerHints: schedulerHints, 45 } 46 47 server, err := servers.Create(computeClient, createOpts).Extract() 48 if err != nil { 49 panic(err) 50 } 51 52 Example to Place Server B on the Same Host as Server A 53 54 schedulerHints := schedulerhints.SchedulerHints{ 55 SameHost: []string{ 56 "server-a-uuid", 57 } 58 } 59 60 serverCreateOpts := servers.CreateOpts{ 61 Name: "server_b", 62 ImageRef: "image-uuid", 63 FlavorRef: "flavor-uuid", 64 } 65 66 createOpts := schedulerhints.CreateOptsExt{ 67 CreateOptsBuilder: serverCreateOpts, 68 SchedulerHints: schedulerHints, 69 } 70 71 server, err := servers.Create(computeClient, createOpts).Extract() 72 if err != nil { 73 panic(err) 74 } 75 */ 76 package schedulerhints