Re: [openstack-dev] Nova XML serialization bug 1223358 moving discussion here to get more people involved

2013-11-15 Thread Rosa, Andrea (HP Cloud Services)
Hi Vish,

Thank you very much indeed for your reply!

From: Vishvananda Ishaya [mailto:vishvana...@gmail.com]
Sent: 12 November 2013 21:56
To: OpenStack Development Mailing List (not for usage questions)
Subject: Re: [openstack-dev] Nova XML serialization bug 1223358 moving
discussion here to get more people involved

I personally don't see any problem with converting the Selector to handle
empty objects. If we are concerned with hiding other exceptions, then we
could explicitly check for == '' instead of catching TypeError.

That was another  option to fix the problem.
I'll let this thread open over the weekend and if no one will object I'll 
submit a new patch implementing the check for the empty object.

Thanks again
Regards
--
Andrea Rosa

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] Nova XML serialization bug 1223358 moving discussion here to get more people involved

2013-11-11 Thread Rosa, Andrea (HP Cloud Services)
Hi all

I realised that I sent this request just the Friday before the HK summit, a 
really bad timing :(
Resending, anyone is available to have a look at  this thread?
Please note that the code change has a -1 and I am not submitting a new patch 
as we (the reviewer and myself) are stuck in finding a common solution for the 
original bug.
As soon as we have a consensus I'll be really happy to submit a new patch.

Regards
--
Andrea Rosa

-Original Message-
From: Rosa, Andrea (HP Cloud Services)
Sent: 01 November 2013 14:35
To: OpenStack Development Mailing List (openstack-dev@lists.openstack.org)
Subject: [openstack-dev] Nova XML serialization bug 1223358 moving
discussion here to get more people involved

Hi all

Long story short: a long time ago I raised a bug [1] and I started to work on 
the
fix:  GuoHui LIu (the reviewer) and myself had long and useful discussion
about the right solution for  that but now we are stuck and we need some
more opinions to find a proper one.

And now the long story:
When we have an instance booted from a volume and we don't specify the
image details in the boot command the XML serialization of instance details
fails and the API call (like nova show) returns a 500 error.
The problem is that the image properties is mandatory to serialize but the xml
serializer can't manage properly an empty value.
In particular in the xmlutil we a have the class Selector which selects datum
within a specific object, that class is designed to deal with missing data in 
the
object but not to deal with an empty object.
At this moment to deal with missing data the logic used in the method is to
catch KeyError or IndexError exceptions:
try:
obj = obj[elem]
except (KeyError, IndexError):
if do_raise:
raise KeyError(elem)

My simple fix was to following the same logic and add a new exception to get
caught TypeError which is raised when the passed object is empty (it is an
empty string).

One of the main complain was that this approach tends to add some business
logic in the xmlutil and also adding a new exception could hide some potential
errors.
I can't disagree but at the same time I say that I am following the same logic
that we already have there.

We are now stuck, because the long-term solution probably is to rethink the
XML serialization process to allow more flexibility but that doesn't seem an
easy task and I really want to get this bug fixed.

What do you think?
Anyone is available to have a look and give us an opinion?

Please @Llu feel free to add your comments or any missing points.

PS: I am not an expert of the nova xmlutil, could be that I am missing some
easy points if so, please let me know.

Thanks
--
Andrea Rosa

[1] https://bugs.launchpad.net/nova/+bug/1223358


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] Nova XML serialization bug 1223358 moving discussion here to get more people involved

2013-11-01 Thread Rosa, Andrea (HP Cloud Services)
Hi all

Long story short: a long time ago I raised a bug [1] and I started to work on 
the fix:  GuoHui LIu (the reviewer) and myself had long and useful discussion 
about the right solution for  that but now we are stuck and we need some more 
opinions to find a proper one.

And now the long story:
When we have an instance booted from a volume and we don't specify the image 
details in the boot command the XML serialization of instance details fails and 
the API call (like nova show) returns a 500 error.
The problem is that the image properties is mandatory to serialize but the xml 
serializer can't manage properly an empty value.
In particular in the xmlutil we a have the class Selector which selects datum 
within a specific object, that class is designed to deal with missing data in 
the object but not to deal with an empty object.
At this moment to deal with missing data the logic used in the method is to 
catch KeyError or IndexError exceptions:
try:
obj = obj[elem]
except (KeyError, IndexError):
if do_raise:
raise KeyError(elem)

My simple fix was to following the same logic and add a new exception to get 
caught TypeError which is raised when the passed object is empty (it is an 
empty string).

One of the main complain was that this approach tends to add some business 
logic in the xmlutil and also adding a new exception could hide some potential 
errors.
I can't disagree but at the same time I say that I am following the same logic 
that we already have there.

We are now stuck, because the long-term solution probably is to rethink the XML 
serialization process to allow more flexibility but that doesn't seem an easy 
task and I really want to get this bug fixed.

What do you think?
Anyone is available to have a look and give us an opinion? 

Please @Llu feel free to add your comments or any missing points.

PS: I am not an expert of the nova xmlutil, could be that I am missing some 
easy points if so, please let me know.

Thanks 
--
Andrea Rosa

[1] https://bugs.launchpad.net/nova/+bug/1223358
 

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev