← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1717547] Re: Creating snapshot fails when image metadata has version field

 

Reviewed:  https://review.openstack.org/614351
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5c21a00e89539bbb271ccfa05e4a2ba1cddae58e
Submitter: Zuul
Branch:    master

commit 5c21a00e89539bbb271ccfa05e4a2ba1cddae58e
Author: Jay Pipes <jaypipes@xxxxxxxxx>
Date:   Tue Nov 6 10:59:40 2018 -0500

    prevent common kwargs from glance client failure
    
    When creating a snapshot of a server using the nova API, failure occurs
    if the image contains the metadata property "version". This was due to
    the way that the GlanceClientWrapper.call() function signature was
    structured.
    
    This patch forces all client positional args to be passed as a named
    "args" argument to the call() function and all client named args to be
    pass as a named "kwargs" argument to the call() function. This
    eliminates any argument name-shadowing that previously caused issues.
    
    Closes-bug: #1717547
    Change-Id: I3ed3303309fe2a25c0043fd206f36bada4b3b8f9


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1717547

Title:
  Creating snapshot fails when image metadata has version field

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) ocata series:
  Confirmed
Status in OpenStack Compute (nova) pike series:
  Confirmed

Bug description:
  Description:

  When creating a snapshot of a server using the nova API, failure
  occurs if the image contains the metadata property "version". It seems
  like image metadata is passed as an argument to _create_v2
  (nova/image/glance.py) which is then passed to call
  (nova/image/glance.py) as kwargs. The function already takes in
  context, method, and version arguments, so it seems that any of these
  metadata properties would cause the snapshot to fail.

  OpenStack version : Pike
  Nova API version : 2.1

  Steps to reporduce:

  1. Create an image with metadata property "version"
  2. Launch an server using this image
  3. Try to create a server snapshot of the server you just launched 

  image used:
  +------------------+----------------------------------------------------------------------------+
  | Field            | Value                                                                      |
  +------------------+----------------------------------------------------------------------------+
  | checksum         | d19875d33815bd8c49fe39829b1df924                                           |
  | container_format | bare                                                                       |
  | created_at       | 2017-09-05T15:57:24Z                                                       |
  | disk_format      | raw                                                                        |
  | file             | /v2/images/c7f76154-dd99-4102-afe2-662a4fcaba7b/file                       |
  | id               | c7f76154-dd99-4102-afe2-662a4fcaba7b                                       |
  | min_disk         | 0                                                                          |
  | min_ram          | 0                                                                          |
  | name             | ubuntu-16.04-amd64_2                                                       |
  | owner            | 71cea55297f94953b33b2a2549d72a95                                           |
  | properties       | architecture='amd64', direct_url='rbd://8838dc54-c385-4949-9624-1cf3911320 |
  |                  | 1d/images/c7f76154-dd99-4102-afe2-662a4fcaba7b/snap',                      |
  |                  | distribution='Ubuntu', family='Linux', username='ubuntu', version='16.04'  |
  | protected        | False                                                                      |
  | schema           | /v2/schemas/image                                                          |
  | size             | 2361393152                                                                 |
  | status           | active                                                                     |
  | tags             |                                                                            |
  | updated_at       | 2017-09-14T21:10:44Z                                                       |
  | virtual_size     | None                                                                       |
  | visibility       | public                                                                     |
  +------------------+----------------------------------------------------------------------------+
  Expected result:
  succesfully create server snapshot

  Actual result:

  logs:

  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions [req-eea1ec3c-a500-4006-ab4d-00a05a6b4f33 f25d972f420840e48163a55bf5713bf6 c657c15a0a13435bbe2c323c732d4e4f - 0e46d3ad069b4f0e85bf594de38fbe0e 0e46d3ad069b4f0e85bf594de38fbe0e] Unexpected exception in API method: TypeError: call() got multiple values for keyword argument 'version'
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions Traceback (most recent call last):
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 336, in wrapped
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/api/openstack/common.py", line 356, in inner
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 108, in wrapper
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return func(*args, **kwargs)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/api/validation/__init__.py", line 108, in wrapper
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return func(*args, **kwargs)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/api/openstack/compute/servers.py", line 999, in _action_create_image
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     extra_properties=metadata)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/compute/api.py", line 208, in _wrapped
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return fn(self, context, instance, *args, **kwargs)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/compute/api.py", line 148, in inner
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return f(self, context, instance, *args, **kw)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/compute/api.py", line 2684, in snapshot
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     extra_properties=extra_properties)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/compute/api.py", line 2754, in _create_image
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return self.image_api.create(context, image_meta)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/image/api.py", line 108, in create
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     return session.create(context, image_info, data=data)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/image/glance.py", line 390, in create
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     data, force_activate)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions   File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/nova/image/glance.py", line 467, in _create_v2
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions     context, 2, 'create', **sent_service_image_meta)
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions TypeError: call() got multiple values for keyword argument 'version'
  2017-09-14 19:57:53.486 27 ERROR nova.api.openstack.extensions
  <type 'exceptions.TypeError'>

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1717547/+subscriptions


References