novaclient needs to move to using the 'volume' service type

Bug #1454369 reported by Jay Bryant
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Won't Fix
Low
Unassigned

Bug Description

It appears that there are still places in Nova that are being hardcoded to use the Cinder V1 api. Evidence of this can be seen by setting enable_v1_api to false in Cinder and then trying to use any of the 'nova volume' commands. Errors like the following are produced:

[root@controller-x86-KVM-SCE-Refstack-SCERest-430gm-abd12ca7 ˜]# nova --debug volume-create 1
DEBUG (session:195) REQ: curl -g -i -X GET http://169.55.21.52:5000/v2.0 -H "Accept: application/json" -H "User-Agent: python-keystoneclient"
INFO (connectionpool:194) Starting new HTTP connection (1): 169.55.21.52
DEBUG (connectionpool:360) "GET /v2.0 HTTP/1.1" 200 338
DEBUG (session:224) RESP: [200] date: Sun, 10 May 2015 19:02:38 GMT vary: X-Auth-Token content-length: 338 content-type: application/json
RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://169.55.21.52:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}

DEBUG (v2:76) Making authentication request to http://169.55.21.52:5000/v2.0/tokens
DEBUG (connectionpool:360) "POST /v2.0/tokens HTTP/1.1" 200 4531
DEBUG (iso8601:171) Parsed 2015-05-10T20:02:38Z into {'tz_sign': None, 'second_fraction': None, 'hour': u'20', 'daydash': u'10', 'tz_hour': None, 'month': None, 'timezone': u'Z', 'second': u'38', 'tz_minute': None, 'year': u'2015', 'separator': u'T', 'monthdash': u'05', 'day': None, 'minute': u'02'} with default timezone <iso8601.iso8601.Utc object at 0x1a26bd0>
DEBUG (iso8601:127) Got u'2015' for 'year' with default None
DEBUG (iso8601:127) Got u'05' for 'monthdash' with default None
DEBUG (iso8601:127) Got 5 for 'month' with default 5
DEBUG (iso8601:127) Got u'10' for 'daydash' with default None
DEBUG (iso8601:127) Got 10 for 'day' with default 10
DEBUG (iso8601:127) Got u'20' for 'hour' with default None
DEBUG (iso8601:127) Got u'02' for 'minute' with default None
DEBUG (iso8601:127) Got u'38' for 'second' with default None
DEBUG (session:195) REQ: curl -g -i -X POST http://169.55.21.52:8776/v1/a7d1b663366740859037201fa8a48b03/volumes -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}3724d0d949251ec67dd2d3b67201b7e196f36c47" -d '{"volume": {"display_name": null, "imageRef": null, "availability_zone": null, "volume_type": null, "display_description": null, "snapshot_id": null, "size": 1}}'
INFO (connectionpool:194) Starting new HTTP connection (1): 169.55.21.52
DEBUG (connectionpool:360) "POST /v1/a7d1b663366740859037201fa8a48b03/volumes HTTP/1.1" 400 141
DEBUG (session:224) RESP:
DEBUG (shell:914) The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 911, in main
    OpenStackComputeShell().main(argv)
  File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 838, in main
    args.func(self.cs, args)
  File "/usr/lib/python2.7/site-packages/novaclient/v2/shell.py", line 2053, in do_volume_create
    imageRef=args.image_id)
  File "/usr/lib/python2.7/site-packages/novaclient/v2/volumes.py", line 72, in create
    return self._create('/volumes', body, 'volume')
  File "/usr/lib/python2.7/site-packages/novaclient/base.py", line 161, in _create
    _resp, body = self.api.client.post(url, body=body)
  File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 176, in post
    return self.request(url, 'POST', **kwargs)
  File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 96, in request
    raise exceptions.from_response(resp, body, url, method)
BadRequest: The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400)
ERROR (BadRequest): The server could not comply with the request since it is either malformed or otherwise incorrect. (HTTP 400)

Attempts to run tempest also fail.

Cinder has added version discovery in Liberty so Nova should go back to using the 'volume' service type as the volumev2 service type will go away and version discovery should take care of making sure the right API version is used.

Tags: volumes
tags: added: volumes
Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Matt Riedemann (mriedem) wrote :

@Jay, per "Cinder has added version discovery in Liberty so Nova should go back to using the 'volume' service type as the volumev2 service type will go away and version discovery should take care of making sure the right API version is used." - what is the cinder version discovery change mentioned? Is that in cinder - can you link to the patch?

Also, I think this is novaclient which means if the version discovery in cinder is only liberty, we can't assume novaclient isn't talking to a kilo cinder.

Changed in python-novaclient:
status: New → Confirmed
importance: Undecided → Low
no longer affects: nova
summary: - nova needs to move to using the 'volume' service type
+ novaclient needs to move to using the 'volume' service type
Revision history for this message
Jay Bryant (jsbryant) wrote :

@Matt,

Version Discovery was added here: https://review.openstack.org/#/c/145613/ It is in Cinderclient.

commit ae03d2a721bd9acb61805ce792a27fb7cf88e5cd
Author: Mike Perez <email address hidden>
Date: Wed Jan 7 14:29:48 2015 -0800

    Enable version discovery

    The service catalog can now have the cinder endpoint x.x.x.x:8776 with
    service_type volume, without needing to specify a version in the
    endpoint. Keystone will do discovery of the root / GET of the Cinder API
    to discover the versions that can be talked to.

    This also provides backwards compatibility for the previous solution of
    having v1 enabled on service_type volume and v2 on service_type
    volumev2.

    Change-Id: Id0347f8370dbc8fd7fa8096cd5859e10b0c5d67c

You have a point about not being able to assume that novaclient isn't talking to a Kilo version of Cinder. We will need to think about how we can handle that situation.

Revision history for this message
melanie witt (melwitt) wrote :

Hi Jay, novaclient calls directly to cinder instead of using the nova proxy. It already defaults to using the 'volume' service type and I think the problem you're hitting is because of how devstack sets up the service types. If you take a look at the output of 'keystone catalog' you can see what urls are mapped for 'volume' and 'volumev2'. I suspect what is happening is you disabled the v1 api but 'volume' in the service catalog is pointing at /v1. In a real deployment, I think an operator would set up the service in the catalog as /v2 and "volume" endpoint and then the same scenario you tried would work fine.

Revision history for this message
Matt Riedemann (mriedem) wrote :

After talking with melwitt for awhile on this, novaclient actually doesn't use nova volume apis for handling the volume clis in novaclient, it talks directly to cinder api, which is the problem here b/c novaclient doesn't have the cinder api version discovery that's in cinderclient via https://review.openstack.org/#/c/145613/ now.

It sounds like novaclient can't just be changed to call nova volume apis because the nova volume apis don't have support for things like volume snapshots and volume types.

So what I'd really like to just do here is deprecate the volume CLIs in novaclient and tell people to use cinderclient, but I'm not sure how hard that would be to get accepted or how long it would take before we could remove them (6 months, a year?).

I'll bring this up in the mailing list and nova meeting agenda.

Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Jay Bryant (jsbryant) wrote :

Matt, I wasn't even aware that it was possible to do these additional volume commands through Nova until this issue came up. I agree that deprecating the commands and moving people to using Cinder's client is the best way to proceed.

Revision history for this message
Jay Pipes (jaypipes) wrote :

Just noting I agree that deprecating the novaclient volume commands is the right approach.

Revision history for this message
Matt Riedemann (mriedem) wrote :

We talked about this at the Vancouver design summit and I'm going to push some changes to emit deprecation warnings when volume CLIs are called (each time, not just once). We'll then cut a release once that change merges. The plan is to drop the deprecated CLIs in the first novaclient release after to the 2016.1 'M' release.

etherpad with details: https://etherpad.openstack.org/p/YVR-nova-contributor-meetup

Changed in python-novaclient:
status: Confirmed → Won't Fix
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-novaclient (master)

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

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

Reviewed: https://review.openstack.org/185141
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=23f13437dd64496fcbc138bbaa9b0ac615a3cf23
Submitter: Jenkins
Branch: master

commit 23f13437dd64496fcbc138bbaa9b0ac615a3cf23
Author: Matt Riedemann <email address hidden>
Date: Fri May 22 13:34:51 2015 -0700

    Deprecate volume/volume-type/volume-snapshot CRUD CLIs/APIs

    This deprecates all of the volume CLIs/APIs that go directly to the
    cinder API via the volume service type.

    This will emit a warning each time a deprecated CLI/API is used and also
    updates the help docs for the deprecated CLIs and docstrings for APIs.

    The plan is to do a release once this is merged so people start seeing
    it and then we'll actually remove the deprecated CLIs/APIs in the first
    python-novaclient release after the Nova server 2016.1 'M' release.

    DocImpact: The volume, volume-type and volume-snapshot CRUD CLIs/APIs are
               deprecated and will be removed after the Nova 2016.1 release.
               Use python-cinderclient or openstackclient for CLIs instead.
               Use python-cinderclient or python-openstacksdk for APIs instead.

    Related-Bug: #1454369

    Change-Id: I4e92f924739de9b664e08117984bfb60359f2212

Revision history for this message
Matt Riedemann (mriedem) wrote :

The volume APIs/CLIs are now deprecated in the 2.26.0 release of python-novaclient.

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.