Ask Your Question

Select host when creating VM

asked 2020-04-16 22:31:33 -0500

New_bee gravatar image

I'm using IBM PowerVC which is based on OpenStack. I'm able to create VM using curl. But I wanted to know the option to select Host where my VM is going to be created. I tried many options but still no luck

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2020-04-17 15:07:35 -0500

qumulus gravatar image

If you are using python-openstackclient, you can specify the host via the availability-zone. e.g. openstack server create --flavor <flavor> --image <image> --network <network> --availability-zone nova:compute123 myserver

edit flag offensive delete link more


No I'm not using python openstakclient. Just using curl.

New_bee gravatar imageNew_bee ( 2020-04-19 02:28:40 -0500 )edit

I was not aware of this syntax. See for more info and alternatives.

Note, however, that you must be admin to select a host this way (except if you tweak the policy).

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-19 09:23:28 -0500 )edit

You can also use the direct API (what you call "curl") to submit such a request. Set availability_zone or hypervisor_hostname; see

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-19 09:26:04 -0500 )edit

availability_zone is like host_group. But I want to select particular Host inside availability_zone

New_bee gravatar imageNew_bee ( 2020-04-30 09:46:40 -0500 )edit

answered 2020-04-17 02:23:11 -0500

There are several options.

Images can have properties that define host characteristics like CPU architecture or hypervisor type.

An administrator can group hosts into host aggregates, then use flavors to expose those host aggregates to users.

Availability zones are implemented as host aggregates, but there purpose is slightly different. The goal of availability zones is to allow a user to create reliable services by running instances on hosts that are unlikely to go down at the same time.

edit flag offensive delete link more


Thanks for your reply! I'm not concern about High Availability. My environment is different and they just need an option to select a host while creating a VM. curl -l -k -i -X POST https://${IP}:5000/powervc/openstack/compute/v2/${PROJECTID}/servers -H "X-Auth-Token:$INSERTTOKEN" -H "Content-Type:

New_bee gravatar imageNew_bee ( 2020-04-17 06:49:08 -0500 )edit

application/jsaon" -d '{"server":{ "flavorRef":"'"$FLAVORID"'", "name": "'"$NEWVNMNAME"'", "networkId": "'"$NETWORKID"'", "imageRef": "'"$IMAGEID"'", "networks":[{"uuid"; "'"$NETWORKID"'"}], "powervm:storage_connectivity_group:; "'"$STORAGE_CONNECTIVITY_GROUP"'"}}'

New_bee gravatar imageNew_bee ( 2020-04-17 06:53:38 -0500 )edit

I can select the Host using GUI of PowerVC. So my guess is there should be some option while creating VM via cli.

New_bee gravatar imageNew_bee ( 2020-04-17 06:55:18 -0500 )edit

Yes, one of the above options.

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-17 07:23:18 -0500 )edit

I created host aggregate but when I try to add the host to the aggregate I get error - "The host cannot be added to more than one aggregate" Code -400

New_bee gravatar imageNew_bee ( 2020-04-19 02:27:25 -0500 )edit

This is strange. A host can't be in more than one availability zone, but it can be in several host aggregates. How did you try to add it?

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-19 09:17:48 -0500 )edit

I used /os-aggregates -d '{"aggregate":{ "name":"'"agg1"'", "availability_zone:: "'"agg1"'"}}'

New_bee gravatar imageNew_bee ( 2020-04-20 07:16:23 -0500 )edit

This creates an aggregate. It doesn't add a host to an aggregate. Use

By the way, agg1 is also an availability zone. A host can only be in one availability zone.

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-20 09:12:52 -0500 )edit

If I just create aggregate then availability_zone: none, I still get the same error. It says the host cannot be in more than two aggregate.

New_bee gravatar imageNew_bee ( 2020-04-30 09:48:36 -0500 )edit

Can you just show the commands that you issue?

Bernd Bausch gravatar imageBernd Bausch ( 2020-04-30 18:19:40 -0500 )edit

curl -l -k -i -x POST http://www. (www. "add_host": { "host": "8408e_218df43"}}

This works if I remove the host from the existing aggregate. But if it's already in aggregate id =6 then I get message "Host cannot be in more than one aggregate"

New_bee gravatar imageNew_bee ( 2020-05-01 19:25:33 -0500 )edit

I'm referring this doc - (

New_bee gravatar imageNew_bee ( 2020-05-01 19:26:10 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2020-04-16 22:31:33 -0500

Seen: 109 times

Last updated: Apr 17 '20

Related questions