Ask Your Question
0

Launch Instance via REST API for different Tenant

asked 2016-03-29 11:06:12 -0500

Andrei.Astra gravatar image

updated 2016-03-31 05:00:06 -0500

Our software communicates with OpenStack via REST API. It connects to OpenStack with the 'admin' credentials and the tenant 'admin'. These are provided by the users of the software.

It launches an instance by posting

http://192.168.111.126:8774/v2/5e3618646b1b40b5b612c195983411c1/servers (http://192.168.111.126:8774/v2/5e3618...)

{
  "server" : {
    "name" : "tenant-rest-demo",
    "imageRef" : "cc254ae5-57ee-41fa-9253-1113855434d4",
    "flavorRef" : "1",
    "personality" : [ ],
    "metadata" : { },
    "networks" : [ ],
    "security_groups" : [ ],
    "config_drive" : false
  }
}

However, it launches the instance for tenant 'admin'.

Is there a way to launch an instance for a different tenant, say the 'demo' tenant?

The REST API documentation for creating a server http://developer.openstack.org/api-ref-compute-v2.1.html#createServer (http://developer.openstack.org/api-re...) says that there is the option 'tenant_id':

Parameter Style Type Description tenant_id URI csapi:UUID
The UUID of the tenant in a multi-tenancy cloud.

{
  "server" : {
    "tenant_id" : "f2bb14e9dd18418db415c89d554949bf",
    "name" : "tenant-rest-demo4",
    "imageRef" : "cc254ae5-57ee-41fa-9253-1113855434d4",
    "flavorRef" : "1",
    "personality" : [ ],
    "metadata" : { },
    "networks" : [ ],
    "security_groups" : [ ],
    "config_drive" : false
  }
}

But it did not help.

Also, it looks that Horizon uses the same REST API to launch instances. I'm able to launch an instance there for a different tenant.

Any comments would be appreciated.

Thank you, Andrei

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-03-31 09:58:48 -0500

Daniel Isla gravatar image

Hi Andrei,

You need to specify the tenant_id in the URI of your request:

 http://192.168.111.126:8774/v2/f2bb14e9dd18418db415c89d554949bf/servers

Regards, Daniel

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-03-29 11:06:12 -0500

Seen: 272 times

Last updated: Mar 31 '16