← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1735430] [NEW] Report client doesn't handle RP create conflict (409) properly

 

Public bug reported:

POST /resource_providers can fail with conflict (HTTP status 409) for
(at least) two reasons: A provider with the specified UUID exists; *or*
a provider with the specified *name* already exists.

In SchedulerReportClient, _ensure_resource_provider uses helper method
_create_resource_provider, whose logic goes like this:

 POST /resource_provider { 'uuid': <uuid>, 'name': <name> }
 if 201:
     cool, return the result
 if 409:
     LOG("Another thread created a provider with this *UUID*")
     GET /resource_provider/<uuid>
     if 200:
         cool, return the result
     if 404 or any other error:
         return None
 if any other error:
     return None

PROBLEM: If a provider exists with the desired *name* (but a different
UUID), this code will always return None (via that 404 path).

PROBLEM: Nobody up the stack is checking the return for None.

What this effectively means is that _ensure_resource_provider...
doesn't.

IMO we should raise an exception in these error paths, forcing consuming
code to handle them explicitly.  But at the very least, any code
consumuing _ensure_resource_provider needs to validate that it succeeds.

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1735430

Title:
  Report client doesn't handle RP create conflict (409) properly

Status in OpenStack Compute (nova):
  New

Bug description:
  POST /resource_providers can fail with conflict (HTTP status 409) for
  (at least) two reasons: A provider with the specified UUID exists;
  *or* a provider with the specified *name* already exists.

  In SchedulerReportClient, _ensure_resource_provider uses helper method
  _create_resource_provider, whose logic goes like this:

   POST /resource_provider { 'uuid': <uuid>, 'name': <name> }
   if 201:
       cool, return the result
   if 409:
       LOG("Another thread created a provider with this *UUID*")
       GET /resource_provider/<uuid>
       if 200:
           cool, return the result
       if 404 or any other error:
           return None
   if any other error:
       return None

  PROBLEM: If a provider exists with the desired *name* (but a different
  UUID), this code will always return None (via that 404 path).

  PROBLEM: Nobody up the stack is checking the return for None.

  What this effectively means is that _ensure_resource_provider...
  doesn't.

  IMO we should raise an exception in these error paths, forcing
  consuming code to handle them explicitly.  But at the very least, any
  code consumuing _ensure_resource_provider needs to validate that it
  succeeds.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1735430/+subscriptions


Follow ups