Merge "Using str replace encode or decode"
This commit is contained in:
commit
ac39c5f228
|
@ -13,9 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_utils import encodeutils
|
||||
import uuid
|
||||
|
||||
from cyborg.common import exception
|
||||
|
@ -355,8 +356,8 @@ class ConductorManager(object):
|
|||
return
|
||||
|
||||
def _get_sub_provider(self, context, parent, name):
|
||||
name = encodeutils.safe_decode(name)
|
||||
old_sub_pr_uuid = str(uuid.uuid3(uuid.NAMESPACE_DNS, name))
|
||||
old_sub_pr_uuid = str(uuid.uuid3(uuid.NAMESPACE_DNS,
|
||||
six.ensure_str(name)))
|
||||
new_sub_pr_uuid = self.placement_client.ensure_resource_provider(
|
||||
context, old_sub_pr_uuid,
|
||||
name=name, parent_provider_uuid=parent)
|
||||
|
@ -395,7 +396,7 @@ class ConductorManager(object):
|
|||
attrs = obj.attribute_list
|
||||
resource_class = [i.value for i in attrs if i.key == 'rc'][0]
|
||||
traits = [i.value for i in attrs
|
||||
if encodeutils.safe_decode(i.key).startswith("trait")]
|
||||
if six.ensure_str(i.key).startswith("trait")]
|
||||
total = obj.num_accelerators
|
||||
rp_uuid = self.provider_report(context, pr_name, resource_class,
|
||||
traits, total, parent_uuid)
|
||||
|
@ -414,8 +415,7 @@ class ConductorManager(object):
|
|||
return result
|
||||
|
||||
def get_rp_uuid_from_obj(self, obj):
|
||||
rp_name = encodeutils.safe_decode(obj.name)
|
||||
return str(uuid.uuid3(uuid.NAMESPACE_DNS, rp_name))
|
||||
return str(uuid.uuid3(uuid.NAMESPACE_DNS, six.ensure_str(obj.name)))
|
||||
|
||||
def _delete_provider_and_sub_providers(self, context, rp_uuid):
|
||||
rp_in_tree = self.placement_client._get_providers_in_tree(context,
|
||||
|
|
Loading…
Reference in New Issue