Closed izapolsk closed 4 years ago
Hi, thanks for reporting. I'm not aware of most of REST API features, so it is possible that this part is missing. There could be two causes - either try to use Providers object in API, but I don't know how API wants model Cloud/Infra managers within the Provider. Or the option for Infra provider could be to added to the API.
@evgeny-chufarov Put there steps how to assign Infra provider with existing API calls, thanks!
Hi!
curl --user admin:smartvm -i -X POST -H "Accept: application/json" -d '{"type" : ManageIQ::Providers::Openstack::InfraManager", "name" : "Infra_1","hostname" : "XXX", "port" : "5000", "api_version" : "v2", "security_protocol" : "non-ssl", "credentials" : {"userid" : "admin","password" : "XXX"}}' http://localhost:3000/api/providers
curl --user admin:smartvm -i -X POST -H "Accept: application/json" -d '{"type" : "ManageIQ::Providers::Openstack::CloudManager","name" : "Cloud_1","hostname" : "XXX","port" : "5000", "provider_id" : "1", "api_version" : "v2", "security_protocol" : "non-ssl", "credentials" : {"userid" : "admin","password" : "XXX"}}' http://localhost:3000/api/providers
@evgeny-chufarov , many thanks !
@dkholodo , please add respective mapping to provider.create_rest(), since you're the most interested in this fix.
Hi @izapolsk , @evgeny-chufarov Thanks a lot for the information.
I've added some code here https://github.com/ManageIQ/integration_tests/blob/master/cfme/common/provider.py#L265
if version == 'v3' and getattr(self, 'keystone_v3_domain_id', None):
provider_attributes['uid_ems'] = self.keystone_v3_domain_id
if getattr(self, 'infra_provider', None):
infra_providers_ids = self.get_all_provider_ids()
if infra_providers_ids:
provider_attributes['provider_id'] = infra_providers_ids[0]
ipdb> infra_providers_ids [u'1000000000089', u'1000000000090']
ipdb> provider_attributes {'provider_id': u'1000000000089', 'name': 'oc_ci', 'ipaddress': 'XXX', 'hostname': 'XXX', 'uid_ems': 'default', 'type': 'ManageIQ::Providers::Openstack::CloudManager', 'api_version': 'v3'}
But finally after cloud provider is created it is "Nothing selected" at the Openstack Infra Provider field https://drive.google.com/open?id=1LQDBmLrd8S8VEzaHunyAjEI-kd5gTgF5 Before adding my code this field was just blank https://drive.google.com/open?id=1TACXGsyjjZHDLNbx3IFAZiF1C_hZeMSB
So as far as I understood based on that that a field changed to "Nothing selected' it was an attempt to use provider_id but attempt was unsuccessful
Correct me please if I'm wrong and what else should be done? Am I using exactly that method for getting provider id or not? Thanks in advance.
@dkholodo Hi, it seems that you take the wrong parameter from your infra OSP provider. You sholud teke "provider_id" from the attributes of infra provider. (from the GET response for example).
Like this:
{"href":"http://localhost:3000/api/providers/37","id":"37","name":"Infra","created_on":"2018-08-02T13:15:46Z","updated_on":"2018-08-02T13:15:46Z","guid":"77758e30-b392-49b1-9a79-e29776423879","zone_id":"1","type":"ManageIQ::Providers::Openstack::InfraManager","api_version":"v3","uid_ems":"default","host_default_vnc_port_start":null,"host_default_vnc_port_end":null,"provider_region":null,"last_refresh_error":null,"last_refresh_date":null,"provider_id":"3","realm":null,"tenant_id":"1","project":null,"parent_ems_id":null,"subscription":null,"last_metrics_error":null,"last_metrics_update_date":null,"last_metrics_success_date":null,"tenant_mapping_enabled":null,"enabled":true,"options":{}
This issue has been automatically marked as stale because it has not been updated for at least 6 months.
If you can still reproduce this issue on the current release or on master
, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions!
@aufi is there an update on this?
No, I think we can close this,
when I add cloud OSP provider via ui, there is field with mapping to infra OSP provider. I didn't manage to figure out how to fill in that field via rest. As far as I see that attribute is missing in provider specific attributes - https://github.com/ManageIQ/manageiq-providers-openstack/blob/17b926bf44d0f0d960b79d571a8435bd0aa4da82/app/models/manageiq/providers/openstack/cloud_manager.rb#L132