Comment 15 for bug 1292572

Revision history for this message
Neetu Jain (nutshi) wrote :

ok so i understand this bug a little better i think .. and it seems like there is currently not much information for do_seggregate_set_metadata to know if the deletion of addition of metadata failed in here.

https://github.com/openstack/python-novaclient/blob/076c1a004ab1c861bd02ef7b020e1cbce8a934cc/novaclient/v1_1/shell.py#L2776

because update_metadata from here
https://github.com/openstack/nova/blob/eb19b011eb29245ba17389d21dce02ea89a8a756/nova/objects/aggregate.py#L111
does not return an error if a there is an attempt to delete non-existent key

so what happens in this usecase is

aggregate-set-metadata <aggregate> "This is the aggregate metadata"

the key is "This is the aggregate metadata"

and the function calls tried to delete is ( since there is not value of key provided) .. since it does not return an error or raise an exception the calls succeeds and hence the message. so technically its is correct .. the entry has been updated as per user's choice ( the key has been deleted but since it was never there .. no action took place)

now we could improve the messaging if we introduce some logic in
https://github.com/openstack/nova/blob/eb19b011eb29245ba17389d21dce02ea89a8a756/nova/objects/aggregate.py#L111

1. we read the metadata of that aggregate-ID and determine what keys are present
2. if the user has given a key-value pair we determine if already existent key-value match to the given by user or not .. if they do .. we report and error "stating key=value" already present if they dont match then we go ahead and make the call to the server
3. simillar when only key is present ..then we check if already present keys match the given key .. if the user-key does not match any keys in teh aggregate ..then deletion is not possible so we raise an error " given key is not present hence can not be deleted "

to do this i am trying to understand how to read the meteadata on teh client side ..