[Openstack] object-oriented design in nova--room for improvement?

Chris Friesen chris.friesen at windriver.com
Thu Aug 22 16:39:23 UTC 2013


On 08/21/2013 09:04 PM, Joshua Harlow wrote:
> There is always room for improvement I hope ;)
>
> +openstack-dev (I think where u wanted this to go).
>
> A question, are u thinking about organizing the 'metadata' associated with
> resources?
>
> If so it might be interesting to see if there could be a grand unification
> around something like 'ResourceTracker' & 'Stats' that exposes 'metadata'
> (different types) via an API that all the other classes could use? Is that
> inline of what u are thinking?? Sort of like a resource + metadata
> 'database' that everyone uses (and accesses and updates via a single set
> of APIs).

In my experience it's often a good thing to try and minimize the number 
of places that know about the details of something since it reduces the 
chances of cut/paste errors or someone changing one area of code but 
missing another area.  Right now there are a lot of places that know 
exactly what resources are exported by the compute node.

It seems like it should be possible to have a base class for "resource 
exported by the compute node" that could be subclassed for each separate 
resource.  Most places in the code that care about that sort of thing 
could iterate over the set of resources and call appropriate member 
functions on them.  That way they would no longer need hardcoded 
knowledge of the exported resources.

Adding a new resource would likely be simpler too, since most of the 
stuff required would be in one place.

Chris




More information about the Openstack mailing list