Creating snapshot fails when image metadata has version field

Bug #1717547 reported by Damien
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Jay Pipes
Ocata
Confirmed
Low
Unassigned
Pike
Confirmed
Low
Unassigned
Queens
Fix Committed
Low
Matt Riedemann
Rocky
Fix Committed
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)
description: updated
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: low-hanging-fruit snapshot
tags: added: openstack-version.pike
priyaduggirala (priyad)
Changed in nova:
assignee: nobody → priyaduggirala (priyad)
priyaduggirala (priyad)
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

priyaduggirala (priyad)
Changed in nova:
assignee: priyaduggirala (priyad) → nobody
priyaduggirala (priyad)
Changed in nova:
status: In Progress → Confirmed
Changed in nova:
assignee: nobody → Lee Yarwood (lyarwood)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in nova:
assignee: Lee Yarwood (lyarwood) → Jay Pipes (jaypipes)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 19.0.0.0rc1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/650064

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/650065

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/rocky)

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)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/queens)

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)

Revision history for this message
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.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.2.1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.11

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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