BugFix: FakeDirver put RC FPGA error

When cyborg-cond make sure RC FPGA exists or not, it will
try to create RC FPGA.

In fact, the format of the RC that placment-api accepts
must be CUSTOM_XXX[1]. Because FPGA RC already exists,
we don't need to create it, so skipping it directly.

[1]. https://docs.openstack.org/api-ref/placement/?expanded=update-resource-class-microversions-1-2-1-6-detail,update-resource-class-detail#create-resource-class

Story: 2006933

Change-Id: I81adaec569ff9089d26ae90602ca2265c8fa4791
This commit is contained in:
chenke 2019-11-22 16:41:43 +08:00
parent f647059215
commit f13a0a69da

View File

@ -16,6 +16,7 @@
from cyborg.common import exception
from cyborg.common import utils
from keystoneauth1 import exceptions as ks_exc
import os_resource_classes as orc
from oslo_log import log as logging
from oslo_middleware import request_id
@ -213,6 +214,9 @@ class PlacementClient(object):
to_ensure = set(names)
for name in to_ensure:
# no payload on the put request
# if rc exists in placement's db, skip it.
if name in orc.STANDARDS:
return
resp = self.put(
"/resource_classes/%s" % name, None, version=version,
global_request_id=context.global_id)