Bug 863099 - API:adding new RHEVM provider fails using API
Summary: API:adding new RHEVM provider fails using API
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: aeolus-conductor
Version: 1.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
Assignee: Petr Blaho
QA Contact: Rehana
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-04 12:43 UTC by pushpesh sharma
Modified: 2014-08-04 22:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-05 06:10:41 UTC
Embargoed:


Attachments (Terms of Use)

Description pushpesh sharma 2012-10-04 12:43:21 UTC
[psharma@dhcp193-66 ~]$ curl -X GET --insecure --header 'Accept: application/xml' --header 'Content-Type: application/xml' --user admin:password https://10.65.201.113:443/conductor/api/provider_types
<provider_types>
<provider_type id='1'>
<name>Mock</name>
<deltacloud_driver>mock</deltacloud_driver>
</provider_type>
<provider_type id='2'>
<name>Amazon EC2</name>
<deltacloud_driver>ec2</deltacloud_driver>
</provider_type>
<provider_type id='3'>
<name>RHEV-M</name>
<deltacloud_driver>rhevm</deltacloud_driver>
</provider_type>
<provider_type id='4'>
<name>VMware vSphere</name>
<deltacloud_driver>vsphere</deltacloud_driver>
</provider_type>
</provider_types>
 
Adding RHEVM provider is failing 

[root@dhcp201-113 ~]# curl -X POST -d '<provider><name>rhevm-accountApiTest-fails</name><url>http://localhost:3002/api</url><provider_type id="3"/><deltacloud_provider>https://ce-qe-pune-rhevm.usersys.redhat.com:8443/api;95beb410-2480-4cbe-ac6e-e289c8b94211</deltacloud_provider></provider>' -H "Content-Type: application/xml" -H "Accept: application/xml" --insecure -u admin:password https://10.65.201.113:443/conductor/api/providers
<errors>
<error>
<message>Cloud Resource Provider name was not found in configuration file</message>
</error>
</errors>

Adding vsphere provider is sucessful 
 
[root@dhcp201-113 ~]# curl -X POST -d '<provider><name>vsphere</name><url>http://localhost:3002/api</url><provider_type id="4"/><deltacloud_provider>10.16.120.136</deltacloud_provider></provider>' -H "Content-Type: application/xml" -H "Accept: application/xml" --insecure -u admin:password https://10.65.201.113:443/conductor/api/providers
<provider href='https://10.65.201.113/conductor/api/providers/88' id='88'>
<name>vsphere</name>
<url>http://localhost:3002/api</url>
<provider_type>vsphere</provider_type>
<deltacloud_provider>10.16.120.136</deltacloud_provider>
</provider>
[root@dhcp201-113 ~]#

Comment 1 pushpesh sharma 2012-10-04 12:44:23 UTC
[root@dhcp201-113 ~]# rpm -qa|grep aeolus
aeolus-conductor-daemons-0.13.16-1.el6cf.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
aeolus-all-0.13.16-1.el6cf.noarch
aeolus-conductor-0.13.16-1.el6cf.noarch
aeolus-conductor-doc-0.13.16-1.el6cf.noarch
rubygem-aeolus-cli-0.7.3-1.el6cf.noarch
aeolus-configure-2.8.8-1.el6cf.noarch

Comment 3 Richard Su 2012-10-04 23:04:56 UTC
The "Cloud Resource Provider name was not found in configuration file" means that either /etc/imagefactory/rhevm.json is missing or the provider name that is entered in the xml doesn't match an entry's name in /etc/imagefactory/rhevm.json.

The entry in rhevm.json needs to exist before attempting to create a new provider. Conductor performs a check for this before the provider is saved.

A typical entry looks like:

{
  "rhevm-default":
  {
    "nfs-dir": "/mnt/rhevm-nfs",
    "nfs-path": "/export/export_domain/domain",
    "nfs-host": "server.corp.com",
    "api-url": "https://server.corp.com:8443/api",
    "cluster": "_any_",
    "timeout": 1800
  }
}

For RHEV, the user also needs mount the nfs export locally as specified by nfs-dir, nfs-path, and nfs-host. Normally aeolus-configure -p sets this up. But may not happen in an API user scenario. So this needs to be documented for api users.

For vSphere, a similar entry needs to also exist in /etc/imagefactory/vsphere.json. A missing entry doesn't prevent you from creating a provider, but will later cause problems when you attempt to push images.

  "vsphere-default":
  {
    "api-url":   "https://server.corp.com/sdk",
    "datastore":    "datastore-name",
    "network_name": "some-network"
  }
}

Comment 4 pushpesh sharma 2012-10-05 06:10:41 UTC
After discussion with dave and as Richard Su  suggested above i am closing this BZ.Name for provider (Rhevm and vsphere) can only be one given in json file which is perfectly wokring.

[root@dhcp201-113 ~]# curl -X POST -d '<provider><name>rhevm-default</name><url>http://localhost:3002/api</url><provider_type id="3"/><deltacloud_provider>https://ce-qe-pune-rhevm.usersys.redhat.com:8443/api;95beb410-2480-4cbe-ac6e-e289c8b94211</deltacloud_provider></provider>' -H "Content-Type: application/xml" -H "Accept: application/xml" --insecure -u admin:password https://10.65.201.113:443/conductor/api/providers
<provider href='https://10.65.201.113/conductor/api/providers/130' id='130'>
<name>rhevm-default</name>
<url>http://localhost:3002/api</url>
<provider_type>rhevm</provider_type>
<deltacloud_provider>https://ce-qe-pune-rhevm.usersys.redhat.com:8443/api;95beb410-2480-4cbe-ac6e-e289c8b94211</deltacloud_provider>
</provider>


[root@dhcp201-113 ~]# cat /etc/imagefactory/rhevm.json
{
  "rhevm-default":
  {
    "nfs-dir": "/mnt/rhevm-nfs",
    "nfs-path": "/opt/export",
    "nfs-host": "ce-qe-pune-rhevm.usersys.redhat.com",
    "api-url": "https://ce-qe-pune-rhevm.usersys.redhat.com:8443/api",
    "cluster": "_any_",
    "timeout": 1800
  }
}
[root@dhcp201-113 ~]# cat /etc/imagefactory/vsphere.json 
{
  "vsphere-default":
  {
    "api-url":   "https://10.16.120.136/sdk",
    "datastore":    "datastore1",
    "network_name": "VM Network"
  }
}
[root@dhcp201-113 ~]# 


Although i believe the similar check is needed for the vsphere provider also because it is blindly accepting any name.I opened a seprate bug to track this. 

https://bugzilla.redhat.com/show_bug.cgi?id=863321

[root@dhcp201-113 ~]#  curl -X POST -d '<provider><name>vsphere-xxx</name><url>http://localhost:3002/api</url><provider_type id="4"/><deltacloud_provider>10.16.120.136</deltacloud_provider></provider>' -H "Content-Type: application/xml" -H "Accept: application/xml" --insecure -u admin:password https://10.65.201.113:443/conductor/api/providers
<provider href='https://10.65.201.113/conductor/api/providers/131' id='131'>
<name>vsphere-xxx</name>
<url>http://localhost:3002/api</url>
<provider_type>vsphere</provider_type>
<deltacloud_provider>10.16.120.136</deltacloud_provider>
</provider>


Note You need to log in before you can comment on or make changes to this bug.