Creating snapshot fails when image metadata has version field

Bug #1717547 reported by Damien on 2017-09-15
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
Jay Pipes
Ocata
Low
Unassigned
Pike
Low
Unassigned
Queens
Low
Matt Riedemann
Rocky
Low
Lee Yarwood

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'>

Damien (doucet-girard) on 2017-09-15
description: updated
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: low-hanging-fruit snapshot
tags: added: openstack-version.pike
priyaduggirala (priyad) on 2017-09-28
Changed in nova:
assignee: nobody → priyaduggirala (priyad)
priyaduggirala (priyad) on 2017-09-29
Changed in nova:
status: Confirmed → In Progress
priyaduggirala (priyad) on 2018-01-31
Changed in nova:
assignee: priyaduggirala (priyad) → nobody
priyaduggirala (priyad) on 2018-02-14
Changed in nova:
status: In Progress → Confirmed
Changed in nova:
assignee: nobody → Lee Yarwood (lyarwood)
status: Confirmed → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/614351

Changed in nova:
assignee: Lee Yarwood (lyarwood) → Jay Pipes (jaypipes)

Change abandoned by Jay Pipes (<email address hidden>) on branch: master
Review: https://review.openstack.org/614351

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 <email address hidden>
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

This issue was fixed in the openstack/nova 19.0.0.0rc1 release candidate.

Reviewed: https://review.openstack.org/650064
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=07ccc82af048494cb7d4c4b0cc191cc30544a270
Submitter: Zuul
Branch: stable/rocky

commit 07ccc82af048494cb7d4c4b0cc191cc30544a270
Author: Jay Pipes <email address hidden>
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
    (cherry picked from commit 5c21a00e89539bbb271ccfa05e4a2ba1cddae58e)

Reviewed: https://review.openstack.org/650065
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f1554d1b527bbf09229273508ce1fb234caf6a66
Submitter: Zuul
Branch: stable/queens

commit f1554d1b527bbf09229273508ce1fb234caf6a66
Author: Jay Pipes <email address hidden>
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
    (cherry picked from commit 5c21a00e89539bbb271ccfa05e4a2ba1cddae58e)
    (cherry picked from commit 07ccc82af048494cb7d4c4b0cc191cc30544a270)

Matt Riedemann (mriedem) wrote :

Note that we don't want to backport this any further without some other fixes related to a regression it caused, see bug 1803717.

Change abandoned by Balazs Gibizer (<email address hidden>) on branch: master
Review: https://review.opendev.org/508533
Reason: bug: #1717547 has been fixed with an alternative patch https://review.opendev.org/#/c/614351/ in the meantime

This issue was fixed in the openstack/nova 18.2.1 release.

This issue was fixed in the openstack/nova 17.0.11 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers