v2 image-update does not handle some schema properties properly

Bug #1371559 reported by Kamil Rykowski
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Kamil Rykowski
Glance Client
Fix Released
Medium
Kamil Rykowski

Bug Description

Step1: Create an empty image using api v1 or v2.
Step2: Use glanceclient with v2 API to update image property called "architecture":

glance --os-image-api-version 2 image-update --property architecture='x86'

This will show following error message:

<html>
  <head>
    <title>409 Conflict</title>
  </head>
  <body>
    <h1>409 Conflict</h1>
    There was a conflict when trying to complete your request.<br /><br />
    Property architecture does not exist.

  </body>
</html> (HTTP 409)

The error shows up, because the client sends to glance API following data:

[{"patch: "/architecture", "value": "x86", "op": "replace"}]

instead of

[{"patch: "/architecture", "value": "x86", "op": "add"}]

The issue is somehow related to overridden patch method in SchemaBasedModel class, which propagates non existing properties from schema properties.

Tags: metadef
Changed in glance:
status: New → In Progress
Changed in python-glanceclient:
status: New → In Progress
description: updated
Changed in glance:
assignee: nobody → Kamil Rykowski (kamil-rykowski)
Changed in python-glanceclient:
assignee: nobody → Kamil Rykowski (kamil-rykowski)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

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

Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :

There is a old bug which reported a same issue but provide a different solution https://bugs.launchpad.net/glance/+bug/1334322

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

Reviewed: https://review.openstack.org/123738
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=94c05cbdbb3a78b3df4df8d522555f34d2f0a166
Submitter: Jenkins
Branch: master

commit 94c05cbdbb3a78b3df4df8d522555f34d2f0a166
Author: Kamil Rykowski <email address hidden>
Date: Wed Sep 24 14:15:59 2014 +0200

    Mark custom properties in image schema as non-base

    Currently it is impossible to determine if given image schema property
    is base or custom one and knowledge of that can be handy in some
    situations. Proposed change appends to every custom property special
    key which determiness that it is not a base property.

    Change-Id: I49255255df311036d516768afc55475c1f9aad47
    Partial-Bug: #1371559

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

Reviewed: https://review.openstack.org/123739
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=2b567cf9176ef7b9d34d9dbe49ab1820576c8b82
Submitter: Jenkins
Branch: master

commit 2b567cf9176ef7b9d34d9dbe49ab1820576c8b82
Author: Kamil Rykowski <email address hidden>
Date: Wed Sep 24 14:25:26 2014 +0200

    Skip non-base properties in patch method

    It's currently impossible to update properties which are defined in
    image schema and which are not a base image property. Proposed fix skips
    every non-base property when building a json patch, that is used to
    update image properties through glance API.

    Change-Id: I3b35cef379fcf437715e2966f9a0d25c1b4e4016
    Closes-Bug: #1371559

Changed in python-glanceclient:
status: In Progress → Fix Committed
Changed in glance:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in glance:
importance: Undecided → Medium
Changed in python-glanceclient:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in glance:
milestone: none → juno-rc2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (proposed/juno)

Fix proposed to branch: proposed/juno
Review: https://review.openstack.org/126479

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (proposed/juno)

Reviewed: https://review.openstack.org/126479
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=0f3b518028196b5c8c36b378928dae31c2c4a6fa
Submitter: Jenkins
Branch: proposed/juno

commit 0f3b518028196b5c8c36b378928dae31c2c4a6fa
Author: Kamil Rykowski <email address hidden>
Date: Wed Sep 24 14:15:59 2014 +0200

    Mark custom properties in image schema as non-base

    Currently it is impossible to determine if given image schema property
    is base or custom one and knowledge of that can be handy in some
    situations. Proposed change appends to every custom property special
    key which determiness that it is not a base property.

    Change-Id: I49255255df311036d516768afc55475c1f9aad47
    Partial-Bug: #1371559
    (cherry picked from commit 94c05cbdbb3a78b3df4df8d522555f34d2f0a166)

Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-rc2 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)
Download full text (14.4 KiB)

Reviewed: https://review.openstack.org/128928
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=858cd9d4fdf32b4cc52e02ec771d01bfb463aa77
Submitter: Jenkins
Branch: master

commit 96e28428655aa7122ed74b045ff1bda1984255b1
Author: Nikhil Komawar <email address hidden>
Date: Tue Oct 14 13:09:48 2014 -0400

    Fix options and their groups - etc/glance-api.conf

    As per the docs at [0] , some of the options should have been moved
    around in the etc/glance-api.conf. This patch changes the conf file to:

        1. indicate new default values
        2. change the group of some of the configs in order to adhere to
           new groups as expected by the deployer.
        3. deprecated configs have been removed or replaced with new ones.

    [0] http://docs.openstack.org/trunk/config-reference/content/glance-conf-changes-master.html

    Fixes bug: 1380689

    Change-Id: I5b5ab96b050b502007e6660a7a613e252404d4e8

commit 9b176a278116849c8f7b7f4d9a987f37ec52779c
Author: Andy McCrae <email address hidden>
Date: Sat Oct 11 20:56:36 2014 +0100

    Adjust authentication.rst doc to reference "identity_uri"

    The "auth_port", "auth_host", and "auth_protocol" variables were
    deprecated in favour of a single "identity_uri" variable.

    * Adjust authentication.rst doc to reference "identity_uri"

    Change-Id: I48de53f21b8d767b276858ed274066015d765f0e
    Closes-Bug: #1361613

commit 08f83f543bc992ae8f2787fb405e58c33dadba73
Author: Jamie Lennox <email address hidden>
Date: Wed Aug 6 18:24:05 2014 +1000

    Use identity_uri instead of older fragments

    This has been the default option in middleware for a while now and we
    should recommend the default options.

    Change-Id: Ief347c897cf15ab4101936a56404e3a378021b15
    (cherry picked from commit e7110a9c6e0119b3d0c6f5cdb3b9675a82b76039)

commit c0d90a580f87dbbf71e3a5d5c1b5cf8d7c7245b2
Author: Stuart McLaren <email address hidden>
Date: Wed Jul 16 13:33:32 2014 +0000

    Prevent setting swift+config locations

    Forbid setting 'swift+config' locations in a similar
    manner to 'file' for security reasons; knowledge of
    the reference name should not be exploitable.

    Setting swift+config had been prevented when swift
    was the default store, this patch changes to forbid
    setting no matter which store is the default.

    As with change id I75af34145521f533dcd6f5fd7690f5a68f3b44b3
    this is v1 only for now.

    Change-Id: I62c4980bd5c2f3dd77fc40cd007bc1067eca63a4
    Closes-bug: 1334196

commit f259cac74d3e988b4012dcc2abd30091df27f5ce
Author: Wayne Okuma <email address hidden>
Date: Wed Oct 8 08:17:20 2014 -0700

    Metadef schema column name is a reserved word in MySQL

    The metadef_properties and metadef_objects tables both have
    a column named schema. Unfortunately, schema is a reserved word
    in some relational database products, including MySQL and PostgreSQL.
    The metadef_properties.schema and metadef_objects.schema
    columns should be renamed to a non reserved word.

    Conflicts:
     glance/db/sqlalchemy/metadata.py
     glance/tests/unit/test_m...

Louis Taylor (kragniz)
Changed in python-glanceclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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