properties should be marked as deleted=0 on update

Bug #752750 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Dan Prince

Bug Description

Using glance 100.

If I use the 'glance' command line utility to update image properties previously deleted properties aren't getting marked as deleted=0 on an update.

The following commands demonstrate the issue:

glance update 3 kernel_id="2" ramdisk_id="1" type="machine" disk_format="ami" container_format="ami" is_public=true

# run the same command and remove kernel_id and ramdisk
glance update 3 type="machine" disk_format="ami" container_format="ami" is_public=true

# add back kernel_id and ramdisk
glance update 3 kernel_id="2" ramdisk_id="1" type="machine" disk_format="ami" container_format="ami" is_public=true

#glance details then reports:

URI: http://0.0.0.0/images/3
Id: 3
Public: Yes
Name: ami-tty
Size: 25165824
Location: file:///var/lib/glance/images/3
Disk format: ami
Container format: ami
Property 'type': machine

** NOTE that kernel_id and ramdisk weren't readded.

They exist in the DB and are marked as deleted=0.

The attached patch resolves the issue. Branch coming shortly...

Related branches

Revision history for this message
Dan Prince (dan-prince) wrote :
Changed in glance:
assignee: nobody → Dan Prince (dan-prince)
Revision history for this message
Jay Pipes (jaypipes) wrote :

The second glance update should *not* mark the kernel_id and ramdisk_id properties as deleted. Isn't that the real issue?

Revision history for this message
Dan Prince (dan-prince) wrote :

In rev 99 we updated glance so that properties are marked as deleted if they are no longer specified in an update. All external requests (using glance-client or the glance command line) now treat updates in this manner.

Essentially when you do an update you are saying "make it so". Any properties that should be associated with an image need to be specified with each update command.

--

Internally Glance within the Glance codebase we relax this criteria a bit via an extra 'purge' flag which is set to false internally. This allows us to quickly update image status properties within the codebase without having to specify the full set of properties for each request.

Dan Prince (dan-prince)
Changed in glance:
status: New → In Progress
Revision history for this message
Dan Prince (dan-prince) wrote :

I just updated the branch for this ticket so that bin/glance now explicitly states the following in the help for the update command:

 Metadata fields that are not specified in the update command will be deleted.

Hopefully this will help users better understand the current update behavior for bin/glance.

Thierry Carrez (ttx)
Changed in glance:
importance: Undecided → High
milestone: none → cactus-rc
Dan Prince (dan-prince)
Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: cactus-rc → 2011.2
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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