← Back to team overview

openstack team mailing list archive

Unused code in Nova [was Re: Quota classes]

 

On Fri, 2012-03-30 at 10:40 -0500, Kevin L. Mitchell wrote:
> On Fri, 2012-03-30 at 08:31 -0400, Eoghan Glynn wrote:
> > A couple of quick questions on how this quota class mechanism is
> > intended to work ...
> > 
> > - how is the mapping between project and quota-class established?
> >   I was expecting a project_quota_class_association table or
> >   some-such in the nova DB. Is this association maintained by
> >   keystone instead?
> > 
> > - is the quota_class attribute currently being set on the request
> >   context anywhere in the dispatch path? Is the idea that the auth
> >   middleware takes care of this? 
> 
> The basic answer is that there isn't anything in nova right now that
> does this, partly because it's a slightly difficult question to answer
> correctly for everyone.  In my testing environment, for instance, I use
> a Turnstile preprocessor to set the quota_class attribute on the request
> context to be the same as the selected rate limit class.
> 
> I envisioned that, ultimately, the quota_class would be set by the
> authentication processing middleware(s), but I'm not against adding an
> association to nova to manage that.

So, I'm looking into the quotas code properly for the first time while
reviewing one of the quota refactor patches and I come across the
quota_class property on RequestContext

My last 45 minutes have been:

  Where is quota_class being set? Nowhere in Nova, really? Let's double,
  triple check that.

  Maybe the auth token middleware is setting it? Nope.

  Well, let's look back through the git log and see if it was ever 
  being set. Nope, even the commit which initially added it doesn't set
  it.

  Hmm, the commit which adds quota classes doesn't reference a 
  blueprint. Ok, let's google quota classes. Ah, a thread with the 
  blueprint which helps hugely and a similar question from Eoghan. Ah,
  Eoghan has also filed:

    https://bugs.launchpad.net/nova/+bug/969537

  So, turnstile is setting this? More googling turns up:

    https://lists.launchpad.net/openstack/msg09322.html

  Ok, dig into turnstile and nova_limits. Nope, they're not setting it 
  either. Poke around Kevin's github repo and discover rs_limits:

    https://github.com/klmitch/rs_limits
      "Rackspace-specific Rate Limit Preprocessor for Turnstile"

  Ah! Now I see. This is code added specifically for a Rackspace 
  specific plugin!


Now, there are some positives here - the blueprint, discussions on the
mailing list, the launchpad bug, that turnstile and co. are in github,
etc. means it was actually possible to figure this out. Awesome,
seriously.

But ... please. Pretty please. Can we avoid adding unused code to Nova?
At the very least, can we document in the code why unused stuff has been
added?

Cheers,
Mark.



Follow ups

References