Tomaz, I greatly appreciate you looking over my code once. As you can see, I always seem to miss some little bit of logic somewhere.
With regard to (1), I replaced that line with:
cpu=float(element.findtext('CPU')) if element.findtext('CPU', None) else
None,
The idea is that those attributes, such as CPU or VCPU, could exist, and
that they may be ints or floats, but otherwise, if they do not exist,
they should be set to None.
With regard to (2), I had forgotten that "as detail" is not supported by
earlier version of Python. I've replaced the code with the code you
provided.
I've submitted my code to the repository.
--
Hutson Betts
Computer Science and Engineering
Texas A&M University
On Fri, 2011-12-09 at 17:54 -0800, Tomaž Muraus wrote:
> Just checked the patch, here are some of the issues I have noticed:
>
> 1.
>
> int(element.findtext('MEMORY', None)
>
> This will thrown if MEMORY key is not present.
>
> This also means all the "self.assertTrue(node.size.cpu is None or
> isinstance(size.cpu, int))" asserts are wrong - currently there is no way
> for node.size.cpu / node.size.ram to be None.
>
> 2.
>
> except InvalidCredsError as detail
>
> This won't work with older Python versions. Now that we also support Python
> 3 we need to do something like this:
>
> except InvalidCredsError:
> detail = sys.exc_info()[1]
>
> Otherwise it looks good to me.
>
> On Tue, Dec 6, 2011 at 12:01 AM, Hutson Betts <[email protected]> wrote:
>
> > An update patch for the OpenNebula compute node for consideration.
> >
> > Changes:
> > * Removed unused JSON import.
> > * Added two new node drivers for OpenNebula, for OpenNebula v3.0 and
> > v3.2, which support additional functionality over the OpenNebula v2.0
> > driver.
> > * Added test suites for those additional capabilities.
> > * Removed destroy() from OpenNebulaNetwork which is not supported by
> > the compute node driver.
> > * Removed unused assignments, mostly pertaining to ET.SubElement.
> > * Added ability to define the name under which the node image will
> > be
> > saved after shutting down for v3.0+.
> > * Added support for a network attribute for v3.0+.
> > * Added support for the upcoming OpenNebula v3.2, and it's new
> > instance
> > type interface.
> > * Added additional tests for a more complete test coverage.
> >
> > --
> > Hutson Betts
> > Computer Science and Engineering
> > Texas A&M University
> >
> >
> >
signature.asc
Description: This is a digitally signed message part
