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