How to create openstack provider via API?


#1

Hi!
I’m working on cfme 5.6
I checked the document on github, see only the VMWare, RHEV example, Can give me an example?


#2

@abellotti any guidance, here?


#3

I referred https://github.com/ManageIQ/manageiq_docs/blob/master/api/examples/create_provider.adoc and I was able to add OpenStack(Packstack) provider.

openstack_provider.json

{
  "type"      : "ManageIQ::Providers::Openstack::CloudManager",
  "name"      : "testo",
  "hostname"  : "testo",
  "ipaddress" : "10.65.8.133",
  "credentials" : {
      "userid"    : "admin",
      "password"  : "superpasswd"
  }
}

manageiq_create_provider.sh

curl -k -l --user admin:hooya \
     -H "Content-Type: application/json" \
     -i -X POST -H "Accept: application/json" \
     -d @openstack_provider.json \
     https://10.65.200.202/api/providers/

Response

{
  "results": [
    {
      "id": 21000000000006,
      "name": "testo",
      "hostname": "testo",
      "ipaddress": "10.65.8.133",
      "created_on": "2016-09-27T09:18:31Z",
      "updated_on": "2016-09-27T09:18:31Z",
      "guid": "5befc378-8493-11e6-92d5-525400b18796",
      "zone_id": 21000000000001,
      "type": "ManageIQ::Providers::Openstack::CloudManager",
      "tenant_id": 21000000000001
    }
  ]
}

PR: https://github.com/psachin/manageiq_docs/blob/provider_types/api/examples/create_provider.adoc


#4

Thank you very much!


#5

Hello, I would like to ask, how will be specified JSON paylod to register openstack in case Events are collected through AMQP and its credentials must be defined.
Thx.


#6

It’ll be great If you could give me a use case


#7

Well, I like to register OpenStack cloud provider with AMQP using API and following payload is not working (response is that provider was created, but credentials are not validated and Ceilometer is selected):

{
  "type"      : "ManageIQ::Providers::Openstack::CloudManager",
  "name"      : "provider_name",
  "provider_region": "",
  "api_version": "v2",
  "hostname" : "FQDN",
  "tenant_mapping_enabled": false,
  "credentials" : [
     {
       "userid"    : "user1",
       "password"  : "pwd1"
     },
     {
       "userid"    : "user2",
       "password"  : "pwd2",
       "auth_type" : "amqp"
     }
  ]
}

So my question is what are correct attributes and what may be their values??? Although something is described at http://manageiq.org/docs/reference/latest/api/appendices/resource_attributes.html#providers, still a lot of details is missing (comparing to attributes I can fill in using UI)!

Thanks,
V.


#8

@vmi

I guess it auth-type should be ‘metrics’[1]. userid is generally ‘guest’ for AMQP, but it depends.

[1] https://github.com/ManageIQ/manageiq_docs/blob/master/api/examples/create_provider_compound_credentials.adoc


#9

For v3 API use,

{
  "type"      : "ManageIQ::Providers::Openstack::CloudManager",
  "name"      : "testo",
  "hostname"  : "testo",
  "ipaddress" : "10.65.8.133",
  "api_version": "v3",
  "uid_ems": "default",
  "security_protocol": "non-ssl",
  "credentials" : {
      "userid"    : "admin",
      "password"  : "superpasswd"
  }
}