[ovirt-devel] Can't add DC with API v4 - client issue
Yaniv Kaul
ykaul at redhat.com
Fri Oct 14 11:45:32 UTC 2016
On Thu, Oct 13, 2016 at 11:13 AM, Juan Hernández <jhernand at redhat.com>
wrote:
> On 10/13/2016 12:04 AM, Yaniv Kaul wrote:
> > On Fri, Oct 7, 2016 at 10:44 PM, Yaniv Kaul <ykaul at redhat.com
> > <mailto:ykaul at redhat.com>> wrote:
> >
> > I'm trying on FC24, using
> > python-ovirt-engine-sdk4-4.1.0-0.0.20161003git056315d.fc24.x86_64 to
> > add a DC, and failing - against master. The client is unhappy:
> > File
> > "/home/ykaul/ovirt-system-tests/basic-suite-master/test-
> scenarios/002_bootstrap.py",
> > line 98, in add_dc4
> > version=sdk4.types.Version(major=DC_VER_MAJ,minor=DC_VER_MIN),
> > File "/usr/lib64/python2.7/site-packages/ovirtsdk4/services.py",
> > line 4347, in add
> > response = self._connection.send(request)
> > File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
> > line 276, in send
> > return self.__send(request)
> > File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
> > line 298, in __send
> > self._sso_token = self._get_access_token()
> > File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
> > line 460, in _get_access_token
> > sso_response = self._get_sso_response(self._sso_url, post_data)
> > File "/usr/lib64/python2.7/site-packages/ovirtsdk4/__init__.py",
> > line 498, in _get_sso_response
> > return json.loads(body_buf.getvalue().decode('utf-8'))
> > File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
> > return _default_decoder.decode(s)
> > File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
> > obj, end = self.raw_decode(s, idx=_w(s, 0).end())
> > File "/usr/lib64/python2.7/json/decoder.py", line 382, in
> raw_decode
> > raise ValueError("No JSON object could be decoded")
> > ValueError: No JSON object could be decoded
> >
> >
> > Surprisingly, I now can't find that RPM of this SDK in
> > resources.ovirt.org <http://resources.ovirt.org> now.
> >
> > I've tried
> > with http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/
> fc24/x86_64/python-ovirt-engine-sdk4-4.0.0-0.1.
> 20161004gitf94eeb5.fc24.x86_64.rpm
> > <http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/
> fc24/x86_64/python-ovirt-engine-sdk4-4.0.0-0.1.
> 20161004gitf94eeb5.fc24.x86_64.rpm>
> >
> > - same result.
> >
> > Did not see anything obvious on server or engine logs.
> > The code:
> > def add_dc4(api):
> > nt.assert_true(api != None)
> > dcs_service = api.system_service().data_centers_service()
> > nt.assert_true(
> > dc = dcs_service.add(
> > sdk4.types.DataCenter(
> > name=DC_NAME4,
> > description='APIv4 DC',
> > local=False,
> >
> > version=sdk4.types.Version(major=DC_VER_MAJ,minor=DC_VER_MIN),
> > ),
> > )
> > )
> >
> >
> > And the api object is from:
> > return sdk4.Connection(
> > url=url,
> > username=constants.ENGINE_USER,
> > password=str(self.metadata['
> ovirt-engine-password']),
> > insecure=True,
> > debug=True,
> > )
> >
> >
> > The clue is actually on the HTTPd logs:
> > 192.168.203.1 - - [12/Oct/2016:17:56:27 -0400] "POST
> > /ovirt-engine/sso/oauth/token HTTP/1.1" 404 74
> >
> > And indeed, from the deubg log:
> > begin captured logging << --------------------\n
> > root: DEBUG: Trying 192.168.203.3...\n
> > root: DEBUG: Connected to 192.168.203.3 (192.168.203.3) port 443 (#0)\n
> > root: DEBUG: Initializing NSS with certpath: sql:/etc/pki/nssdb\n
> > root: DEBUG: skipping SSL peer certificate verification\n
> > root: DEBUG: ALPN/NPN, server did not agree to a protocol\n
> > root: DEBUG: SSL connection using TLS_ECDHE_RSA_WITH_AES_128_
> GCM_SHA256\n
> > root: DEBUG: Server certificate:\n
> > root: DEBUG: subject: CN=engine,O=Test,C=US\n
> > root: DEBUG: start date: Oct 11 21:55:29 2016 GMT\n
> > root: DEBUG: expire date: Sep 16 21:55:29 2021 GMT\n
> > root: DEBUG: common name: engine\nroot: DEBUG: issuer:
> > CN=engine.38998,O=Test,C=US\n
> > *root: DEBUG: POST /ovirt-engine/sso/oauth/token HTTP/1.1\n*
> > *root: DEBUG: Host: 192.168.203.3\n*
> > *root: DEBUG: User-Agent: PythonSDK/4.1.0a0\n*
> > *root: DEBUG: Accept: application/json\n*
> > *root: DEBUG: Content-Length: 78\n*
> > *root: DEBUG: Content-Type: application/x-www-form-urlencoded\nroot:
> > DEBUG:
> > username=admin%40internal&scope=ovirt-app-api&password=
> 123&grant_type=password\n*
> > *root: DEBUG: upload completely sent off: 78 out of 78 bytes\n*
> > *root: DEBUG: HTTP/1.1 404 Not Found\n*
> > *root: DEBUG: Date: Wed, 12 Oct 2016 21:56:27 GMT\n*
> > *root: DEBUG: Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips\n*
> > *root: DEBUG: Content-Length: 74\n*
> > *root: DEBUG: Content-Type: text/html; charset=UTF-8\n*
> > *root: DEBUG: \n*
> > *root: DEBUG: <html><head><title>Error</title></head><body>404 - Not
> > Found</body></html>\n*
> > root: DEBUG: Connection #0 to host 192.168.203.3 left intact\n
> > --------------------- >> end captured logging
> >
>
> That definitively looks like version 3 of the engine. Either that or
> version 4 of the engine with web server configuration modified so that
> the SSO doesn't work as expected.
>
> What do you get if you run this against that server?
>
Attached.
Y.
>
> curl \
> --verbose \
> --insecure \
> --request GET \
> --user "admin at internal:yourpassword" \
> --header "Version: 4" \
> --header "Accept: application/xml" \
> "https://thatserver/ovirt-engine/api"
>
> --
> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
> 3ºD, 28016 Madrid, Spain
> Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20161014/85e89bef/attachment-0001.html>
-------------- next part --------------
curl \
--verbose \
--insecure \
--request GET \
--user "admin at internal:123" \
--header "Version: 4" \
--header "Accept: application/xml" \
"https://engine/ovirt-engine/api"
curl --verbose --insecure --request GET --user "admin at internal:123" --header "Version: 4" --header "Accept: application/xml" "https://engine/ovirt-engine/api"
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 192.168.202.3...
* Connected to engine (192.168.202.3) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* ALPN/NPN, server did not agree to a protocol
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=engine,O=Test,C=US
* start date: אוק 13 11:36:42 2016 GMT
* expire date: ספט 18 11:36:42 2021 GMT
* common name: engine
* issuer: CN=engine.40008,O=Test,C=US
* Server auth using Basic with user 'admin at internal'
> GET /ovirt-engine/api HTTP/1.1
> Host: engine
> Authorization: Basic YWRtaW5AaW50ZXJuYWw6MTIz
> User-Agent: curl/7.47.1
> Version: 4
> Accept: application/xml
>
< HTTP/1.1 200 OK
< Date: Fri, 14 Oct 2016 11:41:42 GMT
< Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips
< Content-Type: application/xml
< Content-Length: 4732
< Link: <https://engine/ovirt-engine/api/affinitylabels>; rel=affinitylabels,<https://engine/ovirt-engine/api/bookmarks>; rel=bookmarks,<https://engine/ovirt-engine/api/clusterlevels>; rel=clusterlevels,<https://engine/ovirt-engine/api/clusters>; rel=clusters,<https://engine/ovirt-engine/api/clusters?search={query}>; rel=clusters/search,<https://engine/ovirt-engine/api/cpuprofiles>; rel=cpuprofiles,<https://engine/ovirt-engine/api/datacenters>; rel=datacenters,<https://engine/ovirt-engine/api/datacenters?search={query}>; rel=datacenters/search,<https://engine/ovirt-engine/api/diskprofiles>; rel=diskprofiles,<https://engine/ovirt-engine/api/disks>; rel=disks,<https://engine/ovirt-engine/api/disks?search={query}>; rel=disks/search,<https://engine/ovirt-engine/api/domains>; rel=domains,<https://engine/ovirt-engine/api/events;from={event_id}?search={query}>; rel=events/search,<https://engine/ovirt-engine/api/events>; rel=events,<https://engine/ovirt-engine/api/externalhostproviders>; rel=externalhostproviders,<https://engine/ovirt-engine/api/groups>; rel=groups,<https://engine/ovirt-engine/api/groups?search={query}>; rel=groups/search,<https://engine/ovirt-engine/api/hosts>; rel=hosts,<https://engine/ovirt-engine/api/hosts?search={query}>; rel=hosts/search,<https://engine/ovirt-engine/api/icons>; rel=icons,<https://engine/ovirt-engine/api/instancetypes>; rel=instancetypes,<https://engine/ovirt-engine/api/instancetypes?search={query}>; rel=instancetypes/search,<https://engine/ovirt-engine/api/jobs>; rel=jobs,<https://engine/ovirt-engine/api/katelloerrata>; rel=katelloerrata,<https://engine/ovirt-engine/api/macpools>; rel=macpools,<https://engine/ovirt-engine/api/networkfilters>; rel=networkfilters,<https://engine/ovirt-engine/api/networks>; rel=networks,<https://engine/ovirt-engine/api/networks?search={query}>; rel=networks/search,<https://engine/ovirt-engine/api/openstackimageproviders>; rel=openstackimageproviders,<https://engine/ovirt-engine/api/openstacknetworkproviders>; rel=openstacknetworkproviders,<https://engine/ovirt-engine/api/openstackvolumeproviders>; rel=openstackvolumeproviders,<https://engine/ovirt-engine/api/operatingsystems>; rel=operatingsystems,<https://engine/ovirt-engine/api/permissions>; rel=permissions,<https://engine/ovirt-engine/api/roles>; rel=roles,<https://engine/ovirt-engine/api/schedulingpolicies>; rel=schedulingpolicies,<https://engine/ovirt-engine/api/schedulingpolicyunits>; rel=schedulingpolicyunits,<https://engine/ovirt-engine/api/storageconnections>; rel=storageconnections,<https://engine/ovirt-engine/api/storagedomains>; rel=storagedomains,<https://engine/ovirt-engine/api/storagedomains?search={query}>; rel=storagedomains/search,<https://engine/ovirt-engine/api/tags>; rel=tags,<https://engine/ovirt-engine/api/templates>; rel=templates,<https://engine/ovirt-engine/api/templates?search={query}>; rel=templates/search,<https://engine/ovirt-engine/api/users>; rel=users,<https://engine/ovirt-engine/api/users?search={query}>; rel=users/search,<https://engine/ovirt-engine/api/vmpools>; rel=vmpools,<https://engine/ovirt-engine/api/vmpools?search={query}>; rel=vmpools/search,<https://engine/ovirt-engine/api/vms>; rel=vms,<https://engine/ovirt-engine/api/vms?search={query}>; rel=vms/search,<https://engine/ovirt-engine/api/vnicprofiles>; rel=vnicprofiles
< Vary: Accept-Encoding
<
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<api>
<link href="/ovirt-engine/api/clusters" rel="clusters"/>
<link href="/ovirt-engine/api/clusters?search={query}" rel="clusters/search"/>
<link href="/ovirt-engine/api/datacenters" rel="datacenters"/>
<link href="/ovirt-engine/api/datacenters?search={query}" rel="datacenters/search"/>
<link href="/ovirt-engine/api/events" rel="events"/>
<link href="/ovirt-engine/api/events;from={event_id}?search={query}" rel="events/search"/>
<link href="/ovirt-engine/api/hosts" rel="hosts"/>
<link href="/ovirt-engine/api/hosts?search={query}" rel="hosts/search"/>
<link href="/ovirt-engine/api/networks" rel="networks"/>
<link href="/ovirt-engine/api/networks?search={query}" rel="networks/search"/>
<link href="/ovirt-engine/api/roles" rel="roles"/>
<link href="/ovirt-engine/api/storagedomains" rel="storagedomains"/>
<link href="/ovirt-engine/api/storagedomains?search={query}" rel="storagedomains/search"/>
<link href="/ovirt-engine/api/tags" rel="tags"/>
<link href="/ovirt-engine/api/bookmarks" rel="bookmarks"/>
<link href="/ovirt-engine/api/icons" rel="icons"/>
<link href="/ovirt-engine/api/templates" rel="templates"/>
<link href="/ovirt-engine/api/templates?search={query}" rel="templates/search"/>
<link href="/ovirt-engine/api/instancetypes" rel="instancetypes"/>
<link href="/ovirt-engine/api/instancetypes?search={query}" rel="instancetypes/search"/>
<link href="/ovirt-engine/api/users" rel="users"/>
<link href="/ovirt-engine/api/users?search={query}" rel="users/search"/>
<link href="/ovirt-engine/api/groups" rel="groups"/>
<link href="/ovirt-engine/api/groups?search={query}" rel="groups/search"/>
<link href="/ovirt-engine/api/domains" rel="domains"/>
<link href="/ovirt-engine/api/vmpools" rel="vmpools"/>
<link href="/ovirt-engine/api/vmpools?search={query}" rel="vmpools/search"/>
<link href="/ovirt-engine/api/vms" rel="vms"/>
<link href="/ovirt-engine/api/vms?search={query}" rel="vms/search"/>
<link href="/ovirt-engine/api/disks" rel="disks"/>
<link href="/ovirt-engine/api/disks?search={query}" rel="disks/search"/>
<link href="/ovirt-engine/api/jobs" rel="jobs"/>
<link href="/ovirt-engine/api/storageconnections" rel="storageconnections"/>
<link href="/ovirt-engine/api/vnicprofiles" rel="vnicprofiles"/>
<link href="/ovirt-engine/api/diskprofiles" rel="diskprofiles"/>
<link href="/ovirt-engine/api/cpuprofiles" rel="cpuprofiles"/>
<link href="/ovirt-engine/api/schedulingpolicyunits" rel="schedulingpolicyunits"/>
<link href="/ovirt-engine/api/schedulingpolicies" rel="schedulingpolicies"/>
<link href="/ovirt-engine/api/permissions" rel="permissions"/>
<link href="/ovirt-engine/api/macpools" rel="macpools"/>
<link href="/ovirt-engine/api/networkfilters" rel="networkfilters"/>
<link href="/ovirt-engine/api/operatingsystems" rel="operatingsystems"/>
<link href="/ovirt-engine/api/externalhostproviders" rel="externalhostproviders"/>
<link href="/ovirt-engine/api/openstackimageproviders" rel="openstackimageproviders"/>
<link href="/ovirt-engine/api/openstackvolumeproviders" rel="openstackvolumeproviders"/>
<link href="/ovirt-engine/api/openstacknetworkproviders" rel="openstacknetworkproviders"/>
<link href="/ovirt-engine/api/katelloerrata" rel="katelloerrata"/>
<link href="/ovirt-engine/api/affinitylabels" rel="affinitylabels"/>
<link href="/ovirt-engine/api/clusterlevels" rel="clusterlevels"/>
<product_info>
<name>oVirt Engine</name>
<vendor>ovirt.org</vendor>
<version>
<build>0</build>
<full_version>4.1.0-0.0.master.20161013212829.gitbb539c2.el7.centos</full_version>
<major>4</major>
<minor>1</minor>
<revision>0</revision>
</version>
</product_info>
<special_objects>
<blank_template href="/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<root_tag href="/ovirt-engine/api/tags/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
</special_objects>
<summary>
<hosts>
<active>0</active>
<total>0</total>
</hosts>
<storage_domains>
<active>0</active>
<total>1</total>
</storage_domains>
<users>
<active>1</active>
<total>1</total>
</users>
<vms>
<active>0</active>
<total>0</total>
</vms>
</summary>
<time>2016-10-14T07:41:42.448-04:00</time>
</api>
* Connection #0 to host engine left intact
More information about the Devel
mailing list