Merge "Remove six.text_type (1/2)"
This commit is contained in:
commit
34c5df7b2b
@ -12,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from keystoneauth1 import exceptions as ks_exc
|
||||
@ -95,7 +93,7 @@ class _CyborgClient(object):
|
||||
err_msg = msg + str(resp)
|
||||
except ks_exc.ClientException as exc:
|
||||
err_msg = _('Could not communicate with Cyborg.')
|
||||
LOG.exception('%s: %s', err_msg, six.text_type(exc))
|
||||
LOG.exception('%s: %s', err_msg, str(exc))
|
||||
|
||||
return resp, err_msg
|
||||
|
||||
|
@ -24,7 +24,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import base64
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from nova.api.metadata import password
|
||||
from nova.api.metadata import vendordata_dynamic
|
||||
@ -718,7 +717,7 @@ def ec2_md_print(data):
|
||||
return output[:-1]
|
||||
elif isinstance(data, list):
|
||||
return '\n'.join(data)
|
||||
elif isinstance(data, (bytes, six.text_type)):
|
||||
elif isinstance(data, (bytes, str)):
|
||||
return data
|
||||
else:
|
||||
return str(data)
|
||||
|
@ -23,7 +23,6 @@ from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import secretutils as secutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
@ -151,8 +150,7 @@ class MetadataRequestHandler(wsgi.Application):
|
||||
remote_address)
|
||||
msg = _('An unknown error has occurred. '
|
||||
'Please try your request again.')
|
||||
raise webob.exc.HTTPInternalServerError(
|
||||
explanation=six.text_type(msg))
|
||||
raise webob.exc.HTTPInternalServerError(explanation=str(msg))
|
||||
|
||||
if meta_data is None:
|
||||
LOG.error('Failed to get metadata for IP %s: no metadata',
|
||||
@ -262,7 +260,7 @@ class MetadataRequestHandler(wsgi.Application):
|
||||
|
||||
# instance_data is unicode-encoded, while cache_utils doesn't like
|
||||
# that. Therefore we convert to str
|
||||
if isinstance(instance_id, six.text_type):
|
||||
if isinstance(instance_id, str):
|
||||
instance_id = instance_id.encode('utf-8')
|
||||
return instance_id, tenant_id
|
||||
|
||||
@ -329,8 +327,7 @@ class MetadataRequestHandler(wsgi.Application):
|
||||
instance_id)
|
||||
msg = _('An unknown error has occurred. '
|
||||
'Please try your request again.')
|
||||
raise webob.exc.HTTPInternalServerError(
|
||||
explanation=six.text_type(msg))
|
||||
raise webob.exc.HTTPInternalServerError(explanation=str(msg))
|
||||
|
||||
if meta_data is None:
|
||||
LOG.error('Failed to get metadata for instance id: %s',
|
||||
|
@ -20,7 +20,6 @@ from urllib import parse as urlparse
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -508,7 +507,7 @@ def is_all_tenants(search_opts):
|
||||
try:
|
||||
all_tenants = strutils.bool_from_string(all_tenants, True)
|
||||
except ValueError as err:
|
||||
raise exception.InvalidInput(six.text_type(err))
|
||||
raise exception.InvalidInput(str(err))
|
||||
else:
|
||||
# The empty string is considered enabling all_tenants
|
||||
all_tenants = 'all_tenants' in search_opts
|
||||
@ -526,7 +525,7 @@ def is_locked(search_opts):
|
||||
try:
|
||||
locked = strutils.bool_from_string(locked, strict=True)
|
||||
except ValueError as err:
|
||||
raise exception.InvalidInput(six.text_type(err))
|
||||
raise exception.InvalidInput(str(err))
|
||||
return locked
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
import datetime
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
@ -211,14 +210,14 @@ class AggregateController(wsgi.Controller):
|
||||
exception.AggregateHostNotFound,
|
||||
exception.ComputeHostNotFound) as e:
|
||||
LOG.error('Failed to remove host %s from aggregate %s. Error: %s',
|
||||
host, id, six.text_type(e))
|
||||
host, id, str(e))
|
||||
msg = _('Cannot remove host %(host)s in aggregate %(id)s') % {
|
||||
'host': host, 'id': id}
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except (exception.InvalidAggregateAction,
|
||||
exception.ResourceProviderUpdateConflict) as e:
|
||||
LOG.error('Failed to remove host %s from aggregate %s. Error: %s',
|
||||
host, id, six.text_type(e))
|
||||
host, id, str(e))
|
||||
msg = _('Cannot remove host %(host)s in aggregate %(id)s') % {
|
||||
'host': host, 'id': id}
|
||||
raise exc.HTTPConflict(explanation=msg)
|
||||
|
@ -17,7 +17,6 @@
|
||||
"""The Assisted volume snapshots extension."""
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack.compute.schemas import assisted_volume_snapshots
|
||||
@ -79,7 +78,7 @@ class AssistedVolumeSnapshotsController(wsgi.Controller):
|
||||
delete_info = jsonutils.loads(delete_metadata['delete_info'])
|
||||
volume_id = delete_info['volume_id']
|
||||
except (KeyError, ValueError) as e:
|
||||
raise exc.HTTPBadRequest(explanation=six.text_type(e))
|
||||
raise exc.HTTPBadRequest(explanation=str(e))
|
||||
|
||||
try:
|
||||
self.compute_api.volume_snapshot_delete(context, volume_id,
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
@ -45,7 +44,7 @@ class FlavorExtraSpecsController(wsgi.Controller):
|
||||
# explicitly as json schema cannot have max length check for
|
||||
# numeric value
|
||||
if isinstance(value, (int, float)):
|
||||
value = six.text_type(value)
|
||||
value = str(value)
|
||||
try:
|
||||
utils.check_string_length(value, 'extra_specs value',
|
||||
max_length=255)
|
||||
|
@ -21,7 +21,6 @@ import oslo_messaging as messaging
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
@ -662,7 +661,7 @@ class ServersController(wsgi.Controller):
|
||||
availability_zone, host, node = parse_az(context,
|
||||
availability_zone)
|
||||
except exception.InvalidInput as err:
|
||||
raise exc.HTTPBadRequest(explanation=six.text_type(err))
|
||||
raise exc.HTTPBadRequest(explanation=str(err))
|
||||
if host or node:
|
||||
context.can(server_policies.SERVERS % 'create:forced_host',
|
||||
target=target)
|
||||
|
@ -16,7 +16,6 @@ from keystoneauth1 import exceptions as ks_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
@ -290,7 +289,7 @@ class ServiceController(wsgi.Controller):
|
||||
LOG.error(
|
||||
"Failed to delete compute node resource provider "
|
||||
"for compute node %s: %s",
|
||||
compute_node.uuid, six.text_type(e))
|
||||
compute_node.uuid, str(e))
|
||||
# remove the host_mapping of this host.
|
||||
try:
|
||||
hm = objects.HostMapping.get_by_host(context, service.host)
|
||||
|
@ -19,7 +19,6 @@ from urllib import parse as urlparse
|
||||
|
||||
import iso8601
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import common
|
||||
@ -41,7 +40,7 @@ def parse_strtime(dstr, fmt):
|
||||
try:
|
||||
return timeutils.parse_strtime(dstr, fmt)
|
||||
except (TypeError, ValueError) as e:
|
||||
raise exception.InvalidStrTime(reason=six.text_type(e))
|
||||
raise exception.InvalidStrTime(reason=str(e))
|
||||
|
||||
|
||||
class SimpleTenantUsageController(wsgi.Controller):
|
||||
|
@ -21,7 +21,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import api_version_request as api_version
|
||||
@ -220,7 +219,7 @@ class JSONDictSerializer(ActionDispatcher):
|
||||
return self.dispatch(data, action=action)
|
||||
|
||||
def default(self, data):
|
||||
return six.text_type(jsonutils.dumps(data))
|
||||
return str(jsonutils.dumps(data))
|
||||
|
||||
|
||||
def response(code):
|
||||
@ -293,8 +292,8 @@ class ResponseObject(object):
|
||||
response.headers[hdr] = encodeutils.safe_decode(
|
||||
encodeutils.safe_encode(val))
|
||||
# Deal with content_type
|
||||
if not isinstance(content_type, six.text_type):
|
||||
content_type = six.text_type(content_type)
|
||||
if not isinstance(content_type, str):
|
||||
content_type = str(content_type)
|
||||
# In Py3.X Headers must be a str.
|
||||
response.headers['Content-Type'] = encodeutils.safe_decode(
|
||||
encodeutils.safe_encode(content_type))
|
||||
@ -506,7 +505,7 @@ class Resource(wsgi.Application):
|
||||
if body:
|
||||
msg = _("Action: '%(action)s', calling method: %(meth)s, body: "
|
||||
"%(body)s") % {'action': action,
|
||||
'body': six.text_type(body, 'utf-8'),
|
||||
'body': str(body, 'utf-8'),
|
||||
'meth': str(meth)}
|
||||
LOG.debug(strutils.mask_password(msg))
|
||||
else:
|
||||
@ -562,8 +561,8 @@ class Resource(wsgi.Application):
|
||||
|
||||
if hasattr(response, 'headers'):
|
||||
for hdr, val in list(response.headers.items()):
|
||||
if not isinstance(val, six.text_type):
|
||||
val = six.text_type(val)
|
||||
if not isinstance(val, str):
|
||||
val = str(val)
|
||||
# In Py3.X Headers must be a string
|
||||
response.headers[hdr] = encodeutils.safe_decode(
|
||||
encodeutils.safe_encode(val))
|
||||
|
@ -25,7 +25,6 @@ from oslo_serialization import base64
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import rfc3986
|
||||
import six
|
||||
|
||||
from nova.api.validation import parameter_types
|
||||
from nova import exception
|
||||
@ -34,7 +33,7 @@ from nova.i18n import _
|
||||
|
||||
@jsonschema.FormatChecker.cls_checks('regex')
|
||||
def _validate_regex_format(instance):
|
||||
if not instance or not isinstance(instance, six.text_type):
|
||||
if not instance or not isinstance(instance, str):
|
||||
return False
|
||||
try:
|
||||
re.compile(instance)
|
||||
@ -56,7 +55,7 @@ def _validate_datetime_format(instance):
|
||||
@jsonschema.FormatChecker.cls_checks('base64')
|
||||
def _validate_base64_format(instance):
|
||||
try:
|
||||
if isinstance(instance, six.text_type):
|
||||
if isinstance(instance, str):
|
||||
instance = instance.encode('utf-8')
|
||||
base64.decode_as_bytes(instance)
|
||||
except TypeError:
|
||||
@ -310,7 +309,7 @@ class _SchemaValidator(object):
|
||||
except TypeError as ex:
|
||||
# NOTE: If passing non string value to patternProperties parameter,
|
||||
# TypeError happens. Here is for catching the TypeError.
|
||||
detail = six.text_type(ex)
|
||||
detail = str(ex)
|
||||
raise exception.ValidationError(detail=detail)
|
||||
|
||||
def _number_from_str(self, instance):
|
||||
|
@ -40,7 +40,6 @@ from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import uuidutils
|
||||
import prettytable
|
||||
import six
|
||||
from sqlalchemy.engine import url as sqla_url
|
||||
|
||||
from nova.cmd import common as cmd_common
|
||||
@ -157,7 +156,7 @@ class DbCommands(object):
|
||||
for k, v in sorted(dct.items(), key=sort_key):
|
||||
# convert dict to str to check length
|
||||
if isinstance(v, dict):
|
||||
v = six.text_type(v)
|
||||
v = str(v)
|
||||
# if value has a newline, add in multiple rows
|
||||
# e.g. fault with stacktrace
|
||||
if v and isinstance(v, str) and r'\n' in v:
|
||||
@ -197,7 +196,7 @@ Has "nova-manage api_db sync" been run?
|
||||
Has "nova-manage cell_v2 map_cell0" been run?
|
||||
Is [api_database]/connection set in nova.conf?
|
||||
Is the cell0 database connection URL correct?
|
||||
Error: %s""") % six.text_type(e))
|
||||
Error: %s""") % str(e))
|
||||
return 1
|
||||
return migration.db_sync(version)
|
||||
|
||||
@ -718,7 +717,7 @@ class CellV2Commands(object):
|
||||
url=objects.CellMapping.format_mq_url(
|
||||
transport_url))
|
||||
except (messaging.InvalidTransportURL, ValueError) as e:
|
||||
print(_('Invalid transport URL: %s') % six.text_type(e))
|
||||
print(_('Invalid transport URL: %s') % str(e))
|
||||
return None
|
||||
|
||||
return transport_url
|
||||
@ -1527,7 +1526,7 @@ class PlacementCommands(object):
|
||||
)['ports']
|
||||
except neutron_client_exc.NeutronClientException as e:
|
||||
raise exception.UnableToQueryPorts(
|
||||
instance_uuid=instance.uuid, error=six.text_type(e))
|
||||
instance_uuid=instance.uuid, error=str(e))
|
||||
|
||||
@staticmethod
|
||||
def _has_request_but_no_allocation(port):
|
||||
@ -1752,13 +1751,13 @@ class PlacementCommands(object):
|
||||
except neutron_client_exc.NeutronClientException as e:
|
||||
output(
|
||||
_('Updating port %(port_uuid)s failed: %(error)s') %
|
||||
{'port_uuid': port['id'], 'error': six.text_type(e)})
|
||||
{'port_uuid': port['id'], 'error': str(e)})
|
||||
# one of the port updates failed. We need to roll back the updates
|
||||
# that succeeded before
|
||||
self._rollback_port_updates(neutron, succeeded, output)
|
||||
# we failed to heal so we need to stop but we successfully rolled
|
||||
# back the partial updates so the admin can retry the healing.
|
||||
raise exception.UnableToUpdatePorts(error=six.text_type(e))
|
||||
raise exception.UnableToUpdatePorts(error=str(e))
|
||||
|
||||
@staticmethod
|
||||
def _rollback_port_updates(neutron, ports_to_rollback, output):
|
||||
@ -1782,7 +1781,7 @@ class PlacementCommands(object):
|
||||
output(
|
||||
_('Rolling back update for port %(port_uuid)s failed: '
|
||||
'%(error)s') % {'port_uuid': port['id'],
|
||||
'error': six.text_type(e)})
|
||||
'error': str(e)})
|
||||
# TODO(gibi): We could implement a retry mechanism with
|
||||
# back off.
|
||||
manual_rollback_needed.append(port['id'])
|
||||
@ -1793,7 +1792,7 @@ class PlacementCommands(object):
|
||||
# back. There are partial updates in neutron. Human intervention
|
||||
# needed.
|
||||
raise exception.UnableToRollbackPortUpdates(
|
||||
error=six.text_type(last_exc),
|
||||
error=str(last_exc),
|
||||
port_uuids=manual_rollback_needed)
|
||||
|
||||
def _heal_missing_alloc(self, ctxt, instance, node_cache):
|
||||
|
@ -27,7 +27,6 @@ from oslo_serialization import jsonutils
|
||||
from oslo_upgradecheck import upgradecheck
|
||||
from oslo_utils import fileutils
|
||||
import pkg_resources
|
||||
import six
|
||||
from sqlalchemy import func as sqlfunc
|
||||
from sqlalchemy import MetaData, Table, and_, select
|
||||
|
||||
@ -343,7 +342,7 @@ class UpgradeCommands(upgradecheck.UpgradeCommands):
|
||||
return upgradecheck.Result(
|
||||
upgradecheck.Code.WARNING,
|
||||
_('Unable to determine Cinder API version due to error: %s') %
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
||||
|
||||
def _check_policy(self):
|
||||
@ -404,7 +403,7 @@ class UpgradeCommands(upgradecheck.UpgradeCommands):
|
||||
status = upgradecheck.Result(
|
||||
upgradecheck.Code.WARNING,
|
||||
_('Unable to perform policy checks due to error: %s') %
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
# reset the policy state so that it can be initialized from fresh if
|
||||
# operator changes policy file after running this upgrade checks.
|
||||
policy.reset()
|
||||
|
@ -34,7 +34,6 @@ from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from nova.accelerator import cyborg
|
||||
from nova import availability_zones
|
||||
@ -286,7 +285,7 @@ def _get_image_meta_obj(image_meta_dict):
|
||||
except ValueError as e:
|
||||
# there must be invalid values in the image meta properties so
|
||||
# consider this an invalid request
|
||||
msg = _('Invalid image metadata. Error: %s') % six.text_type(e)
|
||||
msg = _('Invalid image metadata. Error: %s') % str(e)
|
||||
raise exception.InvalidRequest(msg)
|
||||
return image_meta
|
||||
|
||||
@ -3049,7 +3048,7 @@ class API(base.Base):
|
||||
LOG.error('An error occurred while listing ports '
|
||||
'with an ip_address filter value of "%s". '
|
||||
'Error: %s',
|
||||
address, six.text_type(e))
|
||||
address, str(e))
|
||||
return uuids
|
||||
|
||||
def update_instance(self, context, instance, updates):
|
||||
@ -3193,7 +3192,7 @@ class API(base.Base):
|
||||
LOG.warning("Error while trying to clean up image %(img_id)s: "
|
||||
"%(error_msg)s",
|
||||
{"img_id": image_meta['id'],
|
||||
"error_msg": six.text_type(exc)})
|
||||
"error_msg": str(exc)})
|
||||
attr = 'task_state'
|
||||
state = task_states.DELETING
|
||||
if type(ex) == exception.InstanceNotFound:
|
||||
@ -3303,7 +3302,7 @@ class API(base.Base):
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error("An error occurred during quiesce of instance. "
|
||||
"Unquiescing to ensure instance is thawed. "
|
||||
"Error: %s", six.text_type(ex),
|
||||
"Error: %s", str(ex),
|
||||
instance=instance)
|
||||
self.compute_rpcapi.unquiesce_instance(context, instance,
|
||||
mapping=None)
|
||||
|
@ -22,7 +22,6 @@ import re
|
||||
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import context
|
||||
@ -83,7 +82,7 @@ def create(name, memory, vcpus, root_gb, ephemeral_gb=0, flavorid=None,
|
||||
|
||||
# NOTE(vish): Internally, flavorid is stored as a string but it comes
|
||||
# in through json as an integer, so we convert it here.
|
||||
flavorid = six.text_type(flavorid)
|
||||
flavorid = str(flavorid)
|
||||
|
||||
# NOTE(wangbo): validate attributes of the creating flavor.
|
||||
# ram and vcpus should be positive ( > 0) integers.
|
||||
|
@ -54,7 +54,6 @@ from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
from nova.accelerator import cyborg
|
||||
from nova import block_device
|
||||
@ -1493,7 +1492,7 @@ class ComputeManager(manager.Manager):
|
||||
LOG.error(
|
||||
"Could not retrieve compute node resource provider %s and "
|
||||
"therefore unable to error out any instances stuck in "
|
||||
"BUILDING state. Error: %s", cn_uuid, six.text_type(e))
|
||||
"BUILDING state. Error: %s", cn_uuid, str(e))
|
||||
continue
|
||||
|
||||
not_handled_consumers = (set(allocations) -
|
||||
@ -1972,7 +1971,7 @@ class ComputeManager(manager.Manager):
|
||||
# booting from volume, and will be recorded as an instance fault.
|
||||
# Maintain the original exception message which most likely has
|
||||
# useful details which the standard InvalidBDM error message lacks.
|
||||
raise exception.InvalidBDM(six.text_type(ex))
|
||||
raise exception.InvalidBDM(str(ex))
|
||||
|
||||
def _update_instance_after_spawn(self, instance,
|
||||
vm_state=vm_states.ACTIVE):
|
||||
@ -2347,7 +2346,7 @@ class ComputeManager(manager.Manager):
|
||||
exception.UnexpectedResourceProviderNameForPCIRequest
|
||||
) as e:
|
||||
raise exception.BuildAbortException(
|
||||
reason=six.text_type(e), instance_uuid=instance.uuid)
|
||||
reason=str(e), instance_uuid=instance.uuid)
|
||||
|
||||
# TODO(Luyao) cut over to get_allocs_for_consumer
|
||||
allocs = self.reportclient.get_allocations_for_consumer(
|
||||
@ -2479,7 +2478,7 @@ class ComputeManager(manager.Manager):
|
||||
phase=fields.NotificationPhase.ERROR, exception=e,
|
||||
bdms=block_device_mapping)
|
||||
raise exception.RescheduledException(
|
||||
instance_uuid=instance.uuid, reason=six.text_type(e))
|
||||
instance_uuid=instance.uuid, reason=str(e))
|
||||
|
||||
# NOTE(alaski): This is only useful during reschedules, remove it now.
|
||||
instance.system_metadata.pop('network_allocated', None)
|
||||
@ -2637,10 +2636,10 @@ class ComputeManager(manager.Manager):
|
||||
ctxt.reraise = False
|
||||
LOG.warning('Could not clean up failed build,'
|
||||
' not rescheduling. Error: %s',
|
||||
six.text_type(exc2))
|
||||
str(exc2))
|
||||
raise exception.BuildAbortException(
|
||||
instance_uuid=instance.uuid,
|
||||
reason=six.text_type(exc))
|
||||
reason=str(exc))
|
||||
finally:
|
||||
# Call Cyborg to delete accelerator requests
|
||||
compute_utils.delete_arqs_if_needed(context, instance)
|
||||
@ -2715,7 +2714,7 @@ class ComputeManager(manager.Manager):
|
||||
LOG.warning(
|
||||
'Failed to update network info cache when cleaning up '
|
||||
'allocated networks. Stale VIFs may be left on this host.'
|
||||
'Error: %s', six.text_type(exc)
|
||||
'Error: %s', str(exc)
|
||||
)
|
||||
return
|
||||
|
||||
@ -2733,7 +2732,7 @@ class ComputeManager(manager.Manager):
|
||||
# mostly ignored
|
||||
LOG.warning(
|
||||
'Cleaning up VIFs failed for instance. Error: %s',
|
||||
six.text_type(exc), instance=instance,
|
||||
str(exc), instance=instance,
|
||||
)
|
||||
else:
|
||||
LOG.debug('Unplugged VIFs for instance', instance=instance)
|
||||
@ -2771,7 +2770,7 @@ class ComputeManager(manager.Manager):
|
||||
# Provide a warning that something is amiss.
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.warning('Failed to deallocate network for instance; '
|
||||
'retrying. Error: %s', six.text_type(e),
|
||||
'retrying. Error: %s', str(e),
|
||||
instance=instance)
|
||||
|
||||
try:
|
||||
@ -4529,7 +4528,7 @@ class ComputeManager(manager.Manager):
|
||||
# Do not let this stop us from cleaning up since the guest
|
||||
# is already gone.
|
||||
LOG.error('Failed to delete port bindings from source host. '
|
||||
'Error: %s', six.text_type(e), instance=instance)
|
||||
'Error: %s', str(e), instance=instance)
|
||||
|
||||
def _delete_volume_attachments(self, ctxt, bdms):
|
||||
"""Deletes volume attachment records for the given bdms.
|
||||
@ -4548,7 +4547,7 @@ class ComputeManager(manager.Manager):
|
||||
self.volume_api.attachment_delete(ctxt, bdm.attachment_id)
|
||||
except Exception as e:
|
||||
LOG.error('Failed to delete volume attachment with ID %s. '
|
||||
'Error: %s', bdm.attachment_id, six.text_type(e),
|
||||
'Error: %s', bdm.attachment_id, str(e),
|
||||
instance_uuid=bdm.instance_uuid)
|
||||
|
||||
@wrap_exception()
|
||||
@ -4642,7 +4641,7 @@ class ComputeManager(manager.Manager):
|
||||
# Do not let this stop us from cleaning up since the guest
|
||||
# is already gone.
|
||||
LOG.error('Failed to delete port bindings from target host. '
|
||||
'Error: %s', six.text_type(e), instance=instance)
|
||||
'Error: %s', str(e), instance=instance)
|
||||
|
||||
# Delete any volume attachments remaining for this target host.
|
||||
LOG.debug('Deleting volume attachments for target host.',
|
||||
@ -5125,7 +5124,7 @@ class ComputeManager(manager.Manager):
|
||||
exception.UnexpectedResourceProviderNameForPCIRequest
|
||||
) as e:
|
||||
raise exception.BuildAbortException(
|
||||
reason=six.text_type(e), instance_uuid=instance.uuid)
|
||||
reason=str(e), instance_uuid=instance.uuid)
|
||||
|
||||
limits = filter_properties.get('limits', {})
|
||||
allocs = self.reportclient.get_allocations_for_consumer(
|
||||
@ -5360,7 +5359,7 @@ class ComputeManager(manager.Manager):
|
||||
ctxt, instance, flavor, nodename, migration, allocations,
|
||||
image_meta=instance.image_meta, limits=limits)
|
||||
except Exception as ex:
|
||||
err = six.text_type(ex)
|
||||
err = str(ex)
|
||||
LOG.warning(
|
||||
'Cross-cell resize pre-checks failed for this host (%s). '
|
||||
'Cleaning up. Failure: %s', self.host, err,
|
||||
@ -5457,7 +5456,7 @@ class ComputeManager(manager.Manager):
|
||||
self._power_off_instance(instance)
|
||||
except Exception as e:
|
||||
LOG.exception('Failed to power off instance.', instance=instance)
|
||||
raise exception.InstancePowerOffFailure(reason=six.text_type(e))
|
||||
raise exception.InstancePowerOffFailure(reason=str(e))
|
||||
instance.power_state = self._get_power_state(instance)
|
||||
|
||||
# If a snapshot image ID was provided, we need to snapshot the guest
|
||||
@ -6648,7 +6647,7 @@ class ComputeManager(manager.Manager):
|
||||
LOG.info("Get console output", instance=instance)
|
||||
output = self.driver.get_console_output(context, instance)
|
||||
|
||||
if type(output) is six.text_type:
|
||||
if type(output) is str:
|
||||
output = output.encode("latin-1")
|
||||
|
||||
if tail_length is not None:
|
||||
@ -8494,12 +8493,12 @@ class ComputeManager(manager.Manager):
|
||||
LOG.error('Connection for volume %s not terminated on '
|
||||
'source host %s during post_live_migration: '
|
||||
'%s', bdm.volume_id, self.host,
|
||||
six.text_type(e), instance=instance)
|
||||
str(e), instance=instance)
|
||||
else:
|
||||
LOG.error('Volume attachment %s not deleted on source '
|
||||
'host %s during post_live_migration: %s',
|
||||
bdm.attachment_id, self.host,
|
||||
six.text_type(e), instance=instance)
|
||||
str(e), instance=instance)
|
||||
|
||||
@wrap_exception()
|
||||
@wrap_instance_fault
|
||||
@ -8758,7 +8757,7 @@ class ComputeManager(manager.Manager):
|
||||
LOG.error('Network cleanup failed for source host %s during post '
|
||||
'live migration. You may need to manually clean up '
|
||||
'resources in the network service. Error: %s',
|
||||
prev_host, six.text_type(e))
|
||||
prev_host, str(e))
|
||||
# NOTE(vish): this is necessary to update dhcp for nova-network
|
||||
# NOTE(mriedem): This is a no-op for neutron.
|
||||
self.network_api.setup_networks_on_host(context, instance, self.host)
|
||||
@ -8920,7 +8919,7 @@ class ComputeManager(manager.Manager):
|
||||
'Network cleanup failed for destination host %s '
|
||||
'during live migration rollback. You may need to '
|
||||
'manually clean up resources in the network service. '
|
||||
'Error: %s', dest, six.text_type(e))
|
||||
'Error: %s', dest, str(e))
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(
|
||||
@ -9021,7 +9020,7 @@ class ComputeManager(manager.Manager):
|
||||
'Network cleanup failed for destination host %s '
|
||||
'during live migration rollback. You may need to '
|
||||
'manually clean up resources in the network service. '
|
||||
'Error: %s', self.host, six.text_type(e))
|
||||
'Error: %s', self.host, str(e))
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
# NOTE(tdurakov): even if teardown networks fails driver
|
||||
@ -9816,7 +9815,7 @@ class ComputeManager(manager.Manager):
|
||||
except keystone_exception.ClientException as e:
|
||||
LOG.error(
|
||||
"Failed to delete compute node resource provider "
|
||||
"for compute node %s: %s", cn.uuid, six.text_type(e))
|
||||
"for compute node %s: %s", cn.uuid, str(e))
|
||||
|
||||
for nodename in nodenames:
|
||||
self._update_available_resource_for_node(context, nodename,
|
||||
@ -10260,7 +10259,7 @@ class ComputeManager(manager.Manager):
|
||||
except exception.NotFound as e:
|
||||
LOG.info('Failed to process external instance event '
|
||||
'%(event)s due to: %(error)s',
|
||||
{'event': event.key, 'error': six.text_type(e)},
|
||||
{'event': event.key, 'error': str(e)},
|
||||
instance=instance)
|
||||
elif event.name == 'network-vif-deleted':
|
||||
try:
|
||||
@ -10270,7 +10269,7 @@ class ComputeManager(manager.Manager):
|
||||
except exception.NotFound as e:
|
||||
LOG.info('Failed to process external instance event '
|
||||
'%(event)s due to: %(error)s',
|
||||
{'event': event.key, 'error': six.text_type(e)},
|
||||
{'event': event.key, 'error': str(e)},
|
||||
instance=instance)
|
||||
elif event.name == 'volume-extended':
|
||||
self.extend_volume(context, instance, event.tag)
|
||||
|
@ -25,7 +25,6 @@ import netifaces
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
from nova.accelerator import cyborg
|
||||
from nova import block_device
|
||||
@ -131,7 +130,7 @@ def _get_fault_details(exc_info, error_code):
|
||||
# exceptions (see exception_to_dict).
|
||||
details = ''.join(traceback.format_exception(
|
||||
exc_info[0], exc_info[1], exc_info[2]))
|
||||
return six.text_type(details)
|
||||
return str(details)
|
||||
|
||||
|
||||
def add_instance_fault_from_exc(context, instance, fault, exc_info=None,
|
||||
|
@ -29,7 +29,6 @@ from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import versionutils
|
||||
import six
|
||||
|
||||
from nova.accelerator import cyborg
|
||||
from nova import availability_zones
|
||||
@ -498,7 +497,7 @@ class ComputeTaskManager(base.Base):
|
||||
task_state=None)
|
||||
migration.status = 'error'
|
||||
migration.save()
|
||||
raise exception.MigrationError(reason=six.text_type(ex))
|
||||
raise exception.MigrationError(reason=str(ex))
|
||||
|
||||
def _build_live_migrate_task(self, context, instance, destination,
|
||||
block_migration, disk_over_commit, migration,
|
||||
@ -1122,7 +1121,7 @@ class ComputeTaskManager(base.Base):
|
||||
{'vm_state': vm_states.ERROR,
|
||||
'task_state': None}, ex, request_spec)
|
||||
LOG.warning('Rebuild failed: %s',
|
||||
six.text_type(ex), instance=instance)
|
||||
str(ex), instance=instance)
|
||||
except exception.NoValidHost:
|
||||
with excutils.save_and_reraise_exception():
|
||||
if migration:
|
||||
@ -1214,7 +1213,7 @@ class ComputeTaskManager(base.Base):
|
||||
{'vm_state': vm_states.ERROR,
|
||||
'task_state': None}, ex, request_spec)
|
||||
LOG.warning('Rebuild failed: %s',
|
||||
six.text_type(ex), instance=instance)
|
||||
str(ex), instance=instance)
|
||||
|
||||
compute_utils.notify_about_instance_usage(
|
||||
self.notifier, context, instance, "rebuild.scheduled")
|
||||
|
@ -13,7 +13,6 @@
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
from nova import availability_zones
|
||||
from nova.compute import power_state
|
||||
@ -533,8 +532,7 @@ class LiveMigrationTask(base.TaskBase):
|
||||
# Note(ShaoHe Feng) There are types of RemoteError, such as
|
||||
# NoSuchMethod, UnsupportedVersion, we can distinguish it by
|
||||
# ex.exc_type.
|
||||
raise exception.MigrationSchedulerRPCError(
|
||||
reason=six.text_type(ex))
|
||||
raise exception.MigrationSchedulerRPCError(reason=str(ex))
|
||||
|
||||
scheduler_utils.fill_provider_mapping(request_spec, selection)
|
||||
|
||||
|
@ -18,7 +18,6 @@ import struct
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from nova.console.rfb import auth
|
||||
from nova import exception
|
||||
@ -147,5 +146,5 @@ class RFBAuthSchemeVeNCrypt(auth.RFBAuthScheme):
|
||||
|
||||
except ssl.SSLError as e:
|
||||
reason = _("Error establishing TLS connection to server: %s") % (
|
||||
six.text_type(e))
|
||||
str(e))
|
||||
raise exception.RFBAuthHandshakeFailed(reason=reason)
|
||||
|
@ -16,7 +16,6 @@
|
||||
import struct
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from nova.console.rfb import auth
|
||||
from nova.console.rfb import auths
|
||||
@ -53,7 +52,7 @@ class RFBSecurityProxy(base.SecurityProxy):
|
||||
self.auth_schemes = auths.RFBAuthSchemeList()
|
||||
|
||||
def _make_var_str(self, message):
|
||||
message_str = six.text_type(message)
|
||||
message_str = str(message)
|
||||
message_bytes = message_str.encode('utf-8')
|
||||
message_len = struct.pack("!I", len(message_bytes))
|
||||
return message_len + message_bytes
|
||||
@ -170,7 +169,7 @@ class RFBSecurityProxy(base.SecurityProxy):
|
||||
self._fail(tenant_sock, compute_sock,
|
||||
_("Unable to negotiate security with server"))
|
||||
raise exception.SecurityProxyNegotiationFailed(
|
||||
reason=_("No compute auth available: %s") % six.text_type(e))
|
||||
reason=_("No compute auth available: %s") % str(e))
|
||||
|
||||
compute_sock.sendall(bytes((scheme.security_type(),)))
|
||||
|
||||
@ -184,7 +183,7 @@ class RFBSecurityProxy(base.SecurityProxy):
|
||||
# as that's information leakage
|
||||
self._fail(tenant_sock, None,
|
||||
_("Unable to negotiate security with server"))
|
||||
LOG.debug("Auth failed %s", six.text_type(e))
|
||||
LOG.debug("Auth failed %s", str(e))
|
||||
raise exception.SecurityProxyNegotiationFailed(
|
||||
reason=_("Auth handshake failed"))
|
||||
|
||||
|
@ -34,7 +34,6 @@ from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import and_
|
||||
from sqlalchemy import Boolean
|
||||
@ -4091,7 +4090,7 @@ def _archive_if_instance_deleted(table, shadow_table, instances, conn,
|
||||
except db_exc.DBReferenceError as ex:
|
||||
LOG.warning('Failed to archive %(table)s: %(error)s',
|
||||
{'table': table.name,
|
||||
'error': six.text_type(ex)})
|
||||
'error': str(ex)})
|
||||
return 0
|
||||
|
||||
|
||||
@ -4167,7 +4166,7 @@ def _archive_deleted_rows_for_table(metadata, tablename, max_rows, before):
|
||||
# skip this table for now; we'll come back to it later.
|
||||
LOG.warning("IntegrityError detected when archiving table "
|
||||
"%(tablename)s: %(error)s",
|
||||
{'tablename': tablename, 'error': six.text_type(ex)})
|
||||
{'tablename': tablename, 'error': str(ex)})
|
||||
|
||||
# NOTE(jake): instance_actions_events doesn't have a instance_uuid column
|
||||
# but still needs to be archived as it is a FK constraint
|
||||
|
@ -23,7 +23,6 @@ SHOULD include dedicated exception logging.
|
||||
"""
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
import webob.exc
|
||||
from webob import util as woutil
|
||||
@ -82,7 +81,7 @@ class NovaException(Exception):
|
||||
if not message:
|
||||
message = self.msg_fmt % kwargs
|
||||
else:
|
||||
message = six.text_type(message)
|
||||
message = str(message)
|
||||
except Exception:
|
||||
# NOTE(melwitt): This is done in a separate method so it can be
|
||||
# monkey-patched during testing to make it a hard failure.
|
||||
|
@ -39,7 +39,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -207,7 +206,7 @@ class GlanceClientWrapper(object):
|
||||
'method': method, 'extra': extra})
|
||||
if attempt == num_attempts:
|
||||
raise exception.GlanceConnectionFailed(
|
||||
server=str(self.api_server), reason=six.text_type(e))
|
||||
server=str(self.api_server), reason=str(e))
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
@ -729,7 +728,7 @@ class GlanceImageServiceV2(object):
|
||||
except glanceclient.exc.HTTPForbidden:
|
||||
raise exception.ImageNotAuthorized(image_id=image_id)
|
||||
except glanceclient.exc.HTTPConflict as exc:
|
||||
raise exception.ImageDeleteConflict(reason=six.text_type(exc))
|
||||
raise exception.ImageDeleteConflict(reason=str(exc))
|
||||
return True
|
||||
|
||||
def image_import_copy(self, context, image_id, stores):
|
||||
@ -1048,7 +1047,7 @@ def _translate_image_exception(image_id, exc_value):
|
||||
return exception.ImageNotFound(image_id=image_id)
|
||||
if isinstance(exc_value, glanceclient.exc.BadRequest):
|
||||
return exception.ImageBadRequest(image_id=image_id,
|
||||
response=six.text_type(exc_value))
|
||||
response=str(exc_value))
|
||||
if isinstance(exc_value, glanceclient.exc.HTTPOverLimit):
|
||||
return exception.ImageQuotaExceeded(image_id=image_id)
|
||||
return exc_value
|
||||
@ -1057,11 +1056,11 @@ def _translate_image_exception(image_id, exc_value):
|
||||
def _translate_plain_exception(exc_value):
|
||||
if isinstance(exc_value, (glanceclient.exc.Forbidden,
|
||||
glanceclient.exc.Unauthorized)):
|
||||
return exception.Forbidden(six.text_type(exc_value))
|
||||
return exception.Forbidden(str(exc_value))
|
||||
if isinstance(exc_value, glanceclient.exc.NotFound):
|
||||
return exception.NotFound(six.text_type(exc_value))
|
||||
return exception.NotFound(str(exc_value))
|
||||
if isinstance(exc_value, glanceclient.exc.BadRequest):
|
||||
return exception.Invalid(six.text_type(exc_value))
|
||||
return exception.Invalid(str(exc_value))
|
||||
return exc_value
|
||||
|
||||
|
||||
@ -1079,7 +1078,7 @@ def _verify_certs(context, img_sig_cert_uuid, trusted_certs):
|
||||
'failed for certificate: %s',
|
||||
img_sig_cert_uuid)
|
||||
raise exception.CertificateValidationFailed(
|
||||
cert_uuid=img_sig_cert_uuid, reason=six.text_type(e))
|
||||
cert_uuid=img_sig_cert_uuid, reason=str(e))
|
||||
|
||||
|
||||
def get_remote_image_service(context, image_href):
|
||||
|
@ -30,7 +30,6 @@ from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from nova.compute import utils as compute_utils
|
||||
import nova.conf
|
||||
@ -197,7 +196,7 @@ class ClientWrapper(clientv20.Client):
|
||||
"admin credential located in nova.conf")
|
||||
raise exception.NeutronAdminCredentialConfigurationInvalid()
|
||||
except neutron_client_exc.Forbidden as e:
|
||||
raise exception.Forbidden(six.text_type(e))
|
||||
raise exception.Forbidden(str(e))
|
||||
return ret
|
||||
return wrapper
|
||||
|
||||
@ -2168,7 +2167,7 @@ class API(base.Base):
|
||||
return True
|
||||
except neutron_client_exc.Conflict as ex:
|
||||
LOG.debug('Unable to auto-allocate networks. %s',
|
||||
six.text_type(ex))
|
||||
str(ex))
|
||||
return False
|
||||
|
||||
def _auto_allocate_network(self, instance, neutron):
|
||||
@ -2420,7 +2419,7 @@ class API(base.Base):
|
||||
try:
|
||||
client.update_floatingip(fip['id'], {'floatingip': param})
|
||||
except neutron_client_exc.Conflict as e:
|
||||
raise exception.FloatingIpAssociateFailed(six.text_type(e))
|
||||
raise exception.FloatingIpAssociateFailed(str(e))
|
||||
|
||||
# If the floating IP was associated with another server, try to refresh
|
||||
# the cache for that instance to avoid a window of time where multiple
|
||||
@ -2694,11 +2693,11 @@ class API(base.Base):
|
||||
fip = client.create_floatingip(param)
|
||||
except (neutron_client_exc.IpAddressGenerationFailureClient,
|
||||
neutron_client_exc.ExternalIpAddressExhaustedClient) as e:
|
||||
raise exception.NoMoreFloatingIps(six.text_type(e))
|
||||
raise exception.NoMoreFloatingIps(str(e))
|
||||
except neutron_client_exc.OverQuotaClient as e:
|
||||
raise exception.FloatingIpLimitExceeded(six.text_type(e))
|
||||
raise exception.FloatingIpLimitExceeded(str(e))
|
||||
except neutron_client_exc.BadRequest as e:
|
||||
raise exception.FloatingIpBadRequest(six.text_type(e))
|
||||
raise exception.FloatingIpBadRequest(str(e))
|
||||
|
||||
return fip['floatingip']['floating_ip_address']
|
||||
|
||||
|
@ -27,7 +27,6 @@ from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
from nova import context as nova_context
|
||||
@ -69,11 +68,11 @@ def validate_name(
|
||||
return neutronv20.find_resourceid_by_name_or_id(
|
||||
neutron, 'security_group', name, context.project_id)
|
||||
except n_exc.NeutronClientNoUniqueMatch as e:
|
||||
raise exception.NoUniqueMatch(six.text_type(e))
|
||||
raise exception.NoUniqueMatch(str(e))
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
LOG.debug('Neutron security group %s not found', name)
|
||||
raise exception.SecurityGroupNotFound(six.text_type(e))
|
||||
raise exception.SecurityGroupNotFound(str(e))
|
||||
else:
|
||||
LOG.error('Neutron Error: %s', e)
|
||||
raise e
|
||||
@ -237,7 +236,7 @@ def create_security_group(context, name, description):
|
||||
security_group = neutron.create_security_group(
|
||||
body).get('security_group')
|
||||
except n_exc.BadRequest as e:
|
||||
raise exception.Invalid(six.text_type(e))
|
||||
raise exception.Invalid(str(e))
|
||||
except n_exc.NeutronClientException as e:
|
||||
LOG.exception("Neutron Error creating security group %s", name)
|
||||
if e.status_code == 401:
|
||||
@ -246,7 +245,7 @@ def create_security_group(context, name, description):
|
||||
# quota
|
||||
raise exc.HTTPBadRequest()
|
||||
elif e.status_code == 409:
|
||||
raise exception.SecurityGroupLimitExceeded(six.text_type(e))
|
||||
raise exception.SecurityGroupLimitExceeded(str(e))
|
||||
raise e
|
||||
return _convert_to_nova_security_group_format(security_group)
|
||||
|
||||
@ -312,7 +311,7 @@ def get(context, id):
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
LOG.debug('Neutron security group %s not found', id)
|
||||
raise exception.SecurityGroupNotFound(six.text_type(e))
|
||||
raise exception.SecurityGroupNotFound(str(e))
|
||||
else:
|
||||
LOG.error("Neutron Error: %s", e)
|
||||
raise e
|
||||
@ -360,9 +359,9 @@ def destroy(context, security_group):
|
||||
neutron.delete_security_group(security_group['id'])
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
raise exception.SecurityGroupNotFound(six.text_type(e))
|
||||
raise exception.SecurityGroupNotFound(str(e))
|
||||
elif e.status_code == 409:
|
||||
raise exception.Invalid(six.text_type(e))
|
||||
raise exception.Invalid(str(e))
|
||||
else:
|
||||
LOG.error("Neutron Error: %s", e)
|
||||
raise e
|
||||
@ -385,14 +384,14 @@ def add_rules(context, id, name, vals):
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
LOG.exception("Neutron Error getting security group %s", name)
|
||||
raise exception.SecurityGroupNotFound(six.text_type(e))
|
||||
raise exception.SecurityGroupNotFound(str(e))
|
||||
elif e.status_code == 409:
|
||||
LOG.exception("Neutron Error adding rules to security "
|
||||
"group %s", name)
|
||||
raise exception.SecurityGroupLimitExceeded(six.text_type(e))
|
||||
raise exception.SecurityGroupLimitExceeded(str(e))
|
||||
elif e.status_code == 400:
|
||||
LOG.exception("Neutron Error: %s", e)
|
||||
raise exception.Invalid(six.text_type(e))
|
||||
raise exception.Invalid(str(e))
|
||||
else:
|
||||
raise e
|
||||
converted_rules = []
|
||||
@ -462,7 +461,7 @@ def get_rule(context, id):
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
LOG.debug("Neutron security group rule %s not found", id)
|
||||
raise exception.SecurityGroupNotFound(six.text_type(e))
|
||||
raise exception.SecurityGroupNotFound(str(e))
|
||||
else:
|
||||
LOG.error("Neutron Error: %s", e)
|
||||
raise e
|
||||
@ -606,7 +605,7 @@ def add_to_instance(context, instance, security_group_name):
|
||||
security_group_name,
|
||||
context.project_id)
|
||||
except n_exc.NeutronClientNoUniqueMatch as e:
|
||||
raise exception.NoUniqueMatch(six.text_type(e))
|
||||
raise exception.NoUniqueMatch(str(e))
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
msg = (_("Security group %(name)s is not found for "
|
||||
@ -649,8 +648,7 @@ def add_to_instance(context, instance, security_group_name):
|
||||
neutron.update_port(port['id'], {'port': updated_port})
|
||||
except n_exc.NeutronClientException as e:
|
||||
if e.status_code == 400:
|
||||
raise exception.SecurityGroupCannotBeApplied(
|
||||
six.text_type(e))
|
||||
raise exception.SecurityGroupCannotBeApplied(str(e))
|
||||
else:
|
||||
raise e
|
||||
except Exception:
|
||||
|
@ -15,7 +15,6 @@
|
||||
import copy
|
||||
|
||||
from oslo_utils import versionutils
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova import objects
|
||||
@ -624,9 +623,9 @@ class ImageMetaProps(base.NovaObject):
|
||||
setattr(self, key, image_props[key])
|
||||
|
||||
def _set_attr_from_trait_names(self, image_props):
|
||||
for trait in [six.text_type(k[6:]) for k, v in image_props.items()
|
||||
if six.text_type(k).startswith("trait:") and
|
||||
six.text_type(v) == six.text_type('required')]:
|
||||
for trait in [str(k[6:]) for k, v in image_props.items()
|
||||
if str(k).startswith("trait:") and
|
||||
str(v) == 'required']:
|
||||
if 'traits_required' not in self:
|
||||
self.traits_required = []
|
||||
self.traits_required.append(trait)
|
||||
|
@ -14,7 +14,6 @@ import collections
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import versionutils
|
||||
import six
|
||||
from sqlalchemy.orm import exc as orm_exc
|
||||
from sqlalchemy.orm import joinedload
|
||||
from sqlalchemy.sql import false
|
||||
@ -275,7 +274,7 @@ def populate_user_id(context, max_count):
|
||||
except Exception as exp:
|
||||
LOG.warning('Encountered exception: "%s" while querying '
|
||||
'instances from cell: %s. Continuing to the next '
|
||||
'cell.', six.text_type(exp),
|
||||
'cell.', str(exp),
|
||||
cms_by_id[cell_id].identity)
|
||||
continue
|
||||
# Walk through every instance that has a mapping needing to be updated
|
||||
|
@ -41,7 +41,6 @@
|
||||
import jsonschema
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -143,7 +142,7 @@ def _get_alias_from_config():
|
||||
except jsonschema.exceptions.ValidationError as exc:
|
||||
raise exception.PciInvalidAlias(reason=exc.message)
|
||||
except Exception as exc:
|
||||
raise exception.PciInvalidAlias(reason=six.text_type(exc))
|
||||
raise exception.PciInvalidAlias(reason=str(exc))
|
||||
|
||||
return aliases
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
Helpers for filesystem related routines.
|
||||
"""
|
||||
|
||||
import six
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils.secretutils import md5
|
||||
@ -282,7 +280,7 @@ def _get_hash_str(base_str):
|
||||
|
||||
If base_str is a Unicode string, encode it to UTF-8.
|
||||
"""
|
||||
if isinstance(base_str, six.text_type):
|
||||
if isinstance(base_str, str):
|
||||
base_str = base_str.encode('utf-8')
|
||||
return md5(base_str, usedforsecurity=False).hexdigest()
|
||||
|
||||
|
@ -20,7 +20,6 @@ from oslo_messaging.rpc import dispatcher
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import periodic_task
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
import nova.context
|
||||
@ -135,8 +134,8 @@ class JsonPayloadSerializer(messaging.NoOpSerializer):
|
||||
if isinstance(obj, nova.context.RequestContext):
|
||||
# This matches RequestContextSerializer.serialize_context().
|
||||
return obj.to_dict()
|
||||
# The default fallback in jsonutils.to_primitive() is six.text_type.
|
||||
return six.text_type(obj)
|
||||
# The default fallback in jsonutils.to_primitive() is str.
|
||||
return str(obj)
|
||||
|
||||
def serialize_entity(self, context, entity):
|
||||
return jsonutils.to_primitive(entity, convert_instances=True,
|
||||
|
@ -29,7 +29,6 @@ from oslo_middleware import request_id
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import versionutils
|
||||
import retrying
|
||||
import six
|
||||
|
||||
from nova.compute import provider_tree
|
||||
import nova.conf
|
||||
@ -2199,7 +2198,7 @@ class SchedulerReportClient(object):
|
||||
global_request_id=context.global_id)
|
||||
except ks_exc.ClientException as ex:
|
||||
LOG.error('Failed to get resource provider by name: %s. Error: %s',
|
||||
name, six.text_type(ex))
|
||||
name, str(ex))
|
||||
raise exception.PlacementAPIConnectFailure()
|
||||
|
||||
if resp.status_code == 200:
|
||||
|
@ -25,7 +25,6 @@ from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import periodic_task
|
||||
import six
|
||||
from stevedore import driver
|
||||
|
||||
import nova.conf
|
||||
@ -83,7 +82,7 @@ class SchedulerManager(manager.Manager):
|
||||
except exception.HostMappingExists as exp:
|
||||
msg = ('This periodic task should only be enabled on a single '
|
||||
'scheduler to prevent collisions between multiple '
|
||||
'schedulers: %s' % six.text_type(exp))
|
||||
'schedulers: %s' % str(exp))
|
||||
if not HOST_MAPPING_EXISTS_WARNING:
|
||||
LOG.warning(msg)
|
||||
HOST_MAPPING_EXISTS_WARNING = True
|
||||
|
@ -46,7 +46,6 @@ from oslo_utils import importutils
|
||||
from oslo_utils.secretutils import md5
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -259,8 +258,8 @@ def utf8(value):
|
||||
if value is None or isinstance(value, bytes):
|
||||
return value
|
||||
|
||||
if not isinstance(value, six.text_type):
|
||||
value = six.text_type(value)
|
||||
if not isinstance(value, str):
|
||||
value = str(value)
|
||||
|
||||
return value.encode('utf-8')
|
||||
|
||||
@ -618,7 +617,7 @@ def validate_integer(value, name, min_value=None, max_value=None):
|
||||
try:
|
||||
return strutils.validate_integer(value, name, min_value, max_value)
|
||||
except ValueError as e:
|
||||
raise exception.InvalidInput(reason=six.text_type(e))
|
||||
raise exception.InvalidInput(reason=str(e))
|
||||
|
||||
|
||||
def _serialize_profile_info():
|
||||
@ -730,7 +729,7 @@ def get_system_metadata_from_image(image_meta, flavor=None):
|
||||
if key in SM_SKIP_KEYS:
|
||||
continue
|
||||
|
||||
new_value = safe_truncate(six.text_type(value), 255)
|
||||
new_value = safe_truncate(str(value), 255)
|
||||
system_meta[prefix_format % key] = new_value
|
||||
|
||||
for key in SM_INHERITABLE_KEYS:
|
||||
@ -784,7 +783,7 @@ def get_hash_str(base_str):
|
||||
|
||||
If base_str is a Unicode string, encode it to UTF-8.
|
||||
"""
|
||||
if isinstance(base_str, six.text_type):
|
||||
if isinstance(base_str, str):
|
||||
base_str = base_str.encode('utf-8')
|
||||
return md5(base_str, usedforsecurity=False).hexdigest()
|
||||
|
||||
@ -797,7 +796,7 @@ def get_sha256_str(base_str):
|
||||
or anything else that needs to be retained for a long period a salted
|
||||
hash is better.
|
||||
"""
|
||||
if isinstance(base_str, six.text_type):
|
||||
if isinstance(base_str, str):
|
||||
base_str = base_str.encode('utf-8')
|
||||
return hashlib.sha256(base_str).hexdigest()
|
||||
|
||||
@ -986,7 +985,7 @@ def get_sdk_adapter(service_type, check_service=False):
|
||||
except sdk_exc.ServiceDiscoveryException as e:
|
||||
raise exception.ServiceUnavailable(
|
||||
_("The %(service_type)s service is unavailable: %(error)s") %
|
||||
{'service_type': service_type, 'error': six.text_type(e)})
|
||||
{'service_type': service_type, 'error': str(e)})
|
||||
return getattr(conn, service_type)
|
||||
|
||||
|
||||
|
@ -21,7 +21,6 @@ import shutil
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_utils import fileutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -64,7 +63,7 @@ class ConfigDriveBuilder(object):
|
||||
with open(filepath, 'wb') as f:
|
||||
# the given data can be either text or bytes. we can only write
|
||||
# bytes into files.
|
||||
if isinstance(data, six.text_type):
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
f.write(data)
|
||||
|
||||
|
@ -20,7 +20,6 @@ import time
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.i18n import _
|
||||
@ -83,7 +82,7 @@ class NbdMount(api.Mount):
|
||||
try:
|
||||
_out, err = nova.privsep.fs.nbd_connect(device, self.image.path)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
err = six.text_type(exc)
|
||||
err = str(exc)
|
||||
|
||||
if err:
|
||||
self.error = _('qemu-nbd error: %s') % err
|
||||
@ -106,7 +105,7 @@ class NbdMount(api.Mount):
|
||||
try:
|
||||
_out, err = nova.privsep.fs.nbd_disconnect(device)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
err = six.text_type(exc)
|
||||
err = str(exc)
|
||||
|
||||
if err:
|
||||
LOG.warning('Detaching from erroneous nbd device returned '
|
||||
|
@ -17,7 +17,6 @@ import os
|
||||
from eventlet import tpool
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -185,8 +184,7 @@ class VFSGuestFS(vfs.VFS):
|
||||
guestfs.GuestFS(python_return_dict=False,
|
||||
close_on_exit=False))
|
||||
except TypeError as e:
|
||||
if ('close_on_exit' in six.text_type(e) or
|
||||
'python_return_dict' in six.text_type(e)):
|
||||
if 'close_on_exit' in str(e) or 'python_return_dict' in str(e):
|
||||
# NOTE(russellb) In case we're not using a version of
|
||||
# libguestfs new enough to support parameters close_on_exit
|
||||
# and python_return_dict which were added in libguestfs 1.20.
|
||||
|
@ -26,7 +26,6 @@ import os_resource_classes as orc
|
||||
import os_traits
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import context as nova_context
|
||||
@ -1597,7 +1596,7 @@ class ComputeDriver(object):
|
||||
"""
|
||||
|
||||
if not self._compute_event_callback:
|
||||
LOG.debug("Discarding event %s", six.text_type(event))
|
||||
LOG.debug("Discarding event %s", str(event))
|
||||
return
|
||||
|
||||
if not isinstance(event, virtevent.Event):
|
||||
@ -1605,7 +1604,7 @@ class ComputeDriver(object):
|
||||
_("Event must be an instance of nova.virt.event.Event"))
|
||||
|
||||
try:
|
||||
LOG.debug("Emitting event %s", six.text_type(event))
|
||||
LOG.debug("Emitting event %s", str(event))
|
||||
self._compute_event_callback(event)
|
||||
except Exception as ex:
|
||||
LOG.error("Exception dispatching event %(event)s: %(ex)s",
|
||||
|
@ -23,7 +23,6 @@ import os_traits
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -339,7 +338,7 @@ def get_cpu_topology_constraints(flavor, image_meta):
|
||||
flavor_max_cores = int(flavor_max_cores)
|
||||
flavor_max_threads = int(flavor_max_threads)
|
||||
except ValueError as e:
|
||||
msg = _('Invalid flavor extra spec. Error: %s') % six.text_type(e)
|
||||
msg = _('Invalid flavor extra spec. Error: %s') % str(e)
|
||||
raise exception.InvalidRequest(msg)
|
||||
|
||||
LOG.debug("Flavor limits %(sockets)d:%(cores)d:%(threads)d",
|
||||
@ -379,7 +378,7 @@ def get_cpu_topology_constraints(flavor, image_meta):
|
||||
flavor_cores = int(flavor_cores)
|
||||
flavor_threads = int(flavor_threads)
|
||||
except ValueError as e:
|
||||
msg = _('Invalid flavor extra spec. Error: %s') % six.text_type(e)
|
||||
msg = _('Invalid flavor extra spec. Error: %s') % str(e)
|
||||
raise exception.InvalidRequest(msg)
|
||||
|
||||
LOG.debug("Flavor pref %(sockets)d:%(cores)d:%(threads)d",
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import six
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
@ -189,7 +188,7 @@ class PathUtils(pathutils.PathUtils):
|
||||
os.path.basename(tmp_file.name))
|
||||
shared_storage = os.path.exists(src_path)
|
||||
except OSError as e:
|
||||
raise exception.FileNotFound(six.text_type(e))
|
||||
raise exception.FileNotFound(str(e))
|
||||
|
||||
return shared_storage
|
||||
|
||||
|
@ -18,7 +18,6 @@ import os
|
||||
|
||||
from os_win import utilsfactory
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova import utils
|
||||
@ -99,7 +98,7 @@ class SerialConsoleOps(object):
|
||||
return log
|
||||
except IOError as err:
|
||||
raise exception.ConsoleLogOutputException(
|
||||
instance_id=instance_name, reason=six.text_type(err))
|
||||
instance_id=instance_name, reason=str(err))
|
||||
|
||||
def start_console_handlers(self):
|
||||
active_instances = self._vmutils.get_active_instances()
|
||||
|
@ -33,7 +33,6 @@ from oslo_serialization import jsonutils
|
||||
from oslo_service import loopingcall
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
from tooz import hashring as hash_ring
|
||||
|
||||
from nova.api.metadata import base as instance_metadata
|
||||
@ -453,7 +452,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
"%(node)s when unprovisioning the instance "
|
||||
"%(instance)s: %(reason)s",
|
||||
{'node': node.uuid, 'instance': instance.uuid,
|
||||
'reason': six.text_type(e)})
|
||||
'reason': str(e)})
|
||||
|
||||
def _add_volume_target_info(self, context, instance, block_device_info):
|
||||
bdms = virt_driver.block_device_info_get_mapping(block_device_info)
|
||||
@ -657,12 +656,12 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
node_generator = self.ironic_connection.nodes(**kwargs)
|
||||
except sdk_exc.InvalidResourceQuery as e:
|
||||
LOG.error("Invalid parameters in the provided search query."
|
||||
"Error: %s", six.text_type(e))
|
||||
"Error: %s", str(e))
|
||||
raise exception.VirtDriverNotReady()
|
||||
except Exception as e:
|
||||
LOG.error("An unknown error has occurred when trying to get the "
|
||||
"list of nodes from the Ironic inventory. Error: %s",
|
||||
six.text_type(e))
|
||||
str(e))
|
||||
raise exception.VirtDriverNotReady()
|
||||
if return_generator:
|
||||
return node_generator
|
||||
@ -1225,8 +1224,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
files=injected_files)
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
msg = ("Failed to build configdrive: %s" %
|
||||
six.text_type(e))
|
||||
msg = "Failed to build configdrive: %s" % str(e)
|
||||
LOG.error(msg, instance=instance)
|
||||
self._cleanup_deploy(node, instance, network_info)
|
||||
|
||||
@ -1244,7 +1242,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
LOG.error("Failed to request Ironic to provision instance "
|
||||
"%(inst)s: %(reason)s",
|
||||
{'inst': instance.uuid,
|
||||
'reason': six.text_type(e)})
|
||||
'reason': str(e)})
|
||||
self._cleanup_deploy(node, instance, network_info)
|
||||
|
||||
timer = loopingcall.FixedIntervalLoopingCall(self._wait_for_active,
|
||||
@ -1554,8 +1552,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
# which will cause ironicclient to automatically retry for us.
|
||||
# We can remove this workaround once we are confident that we
|
||||
# are only running against ironic containing this fix.
|
||||
if ('No conductor' in six.text_type(e) and
|
||||
attempt < last_attempt):
|
||||
if 'No conductor' in str(e) and attempt < last_attempt:
|
||||
LOG.warning('No ironic conductor is running; '
|
||||
'waiting...')
|
||||
time.sleep(10)
|
||||
@ -1583,7 +1580,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
{'uuid': instance.uuid,
|
||||
'network_info': network_info_str})
|
||||
for vif in network_info:
|
||||
port_id = six.text_type(vif['id'])
|
||||
port_id = str(vif['id'])
|
||||
self._plug_vif(node, port_id)
|
||||
|
||||
def _unplug_vifs(self, node, instance, network_info):
|
||||
@ -1597,7 +1594,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
if not network_info:
|
||||
return
|
||||
for vif in network_info:
|
||||
port_id = six.text_type(vif['id'])
|
||||
port_id = str(vif['id'])
|
||||
try:
|
||||
self.ironicclient.call("node.vif_detach", node.uuid,
|
||||
port_id)
|
||||
@ -1735,8 +1732,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
files=injected_files)
|
||||
except Exception as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
msg = ("Failed to build configdrive: %s" %
|
||||
six.text_type(e))
|
||||
msg = "Failed to build configdrive: %s" % str(e)
|
||||
LOG.error(msg, instance=instance)
|
||||
raise exception.InstanceDeployFailure(msg)
|
||||
|
||||
@ -1754,7 +1750,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
ironic.exc.BadRequest) as e: # Maintenance
|
||||
msg = (_("Failed to request Ironic to rebuild instance "
|
||||
"%(inst)s: %(reason)s") % {'inst': instance.uuid,
|
||||
'reason': six.text_type(e)})
|
||||
'reason': str(e)})
|
||||
raise exception.InstanceDeployFailure(msg)
|
||||
|
||||
# Although the target provision state is REBUILD, it will actually go
|
||||
@ -1983,7 +1979,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
LOG.warning('Error detaching VIF from node %(node)s '
|
||||
'after deploy failed; %(reason)s',
|
||||
{'node': instance.node,
|
||||
'reason': six.text_type(e)},
|
||||
'reason': str(e)},
|
||||
instance=instance)
|
||||
|
||||
def get_volume_connector(self, instance):
|
||||
@ -2145,7 +2141,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
try:
|
||||
node = self._validate_instance_and_node(instance)
|
||||
except exception.InstanceNotFound as e:
|
||||
raise exception.InstanceRescueFailure(reason=six.text_type(e))
|
||||
raise exception.InstanceRescueFailure(reason=str(e))
|
||||
|
||||
if node.provision_state == ironic_states.RESCUE:
|
||||
raise loopingcall.LoopingCallDone()
|
||||
@ -2159,7 +2155,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
node_uuid, ironic_states.RESCUE,
|
||||
rescue_password=rescue_password)
|
||||
except Exception as e:
|
||||
raise exception.InstanceRescueFailure(reason=six.text_type(e))
|
||||
raise exception.InstanceRescueFailure(reason=str(e))
|
||||
|
||||
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_rescue)
|
||||
timer.start(interval=CONF.ironic.api_retry_interval).wait()
|
||||
@ -2184,8 +2180,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
try:
|
||||
node = self._validate_instance_and_node(instance)
|
||||
except exception.InstanceNotFound as e:
|
||||
raise exception.InstanceUnRescueFailure(
|
||||
reason=six.text_type(e))
|
||||
raise exception.InstanceUnRescueFailure(reason=str(e))
|
||||
|
||||
if node.provision_state == ironic_states.ACTIVE:
|
||||
raise loopingcall.LoopingCallDone()
|
||||
@ -2198,7 +2193,7 @@ class IronicDriver(virt_driver.ComputeDriver):
|
||||
self.ironicclient.call("node.set_provision_state",
|
||||
node_uuid, ironic_states.UNRESCUE)
|
||||
except Exception as e:
|
||||
raise exception.InstanceUnRescueFailure(reason=six.text_type(e))
|
||||
raise exception.InstanceUnRescueFailure(reason=str(e))
|
||||
|
||||
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_unrescue)
|
||||
timer.start(interval=CONF.ironic.api_retry_interval).wait()
|
||||
|
@ -29,7 +29,6 @@ from collections import OrderedDict
|
||||
from lxml import etree
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
@ -60,7 +59,7 @@ class LibvirtConfigObject(object):
|
||||
|
||||
def _text_node(self, node_name, value, **kwargs):
|
||||
child = self._new_node(node_name, **kwargs)
|
||||
child.text = six.text_type(value)
|
||||
child.text = str(value)
|
||||
return child
|
||||
|
||||
def format_dom(self):
|
||||
|
@ -72,7 +72,6 @@ from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import units
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from nova.api.metadata import base as instance_metadata
|
||||
from nova.api.metadata import password
|
||||
@ -1929,7 +1928,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
LOG.exception("Failure rebasing volume %(new_path)s on "
|
||||
"%(old_path)s.", {'new_path': new_path,
|
||||
'old_path': old_path})
|
||||
raise exception.VolumeRebaseFailed(reason=six.text_type(exc))
|
||||
raise exception.VolumeRebaseFailed(reason=str(exc))
|
||||
|
||||
if resize_to:
|
||||
dev.resize(resize_to * units.Gi)
|
||||
@ -4340,7 +4339,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
raise exception.PciDevicePrepareFailed(id=dev['id'],
|
||||
instance_uuid=
|
||||
dev['instance_uuid'],
|
||||
reason=six.text_type(exc))
|
||||
reason=str(exc))
|
||||
|
||||
def _detach_pci_devices(self, guest, pci_devs):
|
||||
try:
|
||||
|
@ -30,7 +30,6 @@ from oslo_utils import excutils
|
||||
from oslo_utils import fileutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -402,7 +401,7 @@ class Image(metaclass=abc.ABCMeta):
|
||||
fileutils.ensure_tree(os.path.dirname(self.disk_info_path))
|
||||
write_to_disk_info_file()
|
||||
except OSError as e:
|
||||
raise exception.DiskInfoReadWriteFail(reason=six.text_type(e))
|
||||
raise exception.DiskInfoReadWriteFail(reason=str(e))
|
||||
return driver_format
|
||||
|
||||
@staticmethod
|
||||
|
@ -24,7 +24,6 @@ import os
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -188,6 +187,6 @@ def remove_volumes(paths):
|
||||
try:
|
||||
nova.privsep.fs.lvremove(path)
|
||||
except processutils.ProcessExecutionError as exp:
|
||||
errors.append(six.text_type(exp))
|
||||
errors.append(str(exp))
|
||||
if errors:
|
||||
raise exception.VolumesNotRemoved(reason=(', ').join(errors))
|
||||
|
@ -20,7 +20,6 @@ import threading
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log
|
||||
from oslo_utils import fileutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
@ -380,7 +379,7 @@ class _HostMountState(object):
|
||||
nova.privsep.fs.umount(mountpoint)
|
||||
except processutils.ProcessExecutionError as ex:
|
||||
LOG.error("Couldn't unmount %(mountpoint)s: %(reason)s",
|
||||
{'mountpoint': mountpoint, 'reason': six.text_type(ex)})
|
||||
{'mountpoint': mountpoint, 'reason': str(ex)})
|
||||
|
||||
if not os.path.ismount(mountpoint):
|
||||
nova.privsep.path.rmdir(mountpoint)
|
||||
|
@ -19,7 +19,6 @@ from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import fileutils
|
||||
import psutil
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import exception as nova_exception
|
||||
@ -97,7 +96,7 @@ def umount_volume(mnt_base):
|
||||
else:
|
||||
nova.privsep.libvirt.unprivileged_umount(mnt_base)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
if 'Device or resource busy' in six.text_type(exc):
|
||||
if 'Device or resource busy' in str(exc):
|
||||
LOG.error("The Quobyte volume at %s is still in use.", mnt_base)
|
||||
else:
|
||||
LOG.exception("Couldn't unmount the Quobyte Volume at %s",
|
||||
|
@ -20,7 +20,6 @@ from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import fileutils
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
import nova.privsep.fs
|
||||
@ -45,7 +44,7 @@ def mount_share(mount_path, export_path,
|
||||
try:
|
||||
nova.privsep.fs.mount(export_type, export_path, mount_path, options)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
if 'Device or resource busy' in six.text_type(exc):
|
||||
if 'Device or resource busy' in str(exc):
|
||||
LOG.warning("%s is already mounted", export_path)
|
||||
else:
|
||||
raise
|
||||
@ -60,7 +59,7 @@ def unmount_share(mount_path, export_path):
|
||||
try:
|
||||
nova.privsep.fs.umount(mount_path)
|
||||
except processutils.ProcessExecutionError as exc:
|
||||
if 'target is busy' in six.text_type(exc):
|
||||
if 'target is busy' in str(exc):
|
||||
LOG.debug("The share %s is still in use.", export_path)
|
||||
else:
|
||||
LOG.exception("Couldn't unmount the share %s", export_path)
|
||||
|
@ -26,7 +26,6 @@ from pypowervm.tasks import partition as pvm_par
|
||||
from pypowervm.tasks import storage as pvm_stor
|
||||
from pypowervm.tasks import vterm as pvm_vterm
|
||||
from pypowervm.wrappers import managed_system as pvm_ms
|
||||
import six
|
||||
from taskflow.patterns import linear_flow as tf_lf
|
||||
|
||||
from nova.compute import task_states
|
||||
@ -400,7 +399,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
||||
except pvm_exc.Error as e:
|
||||
LOG.exception("PowerVM error during destroy.", instance=instance)
|
||||
# Convert to a Nova exception
|
||||
raise exc.InstanceTerminationFailure(reason=six.text_type(e))
|
||||
raise exc.InstanceTerminationFailure(reason=str(e))
|
||||
|
||||
def snapshot(self, context, instance, image_id, update_task_state):
|
||||
"""Snapshots the specified instance.
|
||||
|
@ -24,7 +24,6 @@ from pypowervm import exceptions as pvm_ex
|
||||
from pypowervm.tasks import cna as pvm_cna
|
||||
from pypowervm.tasks import partition as pvm_par
|
||||
from pypowervm.wrappers import event as pvm_evt
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.network import model as network_model
|
||||
@ -210,7 +209,7 @@ class PvmVifDriver(metaclass=abc.ABCMeta):
|
||||
LOG.exception('Unable to unplug VIF with mac %(mac)s.',
|
||||
{'mac': vif['address']}, instance=self.instance)
|
||||
raise exception.VirtualInterfaceUnplugException(
|
||||
reason=six.text_type(e))
|
||||
reason=str(e))
|
||||
return cna_w
|
||||
|
||||
@staticmethod
|
||||
|
@ -32,7 +32,6 @@ from pypowervm.wrappers import base_partition as pvm_bp
|
||||
from pypowervm.wrappers import logical_partition as pvm_lpar
|
||||
from pypowervm.wrappers import network as pvm_net
|
||||
from pypowervm.wrappers import shared_proc_pool as pvm_spp
|
||||
import six
|
||||
|
||||
from nova.compute import power_state
|
||||
from nova import conf
|
||||
@ -153,7 +152,7 @@ def power_on(adapter, instance):
|
||||
except pvm_exc.Error as e:
|
||||
LOG.exception("PowerVM error during power_on.",
|
||||
instance=instance)
|
||||
raise exc.InstancePowerOnFailure(reason=six.text_type(e))
|
||||
raise exc.InstancePowerOnFailure(reason=str(e))
|
||||
|
||||
|
||||
def power_off(adapter, instance, force_immediate=False, timeout=None):
|
||||
@ -189,7 +188,7 @@ def power_off(adapter, instance, force_immediate=False, timeout=None):
|
||||
except pvm_exc.Error as e:
|
||||
LOG.exception("PowerVM error during power_off.",
|
||||
instance=instance)
|
||||
raise exc.InstancePowerOffFailure(reason=six.text_type(e))
|
||||
raise exc.InstancePowerOffFailure(reason=str(e))
|
||||
else:
|
||||
LOG.debug("Power off not required for instance %(inst)s.",
|
||||
{'inst': instance.name})
|
||||
@ -221,7 +220,7 @@ def reboot(adapter, instance, hard):
|
||||
power.power_on(entry, None)
|
||||
except pvm_exc.Error as e:
|
||||
LOG.exception("PowerVM error during reboot.", instance=instance)
|
||||
raise exc.InstanceRebootFailure(reason=six.text_type(e))
|
||||
raise exc.InstanceRebootFailure(reason=str(e))
|
||||
|
||||
|
||||
def delete_lpar(adapter, instance):
|
||||
|
@ -23,7 +23,6 @@ from pypowervm.tasks import scsi_mapper as tsk_map
|
||||
from pypowervm.utils import transaction as pvm_tx
|
||||
from pypowervm.wrappers import storage as pvm_stor
|
||||
from pypowervm.wrappers import virtual_io_server as pvm_vios
|
||||
import six
|
||||
from taskflow import task
|
||||
|
||||
from nova import conf as cfg
|
||||
@ -326,7 +325,7 @@ class FCVscsiVolumeAdapter(object):
|
||||
except Exception as e:
|
||||
LOG.exception('PowerVM error detaching volume from virtual '
|
||||
'machine.', instance=self.instance)
|
||||
ex_args = {'volume_id': self.volume_id, 'reason': six.text_type(e)}
|
||||
ex_args = {'volume_id': self.volume_id, 'reason': str(e)}
|
||||
raise exc.VolumeDetachFailed(**ex_args)
|
||||
self.stg_ftsk.execute()
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
import eventlet
|
||||
import os
|
||||
import six
|
||||
import time
|
||||
|
||||
import os_resource_classes as orc
|
||||
@ -291,7 +290,7 @@ class ZVMDriver(driver.ComputeDriver):
|
||||
raise exception.VirtualInterfaceCreateException()
|
||||
except Exception as err:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error("Failed for vif plugging: %s", six.text_type(err),
|
||||
LOG.error("Failed for vif plugging: %s", str(err),
|
||||
instance=instance)
|
||||
|
||||
def _import_spawn_image(self, context, image_meta_id, image_os_version):
|
||||
|
@ -16,7 +16,6 @@ import os
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
from zvmconnector import connector
|
||||
|
||||
from oslo_utils import fileutils
|
||||
@ -61,9 +60,9 @@ class ConnectorClient(object):
|
||||
if results['overallRC'] != 0:
|
||||
LOG.error("zVM Cloud Connector request %(api)s failed with "
|
||||
"parameters: %(args)s %(kwargs)s . Results: %(results)s",
|
||||
{'api': func_name, 'args': six.text_type(args),
|
||||
'kwargs': six.text_type(kwargs),
|
||||
'results': six.text_type(results)})
|
||||
{'api': func_name, 'args': str(args),
|
||||
'kwargs': str(kwargs),
|
||||
'results': str(results)})
|
||||
raise exception.ZVMConnectorError(results=results)
|
||||
|
||||
return results['output']
|
||||
|
@ -36,7 +36,6 @@ from oslo_utils import encodeutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import strutils
|
||||
import retrying
|
||||
import six
|
||||
|
||||
from nova import availability_zones as az
|
||||
import nova.conf
|
||||
@ -153,7 +152,7 @@ def _get_server_version(context, url):
|
||||
break
|
||||
except cinder_exception.ClientException as e:
|
||||
LOG.warning("Error in server version query:%s\n"
|
||||
"Returning APIVersion 2.0", six.text_type(e.message))
|
||||
"Returning APIVersion 2.0", str(e.message))
|
||||
return (cinder_api_versions.APIVersion(min_version),
|
||||
cinder_api_versions.APIVersion(current_version))
|
||||
|
||||
@ -614,7 +613,7 @@ class API(object):
|
||||
'Attempting to terminate connection.',
|
||||
{'vol': volume_id,
|
||||
'host': connector.get('host'),
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': ex.code})
|
||||
try:
|
||||
self.terminate_connection(context, volume_id, connector)
|
||||
@ -627,7 +626,7 @@ class API(object):
|
||||
'Error: %(msg)s Code: %(code)s.',
|
||||
{'vol': volume_id,
|
||||
'host': connector.get('host'),
|
||||
'msg': six.text_type(exc),
|
||||
'msg': str(exc),
|
||||
'code': exc.code if hasattr(exc, 'code') else None})
|
||||
|
||||
@translate_volume_exception
|
||||
@ -803,7 +802,7 @@ class API(object):
|
||||
LOG.error('Create attachment failed for volume '
|
||||
'%(volume_id)s. Error: %(msg)s Code: %(code)s',
|
||||
{'volume_id': volume_id,
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': getattr(ex, 'code', None)},
|
||||
instance_uuid=instance_id)
|
||||
|
||||
@ -829,7 +828,7 @@ class API(object):
|
||||
LOG.error('Show attachment failed for attachment '
|
||||
'%(id)s. Error: %(msg)s Code: %(code)s',
|
||||
{'id': attachment_id,
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': getattr(ex, 'code', None)})
|
||||
|
||||
@translate_attachment_exception
|
||||
@ -876,7 +875,7 @@ class API(object):
|
||||
LOG.error('Update attachment failed for attachment '
|
||||
'%(id)s. Error: %(msg)s Code: %(code)s',
|
||||
{'id': attachment_id,
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': getattr(ex, 'code', None)})
|
||||
|
||||
@translate_attachment_exception
|
||||
@ -893,7 +892,7 @@ class API(object):
|
||||
LOG.error('Delete attachment failed for attachment '
|
||||
'%(id)s. Error: %(msg)s Code: %(code)s',
|
||||
{'id': attachment_id,
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': getattr(ex, 'code', None)})
|
||||
|
||||
@translate_attachment_exception
|
||||
@ -916,5 +915,5 @@ class API(object):
|
||||
LOG.error('Complete attachment failed for attachment '
|
||||
'%(id)s. Error: %(msg)s Code: %(code)s',
|
||||
{'id': attachment_id,
|
||||
'msg': six.text_type(ex),
|
||||
'msg': str(ex),
|
||||
'code': getattr(ex, 'code', None)})
|
||||
|
Loading…
Reference in New Issue
Block a user