cinder hardcodes the service type to "volumev2"

Bug #1621126 reported by Matthew Edmonds
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
ansible
New
Undecided
Unassigned
python-cinderclient
Invalid
Undecided
Unassigned
python-openstackclient
Confirmed
Undecided
Unassigned

Bug Description

devstack creates a "volumev2" service-type for cinder with v2 endpoints in keystone's catalog. That is not the way that the catalog is designed to be used. The service-type should not be version-specific, and in fact devstack gets this right for every other service except cinder. But that's ok, because in non-devstack cases you setup the catalog yourself and can do so properly, calling the service-type "volume" as it should be. Unfortunately, when you do this, openstackclient's CLI does not work... it assumes the type must be volumev2 when you specify OS_VOLUME_API_VERSION=2, and raises the following error:

publicURL endpoint for volumev2 service in RegionOne region not found
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 387, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 100, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/openstackclient/volume/v2/volume.py", line 331, in take_action
    data = volume_client.volumes.list(search_opts=search_opts)
  File "/usr/lib/python2.7/site-packages/cinderclient/v3/volumes.py", line 284, in list
    return self._list(url, resource_type, limit=limit)
  File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 81, in _list
    resp, body = self.api.client.get(url)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 116, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 113, in _cs_request
    return self.request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 104, in request
    **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 213, in request
    resp = super(LegacyJsonAdapter, self).request(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 101, in request
    return self.session.request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/osc_lib/session.py", line 40, in request
    resp = super(TimingSession, self).request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 94, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 484, in request
    **endpoint_filter)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 765, in get_endpoint
    return auth.get_endpoint(self, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 216, in get_endpoint
    service_name=service_name)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 94, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/access/service_catalog.py", line 228, in url_for
    raise exceptions.EndpointNotFound(msg)
EndpointNotFound: publicURL endpoint for volumev2 service in RegionOne region not found
clean_up ListVolume: publicURL endpoint for volumev2 service in RegionOne region not found
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 135, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 267, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 180, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 387, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/display.py", line 100, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/openstackclient/volume/v2/volume.py", line 331, in take_action
    data = volume_client.volumes.list(search_opts=search_opts)
  File "/usr/lib/python2.7/site-packages/cinderclient/v3/volumes.py", line 284, in list
    return self._list(url, resource_type, limit=limit)
  File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 81, in _list
    resp, body = self.api.client.get(url)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 116, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 113, in _cs_request
    return self.request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 104, in request
    **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 213, in request
    resp = super(LegacyJsonAdapter, self).request(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 101, in request
    return self.session.request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/osc_lib/session.py", line 40, in request
    resp = super(TimingSession, self).request(url, method, **kwargs)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 94, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 484, in request
    **endpoint_filter)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 765, in get_endpoint
    return auth.get_endpoint(self, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/base.py", line 216, in get_endpoint
    service_name=service_name)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 94, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/access/service_catalog.py", line 228, in url_for
    raise exceptions.EndpointNotFound(msg)
EndpointNotFound: publicURL endpoint for volumev2 service in RegionOne region not found

Catalog is as follows in this case:

[root@ip9-114-192-178 ~]# openstack catalog list
+------------+--------------+-----------------------------------------------------------------------------------------------------+
| Name | Type | Endpoints |
+------------+--------------+-----------------------------------------------------------------------------------------------------+
| cinder | volume | RegionOne |
| | | internal: http://127.0.0.1:9000/v2/ba3270dd173d4dd497c5fdaf44857c6f |
| | | RegionOne |
| | | admin: https://myhostname:9000/v2/ba3270dd173d4dd497c5fdaf44857c6f |
| | | RegionOne |
| | | public: https://myhostname:9000/v2/ba3270dd173d4dd497c5fdaf44857c6f |
| | | |

The cinderclient CLI has the same problem. It at least provides a workaround in that you can specify "--service-type volume", though that is really a hack. Surely the code could look for "volumev2" (for those deployments that have followed devstack's bad example) and then failing to find that look for "volume" (for those that have done things correctly).

Revision history for this message
Steve Martinelli (stevemar) wrote :

From an OSC perspective, this is a frustrating change to make. The catalog should not contained versioned types (volume, volumev2, volumev3); and ideally, the URLs specified should be versionless.

We could make use of the "service_type" arg available in the v2 client, but I'm not sure how we would pick up on this. As seen in your example, the error happened now upon client instantiation, but upon accessing an API.

summary: - v2 cinder operations do not work with volume service type
+ cinder hardcodes the service type to "volumev2"
Changed in python-openstackclient:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-cinderclient (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/414605

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/414605
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=204b15ab13004e3d5ac1ec4d0dbd3fe94bb2a8fd
Submitter: Jenkins
Branch: master

commit 204b15ab13004e3d5ac1ec4d0dbd3fe94bb2a8fd
Author: Ivan Kolodyazhny <email address hidden>
Date: Fri Dec 23 16:36:19 2016 +0200

    Removed unnecessary 'service_type' decorator

    @utils.service_type was introduced with 'Initial split from
    python-novaclient' commit and used for CLI. Now both Python and
    Command-line APIs for each version work well without this decorator.

    Unused 'get_service_type' function is removed too.

    'utils.retype_method' removed as well because everything works well
    without it.

    Change-Id: Ic2470d8ca9d581b7c47da8d7e6a414c3c78ad27a
    Partial-Bug: #1643584
    Related-Bug: #1621126

Revision history for this message
Ben (chmod666org) wrote :

This bug seems also to affect ansible.
When I'm trying to create a volume using an aAsible playbook like this one:
- name: Create boot volume
  os_volume:
    state: present
    size: 100
    display_name: "{{ vm_name }}_boot1"
    volume_type: "{{ vol_type }}"
I'm getting this error (here is the ansible output):
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Error fetching volume list (Inner Exception: public endpoint for volumev2 service in RegionOne region not found)"}
It seems to be related to this bug.
When using cinder command directly I add the "--service-type volume"

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

This has since been fixed in python-cinderclient through other changes. Closing as invalid, but if there are still issues seen, please reopen and provide the context to reproduce it.

Changed in python-cinderclient:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.