debug level logs should not be translated
According to the OpenStack translation policy available at https://wiki.openstack.org/wiki/LoggingStandards debug messages should not be translated. Like mentioned in several changes in Nova by garyk this is to help prioritize log translation. This patch adds a new hacking check - N319 - that ensures all debug log messages don't have translations. Change-Id: Id9c2715f25c8f2ea52235aba4bd1583655391584 Implements: blueprint debug-translation-removal Closes-Bug: #1318713
This commit is contained in:
parent
a398e1b5be
commit
5061ab9586
@ -8,6 +8,8 @@ Cinder Style Commandments
|
|||||||
Cinder Specific Commandments
|
Cinder Specific Commandments
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
- [N319] Validate that debug level logs are not translated
|
||||||
|
|
||||||
General
|
General
|
||||||
-------
|
-------
|
||||||
- Use 'raise' instead of 'raise e' to preserve original traceback or exception being reraised::
|
- Use 'raise' instead of 'raise e' to preserve original traceback or exception being reraised::
|
||||||
|
@ -115,9 +115,9 @@ if __name__ == '__main__':
|
|||||||
print(_("Found %d volumes") % len(volumes))
|
print(_("Found %d volumes") % len(volumes))
|
||||||
for volume_ref in volumes:
|
for volume_ref in volumes:
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Send exists notification for <volume_id: "
|
LOG.debug("Send exists notification for <volume_id: "
|
||||||
"%(volume_id)s> <project_id %(project_id)s> "
|
"%(volume_id)s> <project_id %(project_id)s> "
|
||||||
"<%(extra_info)s>") %
|
"<%(extra_info)s>" %
|
||||||
{'volume_id': volume_ref.id,
|
{'volume_id': volume_ref.id,
|
||||||
'project_id': volume_ref.project_id,
|
'project_id': volume_ref.project_id,
|
||||||
'extra_info': extra_info})
|
'extra_info': extra_info})
|
||||||
@ -138,9 +138,9 @@ if __name__ == '__main__':
|
|||||||
'audit_period_beginning': str(volume_ref.created_at),
|
'audit_period_beginning': str(volume_ref.created_at),
|
||||||
'audit_period_ending': str(volume_ref.created_at),
|
'audit_period_ending': str(volume_ref.created_at),
|
||||||
}
|
}
|
||||||
LOG.debug(_("Send create notification for "
|
LOG.debug("Send create notification for "
|
||||||
"<volume_id: %(volume_id)s> "
|
"<volume_id: %(volume_id)s> "
|
||||||
"<project_id %(project_id)s> <%(extra_info)s>") %
|
"<project_id %(project_id)s> <%(extra_info)s>" %
|
||||||
{'volume_id': volume_ref.id,
|
{'volume_id': volume_ref.id,
|
||||||
'project_id': volume_ref.project_id,
|
'project_id': volume_ref.project_id,
|
||||||
'extra_info': local_extra_info})
|
'extra_info': local_extra_info})
|
||||||
@ -165,9 +165,9 @@ if __name__ == '__main__':
|
|||||||
'audit_period_beginning': str(volume_ref.deleted_at),
|
'audit_period_beginning': str(volume_ref.deleted_at),
|
||||||
'audit_period_ending': str(volume_ref.deleted_at),
|
'audit_period_ending': str(volume_ref.deleted_at),
|
||||||
}
|
}
|
||||||
LOG.debug(_("Send delete notification for "
|
LOG.debug("Send delete notification for "
|
||||||
"<volume_id: %(volume_id)s> "
|
"<volume_id: %(volume_id)s> "
|
||||||
"<project_id %(project_id)s> <%(extra_info)s>") %
|
"<project_id %(project_id)s> <%(extra_info)s>" %
|
||||||
{'volume_id': volume_ref.id,
|
{'volume_id': volume_ref.id,
|
||||||
'project_id': volume_ref.project_id,
|
'project_id': volume_ref.project_id,
|
||||||
'extra_info': local_extra_info})
|
'extra_info': local_extra_info})
|
||||||
@ -190,8 +190,8 @@ if __name__ == '__main__':
|
|||||||
print(_("Found %d snapshots") % len(snapshots))
|
print(_("Found %d snapshots") % len(snapshots))
|
||||||
for snapshot_ref in snapshots:
|
for snapshot_ref in snapshots:
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Send notification for <snapshot_id: %(snapshot_id)s> "
|
LOG.debug("Send notification for <snapshot_id: %(snapshot_id)s> "
|
||||||
"<project_id %(project_id)s> <%(extra_info)s>") %
|
"<project_id %(project_id)s> <%(extra_info)s>" %
|
||||||
{'snapshot_id': snapshot_ref.id,
|
{'snapshot_id': snapshot_ref.id,
|
||||||
'project_id': snapshot_ref.project_id,
|
'project_id': snapshot_ref.project_id,
|
||||||
'extra_info': extra_info})
|
'extra_info': extra_info})
|
||||||
@ -212,9 +212,9 @@ if __name__ == '__main__':
|
|||||||
'audit_period_beginning': str(snapshot_ref.created_at),
|
'audit_period_beginning': str(snapshot_ref.created_at),
|
||||||
'audit_period_ending': str(snapshot_ref.created_at),
|
'audit_period_ending': str(snapshot_ref.created_at),
|
||||||
}
|
}
|
||||||
LOG.debug(_("Send create notification for "
|
LOG.debug("Send create notification for "
|
||||||
"<snapshot_id: %(snapshot_id)s> "
|
"<snapshot_id: %(snapshot_id)s> "
|
||||||
"<project_id %(project_id)s> <%(extra_info)s>") %
|
"<project_id %(project_id)s> <%(extra_info)s>" %
|
||||||
{'snapshot_id': snapshot_ref.id,
|
{'snapshot_id': snapshot_ref.id,
|
||||||
'project_id': snapshot_ref.project_id,
|
'project_id': snapshot_ref.project_id,
|
||||||
'extra_info': local_extra_info})
|
'extra_info': local_extra_info})
|
||||||
@ -239,9 +239,9 @@ if __name__ == '__main__':
|
|||||||
'audit_period_beginning': str(snapshot_ref.deleted_at),
|
'audit_period_beginning': str(snapshot_ref.deleted_at),
|
||||||
'audit_period_ending': str(snapshot_ref.deleted_at),
|
'audit_period_ending': str(snapshot_ref.deleted_at),
|
||||||
}
|
}
|
||||||
LOG.debug(_("Send delete notification for "
|
LOG.debug("Send delete notification for "
|
||||||
"<snapshot_id: %(snapshot_id)s> "
|
"<snapshot_id: %(snapshot_id)s> "
|
||||||
"<project_id %(project_id)s> <%(extra_info)s>") %
|
"<project_id %(project_id)s> <%(extra_info)s>" %
|
||||||
{'snapshot_id': snapshot_ref.id,
|
{'snapshot_id': snapshot_ref.id,
|
||||||
'project_id': snapshot_ref.project_id,
|
'project_id': snapshot_ref.project_id,
|
||||||
'extra_info': local_extra_info})
|
'extra_info': local_extra_info})
|
||||||
|
@ -186,7 +186,7 @@ def remove_version_from_href(href):
|
|||||||
new_path = '/'.join(url_parts)
|
new_path = '/'.join(url_parts)
|
||||||
|
|
||||||
if new_path == parsed_url.path:
|
if new_path == parsed_url.path:
|
||||||
msg = _('href %s does not contain version') % href
|
msg = 'href %s does not contain version' % href
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
@wsgi.serializers(xml=BackupTemplate)
|
@wsgi.serializers(xml=BackupTemplate)
|
||||||
def show(self, req, id):
|
def show(self, req, id):
|
||||||
"""Return data about the given backup."""
|
"""Return data about the given backup."""
|
||||||
LOG.debug(_('show called for member %s'), id)
|
LOG.debug('show called for member %s', id)
|
||||||
context = req.environ['cinder.context']
|
context = req.environ['cinder.context']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -170,7 +170,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
|
|
||||||
def delete(self, req, id):
|
def delete(self, req, id):
|
||||||
"""Delete a backup."""
|
"""Delete a backup."""
|
||||||
LOG.debug(_('delete called for member %s'), id)
|
LOG.debug('delete called for member %s', id)
|
||||||
context = req.environ['cinder.context']
|
context = req.environ['cinder.context']
|
||||||
|
|
||||||
LOG.audit(_('Delete backup with id: %s'), id, context=context)
|
LOG.audit(_('Delete backup with id: %s'), id, context=context)
|
||||||
@ -215,7 +215,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
@wsgi.deserializers(xml=CreateDeserializer)
|
@wsgi.deserializers(xml=CreateDeserializer)
|
||||||
def create(self, req, body):
|
def create(self, req, body):
|
||||||
"""Create a new backup."""
|
"""Create a new backup."""
|
||||||
LOG.debug(_('Creating new backup %s'), body)
|
LOG.debug('Creating new backup %s', body)
|
||||||
if not self.is_valid_body(body, 'backup'):
|
if not self.is_valid_body(body, 'backup'):
|
||||||
raise exc.HTTPBadRequest()
|
raise exc.HTTPBadRequest()
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
@wsgi.deserializers(xml=RestoreDeserializer)
|
@wsgi.deserializers(xml=RestoreDeserializer)
|
||||||
def restore(self, req, id, body):
|
def restore(self, req, id, body):
|
||||||
"""Restore an existing backup to a volume."""
|
"""Restore an existing backup to a volume."""
|
||||||
LOG.debug(_('Restoring backup %(backup_id)s (%(body)s)'),
|
LOG.debug('Restoring backup %(backup_id)s (%(body)s)',
|
||||||
{'backup_id': id, 'body': body})
|
{'backup_id': id, 'body': body})
|
||||||
if not self.is_valid_body(body, 'restore'):
|
if not self.is_valid_body(body, 'restore'):
|
||||||
msg = _("Incorrect request body format")
|
msg = _("Incorrect request body format")
|
||||||
@ -297,7 +297,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
@wsgi.serializers(xml=BackupExportImportTemplate)
|
@wsgi.serializers(xml=BackupExportImportTemplate)
|
||||||
def export_record(self, req, id):
|
def export_record(self, req, id):
|
||||||
"""Export a backup."""
|
"""Export a backup."""
|
||||||
LOG.debug(_('export record called for member %s.'), id)
|
LOG.debug('export record called for member %s.', id)
|
||||||
context = req.environ['cinder.context']
|
context = req.environ['cinder.context']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -309,7 +309,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
|
|
||||||
retval = self._view_builder.export_summary(
|
retval = self._view_builder.export_summary(
|
||||||
req, dict(backup_info.iteritems()))
|
req, dict(backup_info.iteritems()))
|
||||||
LOG.debug(_('export record output: %s.'), retval)
|
LOG.debug('export record output: %s.', retval)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
@wsgi.response(201)
|
@wsgi.response(201)
|
||||||
@ -317,7 +317,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
@wsgi.deserializers(xml=BackupImportDeserializer)
|
@wsgi.deserializers(xml=BackupImportDeserializer)
|
||||||
def import_record(self, req, body):
|
def import_record(self, req, body):
|
||||||
"""Import a backup."""
|
"""Import a backup."""
|
||||||
LOG.debug(_('Importing record from %s.'), body)
|
LOG.debug('Importing record from %s.', body)
|
||||||
if not self.is_valid_body(body, 'backup-record'):
|
if not self.is_valid_body(body, 'backup-record'):
|
||||||
msg = _("Incorrect request body format.")
|
msg = _("Incorrect request body format.")
|
||||||
raise exc.HTTPBadRequest(explanation=msg)
|
raise exc.HTTPBadRequest(explanation=msg)
|
||||||
@ -330,7 +330,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
msg = _("Incorrect request body format.")
|
msg = _("Incorrect request body format.")
|
||||||
raise exc.HTTPBadRequest(explanation=msg)
|
raise exc.HTTPBadRequest(explanation=msg)
|
||||||
LOG.debug(_('Importing backup using %(service)s and url %(url)s.'),
|
LOG.debug('Importing backup using %(service)s and url %(url)s.',
|
||||||
{'service': backup_service, 'url': backup_url})
|
{'service': backup_service, 'url': backup_url})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -345,7 +345,7 @@ class BackupsController(wsgi.Controller):
|
|||||||
raise exc.HTTPInternalServerError(explanation=error.msg)
|
raise exc.HTTPInternalServerError(explanation=error.msg)
|
||||||
|
|
||||||
retval = self._view_builder.summary(req, dict(new_backup.iteritems()))
|
retval = self._view_builder.summary(req, dict(new_backup.iteritems()))
|
||||||
LOG.debug(_('import record output: %s.'), retval)
|
LOG.debug('import record output: %s.', retval)
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||||||
def _get_transfers(self, req, is_detail):
|
def _get_transfers(self, req, is_detail):
|
||||||
"""Returns a list of transfers, transformed through view builder."""
|
"""Returns a list of transfers, transformed through view builder."""
|
||||||
context = req.environ['cinder.context']
|
context = req.environ['cinder.context']
|
||||||
LOG.debug(_('Listing volume transfers'))
|
LOG.debug('Listing volume transfers')
|
||||||
transfers = self.transfer_api.get_all(context)
|
transfers = self.transfer_api.get_all(context)
|
||||||
limited_list = common.limited(transfers, req)
|
limited_list = common.limited(transfers, req)
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||||||
@wsgi.deserializers(xml=CreateDeserializer)
|
@wsgi.deserializers(xml=CreateDeserializer)
|
||||||
def create(self, req, body):
|
def create(self, req, body):
|
||||||
"""Create a new volume transfer."""
|
"""Create a new volume transfer."""
|
||||||
LOG.debug(_('Creating new volume transfer %s'), body)
|
LOG.debug('Creating new volume transfer %s', body)
|
||||||
if not self.is_valid_body(body, 'transfer'):
|
if not self.is_valid_body(body, 'transfer'):
|
||||||
raise exc.HTTPBadRequest()
|
raise exc.HTTPBadRequest()
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ class VolumeTransferController(wsgi.Controller):
|
|||||||
def accept(self, req, id, body):
|
def accept(self, req, id, body):
|
||||||
"""Accept a new volume transfer."""
|
"""Accept a new volume transfer."""
|
||||||
transfer_id = id
|
transfer_id = id
|
||||||
LOG.debug(_('Accepting volume transfer %s'), transfer_id)
|
LOG.debug('Accepting volume transfer %s', transfer_id)
|
||||||
if not self.is_valid_body(body, 'accept'):
|
if not self.is_valid_body(body, 'accept'):
|
||||||
raise exc.HTTPBadRequest()
|
raise exc.HTTPBadRequest()
|
||||||
|
|
||||||
|
@ -233,12 +233,12 @@ class ExtensionManager(object):
|
|||||||
def _check_extension(self, extension):
|
def _check_extension(self, extension):
|
||||||
"""Checks for required methods in extension objects."""
|
"""Checks for required methods in extension objects."""
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Ext name: %s'), extension.name)
|
LOG.debug('Ext name: %s', extension.name)
|
||||||
LOG.debug(_('Ext alias: %s'), extension.alias)
|
LOG.debug('Ext alias: %s', extension.alias)
|
||||||
LOG.debug(_('Ext description: %s'),
|
LOG.debug('Ext description: %s',
|
||||||
' '.join(extension.__doc__.strip().split()))
|
' '.join(extension.__doc__.strip().split()))
|
||||||
LOG.debug(_('Ext namespace: %s'), extension.namespace)
|
LOG.debug('Ext namespace: %s', extension.namespace)
|
||||||
LOG.debug(_('Ext updated: %s'), extension.updated)
|
LOG.debug('Ext updated: %s', extension.updated)
|
||||||
except AttributeError as ex:
|
except AttributeError as ex:
|
||||||
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
|
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
|
||||||
return False
|
return False
|
||||||
@ -254,13 +254,13 @@ class ExtensionManager(object):
|
|||||||
expected to call the register() method at least once.
|
expected to call the register() method at least once.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_("Loading extension %s"), ext_factory)
|
LOG.debug("Loading extension %s", ext_factory)
|
||||||
|
|
||||||
# Load the factory
|
# Load the factory
|
||||||
factory = importutils.import_class(ext_factory)
|
factory = importutils.import_class(ext_factory)
|
||||||
|
|
||||||
# Call it
|
# Call it
|
||||||
LOG.debug(_("Calling extension factory %s"), ext_factory)
|
LOG.debug("Calling extension factory %s", ext_factory)
|
||||||
factory(self)
|
factory(self)
|
||||||
|
|
||||||
def _load_extensions(self):
|
def _load_extensions(self):
|
||||||
|
@ -86,7 +86,7 @@ class APIRouter(base_wsgi.Router):
|
|||||||
|
|
||||||
def _setup_ext_routes(self, mapper, ext_mgr):
|
def _setup_ext_routes(self, mapper, ext_mgr):
|
||||||
for resource in ext_mgr.get_resources():
|
for resource in ext_mgr.get_resources():
|
||||||
LOG.debug(_('Extended resource: %s'),
|
LOG.debug('Extended resource: %s',
|
||||||
resource.collection)
|
resource.collection)
|
||||||
|
|
||||||
wsgi_resource = wsgi.Resource(resource.controller)
|
wsgi_resource = wsgi.Resource(resource.controller)
|
||||||
@ -116,8 +116,8 @@ class APIRouter(base_wsgi.Router):
|
|||||||
'collection': collection})
|
'collection': collection})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
LOG.debug(_('Extension %(ext_name)s extending resource: '
|
LOG.debug('Extension %(ext_name)s extending resource: '
|
||||||
'%(collection)s'),
|
'%(collection)s',
|
||||||
{'ext_name': extension.extension.name,
|
{'ext_name': extension.extension.name,
|
||||||
'collection': collection})
|
'collection': collection})
|
||||||
|
|
||||||
|
@ -784,17 +784,17 @@ class Resource(wsgi.Application):
|
|||||||
def get_body(self, request):
|
def get_body(self, request):
|
||||||
|
|
||||||
if len(request.body) == 0:
|
if len(request.body) == 0:
|
||||||
LOG.debug(_("Empty body provided in request"))
|
LOG.debug("Empty body provided in request")
|
||||||
return None, ''
|
return None, ''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content_type = request.get_content_type()
|
content_type = request.get_content_type()
|
||||||
except exception.InvalidContentType:
|
except exception.InvalidContentType:
|
||||||
LOG.debug(_("Unrecognized Content-Type provided in request"))
|
LOG.debug("Unrecognized Content-Type provided in request")
|
||||||
return None, ''
|
return None, ''
|
||||||
|
|
||||||
if not content_type:
|
if not content_type:
|
||||||
LOG.debug(_("No Content-Type provided in request"))
|
LOG.debug("No Content-Type provided in request")
|
||||||
return None, ''
|
return None, ''
|
||||||
|
|
||||||
return content_type, request.body
|
return content_type, request.body
|
||||||
|
@ -63,7 +63,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
save them in the provided container dictionary.
|
save them in the provided container dictionary.
|
||||||
"""
|
"""
|
||||||
type_tag = self.TYPE_TAG_VOL_BASE_META
|
type_tag = self.TYPE_TAG_VOL_BASE_META
|
||||||
LOG.debug(_("Getting metadata type '%s'") % type_tag)
|
LOG.debug("Getting metadata type '%s'" % type_tag)
|
||||||
meta = self.db.volume_get(self.context, volume_id)
|
meta = self.db.volume_get(self.context, volume_id)
|
||||||
if meta:
|
if meta:
|
||||||
container[type_tag] = {}
|
container[type_tag] = {}
|
||||||
@ -75,9 +75,9 @@ class BackupMetadataAPI(base.Base):
|
|||||||
continue
|
continue
|
||||||
container[type_tag][key] = value
|
container[type_tag][key] = value
|
||||||
|
|
||||||
LOG.debug(_("Completed fetching metadata type '%s'") % type_tag)
|
LOG.debug("Completed fetching metadata type '%s'" % type_tag)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No metadata type '%s' available") % type_tag)
|
LOG.debug("No metadata type '%s' available" % type_tag)
|
||||||
|
|
||||||
def _save_vol_meta(self, container, volume_id):
|
def _save_vol_meta(self, container, volume_id):
|
||||||
"""Save volume metadata to container.
|
"""Save volume metadata to container.
|
||||||
@ -86,7 +86,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
volume_id and save them in the provided container dictionary.
|
volume_id and save them in the provided container dictionary.
|
||||||
"""
|
"""
|
||||||
type_tag = self.TYPE_TAG_VOL_META
|
type_tag = self.TYPE_TAG_VOL_META
|
||||||
LOG.debug(_("Getting metadata type '%s'") % type_tag)
|
LOG.debug("Getting metadata type '%s'" % type_tag)
|
||||||
meta = self.db.volume_metadata_get(self.context, volume_id)
|
meta = self.db.volume_metadata_get(self.context, volume_id)
|
||||||
if meta:
|
if meta:
|
||||||
container[type_tag] = {}
|
container[type_tag] = {}
|
||||||
@ -98,9 +98,9 @@ class BackupMetadataAPI(base.Base):
|
|||||||
continue
|
continue
|
||||||
container[type_tag][entry] = meta[entry]
|
container[type_tag][entry] = meta[entry]
|
||||||
|
|
||||||
LOG.debug(_("Completed fetching metadata type '%s'") % type_tag)
|
LOG.debug("Completed fetching metadata type '%s'" % type_tag)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No metadata type '%s' available") % type_tag)
|
LOG.debug("No metadata type '%s' available" % type_tag)
|
||||||
|
|
||||||
def _save_vol_glance_meta(self, container, volume_id):
|
def _save_vol_glance_meta(self, container, volume_id):
|
||||||
"""Save volume Glance metadata to container.
|
"""Save volume Glance metadata to container.
|
||||||
@ -109,7 +109,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
volume_id and save them in the provided container dictionary.
|
volume_id and save them in the provided container dictionary.
|
||||||
"""
|
"""
|
||||||
type_tag = self.TYPE_TAG_VOL_GLANCE_META
|
type_tag = self.TYPE_TAG_VOL_GLANCE_META
|
||||||
LOG.debug(_("Getting metadata type '%s'") % type_tag)
|
LOG.debug("Getting metadata type '%s'" % type_tag)
|
||||||
try:
|
try:
|
||||||
meta = self.db.volume_glance_metadata_get(self.context, volume_id)
|
meta = self.db.volume_glance_metadata_get(self.context, volume_id)
|
||||||
if meta:
|
if meta:
|
||||||
@ -122,9 +122,9 @@ class BackupMetadataAPI(base.Base):
|
|||||||
continue
|
continue
|
||||||
container[type_tag][entry.key] = entry.value
|
container[type_tag][entry.key] = entry.value
|
||||||
|
|
||||||
LOG.debug(_("Completed fetching metadata type '%s'") % type_tag)
|
LOG.debug("Completed fetching metadata type '%s'" % type_tag)
|
||||||
except exception.GlanceMetadataNotFound:
|
except exception.GlanceMetadataNotFound:
|
||||||
LOG.debug(_("No metadata type '%s' available") % type_tag)
|
LOG.debug("No metadata type '%s' available" % type_tag)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _filter(metadata, fields):
|
def _filter(metadata, fields):
|
||||||
@ -140,13 +140,13 @@ class BackupMetadataAPI(base.Base):
|
|||||||
if field in metadata:
|
if field in metadata:
|
||||||
subset[field] = metadata[field]
|
subset[field] = metadata[field]
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Excluding field '%s'") % (field))
|
LOG.debug("Excluding field '%s'" % (field))
|
||||||
|
|
||||||
return subset
|
return subset
|
||||||
|
|
||||||
def _restore_vol_base_meta(self, metadata, volume_id, fields):
|
def _restore_vol_base_meta(self, metadata, volume_id, fields):
|
||||||
"""Restore values to Volume object for provided fields."""
|
"""Restore values to Volume object for provided fields."""
|
||||||
LOG.debug(_("Restoring volume base metadata"))
|
LOG.debug("Restoring volume base metadata")
|
||||||
# Only set the display_name if it was not None since the
|
# Only set the display_name if it was not None since the
|
||||||
# restore action will have set a name which is more useful than
|
# restore action will have set a name which is more useful than
|
||||||
# None.
|
# None.
|
||||||
@ -159,7 +159,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
|
|
||||||
def _restore_vol_meta(self, metadata, volume_id, fields):
|
def _restore_vol_meta(self, metadata, volume_id, fields):
|
||||||
"""Restore values to VolumeMetadata object for provided fields."""
|
"""Restore values to VolumeMetadata object for provided fields."""
|
||||||
LOG.debug(_("Restoring volume metadata"))
|
LOG.debug("Restoring volume metadata")
|
||||||
metadata = self._filter(metadata, fields)
|
metadata = self._filter(metadata, fields)
|
||||||
self.db.volume_metadata_update(self.context, volume_id, metadata, True)
|
self.db.volume_metadata_update(self.context, volume_id, metadata, True)
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
|
|
||||||
First delete any existing metadata then save new values.
|
First delete any existing metadata then save new values.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Restoring volume glance metadata"))
|
LOG.debug("Restoring volume glance metadata")
|
||||||
metadata = self._filter(metadata, fields)
|
metadata = self._filter(metadata, fields)
|
||||||
self.db.volume_glance_metadata_delete_by_volume(self.context,
|
self.db.volume_glance_metadata_delete_by_volume(self.context,
|
||||||
volume_id)
|
volume_id)
|
||||||
@ -235,7 +235,7 @@ class BackupMetadataAPI(base.Base):
|
|||||||
if type in meta_container:
|
if type in meta_container:
|
||||||
func(meta_container[type], volume_id, fields)
|
func(meta_container[type], volume_id, fields)
|
||||||
else:
|
else:
|
||||||
msg = _("No metadata of type '%s' to restore") % (type)
|
msg = "No metadata of type '%s' to restore" % (type)
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class VolumeMetadataBackup(object):
|
|||||||
"""
|
"""
|
||||||
meta_obj = rados.Object(self._client.ioctx, self.name)
|
meta_obj = rados.Object(self._client.ioctx, self.name)
|
||||||
if not self._exists(meta_obj):
|
if not self._exists(meta_obj):
|
||||||
msg = _("Metadata backup object %s does not exist") % self.name
|
msg = "Metadata backup object %s does not exist" % self.name
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class VolumeMetadataBackup(object):
|
|||||||
try:
|
try:
|
||||||
meta_obj.remove()
|
meta_obj.remove()
|
||||||
except rados.ObjectNotFound:
|
except rados.ObjectNotFound:
|
||||||
msg = (_("Metadata backup object '%s' not found - ignoring") %
|
msg = ("Metadata backup object '%s' not found - ignoring" %
|
||||||
self.name)
|
self.name)
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
and pad with zeroes.
|
and pad with zeroes.
|
||||||
"""
|
"""
|
||||||
if length:
|
if length:
|
||||||
LOG.debug(_("Discarding %(length)s bytes from offset %(offset)s") %
|
LOG.debug("Discarding %(length)s bytes from offset %(offset)s" %
|
||||||
{'length': length, 'offset': offset})
|
{'length': length, 'offset': offset})
|
||||||
if self._file_is_rbd(volume):
|
if self._file_is_rbd(volume):
|
||||||
volume.rbd_image.discard(offset, length)
|
volume.rbd_image.discard(offset, length)
|
||||||
@ -284,7 +284,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
zeroes = '\0' * length
|
zeroes = '\0' * length
|
||||||
chunks = int(length / self.chunk_size)
|
chunks = int(length / self.chunk_size)
|
||||||
for chunk in xrange(0, chunks):
|
for chunk in xrange(0, chunks):
|
||||||
LOG.debug(_("Writing zeroes chunk %d") % chunk)
|
LOG.debug("Writing zeroes chunk %d" % chunk)
|
||||||
volume.write(zeroes)
|
volume.write(zeroes)
|
||||||
volume.flush()
|
volume.flush()
|
||||||
# yield to any other pending backups
|
# yield to any other pending backups
|
||||||
@ -298,11 +298,11 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
def _transfer_data(self, src, src_name, dest, dest_name, length):
|
def _transfer_data(self, src, src_name, dest, dest_name, length):
|
||||||
"""Transfer data between files (Python IO objects)."""
|
"""Transfer data between files (Python IO objects)."""
|
||||||
LOG.debug(_("Transferring data between '%(src)s' and '%(dest)s'") %
|
LOG.debug("Transferring data between '%(src)s' and '%(dest)s'" %
|
||||||
{'src': src_name, 'dest': dest_name})
|
{'src': src_name, 'dest': dest_name})
|
||||||
|
|
||||||
chunks = int(length / self.chunk_size)
|
chunks = int(length / self.chunk_size)
|
||||||
LOG.debug(_("%(chunks)s chunks of %(bytes)s bytes to be transferred") %
|
LOG.debug("%(chunks)s chunks of %(bytes)s bytes to be transferred" %
|
||||||
{'chunks': chunks, 'bytes': self.chunk_size})
|
{'chunks': chunks, 'bytes': self.chunk_size})
|
||||||
|
|
||||||
for chunk in xrange(0, chunks):
|
for chunk in xrange(0, chunks):
|
||||||
@ -331,7 +331,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
rem = int(length % self.chunk_size)
|
rem = int(length % self.chunk_size)
|
||||||
if rem:
|
if rem:
|
||||||
LOG.debug(_("Transferring remaining %s bytes") % rem)
|
LOG.debug("Transferring remaining %s bytes" % rem)
|
||||||
data = src.read(rem)
|
data = src.read(rem)
|
||||||
if data == '':
|
if data == '':
|
||||||
if CONF.restore_discard_excess_bytes:
|
if CONF.restore_discard_excess_bytes:
|
||||||
@ -347,7 +347,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
This will be the base image used for storing differential exports.
|
This will be the base image used for storing differential exports.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Creating base image '%s'") % name)
|
LOG.debug("Creating base image '%s'" % name)
|
||||||
old_format, features = self._get_rbd_support()
|
old_format, features = self._get_rbd_support()
|
||||||
self.rbd.RBD().create(ioctx=rados_client.ioctx,
|
self.rbd.RBD().create(ioctx=rados_client.ioctx,
|
||||||
name=name,
|
name=name,
|
||||||
@ -374,10 +374,10 @@ class CephBackupDriver(BackupDriver):
|
|||||||
snap_name = self._get_backup_snap_name(base_rbd, base_name,
|
snap_name = self._get_backup_snap_name(base_rbd, base_name,
|
||||||
backup_id)
|
backup_id)
|
||||||
if snap_name:
|
if snap_name:
|
||||||
LOG.debug(_("Deleting backup snapshot='%s'") % snap_name)
|
LOG.debug("Deleting backup snapshot='%s'" % snap_name)
|
||||||
base_rbd.remove_snap(snap_name)
|
base_rbd.remove_snap(snap_name)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No backup snapshot to delete"))
|
LOG.debug("No backup snapshot to delete")
|
||||||
|
|
||||||
# Now check whether any snapshots remain on the base image
|
# Now check whether any snapshots remain on the base image
|
||||||
backup_snaps = self.get_backup_snaps(base_rbd)
|
backup_snaps = self.get_backup_snaps(base_rbd)
|
||||||
@ -413,8 +413,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
try_diff_format = True
|
try_diff_format = True
|
||||||
|
|
||||||
base_name = self._get_backup_base_name(volume_id, backup_id)
|
base_name = self._get_backup_base_name(volume_id, backup_id)
|
||||||
LOG.debug(_("Trying diff format basename='%(basename)s' for "
|
LOG.debug("Trying diff format basename='%(basename)s' for "
|
||||||
"backup base image of volume %(volume)s.") %
|
"backup base image of volume %(volume)s." %
|
||||||
{'basename': base_name, 'volume': volume_id})
|
{'basename': base_name, 'volume': volume_id})
|
||||||
|
|
||||||
with rbd_driver.RADOSClient(self) as client:
|
with rbd_driver.RADOSClient(self) as client:
|
||||||
@ -460,8 +460,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
'basename': base_name})
|
'basename': base_name})
|
||||||
raise exc
|
raise exc
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Base backup image='%(basename)s' of volume "
|
LOG.debug("Base backup image='%(basename)s' of volume "
|
||||||
"%(volume)s deleted.") %
|
"%(volume)s deleted." %
|
||||||
{'basename': base_name, 'volume': volume_id})
|
{'basename': base_name, 'volume': volume_id})
|
||||||
retries = 0
|
retries = 0
|
||||||
finally:
|
finally:
|
||||||
@ -471,8 +471,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
# volume backup snapshot.
|
# volume backup snapshot.
|
||||||
src_name = strutils.safe_encode(volume_id)
|
src_name = strutils.safe_encode(volume_id)
|
||||||
if src_name in self.rbd.RBD().list(client.ioctx):
|
if src_name in self.rbd.RBD().list(client.ioctx):
|
||||||
LOG.debug(_("Deleting source volume snapshot '%(snapshot)s' "
|
LOG.debug("Deleting source volume snapshot '%(snapshot)s' "
|
||||||
"for backup %(basename)s.") %
|
"for backup %(basename)s." %
|
||||||
{'snapshot': snap, 'basename': base_name})
|
{'snapshot': snap, 'basename': base_name})
|
||||||
src_rbd = self.rbd.Image(client.ioctx, src_name)
|
src_rbd = self.rbd.Image(client.ioctx, src_name)
|
||||||
try:
|
try:
|
||||||
@ -482,8 +482,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
def _piped_execute(self, cmd1, cmd2):
|
def _piped_execute(self, cmd1, cmd2):
|
||||||
"""Pipe output of cmd1 into cmd2."""
|
"""Pipe output of cmd1 into cmd2."""
|
||||||
LOG.debug(_("Piping cmd1='%s' into...") % ' '.join(cmd1))
|
LOG.debug("Piping cmd1='%s' into..." % ' '.join(cmd1))
|
||||||
LOG.debug(_("cmd2='%s'") % ' '.join(cmd2))
|
LOG.debug("cmd2='%s'" % ' '.join(cmd2))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE,
|
p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE,
|
||||||
@ -519,8 +519,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
since the rbd volume/base was created, otherwise it will be those
|
since the rbd volume/base was created, otherwise it will be those
|
||||||
changed since the snapshot was created.
|
changed since the snapshot was created.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Performing differential transfer from '%(src)s' to "
|
LOG.debug("Performing differential transfer from '%(src)s' to "
|
||||||
"'%(dest)s'") %
|
"'%(dest)s'" %
|
||||||
{'src': src_name, 'dest': dest_name})
|
{'src': src_name, 'dest': dest_name})
|
||||||
|
|
||||||
# NOTE(dosaboy): Need to be tolerant of clusters/clients that do
|
# NOTE(dosaboy): Need to be tolerant of clusters/clients that do
|
||||||
@ -557,12 +557,12 @@ class CephBackupDriver(BackupDriver):
|
|||||||
"""Return tuple (exists, name)."""
|
"""Return tuple (exists, name)."""
|
||||||
rbds = self.rbd.RBD().list(client.ioctx)
|
rbds = self.rbd.RBD().list(client.ioctx)
|
||||||
if name not in rbds:
|
if name not in rbds:
|
||||||
msg = _("Image '%s' not found - trying diff format name") % name
|
msg = "Image '%s' not found - trying diff format name" % name
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
if try_diff_format:
|
if try_diff_format:
|
||||||
name = self._get_backup_base_name(volume_id, diff_format=True)
|
name = self._get_backup_base_name(volume_id, diff_format=True)
|
||||||
if name not in rbds:
|
if name not in rbds:
|
||||||
msg = _("Diff format image '%s' not found") % name
|
msg = "Diff format image '%s' not found" % name
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
return False, name
|
return False, name
|
||||||
else:
|
else:
|
||||||
@ -597,8 +597,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
# Identify our --from-snap point (if one exists)
|
# Identify our --from-snap point (if one exists)
|
||||||
from_snap = self._get_most_recent_snap(source_rbd_image)
|
from_snap = self._get_most_recent_snap(source_rbd_image)
|
||||||
LOG.debug(_("Using --from-snap '%(snap)s' for incremental backup of "
|
LOG.debug("Using --from-snap '%(snap)s' for incremental backup of "
|
||||||
"volume %(volume)s.") %
|
"volume %(volume)s." %
|
||||||
{'snap': from_snap, 'volume': volume_id})
|
{'snap': from_snap, 'volume': volume_id})
|
||||||
|
|
||||||
base_name = self._get_backup_base_name(volume_id, diff_format=True)
|
base_name = self._get_backup_base_name(volume_id, diff_format=True)
|
||||||
@ -614,8 +614,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
# If a from_snap is defined but the base does not exist, we
|
# If a from_snap is defined but the base does not exist, we
|
||||||
# ignore it since it is stale and waiting to be cleaned up.
|
# ignore it since it is stale and waiting to be cleaned up.
|
||||||
if from_snap:
|
if from_snap:
|
||||||
LOG.debug(_("Source snapshot '%(snapshot)s' of volume "
|
LOG.debug("Source snapshot '%(snapshot)s' of volume "
|
||||||
"%(volume)s is stale so deleting.") %
|
"%(volume)s is stale so deleting." %
|
||||||
{'snapshot': from_snap, 'volume': volume_id})
|
{'snapshot': from_snap, 'volume': volume_id})
|
||||||
source_rbd_image.remove_snap(from_snap)
|
source_rbd_image.remove_snap(from_snap)
|
||||||
from_snap = None
|
from_snap = None
|
||||||
@ -638,7 +638,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
# Snapshot source volume so that we have a new point-in-time
|
# Snapshot source volume so that we have a new point-in-time
|
||||||
new_snap = self._get_new_snap_name(backup_id)
|
new_snap = self._get_new_snap_name(backup_id)
|
||||||
LOG.debug(_("Creating backup snapshot='%s'") % new_snap)
|
LOG.debug("Creating backup snapshot='%s'" % new_snap)
|
||||||
source_rbd_image.create_snap(new_snap)
|
source_rbd_image.create_snap(new_snap)
|
||||||
|
|
||||||
# Attempt differential backup. If this fails, perhaps because librbd
|
# Attempt differential backup. If this fails, perhaps because librbd
|
||||||
@ -658,7 +658,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
src_snap=new_snap,
|
src_snap=new_snap,
|
||||||
from_snap=from_snap)
|
from_snap=from_snap)
|
||||||
|
|
||||||
LOG.debug(_("Differential backup transfer completed in %.4fs") %
|
LOG.debug("Differential backup transfer completed in %.4fs" %
|
||||||
(time.time() - before))
|
(time.time() - before))
|
||||||
|
|
||||||
# We don't need the previous snapshot (if there was one) anymore so
|
# We don't need the previous snapshot (if there was one) anymore so
|
||||||
@ -667,7 +667,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
source_rbd_image.remove_snap(from_snap)
|
source_rbd_image.remove_snap(from_snap)
|
||||||
|
|
||||||
except exception.BackupRBDOperationFailed:
|
except exception.BackupRBDOperationFailed:
|
||||||
LOG.debug(_("Differential backup transfer failed"))
|
LOG.debug("Differential backup transfer failed")
|
||||||
|
|
||||||
# Clean up if image was created as part of this operation
|
# Clean up if image was created as part of this operation
|
||||||
if image_created:
|
if image_created:
|
||||||
@ -675,8 +675,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
base_name=base_name)
|
base_name=base_name)
|
||||||
|
|
||||||
# Delete snapshot
|
# Delete snapshot
|
||||||
LOG.debug(_("Deleting diff backup snapshot='%(snapshot)s' of "
|
LOG.debug("Deleting diff backup snapshot='%(snapshot)s' of "
|
||||||
"source volume='%(volume)s'.") %
|
"source volume='%(volume)s'." %
|
||||||
{'snapshot': new_snap, 'volume': volume_id})
|
{'snapshot': new_snap, 'volume': volume_id})
|
||||||
source_rbd_image.remove_snap(new_snap)
|
source_rbd_image.remove_snap(new_snap)
|
||||||
|
|
||||||
@ -699,8 +699,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
with rbd_driver.RADOSClient(self, self._ceph_backup_pool) as client:
|
with rbd_driver.RADOSClient(self, self._ceph_backup_pool) as client:
|
||||||
# First create base backup image
|
# First create base backup image
|
||||||
old_format, features = self._get_rbd_support()
|
old_format, features = self._get_rbd_support()
|
||||||
LOG.debug(_("Creating backup base image='%(name)s' for volume "
|
LOG.debug("Creating backup base image='%(name)s' for volume "
|
||||||
"%(volume)s.")
|
"%(volume)s."
|
||||||
% {'name': backup_name, 'volume': volume_id})
|
% {'name': backup_name, 'volume': volume_id})
|
||||||
self.rbd.RBD().create(ioctx=client.ioctx,
|
self.rbd.RBD().create(ioctx=client.ioctx,
|
||||||
name=backup_name,
|
name=backup_name,
|
||||||
@ -710,7 +710,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
stripe_unit=self.rbd_stripe_unit,
|
stripe_unit=self.rbd_stripe_unit,
|
||||||
stripe_count=self.rbd_stripe_count)
|
stripe_count=self.rbd_stripe_count)
|
||||||
|
|
||||||
LOG.debug(_("Copying data from volume %s.") % volume_id)
|
LOG.debug("Copying data from volume %s." % volume_id)
|
||||||
dest_rbd = self.rbd.Image(client.ioctx, backup_name)
|
dest_rbd = self.rbd.Image(client.ioctx, backup_name)
|
||||||
try:
|
try:
|
||||||
rbd_meta = rbd_driver.RBDImageMetadata(dest_rbd,
|
rbd_meta = rbd_driver.RBDImageMetadata(dest_rbd,
|
||||||
@ -771,17 +771,17 @@ class CephBackupDriver(BackupDriver):
|
|||||||
"""
|
"""
|
||||||
snaps = self.get_backup_snaps(rbd_image)
|
snaps = self.get_backup_snaps(rbd_image)
|
||||||
|
|
||||||
LOG.debug(_("Looking for snapshot of backup base '%s'") % name)
|
LOG.debug("Looking for snapshot of backup base '%s'" % name)
|
||||||
|
|
||||||
if not snaps:
|
if not snaps:
|
||||||
LOG.debug(_("Backup base '%s' has no snapshots") % name)
|
LOG.debug("Backup base '%s' has no snapshots" % name)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
snaps = [snap['name'] for snap in snaps
|
snaps = [snap['name'] for snap in snaps
|
||||||
if snap['backup_id'] == backup_id]
|
if snap['backup_id'] == backup_id]
|
||||||
|
|
||||||
if not snaps:
|
if not snaps:
|
||||||
LOG.debug(_("Backup '%s' has no snapshot") % backup_id)
|
LOG.debug("Backup '%s' has no snapshot" % backup_id)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(snaps) > 1:
|
if len(snaps) > 1:
|
||||||
@ -790,7 +790,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.BackupOperationError(msg)
|
raise exception.BackupOperationError(msg)
|
||||||
|
|
||||||
LOG.debug(_("Found snapshot '%s'") % (snaps[0]))
|
LOG.debug("Found snapshot '%s'" % (snaps[0]))
|
||||||
return snaps[0]
|
return snaps[0]
|
||||||
|
|
||||||
def _get_most_recent_snap(self, rbd_image):
|
def _get_most_recent_snap(self, rbd_image):
|
||||||
@ -826,11 +826,11 @@ class CephBackupDriver(BackupDriver):
|
|||||||
"""
|
"""
|
||||||
json_meta = self.get_metadata(backup['volume_id'])
|
json_meta = self.get_metadata(backup['volume_id'])
|
||||||
if not json_meta:
|
if not json_meta:
|
||||||
LOG.debug(_("No metadata to backup for volume %s.") %
|
LOG.debug("No metadata to backup for volume %s." %
|
||||||
backup['volume_id'])
|
backup['volume_id'])
|
||||||
return
|
return
|
||||||
|
|
||||||
LOG.debug(_("Backing up metadata for volume %s.") %
|
LOG.debug("Backing up metadata for volume %s." %
|
||||||
backup['volume_id'])
|
backup['volume_id'])
|
||||||
try:
|
try:
|
||||||
with rbd_driver.RADOSClient(self) as client:
|
with rbd_driver.RADOSClient(self) as client:
|
||||||
@ -852,7 +852,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
volume_id = volume['id']
|
volume_id = volume['id']
|
||||||
volume_name = volume['name']
|
volume_name = volume['name']
|
||||||
|
|
||||||
LOG.debug(_("Starting backup of volume='%s'.") % volume_id)
|
LOG.debug("Starting backup of volume='%s'." % volume_id)
|
||||||
|
|
||||||
# Ensure we are at the beginning of the volume
|
# Ensure we are at the beginning of the volume
|
||||||
volume_file.seek(0)
|
volume_file.seek(0)
|
||||||
@ -865,7 +865,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
self._backup_rbd(backup_id, volume_id, volume_file,
|
self._backup_rbd(backup_id, volume_id, volume_file,
|
||||||
volume_name, length)
|
volume_name, length)
|
||||||
except exception.BackupRBDOperationFailed:
|
except exception.BackupRBDOperationFailed:
|
||||||
LOG.debug(_("Forcing full backup of volume %s.") % volume_id)
|
LOG.debug("Forcing full backup of volume %s." % volume_id)
|
||||||
do_full_backup = True
|
do_full_backup = True
|
||||||
else:
|
else:
|
||||||
do_full_backup = True
|
do_full_backup = True
|
||||||
@ -885,7 +885,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
self.delete(backup)
|
self.delete(backup)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
LOG.debug(_("Backup '%(backup_id)s' of volume %(volume_id)s finished.")
|
LOG.debug("Backup '%(backup_id)s' of volume %(volume_id)s finished."
|
||||||
% {'backup_id': backup_id, 'volume_id': volume_id})
|
% {'backup_id': backup_id, 'volume_id': volume_id})
|
||||||
|
|
||||||
def _full_restore(self, backup_id, volume_id, dest_file, dest_name,
|
def _full_restore(self, backup_id, volume_id, dest_file, dest_name,
|
||||||
@ -945,7 +945,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
dest_image = self.rbd.Image(client.ioctx,
|
dest_image = self.rbd.Image(client.ioctx,
|
||||||
strutils.safe_encode(restore_vol))
|
strutils.safe_encode(restore_vol))
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Adjusting restore vol size"))
|
LOG.debug("Adjusting restore vol size")
|
||||||
dest_image.resize(adjust_size)
|
dest_image.resize(adjust_size)
|
||||||
finally:
|
finally:
|
||||||
dest_image.close()
|
dest_image.close()
|
||||||
@ -957,8 +957,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
rbd_pool = restore_file.rbd_pool
|
rbd_pool = restore_file.rbd_pool
|
||||||
rbd_conf = restore_file.rbd_conf
|
rbd_conf = restore_file.rbd_conf
|
||||||
|
|
||||||
LOG.debug(_("Attempting incremental restore from base='%(base)s' "
|
LOG.debug("Attempting incremental restore from base='%(base)s' "
|
||||||
"snap='%(snap)s'") %
|
"snap='%(snap)s'" %
|
||||||
{'base': base_name, 'snap': restore_point})
|
{'base': base_name, 'snap': restore_point})
|
||||||
before = time.time()
|
before = time.time()
|
||||||
try:
|
try:
|
||||||
@ -980,7 +980,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
self._check_restore_vol_size(base_name, restore_name, restore_length,
|
self._check_restore_vol_size(base_name, restore_name, restore_length,
|
||||||
rbd_pool)
|
rbd_pool)
|
||||||
|
|
||||||
LOG.debug(_("Restore transfer completed in %.4fs") %
|
LOG.debug("Restore transfer completed in %.4fs" %
|
||||||
(time.time() - before))
|
(time.time() - before))
|
||||||
|
|
||||||
def _num_backup_snaps(self, backup_base_name):
|
def _num_backup_snaps(self, backup_base_name):
|
||||||
@ -1029,7 +1029,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
rbd_volume.diff_iterate(0, rbd_volume.size(), None, iter_cb)
|
rbd_volume.diff_iterate(0, rbd_volume.size(), None, iter_cb)
|
||||||
|
|
||||||
if extents:
|
if extents:
|
||||||
LOG.debug(_("RBD has %s extents") % sum(extents))
|
LOG.debug("RBD has %s extents" % sum(extents))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@ -1066,8 +1066,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
# made from, force a full restore since a diff will not work in
|
# made from, force a full restore since a diff will not work in
|
||||||
# this case.
|
# this case.
|
||||||
if volume['id'] == backup['volume_id']:
|
if volume['id'] == backup['volume_id']:
|
||||||
msg = (_("Destination volume is same as backup source volume "
|
msg = ("Destination volume is same as backup source volume "
|
||||||
"%s - forcing full copy.") % volume['id'])
|
"%s - forcing full copy." % volume['id'])
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
return False, restore_point
|
return False, restore_point
|
||||||
|
|
||||||
@ -1077,7 +1077,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
if self._rbd_has_extents(volume_file.rbd_image):
|
if self._rbd_has_extents(volume_file.rbd_image):
|
||||||
# We return the restore point so that a full copy is done
|
# We return the restore point so that a full copy is done
|
||||||
# from snapshot.
|
# from snapshot.
|
||||||
LOG.debug(_("Destination has extents - forcing full copy"))
|
LOG.debug("Destination has extents - forcing full copy")
|
||||||
return False, restore_point
|
return False, restore_point
|
||||||
|
|
||||||
return True, restore_point
|
return True, restore_point
|
||||||
@ -1115,7 +1115,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
restore_point, length)
|
restore_point, length)
|
||||||
do_full_restore = False
|
do_full_restore = False
|
||||||
except exception.BackupRBDOperationFailed:
|
except exception.BackupRBDOperationFailed:
|
||||||
LOG.debug(_("Forcing full restore to volume %s.") %
|
LOG.debug("Forcing full restore to volume %s." %
|
||||||
volume['id'])
|
volume['id'])
|
||||||
|
|
||||||
if do_full_restore:
|
if do_full_restore:
|
||||||
@ -1136,7 +1136,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
if meta is not None:
|
if meta is not None:
|
||||||
self.put_metadata(volume_id, meta)
|
self.put_metadata(volume_id, meta)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Volume %s has no backed up metadata.") %
|
LOG.debug("Volume %s has no backed up metadata." %
|
||||||
backup['volume_id'])
|
backup['volume_id'])
|
||||||
except exception.BackupMetadataUnsupportedVersion:
|
except exception.BackupMetadataUnsupportedVersion:
|
||||||
msg = _("Metadata restore failed due to incompatible version")
|
msg = _("Metadata restore failed due to incompatible version")
|
||||||
@ -1149,8 +1149,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
If volume metadata is available this will also be restored.
|
If volume metadata is available this will also be restored.
|
||||||
"""
|
"""
|
||||||
target_volume = self.db.volume_get(self.context, volume_id)
|
target_volume = self.db.volume_get(self.context, volume_id)
|
||||||
LOG.debug(_('Starting restore from Ceph backup=%(src)s to '
|
LOG.debug('Starting restore from Ceph backup=%(src)s to '
|
||||||
'volume=%(dest)s') %
|
'volume=%(dest)s' %
|
||||||
{'src': backup['id'], 'dest': target_volume['name']})
|
{'src': backup['id'], 'dest': target_volume['name']})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -1160,14 +1160,14 @@ class CephBackupDriver(BackupDriver):
|
|||||||
try:
|
try:
|
||||||
fileno = volume_file.fileno()
|
fileno = volume_file.fileno()
|
||||||
except IOError:
|
except IOError:
|
||||||
LOG.debug(_("Restore target I/O object does not support "
|
LOG.debug("Restore target I/O object does not support "
|
||||||
"fileno() - skipping call to fsync()."))
|
"fileno() - skipping call to fsync().")
|
||||||
else:
|
else:
|
||||||
os.fsync(fileno)
|
os.fsync(fileno)
|
||||||
|
|
||||||
self._restore_metadata(backup, volume_id)
|
self._restore_metadata(backup, volume_id)
|
||||||
|
|
||||||
LOG.debug(_('Restore to volume %s finished successfully.') %
|
LOG.debug('Restore to volume %s finished successfully.' %
|
||||||
volume_id)
|
volume_id)
|
||||||
except exception.BackupOperationError as e:
|
except exception.BackupOperationError as e:
|
||||||
LOG.error(_('Restore to volume %(volume)s finished with error - '
|
LOG.error(_('Restore to volume %(volume)s finished with error - '
|
||||||
@ -1176,7 +1176,7 @@ class CephBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
def delete(self, backup):
|
def delete(self, backup):
|
||||||
"""Delete the given backup from Ceph object store."""
|
"""Delete the given backup from Ceph object store."""
|
||||||
LOG.debug(_('Delete started for backup=%s') % backup['id'])
|
LOG.debug('Delete started for backup=%s' % backup['id'])
|
||||||
|
|
||||||
delete_failed = False
|
delete_failed = False
|
||||||
try:
|
try:
|
||||||
@ -1196,8 +1196,8 @@ class CephBackupDriver(BackupDriver):
|
|||||||
"finished with warning.") %
|
"finished with warning.") %
|
||||||
{'backup': backup['id'], 'volume': backup['volume_id']})
|
{'backup': backup['id'], 'volume': backup['volume_id']})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Delete of backup '%(backup)s' for volume "
|
LOG.debug("Delete of backup '%(backup)s' for volume "
|
||||||
"'%(volume)s' finished.") %
|
"'%(volume)s' finished." %
|
||||||
{'backup': backup['id'], 'volume': backup['volume_id']})
|
{'backup': backup['id'], 'volume': backup['volume_id']})
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
def _create_container(self, context, backup):
|
def _create_container(self, context, backup):
|
||||||
backup_id = backup['id']
|
backup_id = backup['id']
|
||||||
container = backup['container']
|
container = backup['container']
|
||||||
LOG.debug(_('_create_container started, container: %(container)s,'
|
LOG.debug('_create_container started, container: %(container)s,'
|
||||||
'backup: %(backup_id)s') %
|
'backup: %(backup_id)s' %
|
||||||
{'container': container, 'backup_id': backup_id})
|
{'container': container, 'backup_id': backup_id})
|
||||||
if container is None:
|
if container is None:
|
||||||
container = CONF.backup_swift_container
|
container = CONF.backup_swift_container
|
||||||
@ -156,7 +156,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
volume = 'volume_%s' % (backup['volume_id'])
|
volume = 'volume_%s' % (backup['volume_id'])
|
||||||
timestamp = timeutils.strtime(fmt="%Y%m%d%H%M%S")
|
timestamp = timeutils.strtime(fmt="%Y%m%d%H%M%S")
|
||||||
prefix = volume + '/' + timestamp + '/' + backup_name
|
prefix = volume + '/' + timestamp + '/' + backup_name
|
||||||
LOG.debug(_('_generate_swift_object_name_prefix: %s') % prefix)
|
LOG.debug('_generate_swift_object_name_prefix: %s' % prefix)
|
||||||
return prefix
|
return prefix
|
||||||
|
|
||||||
def _generate_object_names(self, backup):
|
def _generate_object_names(self, backup):
|
||||||
@ -165,7 +165,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
full_listing=True)[1]
|
full_listing=True)[1]
|
||||||
swift_object_names = [swift_obj['name'] for swift_obj in swift_objects]
|
swift_object_names = [swift_obj['name'] for swift_obj in swift_objects]
|
||||||
LOG.debug(_('generated object list: %s') % swift_object_names)
|
LOG.debug('generated object list: %s' % swift_object_names)
|
||||||
return swift_object_names
|
return swift_object_names
|
||||||
|
|
||||||
def _metadata_filename(self, backup):
|
def _metadata_filename(self, backup):
|
||||||
@ -176,8 +176,8 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
def _write_metadata(self, backup, volume_id, container, object_list,
|
def _write_metadata(self, backup, volume_id, container, object_list,
|
||||||
volume_meta):
|
volume_meta):
|
||||||
filename = self._metadata_filename(backup)
|
filename = self._metadata_filename(backup)
|
||||||
LOG.debug(_('_write_metadata started, container name: %(container)s,'
|
LOG.debug('_write_metadata started, container name: %(container)s,'
|
||||||
' metadata filename: %(filename)s') %
|
' metadata filename: %(filename)s' %
|
||||||
{'container': container, 'filename': filename})
|
{'container': container, 'filename': filename})
|
||||||
metadata = {}
|
metadata = {}
|
||||||
metadata['version'] = self.DRIVER_VERSION
|
metadata['version'] = self.DRIVER_VERSION
|
||||||
@ -199,17 +199,17 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
'metadata file sent to swift [%(md5)s]') % {'etag': etag,
|
'metadata file sent to swift [%(md5)s]') % {'etag': etag,
|
||||||
'md5': md5}
|
'md5': md5}
|
||||||
raise exception.InvalidBackup(reason=err)
|
raise exception.InvalidBackup(reason=err)
|
||||||
LOG.debug(_('_write_metadata finished'))
|
LOG.debug('_write_metadata finished')
|
||||||
|
|
||||||
def _read_metadata(self, backup):
|
def _read_metadata(self, backup):
|
||||||
container = backup['container']
|
container = backup['container']
|
||||||
filename = self._metadata_filename(backup)
|
filename = self._metadata_filename(backup)
|
||||||
LOG.debug(_('_read_metadata started, container name: %(container)s, '
|
LOG.debug('_read_metadata started, container name: %(container)s, '
|
||||||
'metadata filename: %(filename)s') %
|
'metadata filename: %(filename)s' %
|
||||||
{'container': container, 'filename': filename})
|
{'container': container, 'filename': filename})
|
||||||
(resp, body) = self.conn.get_object(container, filename)
|
(resp, body) = self.conn.get_object(container, filename)
|
||||||
metadata = json.loads(body)
|
metadata = json.loads(body)
|
||||||
LOG.debug(_('_read_metadata finished (%s)') % metadata)
|
LOG.debug('_read_metadata finished (%s)' % metadata)
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
def _prepare_backup(self, backup):
|
def _prepare_backup(self, backup):
|
||||||
@ -233,10 +233,10 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
object_prefix})
|
object_prefix})
|
||||||
volume_size_bytes = volume['size'] * units.GiB
|
volume_size_bytes = volume['size'] * units.GiB
|
||||||
availability_zone = self.az
|
availability_zone = self.az
|
||||||
LOG.debug(_('starting backup of volume: %(volume_id)s to swift,'
|
LOG.debug('starting backup of volume: %(volume_id)s to swift,'
|
||||||
' volume size: %(volume_size_bytes)d, swift object names'
|
' volume size: %(volume_size_bytes)d, swift object names'
|
||||||
' prefix %(object_prefix)s, availability zone:'
|
' prefix %(object_prefix)s, availability zone:'
|
||||||
' %(availability_zone)s') %
|
' %(availability_zone)s' %
|
||||||
{
|
{
|
||||||
'volume_id': volume_id,
|
'volume_id': volume_id,
|
||||||
'volume_size_bytes': volume_size_bytes,
|
'volume_size_bytes': volume_size_bytes,
|
||||||
@ -257,37 +257,37 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
obj[object_name] = {}
|
obj[object_name] = {}
|
||||||
obj[object_name]['offset'] = data_offset
|
obj[object_name]['offset'] = data_offset
|
||||||
obj[object_name]['length'] = len(data)
|
obj[object_name]['length'] = len(data)
|
||||||
LOG.debug(_('reading chunk of data from volume'))
|
LOG.debug('reading chunk of data from volume')
|
||||||
if self.compressor is not None:
|
if self.compressor is not None:
|
||||||
algorithm = CONF.backup_compression_algorithm.lower()
|
algorithm = CONF.backup_compression_algorithm.lower()
|
||||||
obj[object_name]['compression'] = algorithm
|
obj[object_name]['compression'] = algorithm
|
||||||
data_size_bytes = len(data)
|
data_size_bytes = len(data)
|
||||||
data = self.compressor.compress(data)
|
data = self.compressor.compress(data)
|
||||||
comp_size_bytes = len(data)
|
comp_size_bytes = len(data)
|
||||||
LOG.debug(_('compressed %(data_size_bytes)d bytes of data '
|
LOG.debug('compressed %(data_size_bytes)d bytes of data '
|
||||||
'to %(comp_size_bytes)d bytes using '
|
'to %(comp_size_bytes)d bytes using '
|
||||||
'%(algorithm)s') %
|
'%(algorithm)s' %
|
||||||
{
|
{
|
||||||
'data_size_bytes': data_size_bytes,
|
'data_size_bytes': data_size_bytes,
|
||||||
'comp_size_bytes': comp_size_bytes,
|
'comp_size_bytes': comp_size_bytes,
|
||||||
'algorithm': algorithm,
|
'algorithm': algorithm,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('not compressing data'))
|
LOG.debug('not compressing data')
|
||||||
obj[object_name]['compression'] = 'none'
|
obj[object_name]['compression'] = 'none'
|
||||||
|
|
||||||
reader = six.StringIO(data)
|
reader = six.StringIO(data)
|
||||||
LOG.debug(_('About to put_object'))
|
LOG.debug('About to put_object')
|
||||||
try:
|
try:
|
||||||
etag = self.conn.put_object(container, object_name, reader,
|
etag = self.conn.put_object(container, object_name, reader,
|
||||||
content_length=len(data))
|
content_length=len(data))
|
||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
raise exception.SwiftConnectionFailed(reason=err)
|
raise exception.SwiftConnectionFailed(reason=err)
|
||||||
LOG.debug(_('swift MD5 for %(object_name)s: %(etag)s') %
|
LOG.debug('swift MD5 for %(object_name)s: %(etag)s' %
|
||||||
{'object_name': object_name, 'etag': etag, })
|
{'object_name': object_name, 'etag': etag, })
|
||||||
md5 = hashlib.md5(data).hexdigest()
|
md5 = hashlib.md5(data).hexdigest()
|
||||||
obj[object_name]['md5'] = md5
|
obj[object_name]['md5'] = md5
|
||||||
LOG.debug(_('backup MD5 for %(object_name)s: %(md5)s') %
|
LOG.debug('backup MD5 for %(object_name)s: %(md5)s' %
|
||||||
{'object_name': object_name, 'md5': md5})
|
{'object_name': object_name, 'md5': md5})
|
||||||
if etag != md5:
|
if etag != md5:
|
||||||
err = _('error writing object to swift, MD5 of object in '
|
err = _('error writing object to swift, MD5 of object in '
|
||||||
@ -298,7 +298,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
object_id += 1
|
object_id += 1
|
||||||
object_meta['list'] = object_list
|
object_meta['list'] = object_list
|
||||||
object_meta['id'] = object_id
|
object_meta['id'] = object_id
|
||||||
LOG.debug(_('Calling eventlet.sleep(0)'))
|
LOG.debug('Calling eventlet.sleep(0)')
|
||||||
eventlet.sleep(0)
|
eventlet.sleep(0)
|
||||||
|
|
||||||
def _finalize_backup(self, backup, container, object_meta):
|
def _finalize_backup(self, backup, container, object_meta):
|
||||||
@ -316,7 +316,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
raise exception.SwiftConnectionFailed(reason=err)
|
raise exception.SwiftConnectionFailed(reason=err)
|
||||||
self.db.backup_update(self.context, backup['id'],
|
self.db.backup_update(self.context, backup['id'],
|
||||||
{'object_count': object_id})
|
{'object_count': object_id})
|
||||||
LOG.debug(_('backup %s finished.') % backup['id'])
|
LOG.debug('backup %s finished.' % backup['id'])
|
||||||
|
|
||||||
def _backup_metadata(self, backup, object_meta):
|
def _backup_metadata(self, backup, object_meta):
|
||||||
"""Backup volume metadata.
|
"""Backup volume metadata.
|
||||||
@ -359,12 +359,12 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
def _restore_v1(self, backup, volume_id, metadata, volume_file):
|
def _restore_v1(self, backup, volume_id, metadata, volume_file):
|
||||||
"""Restore a v1 swift volume backup from swift."""
|
"""Restore a v1 swift volume backup from swift."""
|
||||||
backup_id = backup['id']
|
backup_id = backup['id']
|
||||||
LOG.debug(_('v1 swift volume backup restore of %s started'), backup_id)
|
LOG.debug('v1 swift volume backup restore of %s started', backup_id)
|
||||||
container = backup['container']
|
container = backup['container']
|
||||||
metadata_objects = metadata['objects']
|
metadata_objects = metadata['objects']
|
||||||
metadata_object_names = sum((obj.keys() for obj in metadata_objects),
|
metadata_object_names = sum((obj.keys() for obj in metadata_objects),
|
||||||
[])
|
[])
|
||||||
LOG.debug(_('metadata_object_names = %s') % metadata_object_names)
|
LOG.debug('metadata_object_names = %s' % metadata_object_names)
|
||||||
prune_list = [self._metadata_filename(backup)]
|
prune_list = [self._metadata_filename(backup)]
|
||||||
swift_object_names = [swift_object_name for swift_object_name in
|
swift_object_names = [swift_object_name for swift_object_name in
|
||||||
self._generate_object_names(backup)
|
self._generate_object_names(backup)
|
||||||
@ -376,9 +376,9 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
|
|
||||||
for metadata_object in metadata_objects:
|
for metadata_object in metadata_objects:
|
||||||
object_name = metadata_object.keys()[0]
|
object_name = metadata_object.keys()[0]
|
||||||
LOG.debug(_('restoring object from swift. backup: %(backup_id)s, '
|
LOG.debug('restoring object from swift. backup: %(backup_id)s, '
|
||||||
'container: %(container)s, swift object name: '
|
'container: %(container)s, swift object name: '
|
||||||
'%(object_name)s, volume: %(volume_id)s') %
|
'%(object_name)s, volume: %(volume_id)s' %
|
||||||
{
|
{
|
||||||
'backup_id': backup_id,
|
'backup_id': backup_id,
|
||||||
'container': container,
|
'container': container,
|
||||||
@ -392,7 +392,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
compression_algorithm = metadata_object[object_name]['compression']
|
compression_algorithm = metadata_object[object_name]['compression']
|
||||||
decompressor = self._get_compressor(compression_algorithm)
|
decompressor = self._get_compressor(compression_algorithm)
|
||||||
if decompressor is not None:
|
if decompressor is not None:
|
||||||
LOG.debug(_('decompressing data using %s algorithm') %
|
LOG.debug('decompressing data using %s algorithm' %
|
||||||
compression_algorithm)
|
compression_algorithm)
|
||||||
decompressed = decompressor.decompress(body)
|
decompressed = decompressor.decompress(body)
|
||||||
volume_file.write(decompressed)
|
volume_file.write(decompressed)
|
||||||
@ -415,7 +415,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
# threads can run, allowing for among other things the service
|
# threads can run, allowing for among other things the service
|
||||||
# status to be updated
|
# status to be updated
|
||||||
eventlet.sleep(0)
|
eventlet.sleep(0)
|
||||||
LOG.debug(_('v1 swift volume backup restore of %s finished'),
|
LOG.debug('v1 swift volume backup restore of %s finished',
|
||||||
backup_id)
|
backup_id)
|
||||||
|
|
||||||
def restore(self, backup, volume_id, volume_file):
|
def restore(self, backup, volume_id, volume_file):
|
||||||
@ -423,9 +423,9 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
backup_id = backup['id']
|
backup_id = backup['id']
|
||||||
container = backup['container']
|
container = backup['container']
|
||||||
object_prefix = backup['service_metadata']
|
object_prefix = backup['service_metadata']
|
||||||
LOG.debug(_('starting restore of backup %(object_prefix)s from swift'
|
LOG.debug('starting restore of backup %(object_prefix)s from swift'
|
||||||
' container: %(container)s, to volume %(volume_id)s, '
|
' container: %(container)s, to volume %(volume_id)s, '
|
||||||
'backup: %(backup_id)s') %
|
'backup: %(backup_id)s' %
|
||||||
{
|
{
|
||||||
'object_prefix': object_prefix,
|
'object_prefix': object_prefix,
|
||||||
'container': container,
|
'container': container,
|
||||||
@ -437,7 +437,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
raise exception.SwiftConnectionFailed(reason=err)
|
raise exception.SwiftConnectionFailed(reason=err)
|
||||||
metadata_version = metadata['version']
|
metadata_version = metadata['version']
|
||||||
LOG.debug(_('Restoring swift backup version %s'), metadata_version)
|
LOG.debug('Restoring swift backup version %s', metadata_version)
|
||||||
try:
|
try:
|
||||||
restore_func = getattr(self, self.DRIVER_VERSION_MAPPING.get(
|
restore_func = getattr(self, self.DRIVER_VERSION_MAPPING.get(
|
||||||
metadata_version))
|
metadata_version))
|
||||||
@ -458,7 +458,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.BackupOperationError(msg)
|
raise exception.BackupOperationError(msg)
|
||||||
|
|
||||||
LOG.debug(_('restore %(backup_id)s to %(volume_id)s finished.') %
|
LOG.debug('restore %(backup_id)s to %(volume_id)s finished.' %
|
||||||
{'backup_id': backup_id, 'volume_id': volume_id})
|
{'backup_id': backup_id, 'volume_id': volume_id})
|
||||||
|
|
||||||
def delete(self, backup):
|
def delete(self, backup):
|
||||||
@ -484,8 +484,8 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
LOG.warn(_('swift error while deleting object %s, '
|
LOG.warn(_('swift error while deleting object %s, '
|
||||||
'continuing with delete') % swift_object_name)
|
'continuing with delete') % swift_object_name)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('deleted swift object: %(swift_object_name)s'
|
LOG.debug('deleted swift object: %(swift_object_name)s'
|
||||||
' in container: %(container)s') %
|
' in container: %(container)s' %
|
||||||
{
|
{
|
||||||
'swift_object_name': swift_object_name,
|
'swift_object_name': swift_object_name,
|
||||||
'container': container
|
'container': container
|
||||||
@ -494,7 +494,7 @@ class SwiftBackupDriver(BackupDriver):
|
|||||||
# Yield so other threads can run
|
# Yield so other threads can run
|
||||||
eventlet.sleep(0)
|
eventlet.sleep(0)
|
||||||
|
|
||||||
LOG.debug(_('delete %s finished') % backup['id'])
|
LOG.debug('delete %s finished' % backup['id'])
|
||||||
|
|
||||||
|
|
||||||
def get_backup_driver(context):
|
def get_backup_driver(context):
|
||||||
|
@ -367,8 +367,8 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
volume_id = backup['volume_id']
|
volume_id = backup['volume_id']
|
||||||
volume_path, backup_mode = _get_volume_realpath(volume_file,
|
volume_path, backup_mode = _get_volume_realpath(volume_file,
|
||||||
volume_id)
|
volume_id)
|
||||||
LOG.debug(_('Starting backup of volume: %(volume_id)s to TSM,'
|
LOG.debug('Starting backup of volume: %(volume_id)s to TSM,'
|
||||||
' volume path: %(volume_path)s, mode: %(mode)s.')
|
' volume path: %(volume_path)s, mode: %(mode)s.'
|
||||||
% {'volume_id': volume_id,
|
% {'volume_id': volume_id,
|
||||||
'volume_path': volume_path,
|
'volume_path': volume_path,
|
||||||
'mode': backup_mode})
|
'mode': backup_mode})
|
||||||
@ -412,7 +412,7 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
finally:
|
finally:
|
||||||
_cleanup_device_hardlink(backup_path, volume_path, volume_id)
|
_cleanup_device_hardlink(backup_path, volume_path, volume_id)
|
||||||
|
|
||||||
LOG.debug(_('Backup %s finished.') % backup_id)
|
LOG.debug('Backup %s finished.' % backup_id)
|
||||||
|
|
||||||
def restore(self, backup, volume_id, volume_file):
|
def restore(self, backup, volume_id, volume_file):
|
||||||
"""Restore the given volume backup from TSM server.
|
"""Restore the given volume backup from TSM server.
|
||||||
@ -428,10 +428,10 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
# backup_path is the path that was originally backed up.
|
# backup_path is the path that was originally backed up.
|
||||||
backup_path, backup_mode = _get_backup_metadata(backup, 'restore')
|
backup_path, backup_mode = _get_backup_metadata(backup, 'restore')
|
||||||
|
|
||||||
LOG.debug(_('Starting restore of backup from TSM '
|
LOG.debug('Starting restore of backup from TSM '
|
||||||
'to volume %(volume_id)s, '
|
'to volume %(volume_id)s, '
|
||||||
'backup: %(backup_id)s, '
|
'backup: %(backup_id)s, '
|
||||||
'mode: %(mode)s.') %
|
'mode: %(mode)s.' %
|
||||||
{'volume_id': volume_id,
|
{'volume_id': volume_id,
|
||||||
'backup_id': backup_id,
|
'backup_id': backup_id,
|
||||||
'mode': backup_mode})
|
'mode': backup_mode})
|
||||||
@ -473,7 +473,7 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
finally:
|
finally:
|
||||||
_cleanup_device_hardlink(restore_path, volume_path, volume_id)
|
_cleanup_device_hardlink(restore_path, volume_path, volume_id)
|
||||||
|
|
||||||
LOG.debug(_('Restore %(backup_id)s to %(volume_id)s finished.')
|
LOG.debug('Restore %(backup_id)s to %(volume_id)s finished.'
|
||||||
% {'backup_id': backup_id,
|
% {'backup_id': backup_id,
|
||||||
'volume_id': volume_id})
|
'volume_id': volume_id})
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
delete_path, backup_mode = _get_backup_metadata(backup, 'restore')
|
delete_path, backup_mode = _get_backup_metadata(backup, 'restore')
|
||||||
volume_id = backup['volume_id']
|
volume_id = backup['volume_id']
|
||||||
|
|
||||||
LOG.debug(_('Delete started for backup: %(backup)s, mode: %(mode)s.'),
|
LOG.debug('Delete started for backup: %(backup)s, mode: %(mode)s.',
|
||||||
{'backup': backup['id'],
|
{'backup': backup['id'],
|
||||||
'mode': backup_mode})
|
'mode': backup_mode})
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ class TSMBackupDriver(BackupDriver):
|
|||||||
'err': err})
|
'err': err})
|
||||||
LOG.error(err)
|
LOG.error(err)
|
||||||
|
|
||||||
LOG.debug(_('Delete %s finished.') % backup['id'])
|
LOG.debug('Delete %s finished.' % backup['id'])
|
||||||
|
|
||||||
|
|
||||||
def get_backup_driver(context):
|
def get_backup_driver(context):
|
||||||
|
@ -102,7 +102,7 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
msg = _("NULL host not allowed for volume backend lookup.")
|
msg = _("NULL host not allowed for volume backend lookup.")
|
||||||
raise exception.BackupFailedToGetVolumeBackend(msg)
|
raise exception.BackupFailedToGetVolumeBackend(msg)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Checking hostname '%s' for backend info.") % (host))
|
LOG.debug("Checking hostname '%s' for backend info." % (host))
|
||||||
part = host.partition('@')
|
part = host.partition('@')
|
||||||
if (part[1] == '@') and (part[2] != ''):
|
if (part[1] == '@') and (part[2] != ''):
|
||||||
backend = part[2]
|
backend = part[2]
|
||||||
@ -119,10 +119,10 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
return 'default'
|
return 'default'
|
||||||
|
|
||||||
def _get_manager(self, backend):
|
def _get_manager(self, backend):
|
||||||
LOG.debug(_("Manager requested for volume_backend '%s'.") %
|
LOG.debug("Manager requested for volume_backend '%s'." %
|
||||||
(backend))
|
(backend))
|
||||||
if backend is None:
|
if backend is None:
|
||||||
LOG.debug(_("Fetching default backend."))
|
LOG.debug("Fetching default backend.")
|
||||||
backend = self._get_volume_backend(allow_null_host=True)
|
backend = self._get_volume_backend(allow_null_host=True)
|
||||||
if backend not in self.volume_managers:
|
if backend not in self.volume_managers:
|
||||||
msg = (_("Volume manager for backend '%s' does not exist.") %
|
msg = (_("Volume manager for backend '%s' does not exist.") %
|
||||||
@ -131,10 +131,10 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
return self.volume_managers[backend]
|
return self.volume_managers[backend]
|
||||||
|
|
||||||
def _get_driver(self, backend=None):
|
def _get_driver(self, backend=None):
|
||||||
LOG.debug(_("Driver requested for volume_backend '%s'.") %
|
LOG.debug("Driver requested for volume_backend '%s'." %
|
||||||
(backend))
|
(backend))
|
||||||
if backend is None:
|
if backend is None:
|
||||||
LOG.debug(_("Fetching default backend."))
|
LOG.debug("Fetching default backend.")
|
||||||
backend = self._get_volume_backend(allow_null_host=True)
|
backend = self._get_volume_backend(allow_null_host=True)
|
||||||
mgr = self._get_manager(backend)
|
mgr = self._get_manager(backend)
|
||||||
mgr.driver.db = self.db
|
mgr.driver.db = self.db
|
||||||
@ -149,14 +149,14 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
service_name=backend)
|
service_name=backend)
|
||||||
config = mgr.configuration
|
config = mgr.configuration
|
||||||
backend_name = config.safe_get('volume_backend_name')
|
backend_name = config.safe_get('volume_backend_name')
|
||||||
LOG.debug(_("Registering backend %(backend)s (host=%(host)s "
|
LOG.debug("Registering backend %(backend)s (host=%(host)s "
|
||||||
"backend_name=%(backend_name)s).") %
|
"backend_name=%(backend_name)s)." %
|
||||||
{'backend': backend, 'host': host,
|
{'backend': backend, 'host': host,
|
||||||
'backend_name': backend_name})
|
'backend_name': backend_name})
|
||||||
self.volume_managers[backend] = mgr
|
self.volume_managers[backend] = mgr
|
||||||
else:
|
else:
|
||||||
default = importutils.import_object(CONF.volume_manager)
|
default = importutils.import_object(CONF.volume_manager)
|
||||||
LOG.debug(_("Registering default backend %s.") % (default))
|
LOG.debug("Registering default backend %s." % (default))
|
||||||
self.volume_managers['default'] = default
|
self.volume_managers['default'] = default
|
||||||
|
|
||||||
def _init_volume_driver(self, ctxt, driver):
|
def _init_volume_driver(self, ctxt, driver):
|
||||||
|
@ -239,8 +239,8 @@ class ISCSIConnector(InitiatorConnector):
|
|||||||
time.sleep(tries ** 2)
|
time.sleep(tries ** 2)
|
||||||
|
|
||||||
if tries != 0:
|
if tries != 0:
|
||||||
LOG.debug(_("Found iSCSI node %(host_device)s "
|
LOG.debug("Found iSCSI node %(host_device)s "
|
||||||
"(after %(tries)s rescans)"),
|
"(after %(tries)s rescans)",
|
||||||
{'host_device': host_device, 'tries': tries})
|
{'host_device': host_device, 'tries': tries})
|
||||||
|
|
||||||
if self.use_multipath:
|
if self.use_multipath:
|
||||||
@ -616,7 +616,7 @@ class FibreChannelConnector(InitiatorConnector):
|
|||||||
def _wait_for_device_discovery(host_devices):
|
def _wait_for_device_discovery(host_devices):
|
||||||
tries = self.tries
|
tries = self.tries
|
||||||
for device in host_devices:
|
for device in host_devices:
|
||||||
LOG.debug(_("Looking for Fibre Channel dev %(device)s"),
|
LOG.debug("Looking for Fibre Channel dev %(device)s",
|
||||||
{'device': device})
|
{'device': device})
|
||||||
if os.path.exists(device):
|
if os.path.exists(device):
|
||||||
self.host_device = device
|
self.host_device = device
|
||||||
@ -646,8 +646,8 @@ class FibreChannelConnector(InitiatorConnector):
|
|||||||
|
|
||||||
tries = self.tries
|
tries = self.tries
|
||||||
if self.host_device is not None and self.device_name is not None:
|
if self.host_device is not None and self.device_name is not None:
|
||||||
LOG.debug(_("Found Fibre Channel volume %(name)s "
|
LOG.debug("Found Fibre Channel volume %(name)s "
|
||||||
"(after %(tries)s rescans)"),
|
"(after %(tries)s rescans)",
|
||||||
{'name': self.device_name, 'tries': tries})
|
{'name': self.device_name, 'tries': tries})
|
||||||
|
|
||||||
# see if the new drive is part of a multipath
|
# see if the new drive is part of a multipath
|
||||||
@ -655,7 +655,7 @@ class FibreChannelConnector(InitiatorConnector):
|
|||||||
if self.use_multipath:
|
if self.use_multipath:
|
||||||
mdev_info = self._linuxscsi.find_multipath_device(self.device_name)
|
mdev_info = self._linuxscsi.find_multipath_device(self.device_name)
|
||||||
if mdev_info is not None:
|
if mdev_info is not None:
|
||||||
LOG.debug(_("Multipath device discovered %(device)s")
|
LOG.debug("Multipath device discovered %(device)s"
|
||||||
% {'device': mdev_info['device']})
|
% {'device': mdev_info['device']})
|
||||||
device_path = mdev_info['device']
|
device_path = mdev_info['device']
|
||||||
devices = mdev_info['devices']
|
devices = mdev_info['devices']
|
||||||
@ -787,8 +787,8 @@ class AoEConnector(InitiatorConnector):
|
|||||||
timer.start(interval=2).wait()
|
timer.start(interval=2).wait()
|
||||||
|
|
||||||
if waiting_status['tries']:
|
if waiting_status['tries']:
|
||||||
LOG.debug(_("Found AoE device %(path)s "
|
LOG.debug("Found AoE device %(path)s "
|
||||||
"(after %(tries)s rediscover)"),
|
"(after %(tries)s rediscover)",
|
||||||
{'path': aoe_path,
|
{'path': aoe_path,
|
||||||
'tries': waiting_status['tries']})
|
'tries': waiting_status['tries']})
|
||||||
|
|
||||||
@ -813,7 +813,7 @@ class AoEConnector(InitiatorConnector):
|
|||||||
root_helper=self._root_helper,
|
root_helper=self._root_helper,
|
||||||
check_exit_code=0)
|
check_exit_code=0)
|
||||||
|
|
||||||
LOG.debug(_('aoe-discover: stdout=%(out)s stderr%(err)s') %
|
LOG.debug('aoe-discover: stdout=%(out)s stderr%(err)s' %
|
||||||
{'out': out, 'err': err})
|
{'out': out, 'err': err})
|
||||||
|
|
||||||
def _aoe_revalidate(self, aoe_device):
|
def _aoe_revalidate(self, aoe_device):
|
||||||
@ -823,7 +823,7 @@ class AoEConnector(InitiatorConnector):
|
|||||||
root_helper=self._root_helper,
|
root_helper=self._root_helper,
|
||||||
check_exit_code=0)
|
check_exit_code=0)
|
||||||
|
|
||||||
LOG.debug(_('aoe-revalidate %(dev)s: stdout=%(out)s stderr%(err)s') %
|
LOG.debug('aoe-revalidate %(dev)s: stdout=%(out)s stderr%(err)s' %
|
||||||
{'dev': aoe_device, 'out': out, 'err': err})
|
{'dev': aoe_device, 'out': out, 'err': err})
|
||||||
|
|
||||||
def _aoe_flush(self, aoe_device):
|
def _aoe_flush(self, aoe_device):
|
||||||
@ -832,7 +832,7 @@ class AoEConnector(InitiatorConnector):
|
|||||||
run_as_root=True,
|
run_as_root=True,
|
||||||
root_helper=self._root_helper,
|
root_helper=self._root_helper,
|
||||||
check_exit_code=0)
|
check_exit_code=0)
|
||||||
LOG.debug(_('aoe-flush %(dev)s: stdout=%(out)s stderr%(err)s') %
|
LOG.debug('aoe-flush %(dev)s: stdout=%(out)s stderr%(err)s' %
|
||||||
{'dev': aoe_device, 'out': out, 'err': err})
|
{'dev': aoe_device, 'out': out, 'err': err})
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class LinuxSCSI(executor.Executor):
|
|||||||
% {'line': line})
|
% {'line': line})
|
||||||
return None
|
return None
|
||||||
|
|
||||||
LOG.debug(_("Found multipath device = %(mdev)s")
|
LOG.debug("Found multipath device = %(mdev)s"
|
||||||
% {'mdev': mdev})
|
% {'mdev': mdev})
|
||||||
device_lines = lines[3:]
|
device_lines = lines[3:]
|
||||||
for dev_line in device_lines:
|
for dev_line in device_lines:
|
||||||
|
@ -178,8 +178,8 @@ class TgtAdm(TargetAdmin):
|
|||||||
f = open(volume_path, 'w+')
|
f = open(volume_path, 'w+')
|
||||||
f.write(volume_conf)
|
f.write(volume_conf)
|
||||||
f.close()
|
f.close()
|
||||||
LOG.debug(_('Created volume path %(vp)s,\n'
|
LOG.debug('Created volume path %(vp)s,\n'
|
||||||
'content: %(vc)s')
|
'content: %(vc)s'
|
||||||
% {'vp': volume_path, 'vc': volume_conf})
|
% {'vp': volume_path, 'vc': volume_conf})
|
||||||
|
|
||||||
old_persist_file = None
|
old_persist_file = None
|
||||||
|
@ -431,10 +431,10 @@ class LVM(executor.Executor):
|
|||||||
size_str = self._calculate_thin_pool_size()
|
size_str = self._calculate_thin_pool_size()
|
||||||
|
|
||||||
cmd = ['lvcreate', '-T', '-L', size_str, vg_pool_name]
|
cmd = ['lvcreate', '-T', '-L', size_str, vg_pool_name]
|
||||||
LOG.debug(_('Created thin pool \'%(pool)s\' with size %(size)s of '
|
LOG.debug('Created thin pool \'%(pool)s\' with size %(size)s of '
|
||||||
'total %(free)sg') % {'pool': vg_pool_name,
|
'total %(free)sg' % {'pool': vg_pool_name,
|
||||||
'size': size_str,
|
'size': size_str,
|
||||||
'free': self.vg_free_space})
|
'free': self.vg_free_space})
|
||||||
|
|
||||||
self._execute(*cmd,
|
self._execute(*cmd,
|
||||||
root_helper=self._root_helper,
|
root_helper=self._root_helper,
|
||||||
@ -601,7 +601,7 @@ class LVM(executor.Executor):
|
|||||||
{'command': err.cmd, 'response': err.stderr})
|
{'command': err.cmd, 'response': err.stderr})
|
||||||
LOG.debug(mesg)
|
LOG.debug(mesg)
|
||||||
|
|
||||||
LOG.debug(_('Attempting udev settle and retry of lvremove...'))
|
LOG.debug('Attempting udev settle and retry of lvremove...')
|
||||||
run_udevadm_settle()
|
run_udevadm_settle()
|
||||||
|
|
||||||
self._execute('lvremove',
|
self._execute('lvremove',
|
||||||
|
@ -120,12 +120,12 @@ class RemoteFsClient(object):
|
|||||||
options = self._nfs_mount_type_opts[mnt_type]
|
options = self._nfs_mount_type_opts[mnt_type]
|
||||||
try:
|
try:
|
||||||
self._do_mount('nfs', nfs_share, mount_path, options, flags)
|
self._do_mount('nfs', nfs_share, mount_path, options, flags)
|
||||||
LOG.debug(_('Mounted %(sh)s using %(mnt_type)s.')
|
LOG.debug('Mounted %(sh)s using %(mnt_type)s.'
|
||||||
% {'sh': nfs_share, 'mnt_type': mnt_type})
|
% {'sh': nfs_share, 'mnt_type': mnt_type})
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mnt_errors[mnt_type] = six.text_type(e)
|
mnt_errors[mnt_type] = six.text_type(e)
|
||||||
LOG.debug(_('Failed to do %s mount.'), mnt_type)
|
LOG.debug('Failed to do %s mount.', mnt_type)
|
||||||
raise exception.BrickException(_("NFS mount failed for share %(sh)s."
|
raise exception.BrickException(_("NFS mount failed for share %(sh)s."
|
||||||
"Error - %(error)s")
|
"Error - %(error)s")
|
||||||
% {'sh': nfs_share,
|
% {'sh': nfs_share,
|
||||||
|
@ -95,7 +95,7 @@ def novaclient(context, admin=False):
|
|||||||
service_name=service_name,
|
service_name=service_name,
|
||||||
endpoint_type=endpoint_type)
|
endpoint_type=endpoint_type)
|
||||||
|
|
||||||
LOG.debug(_('Novaclient connection created using URL: %s') % url)
|
LOG.debug('Novaclient connection created using URL: %s' % url)
|
||||||
|
|
||||||
extensions = [assisted_volume_snapshots]
|
extensions = [assisted_volume_snapshots]
|
||||||
|
|
||||||
|
0
cinder/hacking/__init__.py
Normal file
0
cinder/hacking/__init__.py
Normal file
49
cinder/hacking/checks.py
Normal file
49
cinder/hacking/checks.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Copyright (c) 2014 OpenStack Foundation.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Guidelines for writing new hacking checks
|
||||||
|
|
||||||
|
- Use only for Cinder specific tests. OpenStack general tests
|
||||||
|
should be submitted to the common 'hacking' module.
|
||||||
|
- Pick numbers in the range N3xx. Find the current test with
|
||||||
|
the highest allocated number and then pick the next value.
|
||||||
|
- Keep the test method code in the source file ordered based
|
||||||
|
on the N3xx value.
|
||||||
|
- List the new rule in the top level HACKING.rst file
|
||||||
|
- Add test cases for each new rule to
|
||||||
|
cinder/tests/unit/test_hacking.py
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def no_translate_debug_logs(logical_line, filename):
|
||||||
|
"""Check for 'LOG.debug(_('
|
||||||
|
|
||||||
|
As per our translation policy,
|
||||||
|
https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
|
||||||
|
we shouldn't translate debug level logs.
|
||||||
|
|
||||||
|
* This check assumes that 'LOG' is a logger.
|
||||||
|
* Use filename so we can start enforcing this in specific folders instead
|
||||||
|
of needing to do so all at once.
|
||||||
|
N319
|
||||||
|
"""
|
||||||
|
if logical_line.startswith("LOG.debug(_("):
|
||||||
|
yield(0, "N319 Don't translate debug level logs")
|
||||||
|
|
||||||
|
|
||||||
|
def factory(register):
|
||||||
|
register(no_translate_debug_logs)
|
@ -175,9 +175,9 @@ def fetch_to_volume_format(context, image_service,
|
|||||||
# qemu-img is not installed but we do have a RAW image. As a
|
# qemu-img is not installed but we do have a RAW image. As a
|
||||||
# result we only need to copy the image to the destination and then
|
# result we only need to copy the image to the destination and then
|
||||||
# return.
|
# return.
|
||||||
LOG.debug(_('Copying image from %(tmp)s to volume %(dest)s - '
|
LOG.debug('Copying image from %(tmp)s to volume %(dest)s - '
|
||||||
'size: %(size)s') % {'tmp': tmp, 'dest': dest,
|
'size: %(size)s' % {'tmp': tmp, 'dest': dest,
|
||||||
'size': image_meta['size']})
|
'size': image_meta['size']})
|
||||||
volume_utils.copy_volume(tmp, dest, image_meta['size'], blocksize)
|
volume_utils.copy_volume(tmp, dest, image_meta['size'], blocksize)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class SchedulerDependentManager(Manager):
|
|||||||
def _publish_service_capabilities(self, context):
|
def _publish_service_capabilities(self, context):
|
||||||
"""Pass data back to the scheduler at a periodic interval."""
|
"""Pass data back to the scheduler at a periodic interval."""
|
||||||
if self.last_capabilities:
|
if self.last_capabilities:
|
||||||
LOG.debug(_('Notifying Schedulers of capabilities ...'))
|
LOG.debug('Notifying Schedulers of capabilities ...')
|
||||||
self.scheduler_rpcapi.update_service_capabilities(
|
self.scheduler_rpcapi.update_service_capabilities(
|
||||||
context,
|
context,
|
||||||
self.service_name,
|
self.service_name,
|
||||||
|
@ -746,7 +746,7 @@ class QuotaEngine(object):
|
|||||||
expire=expire,
|
expire=expire,
|
||||||
project_id=project_id)
|
project_id=project_id)
|
||||||
|
|
||||||
LOG.debug(_("Created reservations %s") % reservations)
|
LOG.debug("Created reservations %s" % reservations)
|
||||||
|
|
||||||
return reservations
|
return reservations
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ class FilterScheduler(driver.Scheduler):
|
|||||||
if not hosts:
|
if not hosts:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
LOG.debug(_("Filtered %s") % hosts)
|
LOG.debug("Filtered %s" % hosts)
|
||||||
# weighted_host = WeightedHost() ... the best
|
# weighted_host = WeightedHost() ... the best
|
||||||
# host for the job.
|
# host for the job.
|
||||||
weighed_hosts = self.host_manager.get_weighed_hosts(hosts,
|
weighed_hosts = self.host_manager.get_weighed_hosts(hosts,
|
||||||
@ -273,7 +273,7 @@ class FilterScheduler(driver.Scheduler):
|
|||||||
def _choose_top_host(self, weighed_hosts, request_spec):
|
def _choose_top_host(self, weighed_hosts, request_spec):
|
||||||
top_host = weighed_hosts[0]
|
top_host = weighed_hosts[0]
|
||||||
host_state = top_host.obj
|
host_state = top_host.obj
|
||||||
LOG.debug(_("Choosing %s") % host_state.host)
|
LOG.debug("Choosing %s" % host_state.host)
|
||||||
volume_properties = request_spec['volume_properties']
|
volume_properties = request_spec['volume_properties']
|
||||||
host_state.consume_from_volume(volume_properties)
|
host_state.consume_from_volume(volume_properties)
|
||||||
return top_host
|
return top_host
|
||||||
|
@ -263,13 +263,13 @@ class HostManager(object):
|
|||||||
def update_service_capabilities(self, service_name, host, capabilities):
|
def update_service_capabilities(self, service_name, host, capabilities):
|
||||||
"""Update the per-service capabilities based on this notification."""
|
"""Update the per-service capabilities based on this notification."""
|
||||||
if service_name != 'volume':
|
if service_name != 'volume':
|
||||||
LOG.debug(_('Ignoring %(service_name)s service update '
|
LOG.debug('Ignoring %(service_name)s service update '
|
||||||
'from %(host)s'),
|
'from %(host)s',
|
||||||
{'service_name': service_name, 'host': host})
|
{'service_name': service_name, 'host': host})
|
||||||
return
|
return
|
||||||
|
|
||||||
LOG.debug(_("Received %(service_name)s service update from "
|
LOG.debug("Received %(service_name)s service update from "
|
||||||
"%(host)s.") %
|
"%(host)s." %
|
||||||
{'service_name': service_name, 'host': host})
|
{'service_name': service_name, 'host': host})
|
||||||
|
|
||||||
# Copy the capabilities, so we don't modify the original dict
|
# Copy the capabilities, so we don't modify the original dict
|
||||||
|
@ -109,7 +109,7 @@ class Service(service.Service):
|
|||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
self._create_service_ref(ctxt)
|
self._create_service_ref(ctxt)
|
||||||
|
|
||||||
LOG.debug(_("Creating RPC server for service %s") % self.topic)
|
LOG.debug("Creating RPC server for service %s" % self.topic)
|
||||||
|
|
||||||
target = messaging.Target(topic=self.topic, server=self.host)
|
target = messaging.Target(topic=self.topic, server=self.host)
|
||||||
endpoints = [self.manager]
|
endpoints = [self.manager]
|
||||||
@ -248,8 +248,8 @@ class Service(service.Service):
|
|||||||
try:
|
try:
|
||||||
service_ref = db.service_get(ctxt, self.service_id)
|
service_ref = db.service_get(ctxt, self.service_id)
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
LOG.debug(_('The service database object disappeared, '
|
LOG.debug('The service database object disappeared, '
|
||||||
'Recreating it.'))
|
'Recreating it.')
|
||||||
self._create_service_ref(ctxt)
|
self._create_service_ref(ctxt)
|
||||||
service_ref = db.service_get(ctxt, self.service_id)
|
service_ref = db.service_get(ctxt, self.service_id)
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ def serve(server, workers=None):
|
|||||||
|
|
||||||
|
|
||||||
def wait():
|
def wait():
|
||||||
LOG.debug(_('Full set of CONF:'))
|
LOG.debug('Full set of CONF:')
|
||||||
for flag in CONF:
|
for flag in CONF:
|
||||||
flag_get = CONF.get(flag, None)
|
flag_get = CONF.get(flag, None)
|
||||||
# hide flag contents from log if contains a password
|
# hide flag contents from log if contains a password
|
||||||
@ -380,7 +380,7 @@ def wait():
|
|||||||
if ("_password" in flag or "_key" in flag or
|
if ("_password" in flag or "_key" in flag or
|
||||||
(flag == "sql_connection" and
|
(flag == "sql_connection" and
|
||||||
("mysql:" in flag_get or "postgresql:" in flag_get))):
|
("mysql:" in flag_get or "postgresql:" in flag_get))):
|
||||||
LOG.debug(_('%s : FLAG SET ') % flag)
|
LOG.debug('%s : FLAG SET ' % flag)
|
||||||
else:
|
else:
|
||||||
LOG.debug('%(flag)s : %(flag_get)s' %
|
LOG.debug('%(flag)s : %(flag_get)s' %
|
||||||
{'flag': flag, 'flag_get': flag_get})
|
{'flag': flag, 'flag_get': flag_get})
|
||||||
|
@ -54,7 +54,7 @@ class FakeISCSIDriver(lvm.LVMISCSIDriver):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_execute(cmd, *_args, **_kwargs):
|
def fake_execute(cmd, *_args, **_kwargs):
|
||||||
"""Execute that simply logs the command."""
|
"""Execute that simply logs the command."""
|
||||||
LOG.debug(_("FAKE ISCSI: %s"), cmd)
|
LOG.debug("FAKE ISCSI: %s", cmd)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class FakeISERDriver(FakeISCSIDriver):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_execute(cmd, *_args, **_kwargs):
|
def fake_execute(cmd, *_args, **_kwargs):
|
||||||
"""Execute that simply logs the command."""
|
"""Execute that simply logs the command."""
|
||||||
LOG.debug(_("FAKE ISER: %s"), cmd)
|
LOG.debug("FAKE ISER: %s", cmd)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
|
|
||||||
@ -121,12 +121,12 @@ class LoggingVolumeDriver(driver.VolumeDriver):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def log_action(action, parameters):
|
def log_action(action, parameters):
|
||||||
"""Logs the command."""
|
"""Logs the command."""
|
||||||
LOG.debug(_("LoggingVolumeDriver: %s") % (action))
|
LOG.debug("LoggingVolumeDriver: %s" % (action))
|
||||||
log_dictionary = {}
|
log_dictionary = {}
|
||||||
if parameters:
|
if parameters:
|
||||||
log_dictionary = dict(parameters)
|
log_dictionary = dict(parameters)
|
||||||
log_dictionary['action'] = action
|
log_dictionary['action'] = action
|
||||||
LOG.debug(_("LoggingVolumeDriver: %s") % (log_dictionary))
|
LOG.debug("LoggingVolumeDriver: %s" % (log_dictionary))
|
||||||
LoggingVolumeDriver._LOGS.append(log_dictionary)
|
LoggingVolumeDriver._LOGS.append(log_dictionary)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -67,7 +67,7 @@ def fake_execute(*cmd_parts, **kwargs):
|
|||||||
run_as_root = kwargs.get('run_as_root', False)
|
run_as_root = kwargs.get('run_as_root', False)
|
||||||
cmd_str = ' '.join(str(part) for part in cmd_parts)
|
cmd_str = ' '.join(str(part) for part in cmd_parts)
|
||||||
|
|
||||||
LOG.debug(_("Faking execution of cmd (subprocess): %s"), cmd_str)
|
LOG.debug("Faking execution of cmd (subprocess): %s", cmd_str)
|
||||||
_fake_execute_log.append(cmd_str)
|
_fake_execute_log.append(cmd_str)
|
||||||
|
|
||||||
reply_handler = fake_execute_default_reply_handler
|
reply_handler = fake_execute_default_reply_handler
|
||||||
@ -75,7 +75,7 @@ def fake_execute(*cmd_parts, **kwargs):
|
|||||||
for fake_replier in _fake_execute_repliers:
|
for fake_replier in _fake_execute_repliers:
|
||||||
if re.match(fake_replier[0], cmd_str):
|
if re.match(fake_replier[0], cmd_str):
|
||||||
reply_handler = fake_replier[1]
|
reply_handler = fake_replier[1]
|
||||||
LOG.debug(_('Faked command matched %s') % fake_replier[0])
|
LOG.debug('Faked command matched %s' % fake_replier[0])
|
||||||
break
|
break
|
||||||
|
|
||||||
if isinstance(reply_handler, basestring):
|
if isinstance(reply_handler, basestring):
|
||||||
@ -91,12 +91,12 @@ def fake_execute(*cmd_parts, **kwargs):
|
|||||||
run_as_root=run_as_root,
|
run_as_root=run_as_root,
|
||||||
check_exit_code=check_exit_code)
|
check_exit_code=check_exit_code)
|
||||||
except processutils.ProcessExecutionError as e:
|
except processutils.ProcessExecutionError as e:
|
||||||
LOG.debug(_('Faked command raised an exception %s'), e)
|
LOG.debug('Faked command raised an exception %s', e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
LOG.debug(_("Reply to faked command is stdout='%(stdout)s' "
|
LOG.debug("Reply to faked command is stdout='%(stdout)s' "
|
||||||
"stderr='%(stderr)s'") % {'stdout': reply[0],
|
"stderr='%(stderr)s'" % {'stdout': reply[0],
|
||||||
'stderr': reply[1]})
|
'stderr': reply[1]})
|
||||||
|
|
||||||
# Replicate the sleep call in the real function
|
# Replicate the sleep call in the real function
|
||||||
greenthread.sleep(0)
|
greenthread.sleep(0)
|
||||||
|
@ -121,7 +121,7 @@ class TestOpenStackClient(object):
|
|||||||
headers=headers)
|
headers=headers)
|
||||||
|
|
||||||
http_status = response.status_code
|
http_status = response.status_code
|
||||||
LOG.debug(_("%(auth_uri)s => code %(http_status)s"),
|
LOG.debug("%(auth_uri)s => code %(http_status)s",
|
||||||
{'auth_uri': auth_uri, 'http_status': http_status})
|
{'auth_uri': auth_uri, 'http_status': http_status})
|
||||||
|
|
||||||
if http_status == 401:
|
if http_status == 401:
|
||||||
@ -144,7 +144,7 @@ class TestOpenStackClient(object):
|
|||||||
response = self.request(full_uri, **kwargs)
|
response = self.request(full_uri, **kwargs)
|
||||||
|
|
||||||
http_status = response.status_code
|
http_status = response.status_code
|
||||||
LOG.debug(_("%(relative_uri)s => code %(http_status)s"),
|
LOG.debug("%(relative_uri)s => code %(http_status)s",
|
||||||
{'relative_uri': relative_uri, 'http_status': http_status})
|
{'relative_uri': relative_uri, 'http_status': http_status})
|
||||||
|
|
||||||
if check_response_status:
|
if check_response_status:
|
||||||
@ -162,7 +162,7 @@ class TestOpenStackClient(object):
|
|||||||
|
|
||||||
def _decode_json(self, response):
|
def _decode_json(self, response):
|
||||||
body = response.text
|
body = response.text
|
||||||
LOG.debug(_("Decoding JSON: %s") % (body))
|
LOG.debug("Decoding JSON: %s" % (body))
|
||||||
if body:
|
if body:
|
||||||
return jsonutils.loads(body)
|
return jsonutils.loads(body)
|
||||||
else:
|
else:
|
||||||
|
@ -26,4 +26,4 @@ class LoginTest(integrated_helpers._IntegratedTestBase):
|
|||||||
"""Simple check - we list volumes - so we know we're logged in."""
|
"""Simple check - we list volumes - so we know we're logged in."""
|
||||||
volumes = self.api.get_volumes()
|
volumes = self.api.get_volumes()
|
||||||
for volume in volumes:
|
for volume in volumes:
|
||||||
LOG.debug(_("volume: %s") % volume)
|
LOG.debug("volume: %s" % volume)
|
||||||
|
@ -1438,18 +1438,18 @@ class StorwizeSVCFakeDriver(storwize_svc.StorwizeSVCDriver):
|
|||||||
|
|
||||||
def _run_ssh(self, cmd, check_exit_code=True, attempts=1):
|
def _run_ssh(self, cmd, check_exit_code=True, attempts=1):
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Run CLI command: %s') % cmd)
|
LOG.debug('Run CLI command: %s' % cmd)
|
||||||
utils.check_ssh_injection(cmd)
|
utils.check_ssh_injection(cmd)
|
||||||
ret = self.fake_storage.execute_command(cmd, check_exit_code)
|
ret = self.fake_storage.execute_command(cmd, check_exit_code)
|
||||||
(stdout, stderr) = ret
|
(stdout, stderr) = ret
|
||||||
LOG.debug(_('CLI output:\n stdout: %(stdout)s\n stderr: '
|
LOG.debug('CLI output:\n stdout: %(stdout)s\n stderr: '
|
||||||
'%(stderr)s') % {'stdout': stdout, 'stderr': stderr})
|
'%(stderr)s' % {'stdout': stdout, 'stderr': stderr})
|
||||||
|
|
||||||
except processutils.ProcessExecutionError as e:
|
except processutils.ProcessExecutionError as e:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.debug(_('CLI Exception output:\n stdout: %(out)s\n '
|
LOG.debug('CLI Exception output:\n stdout: %(out)s\n '
|
||||||
'stderr: %(err)s') % {'out': e.stdout,
|
'stderr: %(err)s' % {'out': e.stdout,
|
||||||
'err': e.stderr})
|
'err': e.stderr})
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class FakeBrcdFCZoneClientCLI(object):
|
|||||||
raise paramiko.SSHException("Unable to connect to fabric")
|
raise paramiko.SSHException("Unable to connect to fabric")
|
||||||
|
|
||||||
def get_active_zone_set(self):
|
def get_active_zone_set(self):
|
||||||
LOG.debug(_("Inside get_active_zone_set %s"), GlobalVars._active_cfg)
|
LOG.debug("Inside get_active_zone_set %s", GlobalVars._active_cfg)
|
||||||
return GlobalVars._active_cfg
|
return GlobalVars._active_cfg
|
||||||
|
|
||||||
def add_zones(self, zones, isActivate):
|
def add_zones(self, zones, isActivate):
|
||||||
|
@ -433,7 +433,7 @@ class LazyPluggable(object):
|
|||||||
fromlist = backend
|
fromlist = backend
|
||||||
|
|
||||||
self.__backend = __import__(name, None, None, fromlist)
|
self.__backend = __import__(name, None, None, fromlist)
|
||||||
LOG.debug(_('backend %s'), self.__backend)
|
LOG.debug('backend %s', self.__backend)
|
||||||
return self.__backend
|
return self.__backend
|
||||||
|
|
||||||
def __getattr__(self, key):
|
def __getattr__(self, key):
|
||||||
@ -708,7 +708,7 @@ def tempdir(**kwargs):
|
|||||||
try:
|
try:
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
LOG.debug(_('Could not remove tmpdir: %s'), e)
|
LOG.debug('Could not remove tmpdir: %s', e)
|
||||||
|
|
||||||
|
|
||||||
def walk_class_hierarchy(clazz, encountered=None):
|
def walk_class_hierarchy(clazz, encountered=None):
|
||||||
|
@ -295,7 +295,7 @@ class API(base.Base):
|
|||||||
filters['no_migration_targets'] = True
|
filters['no_migration_targets'] = True
|
||||||
|
|
||||||
if filters:
|
if filters:
|
||||||
LOG.debug(_("Searching by: %s") % str(filters))
|
LOG.debug("Searching by: %s" % str(filters))
|
||||||
|
|
||||||
if (context.is_admin and 'all_tenants' in filters):
|
if (context.is_admin and 'all_tenants' in filters):
|
||||||
# Need to remove all_tenants to pass the filtering below.
|
# Need to remove all_tenants to pass the filtering below.
|
||||||
@ -337,7 +337,7 @@ class API(base.Base):
|
|||||||
context, context.project_id)
|
context, context.project_id)
|
||||||
|
|
||||||
if search_opts:
|
if search_opts:
|
||||||
LOG.debug(_("Searching by: %s") % search_opts)
|
LOG.debug("Searching by: %s" % search_opts)
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
not_found = object()
|
not_found = object()
|
||||||
|
@ -275,7 +275,7 @@ class VolumeDriver(object):
|
|||||||
|
|
||||||
def copy_volume_data(self, context, src_vol, dest_vol, remote=None):
|
def copy_volume_data(self, context, src_vol, dest_vol, remote=None):
|
||||||
"""Copy data from src_vol to dest_vol."""
|
"""Copy data from src_vol to dest_vol."""
|
||||||
LOG.debug(_('copy_data_between_volumes %(src)s -> %(dest)s.')
|
LOG.debug('copy_data_between_volumes %(src)s -> %(dest)s.'
|
||||||
% {'src': src_vol['name'], 'dest': dest_vol['name']})
|
% {'src': src_vol['name'], 'dest': dest_vol['name']})
|
||||||
|
|
||||||
properties = utils.brick_get_connector_properties()
|
properties = utils.brick_get_connector_properties()
|
||||||
@ -332,7 +332,7 @@ class VolumeDriver(object):
|
|||||||
|
|
||||||
def copy_image_to_volume(self, context, volume, image_service, image_id):
|
def copy_image_to_volume(self, context, volume, image_service, image_id):
|
||||||
"""Fetch the image from image_service and write it to the volume."""
|
"""Fetch the image from image_service and write it to the volume."""
|
||||||
LOG.debug(_('copy_image_to_volume %s.') % volume['name'])
|
LOG.debug('copy_image_to_volume %s.' % volume['name'])
|
||||||
|
|
||||||
properties = utils.brick_get_connector_properties()
|
properties = utils.brick_get_connector_properties()
|
||||||
attach_info = self._attach_volume(context, volume, properties)
|
attach_info = self._attach_volume(context, volume, properties)
|
||||||
@ -349,7 +349,7 @@ class VolumeDriver(object):
|
|||||||
|
|
||||||
def copy_volume_to_image(self, context, volume, image_service, image_meta):
|
def copy_volume_to_image(self, context, volume, image_service, image_meta):
|
||||||
"""Copy the volume to the specified image."""
|
"""Copy the volume to the specified image."""
|
||||||
LOG.debug(_('copy_volume_to_image %s.') % volume['name'])
|
LOG.debug('copy_volume_to_image %s.' % volume['name'])
|
||||||
|
|
||||||
properties = utils.brick_get_connector_properties()
|
properties = utils.brick_get_connector_properties()
|
||||||
attach_info = self._attach_volume(context, volume, properties)
|
attach_info = self._attach_volume(context, volume, properties)
|
||||||
@ -375,7 +375,7 @@ class VolumeDriver(object):
|
|||||||
# clean this up in the future.
|
# clean this up in the future.
|
||||||
model_update = None
|
model_update = None
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Volume %s: creating export"), volume['id'])
|
LOG.debug("Volume %s: creating export", volume['id'])
|
||||||
model_update = self.create_export(context, volume)
|
model_update = self.create_export(context, volume)
|
||||||
if model_update:
|
if model_update:
|
||||||
volume = self.db.volume_update(context, volume['id'],
|
volume = self.db.volume_update(context, volume['id'],
|
||||||
@ -453,7 +453,7 @@ class VolumeDriver(object):
|
|||||||
raise exception.VolumeBackendAPIException(data=err_msg)
|
raise exception.VolumeBackendAPIException(data=err_msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("volume %s: removing export"), volume['id'])
|
LOG.debug("volume %s: removing export", volume['id'])
|
||||||
self.remove_export(context, volume)
|
self.remove_export(context, volume)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.exception(_("Error detaching volume %(volume)s, "
|
LOG.exception(_("Error detaching volume %(volume)s, "
|
||||||
@ -487,7 +487,7 @@ class VolumeDriver(object):
|
|||||||
"""Create a new backup from an existing volume."""
|
"""Create a new backup from an existing volume."""
|
||||||
volume = self.db.volume_get(context, backup['volume_id'])
|
volume = self.db.volume_get(context, backup['volume_id'])
|
||||||
|
|
||||||
LOG.debug(_('Creating a new backup for volume %s.') %
|
LOG.debug('Creating a new backup for volume %s.' %
|
||||||
volume['name'])
|
volume['name'])
|
||||||
|
|
||||||
properties = utils.brick_get_connector_properties()
|
properties = utils.brick_get_connector_properties()
|
||||||
@ -504,8 +504,8 @@ class VolumeDriver(object):
|
|||||||
|
|
||||||
def restore_backup(self, context, backup, volume, backup_service):
|
def restore_backup(self, context, backup, volume, backup_service):
|
||||||
"""Restore an existing backup to a new or existing volume."""
|
"""Restore an existing backup to a new or existing volume."""
|
||||||
LOG.debug(_('Restoring backup %(backup)s to '
|
LOG.debug('Restoring backup %(backup)s to '
|
||||||
'volume %(volume)s.') %
|
'volume %(volume)s.' %
|
||||||
{'backup': backup['id'],
|
{'backup': backup['id'],
|
||||||
'volume': volume['name']})
|
'volume': volume['name']})
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ class ISCSIDriver(VolumeDriver):
|
|||||||
except processutils.ProcessExecutionError as ex:
|
except processutils.ProcessExecutionError as ex:
|
||||||
LOG.error(_("ISCSI discovery attempt failed for:%s") %
|
LOG.error(_("ISCSI discovery attempt failed for:%s") %
|
||||||
volume['host'].split('@')[0])
|
volume['host'].split('@')[0])
|
||||||
LOG.debug(_("Error from iscsiadm -m discovery: %s") % ex.stderr)
|
LOG.debug("Error from iscsiadm -m discovery: %s" % ex.stderr)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
for target in out.splitlines():
|
for target in out.splitlines():
|
||||||
@ -702,7 +702,7 @@ class ISCSIDriver(VolumeDriver):
|
|||||||
(volume['name']))
|
(volume['name']))
|
||||||
raise exception.InvalidVolume(reason=msg)
|
raise exception.InvalidVolume(reason=msg)
|
||||||
|
|
||||||
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
|
LOG.debug("ISCSI Discovery: Found %s" % (location))
|
||||||
properties['target_discovered'] = True
|
properties['target_discovered'] = True
|
||||||
|
|
||||||
results = location.split(" ")
|
results = location.split(" ")
|
||||||
@ -820,7 +820,7 @@ class ISCSIDriver(VolumeDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
data["volume_backend_name"] = backend_name or 'Generic_iSCSI'
|
data["volume_backend_name"] = backend_name or 'Generic_iSCSI'
|
||||||
@ -880,7 +880,7 @@ class FakeISCSIDriver(ISCSIDriver):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_execute(cmd, *_args, **_kwargs):
|
def fake_execute(cmd, *_args, **_kwargs):
|
||||||
"""Execute that simply logs the command."""
|
"""Execute that simply logs the command."""
|
||||||
LOG.debug(_("FAKE ISCSI: %s"), cmd)
|
LOG.debug("FAKE ISCSI: %s", cmd)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
@ -978,7 +978,7 @@ class ISERDriver(ISCSIDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
data["volume_backend_name"] = backend_name or 'Generic_iSER'
|
data["volume_backend_name"] = backend_name or 'Generic_iSER'
|
||||||
@ -1017,7 +1017,7 @@ class FakeISERDriver(FakeISCSIDriver):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_execute(cmd, *_args, **_kwargs):
|
def fake_execute(cmd, *_args, **_kwargs):
|
||||||
"""Execute that simply logs the command."""
|
"""Execute that simply logs the command."""
|
||||||
LOG.debug(_("FAKE ISER: %s"), cmd)
|
LOG.debug("FAKE ISER: %s", cmd)
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ class CoraidAppliance(object):
|
|||||||
relogin_attempts -= 1
|
relogin_attempts -= 1
|
||||||
if relogin_attempts <= 0:
|
if relogin_attempts <= 0:
|
||||||
raise exception.CoraidESMReloginFailed()
|
raise exception.CoraidESMReloginFailed()
|
||||||
LOG.debug(_('Session is expired. Relogin on ESM.'))
|
LOG.debug('Session is expired. Relogin on ESM.')
|
||||||
self._relogin()
|
self._relogin()
|
||||||
else:
|
else:
|
||||||
return reply
|
return reply
|
||||||
@ -281,7 +281,7 @@ class CoraidAppliance(object):
|
|||||||
try:
|
try:
|
||||||
self.rpc('fetch', {}, None, allow_empty_response=True)
|
self.rpc('fetch', {}, None, allow_empty_response=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(_('Coraid Appliance ping failed: %s'), e)
|
LOG.debug('Coraid Appliance ping failed: %s', e)
|
||||||
raise exception.CoraidESMNotAvailable(reason=e)
|
raise exception.CoraidESMNotAvailable(reason=e)
|
||||||
|
|
||||||
def create_lun(self, repository_name, volume_name, volume_size_in_gb):
|
def create_lun(self, repository_name, volume_name, volume_size_in_gb):
|
||||||
@ -294,7 +294,7 @@ class CoraidAppliance(object):
|
|||||||
'op': 'orchStrLun',
|
'op': 'orchStrLun',
|
||||||
'args': 'add'}
|
'args': 'add'}
|
||||||
esm_result = self.esm_command(request)
|
esm_result = self.esm_command(request)
|
||||||
LOG.debug(_('Volume "%(name)s" created with VSX LUN "%(lun)s"') %
|
LOG.debug('Volume "%(name)s" created with VSX LUN "%(lun)s"' %
|
||||||
{'name': volume_name,
|
{'name': volume_name,
|
||||||
'lun': esm_result['firstParam']})
|
'lun': esm_result['firstParam']})
|
||||||
return esm_result
|
return esm_result
|
||||||
@ -308,15 +308,15 @@ class CoraidAppliance(object):
|
|||||||
'op': 'orchStrLun/verified',
|
'op': 'orchStrLun/verified',
|
||||||
'args': 'delete'}
|
'args': 'delete'}
|
||||||
esm_result = self.esm_command(request)
|
esm_result = self.esm_command(request)
|
||||||
LOG.debug(_('Volume "%s" deleted.'), volume_name)
|
LOG.debug('Volume "%s" deleted.', volume_name)
|
||||||
return esm_result
|
return esm_result
|
||||||
|
|
||||||
def resize_volume(self, volume_name, new_volume_size_in_gb):
|
def resize_volume(self, volume_name, new_volume_size_in_gb):
|
||||||
LOG.debug(_('Resize volume "%(name)s" to %(size)s GB.') %
|
LOG.debug('Resize volume "%(name)s" to %(size)s GB.' %
|
||||||
{'name': volume_name,
|
{'name': volume_name,
|
||||||
'size': new_volume_size_in_gb})
|
'size': new_volume_size_in_gb})
|
||||||
repository = self.get_volume_repository(volume_name)
|
repository = self.get_volume_repository(volume_name)
|
||||||
LOG.debug(_('Repository for volume "%(name)s" found: "%(repo)s"') %
|
LOG.debug('Repository for volume "%(name)s" found: "%(repo)s"' %
|
||||||
{'name': volume_name,
|
{'name': volume_name,
|
||||||
'repo': repository})
|
'repo': repository})
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ class CoraidAppliance(object):
|
|||||||
'args': 'resize'}
|
'args': 'resize'}
|
||||||
esm_result = self.esm_command(request)
|
esm_result = self.esm_command(request)
|
||||||
|
|
||||||
LOG.debug(_('Volume "%(name)s" resized. New size is %(size)s GB.') %
|
LOG.debug('Volume "%(name)s" resized. New size is %(size)s GB.' %
|
||||||
{'name': volume_name,
|
{'name': volume_name,
|
||||||
'size': new_volume_size_in_gb})
|
'size': new_volume_size_in_gb})
|
||||||
return esm_result
|
return esm_result
|
||||||
@ -502,7 +502,7 @@ class CoraidDriver(driver.VolumeDriver):
|
|||||||
shelf = volume_info['shelf']
|
shelf = volume_info['shelf']
|
||||||
lun = volume_info['lun']
|
lun = volume_info['lun']
|
||||||
|
|
||||||
LOG.debug(_('Initialize connection %(shelf)s/%(lun)s for %(name)s') %
|
LOG.debug('Initialize connection %(shelf)s/%(lun)s for %(name)s' %
|
||||||
{'shelf': shelf,
|
{'shelf': shelf,
|
||||||
'lun': lun,
|
'lun': lun,
|
||||||
'name': volume['name']})
|
'name': volume['name']})
|
||||||
|
@ -166,7 +166,7 @@ class EMCCLIISCSIDriver(driver.ISCSIDriver):
|
|||||||
" for volume %s") %
|
" for volume %s") %
|
||||||
(volume['name']))
|
(volume['name']))
|
||||||
|
|
||||||
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
|
LOG.debug("ISCSI Discovery: Found %s" % (location))
|
||||||
properties['target_discovered'] = True
|
properties['target_discovered'] = True
|
||||||
|
|
||||||
hostname = connector['host']
|
hostname = connector['host']
|
||||||
@ -199,7 +199,7 @@ class EMCCLIISCSIDriver(driver.ISCSIDriver):
|
|||||||
break
|
break
|
||||||
for endpoint in endpoints:
|
for endpoint in endpoints:
|
||||||
if properties['target_iqn'] == endpoint:
|
if properties['target_iqn'] == endpoint:
|
||||||
LOG.debug(_("Found iSCSI endpoint: %s") % endpoint)
|
LOG.debug("Found iSCSI endpoint: %s" % endpoint)
|
||||||
foundEndpoint = True
|
foundEndpoint = True
|
||||||
break
|
break
|
||||||
if foundEndpoint:
|
if foundEndpoint:
|
||||||
@ -244,7 +244,7 @@ class EMCCLIISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def update_volume_stats(self):
|
def update_volume_stats(self):
|
||||||
"""Retrieve status info from volume group."""
|
"""Retrieve status info from volume group."""
|
||||||
LOG.debug(_("Updating volume status"))
|
LOG.debug("Updating volume status")
|
||||||
# retrieving the volume update from the VNX
|
# retrieving the volume update from the VNX
|
||||||
data = self.cli.update_volume_status()
|
data = self.cli.update_volume_status()
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
|
@ -79,7 +79,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
"""Creates a EMC(VMAX/VNX) volume."""
|
"""Creates a EMC(VMAX/VNX) volume."""
|
||||||
LOG.debug(_('Entering create_volume.'))
|
LOG.debug('Entering create_volume.')
|
||||||
volumesize = int(volume['size']) * units.GiB
|
volumesize = int(volume['size']) * units.GiB
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
|
|
||||||
@ -91,15 +91,15 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
storage_type = self._get_storage_type(volume)
|
storage_type = self._get_storage_type(volume)
|
||||||
|
|
||||||
LOG.debug(_('Create Volume: %(volume)s '
|
LOG.debug('Create Volume: %(volume)s '
|
||||||
'Storage type: %(storage_type)s')
|
'Storage type: %(storage_type)s'
|
||||||
% {'volume': volumename,
|
% {'volume': volumename,
|
||||||
'storage_type': storage_type})
|
'storage_type': storage_type})
|
||||||
|
|
||||||
pool, storage_system = self._find_pool(storage_type[POOL])
|
pool, storage_system = self._find_pool(storage_type[POOL])
|
||||||
|
|
||||||
LOG.debug(_('Create Volume: %(volume)s Pool: %(pool)s '
|
LOG.debug('Create Volume: %(volume)s Pool: %(pool)s '
|
||||||
'Storage System: %(storage_system)s')
|
'Storage System: %(storage_system)s'
|
||||||
% {'volume': volumename,
|
% {'volume': volumename,
|
||||||
'pool': pool,
|
'pool': pool,
|
||||||
'storage_system': storage_system})
|
'storage_system': storage_system})
|
||||||
@ -117,10 +117,10 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
provisioning = self._get_provisioning(storage_type)
|
provisioning = self._get_provisioning(storage_type)
|
||||||
|
|
||||||
LOG.debug(_('Create Volume: %(name)s Method: '
|
LOG.debug('Create Volume: %(name)s Method: '
|
||||||
'CreateOrModifyElementFromStoragePool ConfigServicie: '
|
'CreateOrModifyElementFromStoragePool ConfigServicie: '
|
||||||
'%(service)s ElementName: %(name)s InPool: %(pool)s '
|
'%(service)s ElementName: %(name)s InPool: %(pool)s '
|
||||||
'ElementType: %(provisioning)s Size: %(size)lu')
|
'ElementType: %(provisioning)s Size: %(size)lu'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'name': volumename,
|
'name': volumename,
|
||||||
'pool': pool,
|
'pool': pool,
|
||||||
@ -133,7 +133,7 @@ class EMCSMISCommon():
|
|||||||
ElementType=self._getnum(provisioning, '16'),
|
ElementType=self._getnum(provisioning, '16'),
|
||||||
Size=self._getnum(volumesize, '64'))
|
Size=self._getnum(volumesize, '64'))
|
||||||
|
|
||||||
LOG.debug(_('Create Volume: %(volumename)s Return code: %(rc)lu')
|
LOG.debug('Create Volume: %(volumename)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
|
|
||||||
@ -161,9 +161,9 @@ class EMCSMISCommon():
|
|||||||
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
||||||
name['keybindings'] = keys
|
name['keybindings'] = keys
|
||||||
|
|
||||||
LOG.debug(_('Leaving create_volume: %(volumename)s '
|
LOG.debug('Leaving create_volume: %(volumename)s '
|
||||||
'Return code: %(rc)lu '
|
'Return code: %(rc)lu '
|
||||||
'volume instance: %(name)s')
|
'volume instance: %(name)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc,
|
'rc': rc,
|
||||||
'name': name})
|
'name': name})
|
||||||
@ -173,7 +173,7 @@ class EMCSMISCommon():
|
|||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Creates a volume from a snapshot."""
|
"""Creates a volume from a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('Entering create_volume_from_snapshot.'))
|
LOG.debug('Entering create_volume_from_snapshot.')
|
||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
@ -188,9 +188,9 @@ class EMCSMISCommon():
|
|||||||
snapshot_instance = self._find_lun(snapshot)
|
snapshot_instance = self._find_lun(snapshot)
|
||||||
storage_system = snapshot_instance['SystemName']
|
storage_system = snapshot_instance['SystemName']
|
||||||
|
|
||||||
LOG.debug(_('Create Volume from Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Volume from Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s Snapshot Instance: '
|
'Snapshot: %(snapshotname)s Snapshot Instance: '
|
||||||
'%(snapshotinstance)s Storage System: %(storage_system)s.')
|
'%(snapshotinstance)s Storage System: %(storage_system)s.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'snapshotinstance': snapshot_instance.path,
|
'snapshotinstance': snapshot_instance.path,
|
||||||
@ -218,11 +218,11 @@ class EMCSMISCommon():
|
|||||||
LOG.error(exception_message)
|
LOG.error(exception_message)
|
||||||
raise exception.VolumeBackendAPIException(data=exception_message)
|
raise exception.VolumeBackendAPIException(data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_('Create Volume from Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Volume from Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s Method: CreateElementReplica '
|
'Snapshot: %(snapshotname)s Method: CreateElementReplica '
|
||||||
'ReplicationService: %(service)s ElementName: '
|
'ReplicationService: %(service)s ElementName: '
|
||||||
'%(elementname)s SyncType: 8 SourceElement: '
|
'%(elementname)s SyncType: 8 SourceElement: '
|
||||||
'%(sourceelement)s')
|
'%(sourceelement)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -265,9 +265,9 @@ class EMCSMISCommon():
|
|||||||
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
||||||
name['keybindings'] = keys
|
name['keybindings'] = keys
|
||||||
|
|
||||||
LOG.debug(_('Create Volume from Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Volume from Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s. Successfully clone volume '
|
'Snapshot: %(snapshotname)s. Successfully clone volume '
|
||||||
'from snapshot. Finding the clone relationship.')
|
'from snapshot. Finding the clone relationship.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname})
|
'snapshotname': snapshotname})
|
||||||
|
|
||||||
@ -277,11 +277,11 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
# Remove the Clone relationshop so it can be used as a regular lun
|
# Remove the Clone relationshop so it can be used as a regular lun
|
||||||
# 8 - Detach operation
|
# 8 - Detach operation
|
||||||
LOG.debug(_('Create Volume from Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Volume from Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s. Remove the clone '
|
'Snapshot: %(snapshotname)s. Remove the clone '
|
||||||
'relationship. Method: ModifyReplicaSynchronization '
|
'relationship. Method: ModifyReplicaSynchronization '
|
||||||
'ReplicationService: %(service)s Operation: 8 '
|
'ReplicationService: %(service)s Operation: 8 '
|
||||||
'Synchronization: %(sync_name)s')
|
'Synchronization: %(sync_name)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -293,8 +293,8 @@ class EMCSMISCommon():
|
|||||||
Operation=self._getnum(8, '16'),
|
Operation=self._getnum(8, '16'),
|
||||||
Synchronization=sync_name)
|
Synchronization=sync_name)
|
||||||
|
|
||||||
LOG.debug(_('Create Volume from Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Volume from Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s Return code: %(rc)lu')
|
'Snapshot: %(snapshotname)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -314,9 +314,9 @@ class EMCSMISCommon():
|
|||||||
raise exception.VolumeBackendAPIException(
|
raise exception.VolumeBackendAPIException(
|
||||||
data=exception_message)
|
data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_('Leaving create_volume_from_snapshot: Volume: '
|
LOG.debug('Leaving create_volume_from_snapshot: Volume: '
|
||||||
'%(volumename)s Snapshot: %(snapshotname)s '
|
'%(volumename)s Snapshot: %(snapshotname)s '
|
||||||
'Return code: %(rc)lu.')
|
'Return code: %(rc)lu.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -325,7 +325,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
def create_cloned_volume(self, volume, src_vref):
|
def create_cloned_volume(self, volume, src_vref):
|
||||||
"""Creates a clone of the specified volume."""
|
"""Creates a clone of the specified volume."""
|
||||||
LOG.debug(_('Entering create_cloned_volume.'))
|
LOG.debug('Entering create_cloned_volume.')
|
||||||
|
|
||||||
srcname = src_vref['name']
|
srcname = src_vref['name']
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
@ -340,9 +340,9 @@ class EMCSMISCommon():
|
|||||||
src_instance = self._find_lun(src_vref)
|
src_instance = self._find_lun(src_vref)
|
||||||
storage_system = src_instance['SystemName']
|
storage_system = src_instance['SystemName']
|
||||||
|
|
||||||
LOG.debug(_('Create Cloned Volume: Volume: %(volumename)s '
|
LOG.debug('Create Cloned Volume: Volume: %(volumename)s '
|
||||||
'Source Volume: %(srcname)s Source Instance: '
|
'Source Volume: %(srcname)s Source Instance: '
|
||||||
'%(src_instance)s Storage System: %(storage_system)s.')
|
'%(src_instance)s Storage System: %(storage_system)s.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname,
|
'srcname': srcname,
|
||||||
'src_instance': src_instance.path,
|
'src_instance': src_instance.path,
|
||||||
@ -359,11 +359,11 @@ class EMCSMISCommon():
|
|||||||
LOG.error(exception_message)
|
LOG.error(exception_message)
|
||||||
raise exception.VolumeBackendAPIException(data=exception_message)
|
raise exception.VolumeBackendAPIException(data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_('Create Cloned Volume: Volume: %(volumename)s '
|
LOG.debug('Create Cloned Volume: Volume: %(volumename)s '
|
||||||
'Source Volume: %(srcname)s Method: CreateElementReplica '
|
'Source Volume: %(srcname)s Method: CreateElementReplica '
|
||||||
'ReplicationService: %(service)s ElementName: '
|
'ReplicationService: %(service)s ElementName: '
|
||||||
'%(elementname)s SyncType: 8 SourceElement: '
|
'%(elementname)s SyncType: 8 SourceElement: '
|
||||||
'%(sourceelement)s')
|
'%(sourceelement)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname,
|
'srcname': srcname,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -406,9 +406,9 @@ class EMCSMISCommon():
|
|||||||
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
||||||
name['keybindings'] = keys
|
name['keybindings'] = keys
|
||||||
|
|
||||||
LOG.debug(_('Create Cloned Volume: Volume: %(volumename)s '
|
LOG.debug('Create Cloned Volume: Volume: %(volumename)s '
|
||||||
'Source Volume: %(srcname)s. Successfully cloned volume '
|
'Source Volume: %(srcname)s. Successfully cloned volume '
|
||||||
'from source volume. Finding the clone relationship.')
|
'from source volume. Finding the clone relationship.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname})
|
'srcname': srcname})
|
||||||
|
|
||||||
@ -418,11 +418,11 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
# Remove the Clone relationshop so it can be used as a regular lun
|
# Remove the Clone relationshop so it can be used as a regular lun
|
||||||
# 8 - Detach operation
|
# 8 - Detach operation
|
||||||
LOG.debug(_('Create Cloned Volume: Volume: %(volumename)s '
|
LOG.debug('Create Cloned Volume: Volume: %(volumename)s '
|
||||||
'Source Volume: %(srcname)s. Remove the clone '
|
'Source Volume: %(srcname)s. Remove the clone '
|
||||||
'relationship. Method: ModifyReplicaSynchronization '
|
'relationship. Method: ModifyReplicaSynchronization '
|
||||||
'ReplicationService: %(service)s Operation: 8 '
|
'ReplicationService: %(service)s Operation: 8 '
|
||||||
'Synchronization: %(sync_name)s')
|
'Synchronization: %(sync_name)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname,
|
'srcname': srcname,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -434,8 +434,8 @@ class EMCSMISCommon():
|
|||||||
Operation=self._getnum(8, '16'),
|
Operation=self._getnum(8, '16'),
|
||||||
Synchronization=sync_name)
|
Synchronization=sync_name)
|
||||||
|
|
||||||
LOG.debug(_('Create Cloned Volume: Volume: %(volumename)s '
|
LOG.debug('Create Cloned Volume: Volume: %(volumename)s '
|
||||||
'Source Volume: %(srcname)s Return code: %(rc)lu')
|
'Source Volume: %(srcname)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname,
|
'srcname': srcname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -455,9 +455,9 @@ class EMCSMISCommon():
|
|||||||
raise exception.VolumeBackendAPIException(
|
raise exception.VolumeBackendAPIException(
|
||||||
data=exception_message)
|
data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_('Leaving create_cloned_volume: Volume: '
|
LOG.debug('Leaving create_cloned_volume: Volume: '
|
||||||
'%(volumename)s Source Volume: %(srcname)s '
|
'%(volumename)s Source Volume: %(srcname)s '
|
||||||
'Return code: %(rc)lu.')
|
'Return code: %(rc)lu.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'srcname': srcname,
|
'srcname': srcname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -466,7 +466,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
def delete_volume(self, volume):
|
def delete_volume(self, volume):
|
||||||
"""Deletes an EMC volume."""
|
"""Deletes an EMC volume."""
|
||||||
LOG.debug(_('Entering delete_volume.'))
|
LOG.debug('Entering delete_volume.')
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
LOG.info(_('Delete Volume: %(volume)s')
|
LOG.info(_('Delete Volume: %(volume)s')
|
||||||
% {'volume': volumename})
|
% {'volume': volumename})
|
||||||
@ -493,12 +493,12 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
device_id = vol_instance['DeviceID']
|
device_id = vol_instance['DeviceID']
|
||||||
|
|
||||||
LOG.debug(_('Delete Volume: %(name)s DeviceID: %(deviceid)s')
|
LOG.debug('Delete Volume: %(name)s DeviceID: %(deviceid)s'
|
||||||
% {'name': volumename,
|
% {'name': volumename,
|
||||||
'deviceid': device_id})
|
'deviceid': device_id})
|
||||||
|
|
||||||
LOG.debug(_('Delete Volume: %(name)s Method: EMCReturnToStoragePool '
|
LOG.debug('Delete Volume: %(name)s Method: EMCReturnToStoragePool '
|
||||||
'ConfigServic: %(service)s TheElement: %(vol_instance)s')
|
'ConfigServic: %(service)s TheElement: %(vol_instance)s'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'name': volumename,
|
'name': volumename,
|
||||||
'vol_instance': vol_instance.path})
|
'vol_instance': vol_instance.path})
|
||||||
@ -520,14 +520,14 @@ class EMCSMISCommon():
|
|||||||
raise exception.VolumeBackendAPIException(
|
raise exception.VolumeBackendAPIException(
|
||||||
data=exception_message)
|
data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_('Leaving delete_volume: %(volumename)s Return code: '
|
LOG.debug('Leaving delete_volume: %(volumename)s Return code: '
|
||||||
'%(rc)lu')
|
'%(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
|
|
||||||
def create_snapshot(self, snapshot, volume):
|
def create_snapshot(self, snapshot, volume):
|
||||||
"""Creates a snapshot."""
|
"""Creates a snapshot."""
|
||||||
LOG.debug(_('Entering create_snapshot.'))
|
LOG.debug('Entering create_snapshot.')
|
||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = snapshot['volume_name']
|
volumename = snapshot['volume_name']
|
||||||
@ -541,8 +541,8 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
device_id = vol_instance['DeviceID']
|
device_id = vol_instance['DeviceID']
|
||||||
storage_system = vol_instance['SystemName']
|
storage_system = vol_instance['SystemName']
|
||||||
LOG.debug(_('Device ID: %(deviceid)s: Storage System: '
|
LOG.debug('Device ID: %(deviceid)s: Storage System: '
|
||||||
'%(storagesystem)s')
|
'%(storagesystem)s'
|
||||||
% {'deviceid': device_id,
|
% {'deviceid': device_id,
|
||||||
'storagesystem': storage_system})
|
'storagesystem': storage_system})
|
||||||
|
|
||||||
@ -555,10 +555,10 @@ class EMCSMISCommon():
|
|||||||
% volumename)
|
% volumename)
|
||||||
raise exception.VolumeBackendAPIException(data=exception_message)
|
raise exception.VolumeBackendAPIException(data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_("Create Snapshot: Method: CreateElementReplica: "
|
LOG.debug("Create Snapshot: Method: CreateElementReplica: "
|
||||||
"Target: %(snapshot)s Source: %(volume)s Replication "
|
"Target: %(snapshot)s Source: %(volume)s Replication "
|
||||||
"Service: %(service)s ElementName: %(elementname)s Sync "
|
"Service: %(service)s ElementName: %(elementname)s Sync "
|
||||||
"Type: 7 SourceElement: %(sourceelement)s.")
|
"Type: 7 SourceElement: %(sourceelement)s."
|
||||||
% {'snapshot': snapshotname,
|
% {'snapshot': snapshotname,
|
||||||
'volume': volumename,
|
'volume': volumename,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -571,8 +571,8 @@ class EMCSMISCommon():
|
|||||||
SyncType=self._getnum(7, '16'),
|
SyncType=self._getnum(7, '16'),
|
||||||
SourceElement=vol_instance.path)
|
SourceElement=vol_instance.path)
|
||||||
|
|
||||||
LOG.debug(_('Create Snapshot: Volume: %(volumename)s '
|
LOG.debug('Create Snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s Return code: %(rc)lu')
|
'Snapshot: %(snapshotname)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -602,15 +602,15 @@ class EMCSMISCommon():
|
|||||||
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
keys['SystemCreationClassName'] = volpath['SystemCreationClassName']
|
||||||
name['keybindings'] = keys
|
name['keybindings'] = keys
|
||||||
|
|
||||||
LOG.debug(_('Leaving create_snapshot: Snapshot: %(snapshot)s '
|
LOG.debug('Leaving create_snapshot: Snapshot: %(snapshot)s '
|
||||||
'Volume: %(volume)s Return code: %(rc)lu.') %
|
'Volume: %(volume)s Return code: %(rc)lu.' %
|
||||||
{'snapshot': snapshotname, 'volume': volumename, 'rc': rc})
|
{'snapshot': snapshotname, 'volume': volumename, 'rc': rc})
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def delete_snapshot(self, snapshot, volume):
|
def delete_snapshot(self, snapshot, volume):
|
||||||
"""Deletes a snapshot."""
|
"""Deletes a snapshot."""
|
||||||
LOG.debug(_('Entering delete_snapshot.'))
|
LOG.debug('Entering delete_snapshot.')
|
||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = snapshot['volume_name']
|
volumename = snapshot['volume_name']
|
||||||
@ -620,8 +620,8 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
self.conn = self._get_ecom_connection()
|
self.conn = self._get_ecom_connection()
|
||||||
|
|
||||||
LOG.debug(_('Delete Snapshot: %(snapshot)s: volume: %(volume)s. '
|
LOG.debug('Delete Snapshot: %(snapshot)s: volume: %(volume)s. '
|
||||||
'Finding StorageSychronization_SV_SV.')
|
'Finding StorageSychronization_SV_SV.'
|
||||||
% {'snapshot': snapshotname,
|
% {'snapshot': snapshotname,
|
||||||
'volume': volumename})
|
'volume': volumename})
|
||||||
|
|
||||||
@ -643,11 +643,11 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
# Delete snapshot - deletes both the target element
|
# Delete snapshot - deletes both the target element
|
||||||
# and the snap session
|
# and the snap session
|
||||||
LOG.debug(_("Delete Snapshot: Target: %(snapshot)s "
|
LOG.debug("Delete Snapshot: Target: %(snapshot)s "
|
||||||
"Source: %(volume)s. Method: "
|
"Source: %(volume)s. Method: "
|
||||||
"ModifyReplicaSynchronization: "
|
"ModifyReplicaSynchronization: "
|
||||||
"Replication Service: %(service)s Operation: 19 "
|
"Replication Service: %(service)s Operation: 19 "
|
||||||
"Synchronization: %(sync_name)s.")
|
"Synchronization: %(sync_name)s."
|
||||||
% {'snapshot': snapshotname,
|
% {'snapshot': snapshotname,
|
||||||
'volume': volumename,
|
'volume': volumename,
|
||||||
'service': repservice,
|
'service': repservice,
|
||||||
@ -659,8 +659,8 @@ class EMCSMISCommon():
|
|||||||
Operation=self._getnum(19, '16'),
|
Operation=self._getnum(19, '16'),
|
||||||
Synchronization=sync_name)
|
Synchronization=sync_name)
|
||||||
|
|
||||||
LOG.debug(_('Delete Snapshot: Volume: %(volumename)s Snapshot: '
|
LOG.debug('Delete Snapshot: Volume: %(volumename)s Snapshot: '
|
||||||
'%(snapshotname)s Return code: %(rc)lu')
|
'%(snapshotname)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -721,8 +721,8 @@ class EMCSMISCommon():
|
|||||||
'error': str(ex.args)})
|
'error': str(ex.args)})
|
||||||
break
|
break
|
||||||
|
|
||||||
LOG.debug(_('Leaving delete_snapshot: Volume: %(volumename)s '
|
LOG.debug('Leaving delete_snapshot: Volume: %(volumename)s '
|
||||||
'Snapshot: %(snapshotname)s Return code: %(rc)lu.')
|
'Snapshot: %(snapshotname)s Return code: %(rc)lu.'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
@ -742,9 +742,9 @@ class EMCSMISCommon():
|
|||||||
lunmask_ctrl = self._find_lunmasking_scsi_protocol_controller(
|
lunmask_ctrl = self._find_lunmasking_scsi_protocol_controller(
|
||||||
storage_system, connector)
|
storage_system, connector)
|
||||||
|
|
||||||
LOG.debug(_('ExposePaths: %(vol)s ConfigServicie: %(service)s '
|
LOG.debug('ExposePaths: %(vol)s ConfigServicie: %(service)s '
|
||||||
'LUNames: %(lun_name)s InitiatorPortIDs: %(initiator)s '
|
'LUNames: %(lun_name)s InitiatorPortIDs: %(initiator)s '
|
||||||
'DeviceAccesses: 2')
|
'DeviceAccesses: 2'
|
||||||
% {'vol': vol_instance.path,
|
% {'vol': vol_instance.path,
|
||||||
'service': configservice,
|
'service': configservice,
|
||||||
'lun_name': lun_name,
|
'lun_name': lun_name,
|
||||||
@ -757,9 +757,9 @@ class EMCSMISCommon():
|
|||||||
InitiatorPortIDs=initiators,
|
InitiatorPortIDs=initiators,
|
||||||
DeviceAccesses=[self._getnum(2, '16')])
|
DeviceAccesses=[self._getnum(2, '16')])
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('ExposePaths parameter '
|
LOG.debug('ExposePaths parameter '
|
||||||
'LunMaskingSCSIProtocolController: '
|
'LunMaskingSCSIProtocolController: '
|
||||||
'%(lunmasking)s')
|
'%(lunmasking)s'
|
||||||
% {'lunmasking': lunmask_ctrl})
|
% {'lunmasking': lunmask_ctrl})
|
||||||
rc, controller =\
|
rc, controller =\
|
||||||
self.conn.InvokeMethod('ExposePaths',
|
self.conn.InvokeMethod('ExposePaths',
|
||||||
@ -772,7 +772,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_('ExposePaths for volume %s completed successfully.')
|
LOG.debug('ExposePaths for volume %s completed successfully.'
|
||||||
% volumename)
|
% volumename)
|
||||||
|
|
||||||
# Unmapping method for VNX
|
# Unmapping method for VNX
|
||||||
@ -788,9 +788,9 @@ class EMCSMISCommon():
|
|||||||
lunmask_ctrl = self._find_lunmasking_scsi_protocol_controller_for_vol(
|
lunmask_ctrl = self._find_lunmasking_scsi_protocol_controller_for_vol(
|
||||||
vol_instance, connector)
|
vol_instance, connector)
|
||||||
|
|
||||||
LOG.debug(_('HidePaths: %(vol)s ConfigServicie: %(service)s '
|
LOG.debug('HidePaths: %(vol)s ConfigServicie: %(service)s '
|
||||||
'LUNames: %(device_id)s LunMaskingSCSIProtocolController: '
|
'LUNames: %(device_id)s LunMaskingSCSIProtocolController: '
|
||||||
'%(lunmasking)s')
|
'%(lunmasking)s'
|
||||||
% {'vol': vol_instance.path,
|
% {'vol': vol_instance.path,
|
||||||
'service': configservice,
|
'service': configservice,
|
||||||
'device_id': device_id,
|
'device_id': device_id,
|
||||||
@ -805,7 +805,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_('HidePaths for volume %s completed successfully.')
|
LOG.debug('HidePaths for volume %s completed successfully.'
|
||||||
% volumename)
|
% volumename)
|
||||||
|
|
||||||
# Mapping method for VMAX
|
# Mapping method for VMAX
|
||||||
@ -818,8 +818,8 @@ class EMCSMISCommon():
|
|||||||
volumename = vol_instance['ElementName']
|
volumename = vol_instance['ElementName']
|
||||||
masking_group = self._find_device_masking_group()
|
masking_group = self._find_device_masking_group()
|
||||||
|
|
||||||
LOG.debug(_('AddMembers: ConfigServicie: %(service)s MaskingGroup: '
|
LOG.debug('AddMembers: ConfigServicie: %(service)s MaskingGroup: '
|
||||||
'%(masking_group)s Members: %(vol)s')
|
'%(masking_group)s Members: %(vol)s'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'masking_group': masking_group,
|
'masking_group': masking_group,
|
||||||
'vol': vol_instance.path})
|
'vol': vol_instance.path})
|
||||||
@ -838,7 +838,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_('AddMembers for volume %s completed successfully.')
|
LOG.debug('AddMembers for volume %s completed successfully.'
|
||||||
% volumename)
|
% volumename)
|
||||||
|
|
||||||
# Unmapping method for VMAX
|
# Unmapping method for VMAX
|
||||||
@ -851,8 +851,8 @@ class EMCSMISCommon():
|
|||||||
volumename = vol_instance['ElementName']
|
volumename = vol_instance['ElementName']
|
||||||
masking_group = self._find_device_masking_group()
|
masking_group = self._find_device_masking_group()
|
||||||
|
|
||||||
LOG.debug(_('RemoveMembers: ConfigServicie: %(service)s '
|
LOG.debug('RemoveMembers: ConfigServicie: %(service)s '
|
||||||
'MaskingGroup: %(masking_group)s Members: %(vol)s')
|
'MaskingGroup: %(masking_group)s Members: %(vol)s'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'masking_group': masking_group,
|
'masking_group': masking_group,
|
||||||
'vol': vol_instance.path})
|
'vol': vol_instance.path})
|
||||||
@ -869,7 +869,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_('RemoveMembers for volume %s completed successfully.')
|
LOG.debug('RemoveMembers for volume %s completed successfully.'
|
||||||
% volumename)
|
% volumename)
|
||||||
|
|
||||||
def _map_lun(self, volume, connector):
|
def _map_lun(self, volume, connector):
|
||||||
@ -953,7 +953,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
"""Extends an existing volume."""
|
"""Extends an existing volume."""
|
||||||
LOG.debug(_('Entering extend_volume.'))
|
LOG.debug('Entering extend_volume.')
|
||||||
volumesize = int(new_size) * units.GiB
|
volumesize = int(new_size) * units.GiB
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
|
|
||||||
@ -969,8 +969,8 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
device_id = vol_instance['DeviceID']
|
device_id = vol_instance['DeviceID']
|
||||||
storage_system = vol_instance['SystemName']
|
storage_system = vol_instance['SystemName']
|
||||||
LOG.debug(_('Device ID: %(deviceid)s: Storage System: '
|
LOG.debug('Device ID: %(deviceid)s: Storage System: '
|
||||||
'%(storagesystem)s')
|
'%(storagesystem)s'
|
||||||
% {'deviceid': device_id,
|
% {'deviceid': device_id,
|
||||||
'storagesystem': storage_system})
|
'storagesystem': storage_system})
|
||||||
|
|
||||||
@ -985,10 +985,10 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
provisioning = self._get_provisioning(storage_type)
|
provisioning = self._get_provisioning(storage_type)
|
||||||
|
|
||||||
LOG.debug(_('Extend Volume: %(name)s Method: '
|
LOG.debug('Extend Volume: %(name)s Method: '
|
||||||
'CreateOrModifyElementFromStoragePool ConfigServicie: '
|
'CreateOrModifyElementFromStoragePool ConfigServicie: '
|
||||||
'%(service)s ElementType: %(provisioning)s Size: %(size)lu'
|
'%(service)s ElementType: %(provisioning)s Size: %(size)lu'
|
||||||
'Volume path: %(volumepath)s')
|
'Volume path: %(volumepath)s'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'name': volumename,
|
'name': volumename,
|
||||||
'provisioning': provisioning,
|
'provisioning': provisioning,
|
||||||
@ -1001,7 +1001,7 @@ class EMCSMISCommon():
|
|||||||
Size=self._getnum(volumesize, '64'),
|
Size=self._getnum(volumesize, '64'),
|
||||||
TheElement=vol_instance.path)
|
TheElement=vol_instance.path)
|
||||||
|
|
||||||
LOG.debug(_('Extend Volume: %(volumename)s Return code: %(rc)lu')
|
LOG.debug('Extend Volume: %(volumename)s Return code: %(rc)lu'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
|
|
||||||
@ -1015,14 +1015,14 @@ class EMCSMISCommon():
|
|||||||
'error': errordesc})
|
'error': errordesc})
|
||||||
raise exception.VolumeBackendAPIException(data=errordesc)
|
raise exception.VolumeBackendAPIException(data=errordesc)
|
||||||
|
|
||||||
LOG.debug(_('Leaving extend_volume: %(volumename)s '
|
LOG.debug('Leaving extend_volume: %(volumename)s '
|
||||||
'Return code: %(rc)lu ')
|
'Return code: %(rc)lu '
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
|
|
||||||
def update_volume_stats(self):
|
def update_volume_stats(self):
|
||||||
"""Retrieve stats info."""
|
"""Retrieve stats info."""
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
self.stats['total_capacity_gb'] = 'unknown'
|
self.stats['total_capacity_gb'] = 'unknown'
|
||||||
self.stats['free_capacity_gb'] = 'unknown'
|
self.stats['free_capacity_gb'] = 'unknown'
|
||||||
|
|
||||||
@ -1037,7 +1037,7 @@ class EMCSMISCommon():
|
|||||||
specs = self._get_volumetype_extraspecs(volume)
|
specs = self._get_volumetype_extraspecs(volume)
|
||||||
if not specs:
|
if not specs:
|
||||||
specs = self._get_storage_type_conffile()
|
specs = self._get_storage_type_conffile()
|
||||||
LOG.debug(_("Storage Type: %s") % (specs))
|
LOG.debug("Storage Type: %s" % (specs))
|
||||||
return specs
|
return specs
|
||||||
|
|
||||||
def _get_storage_type_conffile(self, filename=None):
|
def _get_storage_type_conffile(self, filename=None):
|
||||||
@ -1054,7 +1054,7 @@ class EMCSMISCommon():
|
|||||||
storageType = storageTypes[0].toxml()
|
storageType = storageTypes[0].toxml()
|
||||||
storageType = storageType.replace('<StorageType>', '')
|
storageType = storageType.replace('<StorageType>', '')
|
||||||
storageType = storageType.replace('</StorageType>', '')
|
storageType = storageType.replace('</StorageType>', '')
|
||||||
LOG.debug(_("Found Storage Type in config file: %s")
|
LOG.debug("Found Storage Type in config file: %s"
|
||||||
% (storageType))
|
% (storageType))
|
||||||
specs = {}
|
specs = {}
|
||||||
specs[POOL] = storageType
|
specs[POOL] = storageType
|
||||||
@ -1076,10 +1076,10 @@ class EMCSMISCommon():
|
|||||||
if views is not None and len(views) > 0:
|
if views is not None and len(views) > 0:
|
||||||
view = views[0].toxml().replace('<MaskingView>', '')
|
view = views[0].toxml().replace('<MaskingView>', '')
|
||||||
view = view.replace('</MaskingView>', '')
|
view = view.replace('</MaskingView>', '')
|
||||||
LOG.debug(_("Found Masking View: %s") % (view))
|
LOG.debug("Found Masking View: %s" % (view))
|
||||||
return view
|
return view
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Masking View not found."))
|
LOG.debug("Masking View not found.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_timeout(self, filename=None):
|
def _get_timeout(self, filename=None):
|
||||||
@ -1094,10 +1094,10 @@ class EMCSMISCommon():
|
|||||||
if timeouts is not None and len(timeouts) > 0:
|
if timeouts is not None and len(timeouts) > 0:
|
||||||
timeout = timeouts[0].toxml().replace('<Timeout>', '')
|
timeout = timeouts[0].toxml().replace('<Timeout>', '')
|
||||||
timeout = timeout.replace('</Timeout>', '')
|
timeout = timeout.replace('</Timeout>', '')
|
||||||
LOG.debug(_("Found Timeout: %s") % (timeout))
|
LOG.debug("Found Timeout: %s" % (timeout))
|
||||||
return timeout
|
return timeout
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Timeout not specified."))
|
LOG.debug("Timeout not specified.")
|
||||||
return 10
|
return 10
|
||||||
|
|
||||||
def _get_ecom_cred(self, filename=None):
|
def _get_ecom_cred(self, filename=None):
|
||||||
@ -1119,7 +1119,7 @@ class EMCSMISCommon():
|
|||||||
if ecomUser is not None and ecomPasswd is not None:
|
if ecomUser is not None and ecomPasswd is not None:
|
||||||
return ecomUser, ecomPasswd
|
return ecomUser, ecomPasswd
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Ecom user not found."))
|
LOG.debug("Ecom user not found.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_ecom_server(self, filename=None):
|
def _get_ecom_server(self, filename=None):
|
||||||
@ -1139,11 +1139,11 @@ class EMCSMISCommon():
|
|||||||
ecomPort = ecomPorts[0].toxml().replace('<EcomServerPort>', '')
|
ecomPort = ecomPorts[0].toxml().replace('<EcomServerPort>', '')
|
||||||
ecomPort = ecomPort.replace('</EcomServerPort>', '')
|
ecomPort = ecomPort.replace('</EcomServerPort>', '')
|
||||||
if ecomIp is not None and ecomPort is not None:
|
if ecomIp is not None and ecomPort is not None:
|
||||||
LOG.debug(_("Ecom IP: %(ecomIp)s Port: %(ecomPort)s"),
|
LOG.debug("Ecom IP: %(ecomIp)s Port: %(ecomPort)s",
|
||||||
{'ecomIp': ecomIp, 'ecomPort': ecomPort})
|
{'ecomIp': ecomIp, 'ecomPort': ecomPort})
|
||||||
return ecomIp, ecomPort
|
return ecomIp, ecomPort
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Ecom server not found."))
|
LOG.debug("Ecom server not found.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_ecom_connection(self, filename=None):
|
def _get_ecom_connection(self, filename=None):
|
||||||
@ -1162,7 +1162,7 @@ class EMCSMISCommon():
|
|||||||
for repservice in repservices:
|
for repservice in repservices:
|
||||||
if storage_system == repservice['SystemName']:
|
if storage_system == repservice['SystemName']:
|
||||||
foundRepService = repservice
|
foundRepService = repservice
|
||||||
LOG.debug(_("Found Replication Service: %s")
|
LOG.debug("Found Replication Service: %s"
|
||||||
% (repservice))
|
% (repservice))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1175,7 +1175,7 @@ class EMCSMISCommon():
|
|||||||
for configservice in configservices:
|
for configservice in configservices:
|
||||||
if storage_system == configservice['SystemName']:
|
if storage_system == configservice['SystemName']:
|
||||||
foundConfigService = configservice
|
foundConfigService = configservice
|
||||||
LOG.debug(_("Found Storage Configuration Service: %s")
|
LOG.debug("Found Storage Configuration Service: %s"
|
||||||
% (configservice))
|
% (configservice))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1188,7 +1188,7 @@ class EMCSMISCommon():
|
|||||||
for configservice in configservices:
|
for configservice in configservices:
|
||||||
if storage_system == configservice['SystemName']:
|
if storage_system == configservice['SystemName']:
|
||||||
foundConfigService = configservice
|
foundConfigService = configservice
|
||||||
LOG.debug(_("Found Controller Configuration Service: %s")
|
LOG.debug("Found Controller Configuration Service: %s"
|
||||||
% (configservice))
|
% (configservice))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1201,7 +1201,7 @@ class EMCSMISCommon():
|
|||||||
for configservice in configservices:
|
for configservice in configservices:
|
||||||
if storage_system == configservice['SystemName']:
|
if storage_system == configservice['SystemName']:
|
||||||
foundConfigService = configservice
|
foundConfigService = configservice
|
||||||
LOG.debug(_("Found Storage Hardware ID Management Service: %s")
|
LOG.debug("Found Storage Hardware ID Management Service: %s"
|
||||||
% (configservice))
|
% (configservice))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1257,7 +1257,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(exception_message)
|
LOG.error(exception_message)
|
||||||
raise exception.VolumeBackendAPIException(data=exception_message)
|
raise exception.VolumeBackendAPIException(data=exception_message)
|
||||||
|
|
||||||
LOG.debug(_("Pool: %(pool)s SystemName: %(systemname)s.")
|
LOG.debug("Pool: %(pool)s SystemName: %(systemname)s."
|
||||||
% {'pool': foundPool,
|
% {'pool': foundPool,
|
||||||
'systemname': systemname})
|
'systemname': systemname})
|
||||||
return foundPool, systemname
|
return foundPool, systemname
|
||||||
@ -1274,7 +1274,7 @@ class EMCSMISCommon():
|
|||||||
if len(idarray) > 2:
|
if len(idarray) > 2:
|
||||||
systemname = idarray[0] + '+' + idarray[1]
|
systemname = idarray[0] + '+' + idarray[1]
|
||||||
|
|
||||||
LOG.debug(_("Pool name: %(poolname)s System name: %(systemname)s.")
|
LOG.debug("Pool name: %(poolname)s System name: %(systemname)s."
|
||||||
% {'poolname': poolname, 'systemname': systemname})
|
% {'poolname': poolname, 'systemname': systemname})
|
||||||
return poolname, systemname
|
return poolname, systemname
|
||||||
|
|
||||||
@ -1289,11 +1289,11 @@ class EMCSMISCommon():
|
|||||||
foundinstance = self.conn.GetInstance(instancename)
|
foundinstance = self.conn.GetInstance(instancename)
|
||||||
|
|
||||||
if foundinstance is None:
|
if foundinstance is None:
|
||||||
LOG.debug(_("Volume %(volumename)s not found on the array.")
|
LOG.debug("Volume %(volumename)s not found on the array."
|
||||||
% {'volumename': volumename})
|
% {'volumename': volumename})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Volume name: %(volumename)s Volume instance: "
|
LOG.debug("Volume name: %(volumename)s Volume instance: "
|
||||||
"%(vol_instance)s.")
|
"%(vol_instance)s."
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'vol_instance': foundinstance.path})
|
'vol_instance': foundinstance.path})
|
||||||
|
|
||||||
@ -1307,7 +1307,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
LOG.debug(_("Source: %(volumename)s Target: %(snapshotname)s.")
|
LOG.debug("Source: %(volumename)s Target: %(snapshotname)s."
|
||||||
% {'volumename': volumename, 'snapshotname': snapshotname})
|
% {'volumename': volumename, 'snapshotname': snapshotname})
|
||||||
|
|
||||||
snapshot_instance = self._find_lun(snapshot)
|
snapshot_instance = self._find_lun(snapshot)
|
||||||
@ -1319,13 +1319,13 @@ class EMCSMISCommon():
|
|||||||
foundsyncname = self._getinstancename(classname, bindings)
|
foundsyncname = self._getinstancename(classname, bindings)
|
||||||
|
|
||||||
if foundsyncname is None:
|
if foundsyncname is None:
|
||||||
LOG.debug(_("Source: %(volumename)s Target: %(snapshotname)s. "
|
LOG.debug("Source: %(volumename)s Target: %(snapshotname)s. "
|
||||||
"Storage Synchronized not found. ")
|
"Storage Synchronized not found. "
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname})
|
'snapshotname': snapshotname})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Storage system: %(storage_system)s "
|
LOG.debug("Storage system: %(storage_system)s "
|
||||||
"Storage Synchronized instance: %(sync)s.")
|
"Storage Synchronized instance: %(sync)s."
|
||||||
% {'storage_system': storage_system,
|
% {'storage_system': storage_system,
|
||||||
'sync': foundsyncname})
|
'sync': foundsyncname})
|
||||||
# Wait for SE_StorageSynchronized_SV_SV to be fully synced
|
# Wait for SE_StorageSynchronized_SV_SV to be fully synced
|
||||||
@ -1354,7 +1354,7 @@ class EMCSMISCommon():
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_("Found %(name)s: %(initiator)s.")
|
LOG.debug("Found %(name)s: %(initiator)s."
|
||||||
% {'name': name,
|
% {'name': name,
|
||||||
'initiator': foundinitiatornames})
|
'initiator': foundinitiatornames})
|
||||||
return foundinitiatornames
|
return foundinitiatornames
|
||||||
@ -1414,9 +1414,9 @@ class EMCSMISCommon():
|
|||||||
if foundCtrl is not None:
|
if foundCtrl is not None:
|
||||||
break
|
break
|
||||||
|
|
||||||
LOG.debug(_("LunMaskingSCSIProtocolController for storage system "
|
LOG.debug("LunMaskingSCSIProtocolController for storage system "
|
||||||
"%(storage_system)s and initiator %(initiator)s is "
|
"%(storage_system)s and initiator %(initiator)s is "
|
||||||
"%(ctrl)s.")
|
"%(ctrl)s."
|
||||||
% {'storage_system': storage_system,
|
% {'storage_system': storage_system,
|
||||||
'initiator': initiators,
|
'initiator': initiators,
|
||||||
'ctrl': foundCtrl})
|
'ctrl': foundCtrl})
|
||||||
@ -1455,8 +1455,8 @@ class EMCSMISCommon():
|
|||||||
if foundCtrl is not None:
|
if foundCtrl is not None:
|
||||||
break
|
break
|
||||||
|
|
||||||
LOG.debug(_("LunMaskingSCSIProtocolController for storage volume "
|
LOG.debug("LunMaskingSCSIProtocolController for storage volume "
|
||||||
"%(vol)s and initiator %(initiator)s is %(ctrl)s.")
|
"%(vol)s and initiator %(initiator)s is %(ctrl)s."
|
||||||
% {'vol': vol_instance.path,
|
% {'vol': vol_instance.path,
|
||||||
'initiator': initiators,
|
'initiator': initiators,
|
||||||
'ctrl': foundCtrl})
|
'ctrl': foundCtrl})
|
||||||
@ -1481,8 +1481,8 @@ class EMCSMISCommon():
|
|||||||
storage_system,
|
storage_system,
|
||||||
connector)
|
connector)
|
||||||
|
|
||||||
LOG.debug(_("LunMaskingSCSIProtocolController for storage system "
|
LOG.debug("LunMaskingSCSIProtocolController for storage system "
|
||||||
"%(storage)s and %(connector)s is %(ctrl)s.")
|
"%(storage)s and %(connector)s is %(ctrl)s."
|
||||||
% {'storage': storage_system,
|
% {'storage': storage_system,
|
||||||
'connector': connector,
|
'connector': connector,
|
||||||
'ctrl': ctrl})
|
'ctrl': ctrl})
|
||||||
@ -1493,8 +1493,8 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
numVolumesMapped = len(associators)
|
numVolumesMapped = len(associators)
|
||||||
|
|
||||||
LOG.debug(_("Found %(numVolumesMapped)d volumes on storage system "
|
LOG.debug("Found %(numVolumesMapped)d volumes on storage system "
|
||||||
"%(storage)s mapped to %(initiator)s.")
|
"%(storage)s mapped to %(connector)s."
|
||||||
% {'numVolumesMapped': numVolumesMapped,
|
% {'numVolumesMapped': numVolumesMapped,
|
||||||
'storage': storage_system,
|
'storage': storage_system,
|
||||||
'connector': connector})
|
'connector': connector})
|
||||||
@ -1528,7 +1528,7 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
out_device_number = '%06d' % out_num_device_number
|
out_device_number = '%06d' % out_num_device_number
|
||||||
|
|
||||||
LOG.debug(_("Available device number on %(storage)s: %(device)s.")
|
LOG.debug("Available device number on %(storage)s: %(device)s."
|
||||||
% {'storage': storage_system, 'device': out_device_number})
|
% {'storage': storage_system, 'device': out_device_number})
|
||||||
return out_device_number
|
return out_device_number
|
||||||
|
|
||||||
@ -1553,9 +1553,9 @@ class EMCSMISCommon():
|
|||||||
vol_instance,
|
vol_instance,
|
||||||
connector)
|
connector)
|
||||||
|
|
||||||
LOG.debug(_("LunMaskingSCSIProtocolController for "
|
LOG.debug("LunMaskingSCSIProtocolController for "
|
||||||
"volume %(vol)s and connector %(connector)s "
|
"volume %(vol)s and connector %(connector)s "
|
||||||
"is %(ctrl)s.")
|
"is %(ctrl)s."
|
||||||
% {'vol': vol_instance.path,
|
% {'vol': vol_instance.path,
|
||||||
'connector': connector,
|
'connector': connector,
|
||||||
'ctrl': ctrl})
|
'ctrl': ctrl})
|
||||||
@ -1594,8 +1594,8 @@ class EMCSMISCommon():
|
|||||||
{'volumename': volumename,
|
{'volumename': volumename,
|
||||||
'vol_instance': vol_instance.path})
|
'vol_instance': vol_instance.path})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Found device number %(device)d for volume "
|
LOG.debug("Found device number %(device)d for volume "
|
||||||
"%(volumename)s %(vol_instance)s.") %
|
"%(volumename)s %(vol_instance)s." %
|
||||||
{'device': out_num_device_number,
|
{'device': out_num_device_number,
|
||||||
'volumename': volumename,
|
'volumename': volumename,
|
||||||
'vol_instance': vol_instance.path})
|
'vol_instance': vol_instance.path})
|
||||||
@ -1604,7 +1604,7 @@ class EMCSMISCommon():
|
|||||||
'storagesystem': storage_system,
|
'storagesystem': storage_system,
|
||||||
'owningsp': sp}
|
'owningsp': sp}
|
||||||
|
|
||||||
LOG.debug(_("Device info: %(data)s.") % {'data': data})
|
LOG.debug("Device info: %(data)s." % {'data': data})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -1626,7 +1626,7 @@ class EMCSMISCommon():
|
|||||||
ResultClass='SE_DeviceMaskingGroup')
|
ResultClass='SE_DeviceMaskingGroup')
|
||||||
foundMaskingGroup = groups[0]
|
foundMaskingGroup = groups[0]
|
||||||
|
|
||||||
LOG.debug(_("Masking view: %(view)s DeviceMaskingGroup: %(masking)s.")
|
LOG.debug("Masking view: %(view)s DeviceMaskingGroup: %(masking)s."
|
||||||
% {'view': maskingview_name,
|
% {'view': maskingview_name,
|
||||||
'masking': foundMaskingGroup})
|
'masking': foundMaskingGroup})
|
||||||
|
|
||||||
@ -1648,7 +1648,7 @@ class EMCSMISCommon():
|
|||||||
if (storage_system == storsystemname and
|
if (storage_system == storsystemname and
|
||||||
owningsp == sp):
|
owningsp == sp):
|
||||||
foundSystem = system
|
foundSystem = system
|
||||||
LOG.debug(_("Found Storage Processor System: %s")
|
LOG.debug("Found Storage Processor System: %s"
|
||||||
% (system))
|
% (system))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -1676,9 +1676,9 @@ class EMCSMISCommon():
|
|||||||
if len(arr2) > 1:
|
if len(arr2) > 1:
|
||||||
foundEndpoints.append(arr2[0])
|
foundEndpoints.append(arr2[0])
|
||||||
|
|
||||||
LOG.debug(_("iSCSIProtocolEndpoint for storage system "
|
LOG.debug("iSCSIProtocolEndpoint for storage system "
|
||||||
"%(storage_system)s and SP %(sp)s is "
|
"%(storage_system)s and SP %(sp)s is "
|
||||||
"%(endpoint)s.")
|
"%(endpoint)s."
|
||||||
% {'storage_system': storage_system,
|
% {'storage_system': storage_system,
|
||||||
'sp': owningsp,
|
'sp': owningsp,
|
||||||
'endpoint': foundEndpoints})
|
'endpoint': foundEndpoints})
|
||||||
@ -1723,8 +1723,8 @@ class EMCSMISCommon():
|
|||||||
|
|
||||||
hardwareids = self._find_storage_hardwareids(connector)
|
hardwareids = self._find_storage_hardwareids(connector)
|
||||||
|
|
||||||
LOG.debug(_('EMCGetTargetEndpoints: Service: %(service)s '
|
LOG.debug('EMCGetTargetEndpoints: Service: %(service)s '
|
||||||
'Storage HardwareIDs: %(hardwareids)s.')
|
'Storage HardwareIDs: %(hardwareids)s.'
|
||||||
% {'service': configservice,
|
% {'service': configservice,
|
||||||
'hardwareids': hardwareids})
|
'hardwareids': hardwareids})
|
||||||
|
|
||||||
@ -1745,9 +1745,9 @@ class EMCSMISCommon():
|
|||||||
# Add target wwn to the list if it is not already there
|
# Add target wwn to the list if it is not already there
|
||||||
if not any(d == wwn for d in target_wwns):
|
if not any(d == wwn for d in target_wwns):
|
||||||
target_wwns.append(wwn)
|
target_wwns.append(wwn)
|
||||||
LOG.debug(_('Add target WWN: %s.') % wwn)
|
LOG.debug('Add target WWN: %s.' % wwn)
|
||||||
|
|
||||||
LOG.debug(_('Target WWNs: %s.') % target_wwns)
|
LOG.debug('Target WWNs: %s.' % target_wwns)
|
||||||
|
|
||||||
return target_wwns
|
return target_wwns
|
||||||
|
|
||||||
@ -1763,8 +1763,8 @@ class EMCSMISCommon():
|
|||||||
if wwpn.lower() == storid.lower():
|
if wwpn.lower() == storid.lower():
|
||||||
foundInstances.append(hardwareid.path)
|
foundInstances.append(hardwareid.path)
|
||||||
|
|
||||||
LOG.debug(_("Storage Hardware IDs for %(wwpns)s is "
|
LOG.debug("Storage Hardware IDs for %(wwpns)s is "
|
||||||
"%(foundInstances)s.")
|
"%(foundInstances)s."
|
||||||
% {'wwpns': wwpns,
|
% {'wwpns': wwpns,
|
||||||
'foundInstances': foundInstances})
|
'foundInstances': foundInstances})
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class EMCSMISFCDriver(driver.FibreChannelDriver):
|
|||||||
'target_wwn': target_wwns,
|
'target_wwn': target_wwns,
|
||||||
'initiator_target_map': init_targ_map}}
|
'initiator_target_map': init_targ_map}}
|
||||||
|
|
||||||
LOG.debug(_('Return FC data: %(data)s.')
|
LOG.debug('Return FC data: %(data)s.'
|
||||||
% {'data': data})
|
% {'data': data})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
@ -181,7 +181,7 @@ class EMCSMISFCDriver(driver.FibreChannelDriver):
|
|||||||
'data': {'target_wwn': target_wwns,
|
'data': {'target_wwn': target_wwns,
|
||||||
'initiator_target_map': init_targ_map}}
|
'initiator_target_map': init_targ_map}}
|
||||||
|
|
||||||
LOG.debug(_('Return FC data: %(data)s.')
|
LOG.debug('Return FC data: %(data)s.'
|
||||||
% {'data': data})
|
% {'data': data})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
@ -215,7 +215,7 @@ class EMCSMISFCDriver(driver.FibreChannelDriver):
|
|||||||
|
|
||||||
def update_volume_stats(self):
|
def update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = self.common.update_volume_stats()
|
data = self.common.update_volume_stats()
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
data['volume_backend_name'] = backend_name or 'EMCSMISFCDriver'
|
data['volume_backend_name'] = backend_name or 'EMCSMISFCDriver'
|
||||||
|
@ -191,7 +191,7 @@ class EMCSMISISCSIDriver(driver.ISCSIDriver):
|
|||||||
" for volume %s") %
|
" for volume %s") %
|
||||||
(volume['name']))
|
(volume['name']))
|
||||||
|
|
||||||
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
|
LOG.debug("ISCSI Discovery: Found %s" % (location))
|
||||||
properties['target_discovered'] = True
|
properties['target_discovered'] = True
|
||||||
|
|
||||||
device_info = self.common.find_device_number(volume, connector)
|
device_info = self.common.find_device_number(volume, connector)
|
||||||
@ -226,7 +226,7 @@ class EMCSMISISCSIDriver(driver.ISCSIDriver):
|
|||||||
break
|
break
|
||||||
for endpoint in endpoints:
|
for endpoint in endpoints:
|
||||||
if properties['target_iqn'] == endpoint:
|
if properties['target_iqn'] == endpoint:
|
||||||
LOG.debug(_("Found iSCSI endpoint: %s") % endpoint)
|
LOG.debug("Found iSCSI endpoint: %s" % endpoint)
|
||||||
foundEndpoint = True
|
foundEndpoint = True
|
||||||
break
|
break
|
||||||
if foundEndpoint:
|
if foundEndpoint:
|
||||||
@ -242,7 +242,7 @@ class EMCSMISISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
properties['volume_id'] = volume['id']
|
properties['volume_id'] = volume['id']
|
||||||
|
|
||||||
LOG.debug(_("ISCSI properties: %s") % (properties))
|
LOG.debug("ISCSI properties: %s" % (properties))
|
||||||
|
|
||||||
auth = volume['provider_auth']
|
auth = volume['provider_auth']
|
||||||
if auth:
|
if auth:
|
||||||
@ -274,7 +274,7 @@ class EMCSMISISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def update_volume_stats(self):
|
def update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = self.common.update_volume_stats()
|
data = self.common.update_volume_stats()
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
data['volume_backend_name'] = backend_name or 'EMCSMISISCSIDriver'
|
data['volume_backend_name'] = backend_name or 'EMCSMISISCSIDriver'
|
||||||
|
@ -122,7 +122,7 @@ class EMCVnxCli(object):
|
|||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
"""Creates a EMC volume."""
|
"""Creates a EMC volume."""
|
||||||
|
|
||||||
LOG.debug(_('Entering create_volume.'))
|
LOG.debug('Entering create_volume.')
|
||||||
volumesize = volume['size']
|
volumesize = volume['size']
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class EMCVnxCli(object):
|
|||||||
thinness = self._get_provisioning_by_volume(volume)
|
thinness = self._get_provisioning_by_volume(volume)
|
||||||
|
|
||||||
# executing CLI command to create volume
|
# executing CLI command to create volume
|
||||||
LOG.debug(_('Create Volume: %(volumename)s')
|
LOG.debug('Create Volume: %(volumename)s'
|
||||||
% {'volumename': volumename})
|
% {'volumename': volumename})
|
||||||
|
|
||||||
lun_create = ('lun', '-create',
|
lun_create = ('lun', '-create',
|
||||||
@ -144,7 +144,7 @@ class EMCVnxCli(object):
|
|||||||
'-poolName', self.pool_name,
|
'-poolName', self.pool_name,
|
||||||
'-name', volumename)
|
'-name', volumename)
|
||||||
out, rc = self._cli_execute(*lun_create)
|
out, rc = self._cli_execute(*lun_create)
|
||||||
LOG.debug(_('Create Volume: %(volumename)s Return code: %(rc)s')
|
LOG.debug('Create Volume: %(volumename)s Return code: %(rc)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'rc': rc})
|
'rc': rc})
|
||||||
if rc == 4:
|
if rc == 4:
|
||||||
@ -175,7 +175,7 @@ class EMCVnxCli(object):
|
|||||||
def delete_volume(self, volume):
|
def delete_volume(self, volume):
|
||||||
"""Deletes an EMC volume."""
|
"""Deletes an EMC volume."""
|
||||||
|
|
||||||
LOG.debug(_('Entering delete_volume.'))
|
LOG.debug('Entering delete_volume.')
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
# defining CLI command
|
# defining CLI command
|
||||||
lun_destroy = ('lun', '-destroy',
|
lun_destroy = ('lun', '-destroy',
|
||||||
@ -184,7 +184,7 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
# executing CLI command to delete volume
|
# executing CLI command to delete volume
|
||||||
out, rc = self._cli_execute(*lun_destroy)
|
out, rc = self._cli_execute(*lun_destroy)
|
||||||
LOG.debug(_('Delete Volume: %(volumename)s Output: %(out)s')
|
LOG.debug('Delete Volume: %(volumename)s Output: %(out)s'
|
||||||
% {'volumename': volumename, 'out': out})
|
% {'volumename': volumename, 'out': out})
|
||||||
if rc not in (0, 9):
|
if rc not in (0, 9):
|
||||||
msg = (_('Failed to destroy %s'), volumename)
|
msg = (_('Failed to destroy %s'), volumename)
|
||||||
@ -194,7 +194,7 @@ class EMCVnxCli(object):
|
|||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
"""Extends an EMC volume."""
|
"""Extends an EMC volume."""
|
||||||
|
|
||||||
LOG.debug(_('Entering extend_volume.'))
|
LOG.debug('Entering extend_volume.')
|
||||||
volumename = volume['name']
|
volumename = volume['name']
|
||||||
|
|
||||||
# defining CLI command
|
# defining CLI command
|
||||||
@ -207,7 +207,7 @@ class EMCVnxCli(object):
|
|||||||
# executing CLI command to extend volume
|
# executing CLI command to extend volume
|
||||||
out, rc = self._cli_execute(*lun_expand)
|
out, rc = self._cli_execute(*lun_expand)
|
||||||
|
|
||||||
LOG.debug(_('Extend Volume: %(volumename)s Output: %(out)s')
|
LOG.debug('Extend Volume: %(volumename)s Output: %(out)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'out': out})
|
'out': out})
|
||||||
if rc == 97:
|
if rc == 97:
|
||||||
@ -223,7 +223,7 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
def update_volume_status(self):
|
def update_volume_status(self):
|
||||||
"""Retrieve status info."""
|
"""Retrieve status info."""
|
||||||
LOG.debug(_("Updating volume status"))
|
LOG.debug("Updating volume status")
|
||||||
|
|
||||||
poolname = self.pool_name
|
poolname = self.pool_name
|
||||||
pool_list = ('storagepool', '-list',
|
pool_list = ('storagepool', '-list',
|
||||||
@ -248,8 +248,8 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
device_id = self._find_lun_id(volumename)
|
device_id = self._find_lun_id(volumename)
|
||||||
|
|
||||||
LOG.debug(_('create_export: Volume: %(volume)s Device ID: '
|
LOG.debug('create_export: Volume: %(volume)s Device ID: '
|
||||||
'%(device_id)s')
|
'%(device_id)s'
|
||||||
% {'volume': volumename,
|
% {'volume': volumename,
|
||||||
'device_id': device_id})
|
'device_id': device_id})
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
def create_snapshot(self, snapshot):
|
def create_snapshot(self, snapshot):
|
||||||
"""Creates a snapshot."""
|
"""Creates a snapshot."""
|
||||||
LOG.debug(_('Entering create_snapshot.'))
|
LOG.debug('Entering create_snapshot.')
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = snapshot['volume_name']
|
volumename = snapshot['volume_name']
|
||||||
LOG.info(_('Create snapshot: %(snapshot)s: volume: %(volume)s')
|
LOG.info(_('Create snapshot: %(snapshot)s: volume: %(volume)s')
|
||||||
@ -289,7 +289,7 @@ class EMCVnxCli(object):
|
|||||||
# executing CLI command to create snapshot
|
# executing CLI command to create snapshot
|
||||||
out, rc = self._cli_execute(*snap_create)
|
out, rc = self._cli_execute(*snap_create)
|
||||||
|
|
||||||
LOG.debug(_('Create Snapshot: %(snapshotname)s Unity: %(out)s')
|
LOG.debug('Create Snapshot: %(snapshotname)s Unity: %(out)s'
|
||||||
% {'snapshotname': snapshotname,
|
% {'snapshotname': snapshotname,
|
||||||
'out': out})
|
'out': out})
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
@ -299,7 +299,7 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
def delete_snapshot(self, snapshot):
|
def delete_snapshot(self, snapshot):
|
||||||
"""Deletes a snapshot."""
|
"""Deletes a snapshot."""
|
||||||
LOG.debug(_('Entering delete_snapshot.'))
|
LOG.debug('Entering delete_snapshot.')
|
||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
volumename = snapshot['volume_name']
|
volumename = snapshot['volume_name']
|
||||||
@ -315,8 +315,8 @@ class EMCVnxCli(object):
|
|||||||
# executing CLI command
|
# executing CLI command
|
||||||
out, rc = self._cli_execute(*snap_destroy)
|
out, rc = self._cli_execute(*snap_destroy)
|
||||||
|
|
||||||
LOG.debug(_('Delete Snapshot: Volume: %(volumename)s Snapshot: '
|
LOG.debug('Delete Snapshot: Volume: %(volumename)s Snapshot: '
|
||||||
'%(snapshotname)s Output: %(out)s')
|
'%(snapshotname)s Output: %(out)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'out': out})
|
'out': out})
|
||||||
@ -345,7 +345,7 @@ class EMCVnxCli(object):
|
|||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Creates a volume from a snapshot."""
|
"""Creates a volume from a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('Entering create_volume_from_snapshot.'))
|
LOG.debug('Entering create_volume_from_snapshot.')
|
||||||
|
|
||||||
snapshotname = snapshot['name']
|
snapshotname = snapshot['name']
|
||||||
source_volume_name = snapshot['volume_name']
|
source_volume_name = snapshot['volume_name']
|
||||||
@ -369,8 +369,8 @@ class EMCVnxCli(object):
|
|||||||
# executing CLI command
|
# executing CLI command
|
||||||
out, rc = self._cli_execute(*lun_create)
|
out, rc = self._cli_execute(*lun_create)
|
||||||
|
|
||||||
LOG.debug(_('Create temporary Volume: %(volumename)s '
|
LOG.debug('Create temporary Volume: %(volumename)s '
|
||||||
'Output : %(out)s')
|
'Output : %(out)s'
|
||||||
% {'volumename': destvolumename, 'out': out})
|
% {'volumename': destvolumename, 'out': out})
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
@ -385,8 +385,8 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
# executing CLI command
|
# executing CLI command
|
||||||
out, rc = self._cli_execute(*smp_create)
|
out, rc = self._cli_execute(*smp_create)
|
||||||
LOG.debug(_('Create mount point : Volume: %(volumename)s '
|
LOG.debug('Create mount point : Volume: %(volumename)s '
|
||||||
'Source Volume: %(sourcevolumename)s Output: %(out)s')
|
'Source Volume: %(sourcevolumename)s Output: %(out)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'sourcevolumename': source_volume_name,
|
'sourcevolumename': source_volume_name,
|
||||||
'out': out})
|
'out': out})
|
||||||
@ -403,8 +403,8 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
# executing CLI command
|
# executing CLI command
|
||||||
out, rc = self._cli_execute(*lun_attach)
|
out, rc = self._cli_execute(*lun_attach)
|
||||||
LOG.debug(_('Attaching mount point Volume: %(volumename)s '
|
LOG.debug('Attaching mount point Volume: %(volumename)s '
|
||||||
'with Snapshot: %(snapshotname)s Output: %(out)s')
|
'with Snapshot: %(snapshotname)s Output: %(out)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'snapshotname': snapshotname,
|
'snapshotname': snapshotname,
|
||||||
'out': out})
|
'out': out})
|
||||||
@ -428,8 +428,8 @@ class EMCVnxCli(object):
|
|||||||
# executing CLI command
|
# executing CLI command
|
||||||
out, rc = self._cli_execute(*migrate_start)
|
out, rc = self._cli_execute(*migrate_start)
|
||||||
|
|
||||||
LOG.debug(_('Migrate Mount Point Volume: %(volumename)s '
|
LOG.debug('Migrate Mount Point Volume: %(volumename)s '
|
||||||
'Output : %(out)s')
|
'Output : %(out)s'
|
||||||
% {'volumename': volumename,
|
% {'volumename': volumename,
|
||||||
'out': out})
|
'out': out})
|
||||||
|
|
||||||
@ -496,13 +496,13 @@ class EMCVnxCli(object):
|
|||||||
out, rc = self._cli_execute(*sg_list)
|
out, rc = self._cli_execute(*sg_list)
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
LOG.debug(_('creating new storage group %s'), storage_groupname)
|
LOG.debug('creating new storage group %s', storage_groupname)
|
||||||
|
|
||||||
sg_create = ('storagegroup', '-create',
|
sg_create = ('storagegroup', '-create',
|
||||||
'-gname', storage_groupname)
|
'-gname', storage_groupname)
|
||||||
out, rc = self._cli_execute(*sg_create)
|
out, rc = self._cli_execute(*sg_create)
|
||||||
LOG.debug(_('Create new storage group : %(storage_groupname)s, '
|
LOG.debug('Create new storage group : %(storage_groupname)s, '
|
||||||
'Output: %(out)s')
|
'Output: %(out)s'
|
||||||
% {'storage_groupname': storage_groupname,
|
% {'storage_groupname': storage_groupname,
|
||||||
'out': out})
|
'out': out})
|
||||||
|
|
||||||
@ -518,8 +518,8 @@ class EMCVnxCli(object):
|
|||||||
'-o')
|
'-o')
|
||||||
|
|
||||||
out, rc = self._cli_execute(*connect_host)
|
out, rc = self._cli_execute(*connect_host)
|
||||||
LOG.debug(_('Connect storage group : %(storage_groupname)s ,'
|
LOG.debug('Connect storage group : %(storage_groupname)s ,'
|
||||||
'To Host : %(hostname)s, Output : %(out)s')
|
'To Host : %(hostname)s, Output : %(out)s'
|
||||||
% {'storage_groupname': storage_groupname,
|
% {'storage_groupname': storage_groupname,
|
||||||
'hostname': hostname,
|
'hostname': hostname,
|
||||||
'out': out})
|
'out': out})
|
||||||
@ -558,7 +558,7 @@ class EMCVnxCli(object):
|
|||||||
for lun in lun_map.iterkeys():
|
for lun in lun_map.iterkeys():
|
||||||
if lun == int(allocated_lun_id):
|
if lun == int(allocated_lun_id):
|
||||||
host_lun_id = lun_map[lun]
|
host_lun_id = lun_map[lun]
|
||||||
LOG.debug(_('Host Lun Id : %s') % (host_lun_id))
|
LOG.debug('Host Lun Id : %s' % (host_lun_id))
|
||||||
break
|
break
|
||||||
|
|
||||||
# finding the owner SP for the LUN
|
# finding the owner SP for the LUN
|
||||||
@ -567,7 +567,7 @@ class EMCVnxCli(object):
|
|||||||
if rc == 0:
|
if rc == 0:
|
||||||
output = out.split('\n')
|
output = out.split('\n')
|
||||||
owner_sp = output[2].split('Current Owner: SP ')[1]
|
owner_sp = output[2].split('Current Owner: SP ')[1]
|
||||||
LOG.debug(_('Owner SP : %s') % (owner_sp))
|
LOG.debug('Owner SP : %s' % (owner_sp))
|
||||||
|
|
||||||
device = {
|
device = {
|
||||||
'hostlunid': host_lun_id,
|
'hostlunid': host_lun_id,
|
||||||
@ -625,8 +625,8 @@ class EMCVnxCli(object):
|
|||||||
'-hlu', host_lun_id,
|
'-hlu', host_lun_id,
|
||||||
'-alu', allocated_lun_id)
|
'-alu', allocated_lun_id)
|
||||||
out, rc = self._cli_execute(*addhlu)
|
out, rc = self._cli_execute(*addhlu)
|
||||||
LOG.debug(_('Add ALU %(alu)s to SG %(sg)s as %(hlu)s. '
|
LOG.debug('Add ALU %(alu)s to SG %(sg)s as %(hlu)s. '
|
||||||
'Output: %(out)s')
|
'Output: %(out)s'
|
||||||
% {'alu': allocated_lun_id,
|
% {'alu': allocated_lun_id,
|
||||||
'sg': storage_groupname,
|
'sg': storage_groupname,
|
||||||
'hlu': host_lun_id,
|
'hlu': host_lun_id,
|
||||||
@ -655,7 +655,7 @@ class EMCVnxCli(object):
|
|||||||
|
|
||||||
out, rc = self._cli_execute(*removehlu)
|
out, rc = self._cli_execute(*removehlu)
|
||||||
|
|
||||||
LOG.debug(_('Remove %(hlu)s from SG %(sg)s. Output: %(out)s')
|
LOG.debug('Remove %(hlu)s from SG %(sg)s. Output: %(out)s'
|
||||||
% {'hlu': device_number,
|
% {'hlu': device_number,
|
||||||
'sg': storage_groupname,
|
'sg': storage_groupname,
|
||||||
'out': out})
|
'out': out})
|
||||||
@ -700,8 +700,8 @@ class EMCVnxCli(object):
|
|||||||
port_wwn = port_info[2].split('Port WWN:')[1].strip()
|
port_wwn = port_info[2].split('Port WWN:')[1].strip()
|
||||||
initiator_address.append(port_wwn)
|
initiator_address.append(port_wwn)
|
||||||
|
|
||||||
LOG.debug(_('WWNs found for SP %(devicesp)s '
|
LOG.debug('WWNs found for SP %(devicesp)s '
|
||||||
'are: %(initiator_address)s')
|
'are: %(initiator_address)s'
|
||||||
% {'devicesp': device_sp,
|
% {'devicesp': device_sp,
|
||||||
'initiator_address': initiator_address})
|
'initiator_address': initiator_address})
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
|
|||||||
while not out.endswith(ending):
|
while not out.endswith(ending):
|
||||||
out += chan.recv(102400)
|
out += chan.recv(102400)
|
||||||
|
|
||||||
LOG.debug(_("CLI output\n%s"), out)
|
LOG.debug("CLI output\n%s", out)
|
||||||
return out.splitlines()
|
return out.splitlines()
|
||||||
|
|
||||||
def _get_prefixed_value(self, lines, prefix):
|
def _get_prefixed_value(self, lines, prefix):
|
||||||
@ -151,15 +151,15 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
|
|||||||
chan = transport.open_session()
|
chan = transport.open_session()
|
||||||
chan.invoke_shell()
|
chan.invoke_shell()
|
||||||
|
|
||||||
LOG.debug(_("Reading CLI MOTD"))
|
LOG.debug("Reading CLI MOTD")
|
||||||
self._get_output(chan)
|
self._get_output(chan)
|
||||||
|
|
||||||
cmd = 'stty columns 255'
|
cmd = 'stty columns 255'
|
||||||
LOG.debug(_("Setting CLI terminal width: '%s'"), cmd)
|
LOG.debug("Setting CLI terminal width: '%s'", cmd)
|
||||||
chan.send(cmd + '\r')
|
chan.send(cmd + '\r')
|
||||||
out = self._get_output(chan)
|
out = self._get_output(chan)
|
||||||
|
|
||||||
LOG.debug(_("Sending CLI command: '%s'"), command)
|
LOG.debug("Sending CLI command: '%s'", command)
|
||||||
chan.send(command + '\r')
|
chan.send(command + '\r')
|
||||||
out = self._get_output(chan)
|
out = self._get_output(chan)
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from eqlx group."""
|
"""Retrieve stats info from eqlx group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = "eqlx"
|
backend_name = "eqlx"
|
||||||
if self.configuration:
|
if self.configuration:
|
||||||
@ -279,8 +279,8 @@ class DellEQLSanISCSIDriver(SanISCSIDriver):
|
|||||||
except processutils.ProcessExecutionError as err:
|
except processutils.ProcessExecutionError as err:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
if err.stdout.find('does not exist.\n') > -1:
|
if err.stdout.find('does not exist.\n') > -1:
|
||||||
LOG.debug(_('Volume %s does not exist, '
|
LOG.debug('Volume %s does not exist, '
|
||||||
'it may have already been deleted'),
|
'it may have already been deleted',
|
||||||
volume['name'])
|
volume['name'])
|
||||||
raise exception.VolumeNotFound(volume_id=volume['id'])
|
raise exception.VolumeNotFound(volume_id=volume['id'])
|
||||||
|
|
||||||
|
@ -251,8 +251,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
qcow2.
|
qcow2.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_("snapshot: %(snap)s, volume: %(vol)s, "
|
LOG.debug("snapshot: %(snap)s, volume: %(vol)s, "
|
||||||
"volume_size: %(size)s")
|
"volume_size: %(size)s"
|
||||||
% {'snap': snapshot['id'],
|
% {'snap': snapshot['id'],
|
||||||
'vol': volume['id'],
|
'vol': volume['id'],
|
||||||
'size': volume_size})
|
'size': volume_size})
|
||||||
@ -270,7 +270,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
|
|
||||||
path_to_new_vol = self._local_path_volume(volume)
|
path_to_new_vol = self._local_path_volume(volume)
|
||||||
|
|
||||||
LOG.debug(_("will copy from snapshot at %s") % path_to_snap_img)
|
LOG.debug("will copy from snapshot at %s" % path_to_snap_img)
|
||||||
|
|
||||||
if self.configuration.glusterfs_qcow2_volumes:
|
if self.configuration.glusterfs_qcow2_volumes:
|
||||||
out_format = 'qcow2'
|
out_format = 'qcow2'
|
||||||
@ -421,7 +421,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
context,
|
context,
|
||||||
snapshot['volume_id'],
|
snapshot['volume_id'],
|
||||||
connection_info)
|
connection_info)
|
||||||
LOG.debug(_('nova call result: %s') % result)
|
LOG.debug('nova call result: %s' % result)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_('Call to Nova to create snapshot failed'))
|
LOG.error(_('Call to Nova to create snapshot failed'))
|
||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
@ -449,7 +449,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
'while creating snapshot.')
|
'while creating snapshot.')
|
||||||
raise exception.GlusterfsException(msg)
|
raise exception.GlusterfsException(msg)
|
||||||
|
|
||||||
LOG.debug(_('Status of snapshot %(id)s is now %(status)s') % {
|
LOG.debug('Status of snapshot %(id)s is now %(status)s' % {
|
||||||
'id': snapshot['id'],
|
'id': snapshot['id'],
|
||||||
'status': s['status']
|
'status': s['status']
|
||||||
})
|
})
|
||||||
@ -474,8 +474,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
LOG.debug(_('create snapshot: %s') % snapshot)
|
LOG.debug('create snapshot: %s' % snapshot)
|
||||||
LOG.debug(_('volume id: %s') % snapshot['volume_id'])
|
LOG.debug('volume id: %s' % snapshot['volume_id'])
|
||||||
|
|
||||||
path_to_disk = self._local_path_volume(snapshot['volume'])
|
path_to_disk = self._local_path_volume(snapshot['volume'])
|
||||||
self._create_snapshot_offline(snapshot, path_to_disk)
|
self._create_snapshot_offline(snapshot, path_to_disk)
|
||||||
@ -582,7 +582,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_('deleting snapshot %s') % snapshot['id'])
|
LOG.debug('deleting snapshot %s' % snapshot['id'])
|
||||||
|
|
||||||
volume_status = snapshot['volume']['status']
|
volume_status = snapshot['volume']['status']
|
||||||
if volume_status not in ['available', 'in-use']:
|
if volume_status not in ['available', 'in-use']:
|
||||||
@ -607,7 +607,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
return
|
return
|
||||||
|
|
||||||
snapshot_file = snap_info[snapshot['id']]
|
snapshot_file = snap_info[snapshot['id']]
|
||||||
LOG.debug(_('snapshot_file for this snap is %s') % snapshot_file)
|
LOG.debug('snapshot_file for this snap is %s' % snapshot_file)
|
||||||
|
|
||||||
snapshot_path = '%s/%s' % (self._local_volume_dir(snapshot['volume']),
|
snapshot_path = '%s/%s' % (self._local_volume_dir(snapshot['volume']),
|
||||||
snapshot_file)
|
snapshot_file)
|
||||||
@ -645,7 +645,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
break
|
break
|
||||||
if base_id is None:
|
if base_id is None:
|
||||||
# This means we are deleting the oldest snapshot
|
# This means we are deleting the oldest snapshot
|
||||||
msg = _('No %(base_id)s found for %(file)s') % {
|
msg = 'No %(base_id)s found for %(file)s' % {
|
||||||
'base_id': 'base_id',
|
'base_id': 'base_id',
|
||||||
'file': snapshot_file}
|
'file': snapshot_file}
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
@ -721,7 +721,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
higher_file),
|
higher_file),
|
||||||
None)
|
None)
|
||||||
if highest_file is None:
|
if highest_file is None:
|
||||||
msg = _('No file depends on %s.') % higher_file
|
msg = 'No file depends on %s.' % higher_file
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
|
|
||||||
# Committing higher_file into snapshot_file
|
# Committing higher_file into snapshot_file
|
||||||
@ -816,8 +816,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
# Nova tasks completed successfully
|
# Nova tasks completed successfully
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
msg = _('status of snapshot %s is '
|
msg = ('status of snapshot %s is '
|
||||||
'still "deleting"... waiting') % snapshot['id']
|
'still "deleting"... waiting') % snapshot['id']
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
time.sleep(increment)
|
time.sleep(increment)
|
||||||
seconds_elapsed += increment
|
seconds_elapsed += increment
|
||||||
@ -1011,7 +1011,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
volume_path = self.local_path(volume)
|
volume_path = self.local_path(volume)
|
||||||
volume_size = volume['size']
|
volume_size = volume['size']
|
||||||
|
|
||||||
LOG.debug(_("creating new volume at %s") % volume_path)
|
LOG.debug("creating new volume at %s" % volume_path)
|
||||||
|
|
||||||
if os.path.exists(volume_path):
|
if os.path.exists(volume_path):
|
||||||
msg = _('file already exists at %s') % volume_path
|
msg = _('file already exists at %s') % volume_path
|
||||||
@ -1042,7 +1042,7 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
LOG.error(_('Exception during mounting %s') % (exc,))
|
LOG.error(_('Exception during mounting %s') % (exc,))
|
||||||
|
|
||||||
LOG.debug(_('Available shares: %s') % self._mounted_shares)
|
LOG.debug('Available shares: %s' % self._mounted_shares)
|
||||||
|
|
||||||
def _ensure_share_writable(self, path):
|
def _ensure_share_writable(self, path):
|
||||||
"""Ensure that the Cinder user can write to the share.
|
"""Ensure that the Cinder user can write to the share.
|
||||||
|
@ -68,7 +68,7 @@ def _loc_info(loc):
|
|||||||
|
|
||||||
def _do_lu_range_check(start, end, maxlun):
|
def _do_lu_range_check(start, end, maxlun):
|
||||||
"""Validate array allocation range."""
|
"""Validate array allocation range."""
|
||||||
LOG.debug(_("Range: start LU: %(start)s, end LU: %(end)s")
|
LOG.debug("Range: start LU: %(start)s, end LU: %(end)s"
|
||||||
% {'start': start,
|
% {'start': start,
|
||||||
'end': end})
|
'end': end})
|
||||||
if int(start) < 0:
|
if int(start) < 0:
|
||||||
@ -82,7 +82,7 @@ def _do_lu_range_check(start, end, maxlun):
|
|||||||
raise exception.InvalidInput(reason=msg)
|
raise exception.InvalidInput(reason=msg)
|
||||||
if int(end) > int(maxlun):
|
if int(end) > int(maxlun):
|
||||||
end = maxlun
|
end = maxlun
|
||||||
LOG.debug(_("setting LU upper (end) limit to %s") % maxlun)
|
LOG.debug("setting LU upper (end) limit to %s" % maxlun)
|
||||||
return (start, end)
|
return (start, end)
|
||||||
|
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
'%s' % (int(volume['size']) * 1024))
|
'%s' % (int(volume['size']) * 1024))
|
||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
sz = int(out.split()[5])
|
sz = int(out.split()[5])
|
||||||
LOG.debug(_("LUN %(lun)s of size %(sz)s MB is created.")
|
LOG.debug("LUN %(lun)s of size %(sz)s MB is created."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'sz': sz})
|
'sz': sz})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
@ -353,7 +353,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
'%s' % (size))
|
'%s' % (size))
|
||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
size = int(out.split()[5])
|
size = int(out.split()[5])
|
||||||
LOG.debug(_("LUN %(lun)s of size %(size)s MB is cloned.")
|
LOG.debug("LUN %(lun)s of size %(size)s MB is cloned."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'size': size})
|
'size': size})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
@ -370,7 +370,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
self.config['password'],
|
self.config['password'],
|
||||||
arid, lun,
|
arid, lun,
|
||||||
'%s' % (new_size * 1024))
|
'%s' % (new_size * 1024))
|
||||||
LOG.debug(_("LUN %(lun)s extended to %(size)s GB.")
|
LOG.debug("LUN %(lun)s extended to %(size)s GB."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'size': new_size})
|
'size': new_size})
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
arid, lun, ctl, port, iqn,
|
arid, lun, ctl, port, iqn,
|
||||||
'')
|
'')
|
||||||
name = self.hus_name
|
name = self.hus_name
|
||||||
LOG.debug(_("delete lun %(lun)s on %(name)s")
|
LOG.debug("delete lun %(lun)s on %(name)s"
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'name': name})
|
'name': name})
|
||||||
self.bend.delete_lu(self.config['hus_cmd'],
|
self.bend.delete_lu(self.config['hus_cmd'],
|
||||||
@ -478,7 +478,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
'%s' % (size))
|
'%s' % (size))
|
||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
sz = int(out.split()[5])
|
sz = int(out.split()[5])
|
||||||
LOG.debug(_("LUN %(lun)s of size %(sz)s MB is created from snapshot.")
|
LOG.debug("LUN %(lun)s of size %(sz)s MB is created from snapshot."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'sz': sz})
|
'sz': sz})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
@ -501,7 +501,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
'%s' % (size))
|
'%s' % (size))
|
||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
size = int(out.split()[5])
|
size = int(out.split()[5])
|
||||||
LOG.debug(_("LUN %(lun)s of size %(size)s MB is created as snapshot.")
|
LOG.debug("LUN %(lun)s of size %(size)s MB is created as snapshot."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'size': size})
|
'size': size})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
@ -520,7 +520,7 @@ class HUSDriver(driver.ISCSIDriver):
|
|||||||
self.config['username'],
|
self.config['username'],
|
||||||
self.config['password'],
|
self.config['password'],
|
||||||
arid, lun)
|
arid, lun)
|
||||||
LOG.debug(_("LUN %s is deleted.") % lun)
|
LOG.debug("LUN %s is deleted." % lun)
|
||||||
return
|
return
|
||||||
|
|
||||||
@utils.synchronized('hds_hus', external=True)
|
@utils.synchronized('hds_hus', external=True)
|
||||||
|
@ -177,7 +177,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
conf[ip]['ctl'] = ctl
|
conf[ip]['ctl'] = ctl
|
||||||
conf[ip]['port'] = port
|
conf[ip]['port'] = port
|
||||||
conf[ip]['iscsi_port'] = ipp
|
conf[ip]['iscsi_port'] = ipp
|
||||||
msg = _('portal: %(ip)s:%(ipp)s, CTL: %(ctl)s, port: %(port)s')
|
msg = ('portal: %(ip)s:%(ipp)s, CTL: %(ctl)s, port: %(port)s')
|
||||||
LOG.debug(msg
|
LOG.debug(msg
|
||||||
% {'ip': ip,
|
% {'ip': ip,
|
||||||
'ipp': ipp,
|
'ipp': ipp,
|
||||||
@ -285,7 +285,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
for line in out.split('\n'):
|
for line in out.split('\n'):
|
||||||
if 'HDP' in line:
|
if 'HDP' in line:
|
||||||
(hdp, size, _ign, used) = line.split()[1:5] # in MB
|
(hdp, size, _ign, used) = line.split()[1:5] # in MB
|
||||||
LOG.debug(_("stats: looking for: %s") % hdp)
|
LOG.debug("stats: looking for: %s", hdp)
|
||||||
if int(hdp) >= units.KiB: # HNAS fsid
|
if int(hdp) >= units.KiB: # HNAS fsid
|
||||||
hdp = line.split()[11]
|
hdp = line.split()[11]
|
||||||
if hdp in self.config['hdp'].keys():
|
if hdp in self.config['hdp'].keys():
|
||||||
@ -404,7 +404,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
name = volume['name']
|
name = volume['name']
|
||||||
LOG.debug(_("create_export %(name)s") % {'name': name})
|
LOG.debug("create_export %(name)s" % {'name': name})
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
provider = volume['provider_location']
|
provider = volume['provider_location']
|
||||||
name = volume['name']
|
name = volume['name']
|
||||||
LOG.debug(_("remove_export provider %(provider)s on %(name)s")
|
LOG.debug("remove_export provider %(provider)s on %(name)s"
|
||||||
% {'provider': provider,
|
% {'provider': provider,
|
||||||
'name': name})
|
'name': name})
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
size = int(out.split()[5])
|
size = int(out.split()[5])
|
||||||
|
|
||||||
LOG.debug(_("LUN %(lun)s of size %(size)s MB is cloned.")
|
LOG.debug("LUN %(lun)s of size %(size)s MB is cloned."
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'size': size})
|
'size': size})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
@ -520,7 +520,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
name = self.hnas_name
|
name = self.hnas_name
|
||||||
|
|
||||||
LOG.debug(_("delete lun %(lun)s on %(name)s")
|
LOG.debug("delete lun %(lun)s on %(name)s"
|
||||||
% {'lun': lun,
|
% {'lun': lun,
|
||||||
'name': name})
|
'name': name})
|
||||||
|
|
||||||
@ -628,7 +628,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
sz = int(out.split()[5])
|
sz = int(out.split()[5])
|
||||||
|
|
||||||
LOG.debug(_("LUN %(lun)s of size %(sz)s MB is created from snapshot.")
|
LOG.debug("LUN %(lun)s of size %(sz)s MB is created from snapshot."
|
||||||
% {'lun': lun, 'sz': sz})
|
% {'lun': lun, 'sz': sz})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
|
|
||||||
@ -652,7 +652,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
lun = self.arid + '.' + out.split()[1]
|
lun = self.arid + '.' + out.split()[1]
|
||||||
size = int(out.split()[5])
|
size = int(out.split()[5])
|
||||||
|
|
||||||
LOG.debug(_("LUN %(lun)s of size %(size)s MB is created.")
|
LOG.debug("LUN %(lun)s of size %(size)s MB is created."
|
||||||
% {'lun': lun, 'size': size})
|
% {'lun': lun, 'size': size})
|
||||||
return {'provider_location': lun}
|
return {'provider_location': lun}
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
|
|||||||
self.config['password'],
|
self.config['password'],
|
||||||
hdp, lun)
|
hdp, lun)
|
||||||
|
|
||||||
LOG.debug(_("LUN %s is deleted.") % lun)
|
LOG.debug("LUN %s is deleted.", lun)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_volume_stats(self, refresh=False):
|
def get_volume_stats(self, refresh=False):
|
||||||
|
@ -207,7 +207,7 @@ class HDSNFSDriver(nfs.NfsDriver):
|
|||||||
path = self._get_volume_path(nfs_mount, volume['name'])
|
path = self._get_volume_path(nfs_mount, volume['name'])
|
||||||
|
|
||||||
# Resize the image file on share to new size.
|
# Resize the image file on share to new size.
|
||||||
LOG.debug(_('Checking file for resize'))
|
LOG.debug('Checking file for resize')
|
||||||
|
|
||||||
if self._is_file_size_equal(path, new_size):
|
if self._is_file_size_equal(path, new_size):
|
||||||
return
|
return
|
||||||
@ -236,7 +236,7 @@ class HDSNFSDriver(nfs.NfsDriver):
|
|||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Creates a volume from a snapshot."""
|
"""Creates a volume from a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('create_volume_from %s') % volume)
|
LOG.debug('create_volume_from %s', volume)
|
||||||
vol_size = volume['size']
|
vol_size = volume['size']
|
||||||
snap_size = snapshot['volume_size']
|
snap_size = snapshot['volume_size']
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ class HDSNFSDriver(nfs.NfsDriver):
|
|||||||
snapshot['name'],
|
snapshot['name'],
|
||||||
snapshot['volume_id'])
|
snapshot['volume_id'])
|
||||||
share = self._get_volume_location(snapshot['volume_id'])
|
share = self._get_volume_location(snapshot['volume_id'])
|
||||||
LOG.debug(_('Share: %s'), share)
|
LOG.debug('Share: %s', share)
|
||||||
|
|
||||||
# returns the mount point (not path)
|
# returns the mount point (not path)
|
||||||
return {'provider_location': share}
|
return {'provider_location': share}
|
||||||
|
@ -62,8 +62,8 @@ class HuaweiVolumeDriver(object):
|
|||||||
conf_file = self.configuration.cinder_huawei_conf_file
|
conf_file = self.configuration.cinder_huawei_conf_file
|
||||||
(product, protocol) = self._get_conf_info(conf_file)
|
(product, protocol) = self._get_conf_info(conf_file)
|
||||||
|
|
||||||
LOG.debug(_('_instantiate_driver: Loading %(protocol)s driver for '
|
LOG.debug('_instantiate_driver: Loading %(protocol)s driver for '
|
||||||
'Huawei OceanStor %(product)s series storage arrays.')
|
'Huawei OceanStor %(product)s series storage arrays.'
|
||||||
% {'protocol': protocol,
|
% {'protocol': protocol,
|
||||||
'product': product})
|
'product': product})
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ class HuaweiDoradoFCDriver(huawei_t.HuaweiTFCDriver):
|
|||||||
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Create FC connection between a volume and a host."""
|
"""Create FC connection between a volume and a host."""
|
||||||
LOG.debug(_('initialize_connection: volume name: %(vol)s '
|
LOG.debug('initialize_connection: volume name: %(vol)s '
|
||||||
'host: %(host)s initiator: %(wwn)s')
|
'host: %(host)s initiator: %(wwn)s'
|
||||||
% {'vol': volume['name'],
|
% {'vol': volume['name'],
|
||||||
'host': connector['host'],
|
'host': connector['host'],
|
||||||
'wwn': connector['wwpns']})
|
'wwn': connector['wwpns']})
|
||||||
@ -89,7 +89,7 @@ class HuaweiDoradoFCDriver(huawei_t.HuaweiTFCDriver):
|
|||||||
fc_port_details = self._get_host_port_details(host_id)
|
fc_port_details = self._get_host_port_details(host_id)
|
||||||
tgt_wwns = self._get_tgt_fc_port_wwns(fc_port_details)
|
tgt_wwns = self._get_tgt_fc_port_wwns(fc_port_details)
|
||||||
|
|
||||||
LOG.debug(_('initialize_connection: Target FC ports WWNS: %s')
|
LOG.debug('initialize_connection: Target FC ports WWNS: %s'
|
||||||
% tgt_wwns)
|
% tgt_wwns)
|
||||||
|
|
||||||
# Finally, map the volume to the host.
|
# Finally, map the volume to the host.
|
||||||
|
@ -98,8 +98,8 @@ class HuaweiTISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Map a volume to a host and return target iSCSI information."""
|
"""Map a volume to a host and return target iSCSI information."""
|
||||||
LOG.debug(_('initialize_connection: volume name: %(vol)s, '
|
LOG.debug('initialize_connection: volume name: %(vol)s, '
|
||||||
'host: %(host)s, initiator: %(ini)s')
|
'host: %(host)s, initiator: %(ini)s'
|
||||||
% {'vol': volume['name'],
|
% {'vol': volume['name'],
|
||||||
'host': connector['host'],
|
'host': connector['host'],
|
||||||
'ini': connector['initiator']})
|
'ini': connector['initiator']})
|
||||||
@ -203,7 +203,7 @@ class HuaweiTISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_('_get_tgt_iqn: iSCSI IP is %s.') % port_ip)
|
LOG.debug('_get_tgt_iqn: iSCSI IP is %s.' % port_ip)
|
||||||
|
|
||||||
cli_cmd = 'showiscsitgtname'
|
cli_cmd = 'showiscsitgtname'
|
||||||
out = self.common._execute_cli(cli_cmd)
|
out = self.common._execute_cli(cli_cmd)
|
||||||
@ -231,7 +231,7 @@ class HuaweiTISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
iqn = iqn_prefix + ':' + iqn_suffix + ':' + port_info[3]
|
iqn = iqn_prefix + ':' + iqn_suffix + ':' + port_info[3]
|
||||||
|
|
||||||
LOG.debug(_('_get_tgt_iqn: iSCSI target iqn is %s.') % iqn)
|
LOG.debug('_get_tgt_iqn: iSCSI target iqn is %s.' % iqn)
|
||||||
|
|
||||||
return (iqn, port_info[0])
|
return (iqn, port_info[0])
|
||||||
|
|
||||||
@ -320,8 +320,8 @@ class HuaweiTISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Terminate the map."""
|
"""Terminate the map."""
|
||||||
LOG.debug(_('terminate_connection: volume: %(vol)s, host: %(host)s, '
|
LOG.debug('terminate_connection: volume: %(vol)s, host: %(host)s, '
|
||||||
'connector: %(initiator)s')
|
'connector: %(initiator)s'
|
||||||
% {'vol': volume['name'],
|
% {'vol': volume['name'],
|
||||||
'host': connector['host'],
|
'host': connector['host'],
|
||||||
'initiator': connector['initiator']})
|
'initiator': connector['initiator']})
|
||||||
@ -440,8 +440,8 @@ class HuaweiTFCDriver(driver.FibreChannelDriver):
|
|||||||
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Create FC connection between a volume and a host."""
|
"""Create FC connection between a volume and a host."""
|
||||||
LOG.debug(_('initialize_connection: volume name: %(vol)s, '
|
LOG.debug('initialize_connection: volume name: %(vol)s, '
|
||||||
'host: %(host)s, initiator: %(wwn)s')
|
'host: %(host)s, initiator: %(wwn)s'
|
||||||
% {'vol': volume['name'],
|
% {'vol': volume['name'],
|
||||||
'host': connector['host'],
|
'host': connector['host'],
|
||||||
'wwn': connector['wwpns']})
|
'wwn': connector['wwpns']})
|
||||||
@ -458,7 +458,7 @@ class HuaweiTFCDriver(driver.FibreChannelDriver):
|
|||||||
fc_port_details = self._get_host_port_details(host_id)
|
fc_port_details = self._get_host_port_details(host_id)
|
||||||
tgt_wwns = self._get_tgt_fc_port_wwns(fc_port_details)
|
tgt_wwns = self._get_tgt_fc_port_wwns(fc_port_details)
|
||||||
|
|
||||||
LOG.debug(_('initialize_connection: Target FC ports WWNS: %s')
|
LOG.debug('initialize_connection: Target FC ports WWNS: %s'
|
||||||
% tgt_wwns)
|
% tgt_wwns)
|
||||||
|
|
||||||
# Finally, map the volume to the host.
|
# Finally, map the volume to the host.
|
||||||
@ -549,8 +549,8 @@ class HuaweiTFCDriver(driver.FibreChannelDriver):
|
|||||||
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Terminate the map."""
|
"""Terminate the map."""
|
||||||
LOG.debug(_('terminate_connection: volume: %(vol)s, host: %(host)s, '
|
LOG.debug('terminate_connection: volume: %(vol)s, host: %(host)s, '
|
||||||
'connector: %(initiator)s')
|
'connector: %(initiator)s'
|
||||||
% {'vol': volume['name'],
|
% {'vol': volume['name'],
|
||||||
'host': connector['host'],
|
'host': connector['host'],
|
||||||
'initiator': connector['initiator']})
|
'initiator': connector['initiator']})
|
||||||
|
@ -125,7 +125,7 @@ def get_conf_host_os_type(host_ip, config):
|
|||||||
if not host_os:
|
if not host_os:
|
||||||
host_os = os_type['Linux'] # default os type
|
host_os = os_type['Linux'] # default os type
|
||||||
|
|
||||||
LOG.debug(_('_get_host_os_type: Host %(ip)s OS type is %(os)s.')
|
LOG.debug('_get_host_os_type: Host %(ip)s OS type is %(os)s.'
|
||||||
% {'ip': host_ip, 'os': host_os})
|
% {'ip': host_ip, 'os': host_os})
|
||||||
|
|
||||||
return host_os
|
return host_os
|
||||||
|
@ -56,8 +56,8 @@ class HVSCommon():
|
|||||||
Convert response into Python Object and return it.
|
Convert response into Python Object and return it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_('HVS Request URL: %(url)s') % {'url': url})
|
LOG.debug('HVS Request URL: %(url)s' % {'url': url})
|
||||||
LOG.debug(_('HVS Request Data: %(data)s') % {'data': data})
|
LOG.debug('HVS Request Data: %(data)s' % {'data': data})
|
||||||
|
|
||||||
headers = {"Connection": "keep-alive",
|
headers = {"Connection": "keep-alive",
|
||||||
"Content-Type": "application/json"}
|
"Content-Type": "application/json"}
|
||||||
@ -70,7 +70,7 @@ class HVSCommon():
|
|||||||
if method:
|
if method:
|
||||||
req.get_method = lambda: method
|
req.get_method = lambda: method
|
||||||
res = urllib2.urlopen(req).read().decode("utf-8")
|
res = urllib2.urlopen(req).read().decode("utf-8")
|
||||||
LOG.debug(_('HVS Response Data: %(res)s') % {'res': res})
|
LOG.debug('HVS Response Data: %(res)s' % {'res': res})
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
err_msg = _('Bad response from server: %s') % err
|
err_msg = _('Bad response from server: %s') % err
|
||||||
LOG.error(err_msg)
|
LOG.error(err_msg)
|
||||||
@ -324,8 +324,8 @@ class HVSCommon():
|
|||||||
snapshot_name = self._encode_name(snapshot['id'])
|
snapshot_name = self._encode_name(snapshot['id'])
|
||||||
volume_name = self._encode_name(snapshot['volume_id'])
|
volume_name = self._encode_name(snapshot['volume_id'])
|
||||||
|
|
||||||
LOG.debug(_('create_snapshot:snapshot name:%(snapshot)s, '
|
LOG.debug('create_snapshot:snapshot name:%(snapshot)s, '
|
||||||
'volume name:%(volume)s.')
|
'volume name:%(volume)s.'
|
||||||
% {'snapshot': snapshot_name,
|
% {'snapshot': snapshot_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -351,8 +351,8 @@ class HVSCommon():
|
|||||||
snapshot_name = self._encode_name(snapshot['id'])
|
snapshot_name = self._encode_name(snapshot['id'])
|
||||||
volume_name = self._encode_name(snapshot['volume_id'])
|
volume_name = self._encode_name(snapshot['volume_id'])
|
||||||
|
|
||||||
LOG.debug(_('_stop_snapshot:snapshot name:%(snapshot)s, '
|
LOG.debug('_stop_snapshot:snapshot name:%(snapshot)s, '
|
||||||
'volume name:%(volume)s.')
|
'volume name:%(volume)s.'
|
||||||
% {'snapshot': snapshot_name,
|
% {'snapshot': snapshot_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -471,8 +471,8 @@ class HVSCommon():
|
|||||||
lun_id = self._get_volume_by_name(volume_name)
|
lun_id = self._get_volume_by_name(volume_name)
|
||||||
view_id = self._find_mapping_view(volume_name)
|
view_id = self._find_mapping_view(volume_name)
|
||||||
|
|
||||||
LOG.debug(_('_mapping_hostgroup_and_lungroup: lun_group: %(lun_group)s'
|
LOG.debug('_mapping_hostgroup_and_lungroup: lun_group: %(lun_group)s'
|
||||||
'view_id: %(view_id)s')
|
'view_id: %(view_id)s'
|
||||||
% {'lun_group': lungroup_id,
|
% {'lun_group': lungroup_id,
|
||||||
'view_id': view_id})
|
'view_id': view_id})
|
||||||
|
|
||||||
@ -508,8 +508,8 @@ class HVSCommon():
|
|||||||
initiator_name = connector['initiator']
|
initiator_name = connector['initiator']
|
||||||
volume_name = self._encode_name(volume['id'])
|
volume_name = self._encode_name(volume['id'])
|
||||||
|
|
||||||
LOG.debug(_('initiator name:%(initiator_name)s, '
|
LOG.debug('initiator name:%(initiator_name)s, '
|
||||||
'volume name:%(volume)s.')
|
'volume name:%(volume)s.'
|
||||||
% {'initiator_name': initiator_name,
|
% {'initiator_name': initiator_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ class HVSCommon():
|
|||||||
lun_id = self._mapping_hostgroup_and_lungroup(volume_name,
|
lun_id = self._mapping_hostgroup_and_lungroup(volume_name,
|
||||||
hostgroup_id, hostid)
|
hostgroup_id, hostid)
|
||||||
hostlunid = self._find_host_lun_id(hostid, lun_id)
|
hostlunid = self._find_host_lun_id(hostid, lun_id)
|
||||||
LOG.debug(_("host lun id is %s") % hostlunid)
|
LOG.debug("host lun id is %s" % hostlunid)
|
||||||
|
|
||||||
# Return iSCSI properties.
|
# Return iSCSI properties.
|
||||||
properties = {}
|
properties = {}
|
||||||
@ -540,8 +540,8 @@ class HVSCommon():
|
|||||||
wwns = connector['wwpns']
|
wwns = connector['wwpns']
|
||||||
volume_name = self._encode_name(volume['id'])
|
volume_name = self._encode_name(volume['id'])
|
||||||
|
|
||||||
LOG.debug(_('initiator name:%(initiator_name)s, '
|
LOG.debug('initiator name:%(initiator_name)s, '
|
||||||
'volume name:%(volume)s.')
|
'volume name:%(volume)s.'
|
||||||
% {'initiator_name': wwns,
|
% {'initiator_name': wwns,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ class HVSCommon():
|
|||||||
connector['ip'])
|
connector['ip'])
|
||||||
|
|
||||||
free_wwns = self._get_connected_free_wwns()
|
free_wwns = self._get_connected_free_wwns()
|
||||||
LOG.debug(_("the free wwns %s") % free_wwns)
|
LOG.debug("the free wwns %s" % free_wwns)
|
||||||
for wwn in wwns:
|
for wwn in wwns:
|
||||||
if wwn in free_wwns:
|
if wwn in free_wwns:
|
||||||
self._add_fc_port_to_host(hostid, wwn)
|
self._add_fc_port_to_host(hostid, wwn)
|
||||||
@ -571,7 +571,7 @@ class HVSCommon():
|
|||||||
properties['target_wwn'] = tgt_port_wwns
|
properties['target_wwn'] = tgt_port_wwns
|
||||||
properties['target_lun'] = int(host_lun_id)
|
properties['target_lun'] = int(host_lun_id)
|
||||||
properties['volume_id'] = volume['id']
|
properties['volume_id'] = volume['id']
|
||||||
LOG.debug(_("the fc server properties is:%s") % properties)
|
LOG.debug("the fc server properties is:%s" % properties)
|
||||||
|
|
||||||
return {'driver_volume_type': 'fibre_channel',
|
return {'driver_volume_type': 'fibre_channel',
|
||||||
'data': properties}
|
'data': properties}
|
||||||
@ -871,8 +871,8 @@ class HVSCommon():
|
|||||||
volume_name = self._encode_name(volume['id'])
|
volume_name = self._encode_name(volume['id'])
|
||||||
host_name = connector['host']
|
host_name = connector['host']
|
||||||
|
|
||||||
LOG.debug(_('terminate_connection:volume name: %(volume)s, '
|
LOG.debug('terminate_connection:volume name: %(volume)s, '
|
||||||
'initiator name: %(ini)s.')
|
'initiator name: %(ini)s.'
|
||||||
% {'volume': volume_name,
|
% {'volume': volume_name,
|
||||||
'ini': initiator_name})
|
'ini': initiator_name})
|
||||||
|
|
||||||
@ -967,8 +967,8 @@ class HVSCommon():
|
|||||||
LOG.error(err_msg)
|
LOG.error(err_msg)
|
||||||
raise exception.CinderException(err_msg)
|
raise exception.CinderException(err_msg)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('Use default prefetch fetchtype. '
|
LOG.debug('Use default prefetch fetchtype. '
|
||||||
'Prefetch fetchtype:Intelligent.'))
|
'Prefetch fetchtype:Intelligent.')
|
||||||
|
|
||||||
return lunsetinfo
|
return lunsetinfo
|
||||||
|
|
||||||
@ -1080,7 +1080,7 @@ class HVSCommon():
|
|||||||
|
|
||||||
def _get_tgt_iqn(self, iscsiip):
|
def _get_tgt_iqn(self, iscsiip):
|
||||||
"""Get target iSCSI iqn."""
|
"""Get target iSCSI iqn."""
|
||||||
LOG.debug(_('_get_tgt_iqn: iSCSI IP is %s.') % iscsiip)
|
LOG.debug('_get_tgt_iqn: iSCSI IP is %s.' % iscsiip)
|
||||||
ip_info = self._get_iscsi_port_info(iscsiip)
|
ip_info = self._get_iscsi_port_info(iscsiip)
|
||||||
iqn_prefix = self._get_iscsi_tgt_port()
|
iqn_prefix = self._get_iscsi_tgt_port()
|
||||||
|
|
||||||
@ -1098,7 +1098,7 @@ class HVSCommon():
|
|||||||
iqn_suffix = iqn_suffix[i:]
|
iqn_suffix = iqn_suffix[i:]
|
||||||
break
|
break
|
||||||
iqn = iqn_prefix + ':' + iqn_suffix + ':' + iscsiip
|
iqn = iqn_prefix + ':' + iqn_suffix + ':' + iscsiip
|
||||||
LOG.debug(_('_get_tgt_iqn: iSCSI target iqn is %s') % iqn)
|
LOG.debug('_get_tgt_iqn: iSCSI target iqn is %s' % iqn)
|
||||||
return iqn
|
return iqn
|
||||||
|
|
||||||
def _get_fc_target_wwpns(self, wwn):
|
def _get_fc_target_wwpns(self, wwn):
|
||||||
@ -1121,8 +1121,8 @@ class HVSCommon():
|
|||||||
def _parse_volume_type(self, volume):
|
def _parse_volume_type(self, volume):
|
||||||
type_id = volume['volume_type_id']
|
type_id = volume['volume_type_id']
|
||||||
params = self._get_lun_conf_params()
|
params = self._get_lun_conf_params()
|
||||||
LOG.debug(_('_parse_volume_type: type id: %(type_id)s '
|
LOG.debug('_parse_volume_type: type id: %(type_id)s '
|
||||||
'config parameter is: %(params)s')
|
'config parameter is: %(params)s'
|
||||||
% {'type_id': type_id,
|
% {'type_id': type_id,
|
||||||
'params': params})
|
'params': params})
|
||||||
|
|
||||||
@ -1159,7 +1159,7 @@ class HVSCommon():
|
|||||||
'and make it consistent with the configuration '
|
'and make it consistent with the configuration '
|
||||||
'file %(conf)s.') % {'key': key, 'conf': conf})
|
'file %(conf)s.') % {'key': key, 'conf': conf})
|
||||||
|
|
||||||
LOG.debug(_("The config parameters are: %s") % params)
|
LOG.debug("The config parameters are: %s" % params)
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def update_volume_stats(self, refresh=False):
|
def update_volume_stats(self, refresh=False):
|
||||||
|
@ -98,7 +98,7 @@ class TseriesCommon():
|
|||||||
|
|
||||||
def do_setup(self, context):
|
def do_setup(self, context):
|
||||||
"""Check config file."""
|
"""Check config file."""
|
||||||
LOG.debug(_('do_setup'))
|
LOG.debug('do_setup')
|
||||||
|
|
||||||
self._check_conf_file()
|
self._check_conf_file()
|
||||||
self.login_info = self._get_login_info()
|
self.login_info = self._get_login_info()
|
||||||
@ -221,7 +221,7 @@ class TseriesCommon():
|
|||||||
"""Create a new volume."""
|
"""Create a new volume."""
|
||||||
volume_name = self._name_translate(volume['name'])
|
volume_name = self._name_translate(volume['name'])
|
||||||
|
|
||||||
LOG.debug(_('create_volume: volume name: %s') % volume_name)
|
LOG.debug('create_volume: volume name: %s' % volume_name)
|
||||||
|
|
||||||
self._update_login_info()
|
self._update_login_info()
|
||||||
if int(volume['size']) == 0:
|
if int(volume['size']) == 0:
|
||||||
@ -239,8 +239,8 @@ class TseriesCommon():
|
|||||||
"""
|
"""
|
||||||
newname = VOL_AND_SNAP_NAME_PREFIX + str(hash(name))
|
newname = VOL_AND_SNAP_NAME_PREFIX + str(hash(name))
|
||||||
|
|
||||||
LOG.debug(_('_name_translate: Name in cinder: %(old)s, new name in '
|
LOG.debug('_name_translate: Name in cinder: %(old)s, new name in '
|
||||||
'storage system: %(new)s') % {'old': name, 'new': newname})
|
'storage system: %(new)s' % {'old': name, 'new': newname})
|
||||||
|
|
||||||
return newname
|
return newname
|
||||||
|
|
||||||
@ -392,8 +392,8 @@ class TseriesCommon():
|
|||||||
elif conf_params['PrefetchType'] == '2':
|
elif conf_params['PrefetchType'] == '2':
|
||||||
conf_params['PrefetchTimes'] = prefetch.attrib['Value'].strip()
|
conf_params['PrefetchTimes'] = prefetch.attrib['Value'].strip()
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('_parse_conf_lun_params: Use default prefetch type. '
|
LOG.debug('_parse_conf_lun_params: Use default prefetch type. '
|
||||||
'Prefetch type: Intelligent'))
|
'Prefetch type: Intelligent')
|
||||||
|
|
||||||
pools_conf = root.findall('LUN/StoragePool')
|
pools_conf = root.findall('LUN/StoragePool')
|
||||||
for pool in pools_conf:
|
for pool in pools_conf:
|
||||||
@ -431,7 +431,7 @@ class TseriesCommon():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_('CLI command: %s') % cmd)
|
LOG.debug('CLI command: %s' % cmd)
|
||||||
connect_times = 1
|
connect_times = 1
|
||||||
ip0 = self.login_info['ControllerIP0']
|
ip0 = self.login_info['ControllerIP0']
|
||||||
ip1 = self.login_info['ControllerIP1']
|
ip1 = self.login_info['ControllerIP1']
|
||||||
@ -506,7 +506,7 @@ class TseriesCommon():
|
|||||||
def delete_volume(self, volume):
|
def delete_volume(self, volume):
|
||||||
volume_name = self._name_translate(volume['name'])
|
volume_name = self._name_translate(volume['name'])
|
||||||
|
|
||||||
LOG.debug(_('delete_volume: volume name: %s') % volume_name)
|
LOG.debug('delete_volume: volume name: %s' % volume_name)
|
||||||
|
|
||||||
self._update_login_info()
|
self._update_login_info()
|
||||||
volume_id = volume.get('provider_location', None)
|
volume_id = volume.get('provider_location', None)
|
||||||
@ -565,8 +565,8 @@ class TseriesCommon():
|
|||||||
snapshot_name = self._name_translate(snapshot['name'])
|
snapshot_name = self._name_translate(snapshot['name'])
|
||||||
volume_name = self._name_translate(volume['name'])
|
volume_name = self._name_translate(volume['name'])
|
||||||
|
|
||||||
LOG.debug(_('create_volume_from_snapshot: snapshot '
|
LOG.debug('create_volume_from_snapshot: snapshot '
|
||||||
'name: %(snapshot)s, volume name: %(volume)s')
|
'name: %(snapshot)s, volume name: %(volume)s'
|
||||||
% {'snapshot': snapshot_name,
|
% {'snapshot': snapshot_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -683,9 +683,9 @@ class TseriesCommon():
|
|||||||
src_vol_name = self._name_translate(src_volume['name'])
|
src_vol_name = self._name_translate(src_volume['name'])
|
||||||
tgt_vol_name = self._name_translate(tgt_volume['name'])
|
tgt_vol_name = self._name_translate(tgt_volume['name'])
|
||||||
|
|
||||||
LOG.debug(_('create_cloned_volume: src volume: %(src)s, '
|
LOG.debug('create_cloned_volume: src volume: %(src)s, '
|
||||||
'tgt volume: %(tgt)s') % {'src': src_vol_name,
|
'tgt volume: %(tgt)s' % {'src': src_vol_name,
|
||||||
'tgt': tgt_vol_name})
|
'tgt': tgt_vol_name})
|
||||||
|
|
||||||
self._update_login_info()
|
self._update_login_info()
|
||||||
src_vol_id = src_volume.get('provider_location', None)
|
src_vol_id = src_volume.get('provider_location', None)
|
||||||
@ -734,9 +734,9 @@ class TseriesCommon():
|
|||||||
str(len(added_vol_ids)))
|
str(len(added_vol_ids)))
|
||||||
added_vol_size = str(int(new_size) - int(volume['size'])) + 'G'
|
added_vol_size = str(int(new_size) - int(volume['size'])) + 'G'
|
||||||
|
|
||||||
LOG.debug(_('extend_volume: extended volume name: %(extended_name)s '
|
LOG.debug('extend_volume: extended volume name: %(extended_name)s '
|
||||||
'new added volume name: %(added_name)s '
|
'new added volume name: %(added_name)s '
|
||||||
'new added volume size: %(added_size)s')
|
'new added volume size: %(added_size)s'
|
||||||
% {'extended_name': extended_vol_name,
|
% {'extended_name': extended_vol_name,
|
||||||
'added_name': added_vol_name,
|
'added_name': added_vol_name,
|
||||||
'added_size': added_vol_size})
|
'added_size': added_vol_size})
|
||||||
@ -774,8 +774,8 @@ class TseriesCommon():
|
|||||||
snapshot_name = self._name_translate(snapshot['name'])
|
snapshot_name = self._name_translate(snapshot['name'])
|
||||||
volume_name = self._name_translate(snapshot['volume_name'])
|
volume_name = self._name_translate(snapshot['volume_name'])
|
||||||
|
|
||||||
LOG.debug(_('create_snapshot: snapshot name: %(snapshot)s, '
|
LOG.debug('create_snapshot: snapshot name: %(snapshot)s, '
|
||||||
'volume name: %(volume)s')
|
'volume name: %(volume)s'
|
||||||
% {'snapshot': snapshot_name,
|
% {'snapshot': snapshot_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
@ -850,9 +850,9 @@ class TseriesCommon():
|
|||||||
snapshot_name = self._name_translate(snapshot['name'])
|
snapshot_name = self._name_translate(snapshot['name'])
|
||||||
volume_name = self._name_translate(snapshot['volume_name'])
|
volume_name = self._name_translate(snapshot['volume_name'])
|
||||||
|
|
||||||
LOG.debug(_('delete_snapshot: snapshot name: %(snapshot)s, '
|
LOG.debug('delete_snapshot: snapshot name: %(snapshot)s, '
|
||||||
'volume name: %(volume)s') % {'snapshot': snapshot_name,
|
'volume name: %(volume)s' % {'snapshot': snapshot_name,
|
||||||
'volume': volume_name})
|
'volume': volume_name})
|
||||||
|
|
||||||
self._update_login_info()
|
self._update_login_info()
|
||||||
snapshot_id = snapshot.get('provider_location', None)
|
snapshot_id = snapshot.get('provider_location', None)
|
||||||
@ -1074,7 +1074,7 @@ class TseriesCommon():
|
|||||||
return lun_details
|
return lun_details
|
||||||
|
|
||||||
def change_lun_ctr(self, lun_id, ctr):
|
def change_lun_ctr(self, lun_id, ctr):
|
||||||
LOG.debug(_('change_lun_ctr: Changing LUN %(lun)s ctr to %(ctr)s.')
|
LOG.debug('change_lun_ctr: Changing LUN %(lun)s ctr to %(ctr)s.'
|
||||||
% {'lun': lun_id, 'ctr': ctr})
|
% {'lun': lun_id, 'ctr': ctr})
|
||||||
|
|
||||||
cli_cmd = 'chglun -lun %s -c %s' % (lun_id, ctr)
|
cli_cmd = 'chglun -lun %s -c %s' % (lun_id, ctr)
|
||||||
@ -1133,9 +1133,9 @@ class TseriesCommon():
|
|||||||
if (re.search('there are IOs accessing the system', out) and
|
if (re.search('there are IOs accessing the system', out) and
|
||||||
(attempts > 0)):
|
(attempts > 0)):
|
||||||
|
|
||||||
LOG.debug(_('_delete_map: There are IOs accessing '
|
LOG.debug('_delete_map: There are IOs accessing '
|
||||||
'the system. Retry to delete host map '
|
'the system. Retry to delete host map '
|
||||||
'%(mapid)s 10s later.') % {'mapid': mapid})
|
'%(mapid)s 10s later.' % {'mapid': mapid})
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
attempts -= 1
|
attempts -= 1
|
||||||
@ -1180,7 +1180,7 @@ class TseriesCommon():
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("_update_volume_stats: Updating volume stats."))
|
LOG.debug("_update_volume_stats: Updating volume stats.")
|
||||||
data = {}
|
data = {}
|
||||||
data['vendor_name'] = 'Huawei'
|
data['vendor_name'] = 'Huawei'
|
||||||
data['total_capacity_gb'] = 'infinite'
|
data['total_capacity_gb'] = 'infinite'
|
||||||
@ -1244,7 +1244,7 @@ class DoradoCommon(TseriesCommon):
|
|||||||
|
|
||||||
def do_setup(self, context):
|
def do_setup(self, context):
|
||||||
"""Check config file."""
|
"""Check config file."""
|
||||||
LOG.debug(_('do_setup'))
|
LOG.debug('do_setup')
|
||||||
|
|
||||||
self._check_conf_file()
|
self._check_conf_file()
|
||||||
exist_luns = self._get_all_luns_info()
|
exist_luns = self._get_all_luns_info()
|
||||||
|
@ -818,7 +818,7 @@ class GPFSDriver(driver.VolumeDriver):
|
|||||||
"""Create a new backup from an existing volume."""
|
"""Create a new backup from an existing volume."""
|
||||||
volume = self.db.volume_get(context, backup['volume_id'])
|
volume = self.db.volume_get(context, backup['volume_id'])
|
||||||
volume_path = self.local_path(volume)
|
volume_path = self.local_path(volume)
|
||||||
LOG.debug(_('Begin backup of volume %s.') % volume['name'])
|
LOG.debug('Begin backup of volume %s.' % volume['name'])
|
||||||
|
|
||||||
# create a snapshot that will be used as the backup source
|
# create a snapshot that will be used as the backup source
|
||||||
backup_path = '%s_%s' % (volume_path, backup['id'])
|
backup_path = '%s_%s' % (volume_path, backup['id'])
|
||||||
@ -838,7 +838,7 @@ class GPFSDriver(driver.VolumeDriver):
|
|||||||
|
|
||||||
def restore_backup(self, context, backup, volume, backup_service):
|
def restore_backup(self, context, backup, volume, backup_service):
|
||||||
"""Restore an existing backup to a new or existing volume."""
|
"""Restore an existing backup to a new or existing volume."""
|
||||||
LOG.debug(_('Begin restore of backup %s.') % backup['id'])
|
LOG.debug('Begin restore of backup %s.' % backup['id'])
|
||||||
|
|
||||||
volume_path = self.local_path(volume)
|
volume_path = self.local_path(volume)
|
||||||
with utils.temporary_chown(volume_path):
|
with utils.temporary_chown(volume_path):
|
||||||
|
@ -96,20 +96,20 @@ class IBMNAS_NFSDriver(nfs.NfsDriver, san.SanDriver):
|
|||||||
|
|
||||||
def _get_provider_location(self, volume_id):
|
def _get_provider_location(self, volume_id):
|
||||||
"""Returns provider location for given volume."""
|
"""Returns provider location for given volume."""
|
||||||
LOG.debug(_("Enter _get_provider_location: volume_id %s") % volume_id)
|
LOG.debug("Enter _get_provider_location: volume_id %s" % volume_id)
|
||||||
volume = self.db.volume_get(self._context, volume_id)
|
volume = self.db.volume_get(self._context, volume_id)
|
||||||
LOG.debug("Exit _get_provider_location")
|
LOG.debug("Exit _get_provider_location")
|
||||||
return volume['provider_location']
|
return volume['provider_location']
|
||||||
|
|
||||||
def _get_export_path(self, volume_id):
|
def _get_export_path(self, volume_id):
|
||||||
"""Returns NFS export path for the given volume."""
|
"""Returns NFS export path for the given volume."""
|
||||||
LOG.debug(_("Enter _get_export_path: volume_id %s") % volume_id)
|
LOG.debug("Enter _get_export_path: volume_id %s" % volume_id)
|
||||||
return self._get_provider_location(volume_id).split(':')[1]
|
return self._get_provider_location(volume_id).split(':')[1]
|
||||||
|
|
||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Enter _update_volume_stats"))
|
LOG.debug("Enter _update_volume_stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
data['volume_backend_name'] = backend_name or 'IBMNAS_NFS'
|
data['volume_backend_name'] = backend_name or 'IBMNAS_NFS'
|
||||||
@ -135,7 +135,7 @@ class IBMNAS_NFSDriver(nfs.NfsDriver, san.SanDriver):
|
|||||||
|
|
||||||
def _create_ibmnas_snap(self, src, dest, mount_path):
|
def _create_ibmnas_snap(self, src, dest, mount_path):
|
||||||
"""Create volume clones and snapshots."""
|
"""Create volume clones and snapshots."""
|
||||||
LOG.debug(_("Enter _create_ibmnas_snap: src %(src)s, dest %(dest)s")
|
LOG.debug("Enter _create_ibmnas_snap: src %(src)s, dest %(dest)s"
|
||||||
% {'src': src, 'dest': dest})
|
% {'src': src, 'dest': dest})
|
||||||
if mount_path is not None:
|
if mount_path is not None:
|
||||||
tmp_file_path = dest + '.snap'
|
tmp_file_path = dest + '.snap'
|
||||||
@ -165,10 +165,10 @@ class IBMNAS_NFSDriver(nfs.NfsDriver, san.SanDriver):
|
|||||||
|
|
||||||
def _create_ibmnas_copy(self, src, dest, snap):
|
def _create_ibmnas_copy(self, src, dest, snap):
|
||||||
"""Create a cloned volume, parent & the clone both remain writable."""
|
"""Create a cloned volume, parent & the clone both remain writable."""
|
||||||
LOG.debug(_('Enter _create_ibmnas_copy: src %(src)s, dest %(dest)s, '
|
LOG.debug('Enter _create_ibmnas_copy: src %(src)s, dest %(dest)s, '
|
||||||
'snap %(snap)s') % {'src': src,
|
'snap %(snap)s' % {'src': src,
|
||||||
'dest': dest,
|
'dest': dest,
|
||||||
'snap': snap})
|
'snap': snap})
|
||||||
ssh_cmd = ['mkclone', '-p', snap, '-s', src, '-t', dest]
|
ssh_cmd = ['mkclone', '-p', snap, '-s', src, '-t', dest]
|
||||||
try:
|
try:
|
||||||
self._run_ssh(ssh_cmd)
|
self._run_ssh(ssh_cmd)
|
||||||
@ -199,8 +199,8 @@ class IBMNAS_NFSDriver(nfs.NfsDriver, san.SanDriver):
|
|||||||
self._resize_volume_file(path, new_size)
|
self._resize_volume_file(path, new_size)
|
||||||
|
|
||||||
def _delete_snapfiles(self, fchild, mount_point):
|
def _delete_snapfiles(self, fchild, mount_point):
|
||||||
LOG.debug(_('Enter _delete_snapfiles: fchild %(fchild)s, '
|
LOG.debug('Enter _delete_snapfiles: fchild %(fchild)s, '
|
||||||
'mount_point %(mount_point)s')
|
'mount_point %(mount_point)s'
|
||||||
% {'fchild': fchild,
|
% {'fchild': fchild,
|
||||||
'mount_point': mount_point})
|
'mount_point': mount_point})
|
||||||
ssh_cmd = ['lsclone', fchild]
|
ssh_cmd = ['lsclone', fchild]
|
||||||
|
@ -140,7 +140,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
|
|
||||||
def do_setup(self, ctxt):
|
def do_setup(self, ctxt):
|
||||||
"""Check that we have all configuration details from the storage."""
|
"""Check that we have all configuration details from the storage."""
|
||||||
LOG.debug(_('enter: do_setup'))
|
LOG.debug('enter: do_setup')
|
||||||
|
|
||||||
# Get storage system name, id, and code level
|
# Get storage system name, id, and code level
|
||||||
self._state.update(self._helpers.get_system_info())
|
self._state.update(self._helpers.get_system_info())
|
||||||
@ -211,11 +211,11 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
self._check_volume_copy_ops)
|
self._check_volume_copy_ops)
|
||||||
self._vdiskcopyops_loop.start(interval=self.VDISKCOPYOPS_INTERVAL)
|
self._vdiskcopyops_loop.start(interval=self.VDISKCOPYOPS_INTERVAL)
|
||||||
|
|
||||||
LOG.debug(_('leave: do_setup'))
|
LOG.debug('leave: do_setup')
|
||||||
|
|
||||||
def check_for_setup_error(self):
|
def check_for_setup_error(self):
|
||||||
"""Ensure that the flags are set properly."""
|
"""Ensure that the flags are set properly."""
|
||||||
LOG.debug(_('enter: check_for_setup_error'))
|
LOG.debug('enter: check_for_setup_error')
|
||||||
|
|
||||||
# Check that we have the system ID information
|
# Check that we have the system ID information
|
||||||
if self._state['system_name'] is None:
|
if self._state['system_name'] is None:
|
||||||
@ -251,7 +251,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
opts = self._helpers.build_default_opts(self.configuration)
|
opts = self._helpers.build_default_opts(self.configuration)
|
||||||
self._helpers.check_vdisk_opts(self._state, opts)
|
self._helpers.check_vdisk_opts(self._state, opts)
|
||||||
|
|
||||||
LOG.debug(_('leave: check_for_setup_error'))
|
LOG.debug('leave: check_for_setup_error')
|
||||||
|
|
||||||
def ensure_export(self, ctxt, volume):
|
def ensure_export(self, ctxt, volume):
|
||||||
"""Check that the volume exists on the storage.
|
"""Check that the volume exists on the storage.
|
||||||
@ -304,8 +304,8 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_('enter: initialize_connection: volume %(vol)s with '
|
LOG.debug('enter: initialize_connection: volume %(vol)s with '
|
||||||
'connector %(conn)s') % {'vol': volume, 'conn': connector})
|
'connector %(conn)s' % {'vol': volume, 'conn': connector})
|
||||||
|
|
||||||
vol_opts = self._get_vdisk_params(volume['volume_type_id'])
|
vol_opts = self._get_vdisk_params(volume['volume_type_id'])
|
||||||
volume_name = volume['name']
|
volume_name = volume['name']
|
||||||
@ -443,8 +443,8 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
'%(conn)s.\n') % {'vol': volume,
|
'%(conn)s.\n') % {'vol': volume,
|
||||||
'conn': connector})
|
'conn': connector})
|
||||||
|
|
||||||
LOG.debug(_('leave: initialize_connection:\n volume: %(vol)s\n '
|
LOG.debug('leave: initialize_connection:\n volume: %(vol)s\n '
|
||||||
'connector %(conn)s\n properties: %(prop)s')
|
'connector %(conn)s\n properties: %(prop)s'
|
||||||
% {'vol': volume, 'conn': connector, 'prop': properties})
|
% {'vol': volume, 'conn': connector, 'prop': properties})
|
||||||
|
|
||||||
return {'driver_volume_type': type_str, 'data': properties, }
|
return {'driver_volume_type': type_str, 'data': properties, }
|
||||||
@ -470,8 +470,8 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
3. Delete the host if it has no more mappings (hosts are created
|
3. Delete the host if it has no more mappings (hosts are created
|
||||||
automatically by this driver when mappings are created)
|
automatically by this driver when mappings are created)
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('enter: terminate_connection: volume %(vol)s with '
|
LOG.debug('enter: terminate_connection: volume %(vol)s with '
|
||||||
'connector %(conn)s') % {'vol': volume, 'conn': connector})
|
'connector %(conn)s' % {'vol': volume, 'conn': connector})
|
||||||
|
|
||||||
vol_name = volume['name']
|
vol_name = volume['name']
|
||||||
if 'host' in connector:
|
if 'host' in connector:
|
||||||
@ -505,8 +505,8 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
|
|
||||||
self._helpers.unmap_vol_from_host(vol_name, host_name)
|
self._helpers.unmap_vol_from_host(vol_name, host_name)
|
||||||
|
|
||||||
LOG.debug(_('leave: terminate_connection: volume %(vol)s with '
|
LOG.debug('leave: terminate_connection: volume %(vol)s with '
|
||||||
'connector %(conn)s') % {'vol': volume, 'conn': connector})
|
'connector %(conn)s' % {'vol': volume, 'conn': connector})
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
opts, True)
|
opts, True)
|
||||||
|
|
||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])
|
LOG.debug('enter: extend_volume: volume %s' % volume['id'])
|
||||||
ret = self._helpers.ensure_vdisk_no_fc_mappings(volume['name'],
|
ret = self._helpers.ensure_vdisk_no_fc_mappings(volume['name'],
|
||||||
allow_snaps=False)
|
allow_snaps=False)
|
||||||
if not ret:
|
if not ret:
|
||||||
@ -578,7 +578,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
|
|
||||||
extend_amt = int(new_size) - volume['size']
|
extend_amt = int(new_size) - volume['size']
|
||||||
self._helpers.extend_vdisk(volume['name'], extend_amt)
|
self._helpers.extend_vdisk(volume['name'], extend_amt)
|
||||||
LOG.debug(_('leave: extend_volume: volume %s') % volume['id'])
|
LOG.debug('leave: extend_volume: volume %s' % volume['id'])
|
||||||
|
|
||||||
def _add_vdisk_copy_op(self, ctxt, volume, new_op):
|
def _add_vdisk_copy_op(self, ctxt, volume, new_op):
|
||||||
metadata = self.db.volume_admin_metadata_get(ctxt.elevated(),
|
metadata = self.db.volume_admin_metadata_get(ctxt.elevated(),
|
||||||
@ -657,7 +657,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
'vdiskcopyops')
|
'vdiskcopyops')
|
||||||
|
|
||||||
def _check_volume_copy_ops(self):
|
def _check_volume_copy_ops(self):
|
||||||
LOG.debug(_("enter: update volume copy status"))
|
LOG.debug("enter: update volume copy status")
|
||||||
ctxt = context.get_admin_context()
|
ctxt = context.get_admin_context()
|
||||||
copy_items = self._vdiskcopyops.items()
|
copy_items = self._vdiskcopyops.items()
|
||||||
for vol_id, copy_ops in copy_items:
|
for vol_id, copy_ops in copy_items:
|
||||||
@ -687,7 +687,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
self._helpers.rm_vdisk_copy(volume['name'], copy_op[0])
|
self._helpers.rm_vdisk_copy(volume['name'], copy_op[0])
|
||||||
self._rm_vdisk_copy_op(ctxt, volume, copy_op[0],
|
self._rm_vdisk_copy_op(ctxt, volume, copy_op[0],
|
||||||
copy_op[1])
|
copy_op[1])
|
||||||
LOG.debug(_("exit: update volume copy status"))
|
LOG.debug("exit: update volume copy status")
|
||||||
|
|
||||||
def migrate_volume(self, ctxt, volume, host):
|
def migrate_volume(self, ctxt, volume, host):
|
||||||
"""Migrate directly if source and dest are managed by same storage.
|
"""Migrate directly if source and dest are managed by same storage.
|
||||||
@ -702,7 +702,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
host['host'] is its name, and host['capabilities'] is a
|
host['host'] is its name, and host['capabilities'] is a
|
||||||
dictionary of its reported capabilities.
|
dictionary of its reported capabilities.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('enter: migrate_volume: id=%(id)s, host=%(host)s') %
|
LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s' %
|
||||||
{'id': volume['id'], 'host': host['host']})
|
{'id': volume['id'], 'host': host['host']})
|
||||||
|
|
||||||
false_ret = (False, None)
|
false_ret = (False, None)
|
||||||
@ -722,7 +722,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
vol_type, self._state,
|
vol_type, self._state,
|
||||||
self.configuration)
|
self.configuration)
|
||||||
self._add_vdisk_copy_op(ctxt, volume, new_op)
|
self._add_vdisk_copy_op(ctxt, volume, new_op)
|
||||||
LOG.debug(_('leave: migrate_volume: id=%(id)s, host=%(host)s') %
|
LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s' %
|
||||||
{'id': volume['id'], 'host': host['host']})
|
{'id': volume['id'], 'host': host['host']})
|
||||||
return (True, None)
|
return (True, None)
|
||||||
|
|
||||||
@ -744,11 +744,11 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
self._helpers.change_vdisk_iogrp(volume['name'],
|
self._helpers.change_vdisk_iogrp(volume['name'],
|
||||||
self._state, (new, old))
|
self._state, (new, old))
|
||||||
|
|
||||||
LOG.debug(_('enter: retype: id=%(id)s, new_type=%(new_type)s,'
|
LOG.debug('enter: retype: id=%(id)s, new_type=%(new_type)s,'
|
||||||
'diff=%(diff)s, host=%(host)s') % {'id': volume['id'],
|
'diff=%(diff)s, host=%(host)s' % {'id': volume['id'],
|
||||||
'new_type': new_type,
|
'new_type': new_type,
|
||||||
'diff': diff,
|
'diff': diff,
|
||||||
'host': host})
|
'host': host})
|
||||||
|
|
||||||
ignore_keys = ['protocol', 'multipath']
|
ignore_keys = ['protocol', 'multipath']
|
||||||
no_copy_keys = ['warning', 'autoexpand', 'easytier']
|
no_copy_keys = ['warning', 'autoexpand', 'easytier']
|
||||||
@ -798,11 +798,11 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
self._helpers.change_vdisk_options(volume['name'], vdisk_changes,
|
self._helpers.change_vdisk_options(volume['name'], vdisk_changes,
|
||||||
new_opts, self._state)
|
new_opts, self._state)
|
||||||
|
|
||||||
LOG.debug(_('exit: retype: ild=%(id)s, new_type=%(new_type)s,'
|
LOG.debug('exit: retype: ild=%(id)s, new_type=%(new_type)s,'
|
||||||
'diff=%(diff)s, host=%(host)s') % {'id': volume['id'],
|
'diff=%(diff)s, host=%(host)s' % {'id': volume['id'],
|
||||||
'new_type': new_type,
|
'new_type': new_type,
|
||||||
'diff': diff,
|
'diff': diff,
|
||||||
'host': host['host']})
|
'host': host['host']})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def manage_existing(self, volume, ref):
|
def manage_existing(self, volume, ref):
|
||||||
@ -869,7 +869,7 @@ class StorwizeSVCDriver(san.SanDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
data['vendor_name'] = 'IBM'
|
data['vendor_name'] = 'IBM'
|
||||||
|
@ -176,7 +176,7 @@ class StorwizeHelpers(object):
|
|||||||
|
|
||||||
def get_host_from_connector(self, connector):
|
def get_host_from_connector(self, connector):
|
||||||
"""Return the Storwize host described by the connector."""
|
"""Return the Storwize host described by the connector."""
|
||||||
LOG.debug(_('enter: get_host_from_connector: %s') % connector)
|
LOG.debug('enter: get_host_from_connector: %s' % connector)
|
||||||
|
|
||||||
# If we have FC information, we have a faster lookup option
|
# If we have FC information, we have a faster lookup option
|
||||||
host_name = None
|
host_name = None
|
||||||
@ -209,7 +209,7 @@ class StorwizeHelpers(object):
|
|||||||
[str(x).lower() for x in connector['wwpns']]):
|
[str(x).lower() for x in connector['wwpns']]):
|
||||||
host_name = name
|
host_name = name
|
||||||
|
|
||||||
LOG.debug(_('leave: get_host_from_connector: host %s') % host_name)
|
LOG.debug('leave: get_host_from_connector: host %s' % host_name)
|
||||||
return host_name
|
return host_name
|
||||||
|
|
||||||
def create_host(self, connector):
|
def create_host(self, connector):
|
||||||
@ -220,7 +220,7 @@ class StorwizeHelpers(object):
|
|||||||
host name (at most 55 characters), plus a random 8-character suffix to
|
host name (at most 55 characters), plus a random 8-character suffix to
|
||||||
avoid collisions. The total length should be at most 63 characters.
|
avoid collisions. The total length should be at most 63 characters.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('enter: create_host: host %s') % connector['host'])
|
LOG.debug('enter: create_host: host %s' % connector['host'])
|
||||||
|
|
||||||
# Before we start, make sure host name is a string and that we have at
|
# Before we start, make sure host name is a string and that we have at
|
||||||
# least one port.
|
# least one port.
|
||||||
@ -267,7 +267,7 @@ class StorwizeHelpers(object):
|
|||||||
for port in ports:
|
for port in ports:
|
||||||
self.ssh.addhostport(host_name, port[0], port[1])
|
self.ssh.addhostport(host_name, port[0], port[1])
|
||||||
|
|
||||||
LOG.debug(_('leave: create_host: host %(host)s - %(host_name)s') %
|
LOG.debug('leave: create_host: host %(host)s - %(host_name)s' %
|
||||||
{'host': connector['host'], 'host_name': host_name})
|
{'host': connector['host'], 'host_name': host_name})
|
||||||
return host_name
|
return host_name
|
||||||
|
|
||||||
@ -277,8 +277,8 @@ class StorwizeHelpers(object):
|
|||||||
def map_vol_to_host(self, volume_name, host_name, multihostmap):
|
def map_vol_to_host(self, volume_name, host_name, multihostmap):
|
||||||
"""Create a mapping between a volume to a host."""
|
"""Create a mapping between a volume to a host."""
|
||||||
|
|
||||||
LOG.debug(_('enter: map_vol_to_host: volume %(volume_name)s to '
|
LOG.debug('enter: map_vol_to_host: volume %(volume_name)s to '
|
||||||
'host %(host_name)s')
|
'host %(host_name)s'
|
||||||
% {'volume_name': volume_name, 'host_name': host_name})
|
% {'volume_name': volume_name, 'host_name': host_name})
|
||||||
|
|
||||||
# Check if this volume is already mapped to this host
|
# Check if this volume is already mapped to this host
|
||||||
@ -303,8 +303,8 @@ class StorwizeHelpers(object):
|
|||||||
self.ssh.mkvdiskhostmap(host_name, volume_name, result_lun,
|
self.ssh.mkvdiskhostmap(host_name, volume_name, result_lun,
|
||||||
multihostmap)
|
multihostmap)
|
||||||
|
|
||||||
LOG.debug(_('leave: map_vol_to_host: LUN %(result_lun)s, volume '
|
LOG.debug('leave: map_vol_to_host: LUN %(result_lun)s, volume '
|
||||||
'%(volume_name)s, host %(host_name)s') %
|
'%(volume_name)s, host %(host_name)s' %
|
||||||
{'result_lun': result_lun,
|
{'result_lun': result_lun,
|
||||||
'volume_name': volume_name,
|
'volume_name': volume_name,
|
||||||
'host_name': host_name})
|
'host_name': host_name})
|
||||||
@ -313,8 +313,8 @@ class StorwizeHelpers(object):
|
|||||||
def unmap_vol_from_host(self, volume_name, host_name):
|
def unmap_vol_from_host(self, volume_name, host_name):
|
||||||
"""Unmap the volume and delete the host if it has no more mappings."""
|
"""Unmap the volume and delete the host if it has no more mappings."""
|
||||||
|
|
||||||
LOG.debug(_('enter: unmap_vol_from_host: volume %(volume_name)s from '
|
LOG.debug('enter: unmap_vol_from_host: volume %(volume_name)s from '
|
||||||
'host %(host_name)s')
|
'host %(host_name)s'
|
||||||
% {'volume_name': volume_name, 'host_name': host_name})
|
% {'volume_name': volume_name, 'host_name': host_name})
|
||||||
|
|
||||||
# Check if the mapping exists
|
# Check if the mapping exists
|
||||||
@ -350,8 +350,8 @@ class StorwizeHelpers(object):
|
|||||||
if not len(resp):
|
if not len(resp):
|
||||||
self.delete_host(host_name)
|
self.delete_host(host_name)
|
||||||
|
|
||||||
LOG.debug(_('leave: unmap_vol_from_host: volume %(volume_name)s from '
|
LOG.debug('leave: unmap_vol_from_host: volume %(volume_name)s from '
|
||||||
'host %(host_name)s')
|
'host %(host_name)s'
|
||||||
% {'volume_name': volume_name, 'host_name': host_name})
|
% {'volume_name': volume_name, 'host_name': host_name})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -498,10 +498,10 @@ class StorwizeHelpers(object):
|
|||||||
return params
|
return params
|
||||||
|
|
||||||
def create_vdisk(self, name, size, units, pool, opts):
|
def create_vdisk(self, name, size, units, pool, opts):
|
||||||
LOG.debug(_('enter: create_vdisk: vdisk %s ') % name)
|
LOG.debug('enter: create_vdisk: vdisk %s ' % name)
|
||||||
params = self._get_vdisk_create_params(opts)
|
params = self._get_vdisk_create_params(opts)
|
||||||
self.ssh.mkvdisk(name, size, units, pool, opts, params)
|
self.ssh.mkvdisk(name, size, units, pool, opts, params)
|
||||||
LOG.debug(_('leave: _create_vdisk: volume %s ') % name)
|
LOG.debug('leave: _create_vdisk: volume %s ' % name)
|
||||||
|
|
||||||
def get_vdisk_attributes(self, vdisk):
|
def get_vdisk_attributes(self, vdisk):
|
||||||
attrs = self.ssh.lsvdisk(vdisk)
|
attrs = self.ssh.lsvdisk(vdisk)
|
||||||
@ -547,16 +547,16 @@ class StorwizeHelpers(object):
|
|||||||
|
|
||||||
def run_flashcopy(self, source, target, timeout, full_copy=True):
|
def run_flashcopy(self, source, target, timeout, full_copy=True):
|
||||||
"""Create a FlashCopy mapping from the source to the target."""
|
"""Create a FlashCopy mapping from the source to the target."""
|
||||||
LOG.debug(_('enter: run_flashcopy: execute FlashCopy from source '
|
LOG.debug('enter: run_flashcopy: execute FlashCopy from source '
|
||||||
'%(source)s to target %(target)s') %
|
'%(source)s to target %(target)s' %
|
||||||
{'source': source, 'target': target})
|
{'source': source, 'target': target})
|
||||||
|
|
||||||
fc_map_id = self.ssh.mkfcmap(source, target, full_copy)
|
fc_map_id = self.ssh.mkfcmap(source, target, full_copy)
|
||||||
self._prepare_fc_map(fc_map_id, timeout)
|
self._prepare_fc_map(fc_map_id, timeout)
|
||||||
self.ssh.startfcmap(fc_map_id)
|
self.ssh.startfcmap(fc_map_id)
|
||||||
|
|
||||||
LOG.debug(_('leave: run_flashcopy: FlashCopy started from '
|
LOG.debug('leave: run_flashcopy: FlashCopy started from '
|
||||||
'%(source)s to %(target)s') %
|
'%(source)s to %(target)s' %
|
||||||
{'source': source, 'target': target})
|
{'source': source, 'target': target})
|
||||||
|
|
||||||
def _get_vdisk_fc_mappings(self, vdisk):
|
def _get_vdisk_fc_mappings(self, vdisk):
|
||||||
@ -575,7 +575,7 @@ class StorwizeHelpers(object):
|
|||||||
|
|
||||||
def _check_vdisk_fc_mappings(self, name, allow_snaps=True):
|
def _check_vdisk_fc_mappings(self, name, allow_snaps=True):
|
||||||
"""FlashCopy mapping check helper."""
|
"""FlashCopy mapping check helper."""
|
||||||
LOG.debug(_('Loopcall: _check_vdisk_fc_mappings(), vdisk %s') % name)
|
LOG.debug('Loopcall: _check_vdisk_fc_mappings(), vdisk %s' % name)
|
||||||
mapping_ids = self._get_vdisk_fc_mappings(name)
|
mapping_ids = self._get_vdisk_fc_mappings(name)
|
||||||
wait_for_copy = False
|
wait_for_copy = False
|
||||||
for map_id in mapping_ids:
|
for map_id in mapping_ids:
|
||||||
@ -634,7 +634,7 @@ class StorwizeHelpers(object):
|
|||||||
# before it finishes. Don't set the sleep interval shorter
|
# before it finishes. Don't set the sleep interval shorter
|
||||||
# than the heartbeat. Otherwise volume service heartbeat
|
# than the heartbeat. Otherwise volume service heartbeat
|
||||||
# will not be serviced.
|
# will not be serviced.
|
||||||
LOG.debug(_('Calling _ensure_vdisk_no_fc_mappings: vdisk %s')
|
LOG.debug('Calling _ensure_vdisk_no_fc_mappings: vdisk %s'
|
||||||
% name)
|
% name)
|
||||||
ret = timer.start(interval=self.check_fcmapping_interval).wait()
|
ret = timer.start(interval=self.check_fcmapping_interval).wait()
|
||||||
timer.stop()
|
timer.stop()
|
||||||
@ -642,17 +642,17 @@ class StorwizeHelpers(object):
|
|||||||
|
|
||||||
def delete_vdisk(self, vdisk, force):
|
def delete_vdisk(self, vdisk, force):
|
||||||
"""Ensures that vdisk is not part of FC mapping and deletes it."""
|
"""Ensures that vdisk is not part of FC mapping and deletes it."""
|
||||||
LOG.debug(_('enter: delete_vdisk: vdisk %s') % vdisk)
|
LOG.debug('enter: delete_vdisk: vdisk %s' % vdisk)
|
||||||
if not self.is_vdisk_defined(vdisk):
|
if not self.is_vdisk_defined(vdisk):
|
||||||
LOG.info(_('Tried to delete non-existant vdisk %s.') % vdisk)
|
LOG.info(_('Tried to delete non-existant vdisk %s.') % vdisk)
|
||||||
return
|
return
|
||||||
self.ensure_vdisk_no_fc_mappings(vdisk)
|
self.ensure_vdisk_no_fc_mappings(vdisk)
|
||||||
self.ssh.rmvdisk(vdisk, force=force)
|
self.ssh.rmvdisk(vdisk, force=force)
|
||||||
LOG.debug(_('leave: delete_vdisk: vdisk %s') % vdisk)
|
LOG.debug('leave: delete_vdisk: vdisk %s' % vdisk)
|
||||||
|
|
||||||
def create_copy(self, src, tgt, src_id, config, opts, full_copy):
|
def create_copy(self, src, tgt, src_id, config, opts, full_copy):
|
||||||
"""Create a new snapshot using FlashCopy."""
|
"""Create a new snapshot using FlashCopy."""
|
||||||
LOG.debug(_('enter: create_copy: snapshot %(src)s to %(tgt)s') %
|
LOG.debug('enter: create_copy: snapshot %(src)s to %(tgt)s' %
|
||||||
{'tgt': tgt, 'src': src})
|
{'tgt': tgt, 'src': src})
|
||||||
|
|
||||||
src_attrs = self.get_vdisk_attributes(src)
|
src_attrs = self.get_vdisk_attributes(src)
|
||||||
@ -672,8 +672,8 @@ class StorwizeHelpers(object):
|
|||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
self.delete_vdisk(tgt, True)
|
self.delete_vdisk(tgt, True)
|
||||||
|
|
||||||
LOG.debug(_('leave: _create_copy: snapshot %(tgt)s from '
|
LOG.debug('leave: _create_copy: snapshot %(tgt)s from '
|
||||||
'vdisk %(src)s') %
|
'vdisk %(src)s' %
|
||||||
{'tgt': tgt, 'src': src})
|
{'tgt': tgt, 'src': src})
|
||||||
|
|
||||||
def extend_vdisk(self, vdisk, amount):
|
def extend_vdisk(self, vdisk, amount):
|
||||||
@ -739,8 +739,8 @@ class StorwizeHelpers(object):
|
|||||||
|
|
||||||
def change_vdisk_iogrp(self, vdisk, state, iogrp):
|
def change_vdisk_iogrp(self, vdisk, state, iogrp):
|
||||||
if state['code_level'] < (6, 4, 0, 0):
|
if state['code_level'] < (6, 4, 0, 0):
|
||||||
LOG.debug(_('Ignore change IO group as storage code level is '
|
LOG.debug('Ignore change IO group as storage code level is '
|
||||||
'%(code_level)s, below the required 6.4.0.0') %
|
'%(code_level)s, below the required 6.4.0.0' %
|
||||||
{'code_level': state['code_level']})
|
{'code_level': state['code_level']})
|
||||||
else:
|
else:
|
||||||
self.ssh.movevdisk(vdisk, str(iogrp[0]))
|
self.ssh.movevdisk(vdisk, str(iogrp[0]))
|
||||||
|
@ -342,7 +342,7 @@ class LVMVolumeDriver(driver.VolumeDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
if self.vg is None:
|
if self.vg is None:
|
||||||
LOG.warning(_('Unable to update stats on non-initialized '
|
LOG.warning(_('Unable to update stats on non-initialized '
|
||||||
'Volume Group: %s'), self.configuration.volume_group)
|
'Volume Group: %s'), self.configuration.volume_group)
|
||||||
|
@ -118,9 +118,9 @@ class RestClient(WebserviceClient):
|
|||||||
"""Invokes end point for resource on path."""
|
"""Invokes end point for resource on path."""
|
||||||
params = {'m': method, 'p': path, 'd': data, 'sys': use_system,
|
params = {'m': method, 'p': path, 'd': data, 'sys': use_system,
|
||||||
't': timeout, 'v': verify, 'k': kwargs}
|
't': timeout, 'v': verify, 'k': kwargs}
|
||||||
LOG.debug(_("Invoking rest with method: %(m)s, path: %(p)s,"
|
LOG.debug("Invoking rest with method: %(m)s, path: %(p)s,"
|
||||||
" data: %(d)s, use_system: %(sys)s, timeout: %(t)s,"
|
" data: %(d)s, use_system: %(sys)s, timeout: %(t)s,"
|
||||||
" verify: %(v)s, kwargs: %(k)s.") % (params))
|
" verify: %(v)s, kwargs: %(k)s." % (params))
|
||||||
url = self._get_resource_url(path, use_system, **kwargs)
|
url = self._get_resource_url(path, use_system, **kwargs)
|
||||||
if self._content_type == 'json':
|
if self._content_type == 'json':
|
||||||
headers = {'Accept': 'application/json',
|
headers = {'Accept': 'application/json',
|
||||||
|
@ -223,7 +223,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
self._objects['volumes']['ref_vol'].pop(vol_id, True)
|
self._objects['volumes']['ref_vol'].pop(vol_id, True)
|
||||||
self._objects['volumes']['label_ref'].pop(label)
|
self._objects['volumes']['label_ref'].pop(label)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Volume %s not cached."), label)
|
LOG.debug("Volume %s not cached.", label)
|
||||||
|
|
||||||
def _del_snapshot_frm_cache(self, obj_name):
|
def _del_snapshot_frm_cache(self, obj_name):
|
||||||
"""Deletes snapshot group from cache."""
|
"""Deletes snapshot group from cache."""
|
||||||
@ -232,7 +232,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
self._objects['snapshots']['ref_snap'].pop(snap_id, True)
|
self._objects['snapshots']['ref_snap'].pop(snap_id, True)
|
||||||
self._objects['snapshots']['label_ref'].pop(obj_name)
|
self._objects['snapshots']['label_ref'].pop(obj_name)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Snapshot %s not cached."), obj_name)
|
LOG.debug("Snapshot %s not cached.", obj_name)
|
||||||
|
|
||||||
def _del_vol_mapping_frm_cache(self, mapping):
|
def _del_vol_mapping_frm_cache(self, mapping):
|
||||||
"""Deletes volume mapping under cached volume."""
|
"""Deletes volume mapping under cached volume."""
|
||||||
@ -242,7 +242,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
try:
|
try:
|
||||||
mappings.remove(mapping)
|
mappings.remove(mapping)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.debug(_("Mapping with id %s already removed."),
|
LOG.debug("Mapping with id %s already removed.",
|
||||||
mapping['lunMappingRef'])
|
mapping['lunMappingRef'])
|
||||||
|
|
||||||
def _get_volume(self, uid):
|
def _get_volume(self, uid):
|
||||||
@ -347,7 +347,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
def _create_snapshot_volume(self, snapshot_id):
|
def _create_snapshot_volume(self, snapshot_id):
|
||||||
"""Creates snapshot volume for given group with snapshot_id."""
|
"""Creates snapshot volume for given group with snapshot_id."""
|
||||||
group = self._get_cached_snapshot_grp(snapshot_id)
|
group = self._get_cached_snapshot_grp(snapshot_id)
|
||||||
LOG.debug(_("Creating snap vol for group %s"), group['label'])
|
LOG.debug("Creating snap vol for group %s", group['label'])
|
||||||
image = self._get_cached_snap_grp_image(snapshot_id)
|
image = self._get_cached_snap_grp_image(snapshot_id)
|
||||||
label = utils.convert_uuid_to_es_fmt(uuid.uuid4())
|
label = utils.convert_uuid_to_es_fmt(uuid.uuid4())
|
||||||
capacity = int(image['pitCapacity']) / units.GiB
|
capacity = int(image['pitCapacity']) / units.GiB
|
||||||
@ -622,7 +622,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Update volume statistics."""
|
"""Update volume statistics."""
|
||||||
LOG.debug(_("Updating volume stats."))
|
LOG.debug("Updating volume stats.")
|
||||||
self._stats = self._stats or {}
|
self._stats = self._stats or {}
|
||||||
netapp_backend = 'NetApp_ESeries'
|
netapp_backend = 'NetApp_ESeries'
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
@ -686,7 +686,7 @@ class Driver(driver.ISCSIDriver):
|
|||||||
try:
|
try:
|
||||||
self._delete_volume(label)
|
self._delete_volume(label)
|
||||||
except exception.NetAppDriverException:
|
except exception.NetAppDriverException:
|
||||||
LOG.debug(_("Error deleting vol with label %s."),
|
LOG.debug("Error deleting vol with label %s.",
|
||||||
label)
|
label)
|
||||||
finally:
|
finally:
|
||||||
utils.set_safe_attr(self, 'clean_job_running', False)
|
utils.set_safe_attr(self, 'clean_job_running', False)
|
||||||
|
@ -102,7 +102,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
host_filer = kwargs['hostname']
|
host_filer = kwargs['hostname']
|
||||||
LOG.debug(_('Using NetApp filer: %s') % host_filer)
|
LOG.debug('Using NetApp filer: %s' % host_filer)
|
||||||
self.client = NaServer(host=host_filer,
|
self.client = NaServer(host=host_filer,
|
||||||
server_type=NaServer.SERVER_TYPE_FILER,
|
server_type=NaServer.SERVER_TYPE_FILER,
|
||||||
transport_type=kwargs['transport_type'],
|
transport_type=kwargs['transport_type'],
|
||||||
@ -147,7 +147,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
self.lun_table = {}
|
self.lun_table = {}
|
||||||
self._get_lun_list()
|
self._get_lun_list()
|
||||||
LOG.debug(_("Success getting LUN list from server"))
|
LOG.debug("Success getting LUN list from server")
|
||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
"""Driver entry point for creating a new volume."""
|
"""Driver entry point for creating a new volume."""
|
||||||
@ -163,7 +163,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
metadata['SpaceReserved'] = 'true'
|
metadata['SpaceReserved'] = 'true'
|
||||||
extra_specs = get_volume_extra_specs(volume)
|
extra_specs = get_volume_extra_specs(volume)
|
||||||
self._create_lun_on_eligible_vol(name, size, metadata, extra_specs)
|
self._create_lun_on_eligible_vol(name, size, metadata, extra_specs)
|
||||||
LOG.debug(_("Created LUN with name %s") % name)
|
LOG.debug("Created LUN with name %s" % name)
|
||||||
handle = self._create_lun_handle(metadata)
|
handle = self._create_lun_handle(metadata)
|
||||||
self._add_lun_to_table(NetAppLun(handle, name, size, metadata))
|
self._add_lun_to_table(NetAppLun(handle, name, size, metadata))
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
lun_destroy.add_new_child('force', 'true')
|
lun_destroy.add_new_child('force', 'true')
|
||||||
self.client.invoke_successfully(lun_destroy, True)
|
self.client.invoke_successfully(lun_destroy, True)
|
||||||
seg = path.split("/")
|
seg = path.split("/")
|
||||||
LOG.debug(_("Destroyed LUN %s") % seg[-1])
|
LOG.debug("Destroyed LUN %s" % seg[-1])
|
||||||
|
|
||||||
def ensure_export(self, context, volume):
|
def ensure_export(self, context, volume):
|
||||||
"""Driver entry point to get the export info for an existing volume."""
|
"""Driver entry point to get the export info for an existing volume."""
|
||||||
@ -287,7 +287,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
def delete_snapshot(self, snapshot):
|
def delete_snapshot(self, snapshot):
|
||||||
"""Driver entry point for deleting a snapshot."""
|
"""Driver entry point for deleting a snapshot."""
|
||||||
self.delete_volume(snapshot)
|
self.delete_volume(snapshot)
|
||||||
LOG.debug(_("Snapshot %s deletion successful") % snapshot['name'])
|
LOG.debug("Snapshot %s deletion successful" % snapshot['name'])
|
||||||
|
|
||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Driver entry point for creating a new volume from a snapshot.
|
"""Driver entry point for creating a new volume from a snapshot.
|
||||||
@ -652,7 +652,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
"""Moves the lun at path to new path."""
|
"""Moves the lun at path to new path."""
|
||||||
seg = path.split("/")
|
seg = path.split("/")
|
||||||
new_seg = new_path.split("/")
|
new_seg = new_path.split("/")
|
||||||
LOG.debug(_("Moving lun %(name)s to %(new_name)s.")
|
LOG.debug("Moving lun %(name)s to %(new_name)s."
|
||||||
% {'name': seg[-1], 'new_name': new_seg[-1]})
|
% {'name': seg[-1], 'new_name': new_seg[-1]})
|
||||||
lun_move = NaElement("lun-move")
|
lun_move = NaElement("lun-move")
|
||||||
lun_move.add_new_child("path", path)
|
lun_move.add_new_child("path", path)
|
||||||
@ -726,7 +726,7 @@ class NetAppDirectISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
def _get_lun_block_count(self, path):
|
def _get_lun_block_count(self, path):
|
||||||
"""Gets block counts for the lun."""
|
"""Gets block counts for the lun."""
|
||||||
LOG.debug(_("Getting lun block count."))
|
LOG.debug("Getting lun block count.")
|
||||||
block_count = 0
|
block_count = 0
|
||||||
lun_infos = self._get_lun_by_args(path=path)
|
lun_infos = self._get_lun_by_args(path=path)
|
||||||
if not lun_infos:
|
if not lun_infos:
|
||||||
@ -838,7 +838,7 @@ class NetAppDirectCmodeISCSIDriver(NetAppDirectISCSIDriver):
|
|||||||
attr_list = result.get_child_by_name('attributes-list')
|
attr_list = result.get_child_by_name('attributes-list')
|
||||||
iscsi_service = attr_list.get_child_by_name('iscsi-service-info')
|
iscsi_service = attr_list.get_child_by_name('iscsi-service-info')
|
||||||
return iscsi_service.get_child_content('node-name')
|
return iscsi_service.get_child_content('node-name')
|
||||||
LOG.debug(_('No iscsi service found for vserver %s') % (self.vserver))
|
LOG.debug('No iscsi service found for vserver %s' % (self.vserver))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _create_lun_handle(self, metadata):
|
def _create_lun_handle(self, metadata):
|
||||||
@ -1005,7 +1005,7 @@ class NetAppDirectCmodeISCSIDriver(NetAppDirectISCSIDriver):
|
|||||||
dest_block += int(block_count)
|
dest_block += int(block_count)
|
||||||
clone_create.add_child_elem(block_ranges)
|
clone_create.add_child_elem(block_ranges)
|
||||||
self.client.invoke_successfully(clone_create, True)
|
self.client.invoke_successfully(clone_create, True)
|
||||||
LOG.debug(_("Cloned LUN with new name %s") % new_name)
|
LOG.debug("Cloned LUN with new name %s" % new_name)
|
||||||
lun = self._get_lun_by_args(vserver=self.vserver, path='/vol/%s/%s'
|
lun = self._get_lun_by_args(vserver=self.vserver, path='/vol/%s/%s'
|
||||||
% (volume, new_name))
|
% (volume, new_name))
|
||||||
if len(lun) == 0:
|
if len(lun) == 0:
|
||||||
@ -1055,7 +1055,7 @@ class NetAppDirectCmodeISCSIDriver(NetAppDirectISCSIDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
netapp_backend = 'NetApp_iSCSI_Cluster_direct'
|
netapp_backend = 'NetApp_iSCSI_Cluster_direct'
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
@ -1440,11 +1440,11 @@ class NetAppDirect7modeISCSIDriver(NetAppDirectISCSIDriver):
|
|||||||
fmt = {'name': name, 'new_name': new_name}
|
fmt = {'name': name, 'new_name': new_name}
|
||||||
if clone_ops_info.get_child_content('clone-state')\
|
if clone_ops_info.get_child_content('clone-state')\
|
||||||
== 'completed':
|
== 'completed':
|
||||||
LOG.debug(_("Clone operation with src %(name)s"
|
LOG.debug("Clone operation with src %(name)s"
|
||||||
" and dest %(new_name)s completed") % fmt)
|
" and dest %(new_name)s completed" % fmt)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Clone operation with src %(name)s"
|
LOG.debug("Clone operation with src %(name)s"
|
||||||
" and dest %(new_name)s failed") % fmt)
|
" and dest %(new_name)s failed" % fmt)
|
||||||
raise NaApiError(
|
raise NaApiError(
|
||||||
clone_ops_info.get_child_content('error'),
|
clone_ops_info.get_child_content('error'),
|
||||||
clone_ops_info.get_child_content('reason'))
|
clone_ops_info.get_child_content('reason'))
|
||||||
@ -1469,7 +1469,7 @@ class NetAppDirect7modeISCSIDriver(NetAppDirectISCSIDriver):
|
|||||||
|
|
||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve status info from volume group."""
|
"""Retrieve status info from volume group."""
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
netapp_backend = 'NetApp_iSCSI_7mode_direct'
|
netapp_backend = 'NetApp_iSCSI_7mode_direct'
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
|
@ -250,8 +250,8 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
file_name = 'img-cache-%s' % image_id
|
file_name = 'img-cache-%s' % image_id
|
||||||
file_path = '%s/%s' % (dir, file_name)
|
file_path = '%s/%s' % (dir, file_name)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
LOG.debug(_('Found cache file for image %(image_id)s'
|
LOG.debug('Found cache file for image %(image_id)s'
|
||||||
' on share %(share)s')
|
' on share %(share)s'
|
||||||
% {'image_id': image_id, 'share': share})
|
% {'image_id': image_id, 'share': share})
|
||||||
result.append((share, file_name))
|
result.append((share, file_name))
|
||||||
return result
|
return result
|
||||||
@ -271,7 +271,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
def _spawn_clean_cache_job(self):
|
def _spawn_clean_cache_job(self):
|
||||||
"""Spawns a clean task if not running."""
|
"""Spawns a clean task if not running."""
|
||||||
if getattr(self, 'cleaning', None):
|
if getattr(self, 'cleaning', None):
|
||||||
LOG.debug(_('Image cache cleaning in progress. Returning... '))
|
LOG.debug('Image cache cleaning in progress. Returning... ')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
#set cleaning to True
|
#set cleaning to True
|
||||||
@ -282,7 +282,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
def _clean_image_cache(self):
|
def _clean_image_cache(self):
|
||||||
"""Clean the image cache files in cache of space crunch."""
|
"""Clean the image cache files in cache of space crunch."""
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Image cache cleaning in progress.'))
|
LOG.debug('Image cache cleaning in progress.')
|
||||||
thres_size_perc_start =\
|
thres_size_perc_start =\
|
||||||
self.configuration.thres_avl_size_perc_start
|
self.configuration.thres_avl_size_perc_start
|
||||||
thres_size_perc_stop =\
|
thres_size_perc_stop =\
|
||||||
@ -298,7 +298,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
threshold_size = int(
|
threshold_size = int(
|
||||||
(thres_size_perc_stop * total_size) / 100)
|
(thres_size_perc_stop * total_size) / 100)
|
||||||
bytes_to_free = int(threshold_size - total_avl)
|
bytes_to_free = int(threshold_size - total_avl)
|
||||||
LOG.debug(_('Files to be queued for deletion %s'),
|
LOG.debug('Files to be queued for deletion %s',
|
||||||
eligible_files)
|
eligible_files)
|
||||||
self._delete_files_till_bytes_free(
|
self._delete_files_till_bytes_free(
|
||||||
eligible_files, share, bytes_to_free)
|
eligible_files, share, bytes_to_free)
|
||||||
@ -311,7 +311,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
% {'share': share, 'ex': e.__str__()})
|
% {'share': share, 'ex': e.__str__()})
|
||||||
continue
|
continue
|
||||||
finally:
|
finally:
|
||||||
LOG.debug(_('Image cache cleaning done.'))
|
LOG.debug('Image cache cleaning done.')
|
||||||
self.cleaning = False
|
self.cleaning = False
|
||||||
|
|
||||||
def _shortlist_del_eligible_files(self, share, old_files):
|
def _shortlist_del_eligible_files(self, share, old_files):
|
||||||
@ -336,14 +336,14 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
|
|
||||||
def _delete_files_till_bytes_free(self, file_list, share, bytes_to_free=0):
|
def _delete_files_till_bytes_free(self, file_list, share, bytes_to_free=0):
|
||||||
"""Delete files from disk till bytes are freed or list exhausted."""
|
"""Delete files from disk till bytes are freed or list exhausted."""
|
||||||
LOG.debug(_('Bytes to free %s'), bytes_to_free)
|
LOG.debug('Bytes to free %s', bytes_to_free)
|
||||||
if file_list and bytes_to_free > 0:
|
if file_list and bytes_to_free > 0:
|
||||||
sorted_files = sorted(file_list, key=lambda x: x[1], reverse=True)
|
sorted_files = sorted(file_list, key=lambda x: x[1], reverse=True)
|
||||||
mount_fs = self._get_mount_point_for_share(share)
|
mount_fs = self._get_mount_point_for_share(share)
|
||||||
for f in sorted_files:
|
for f in sorted_files:
|
||||||
if f:
|
if f:
|
||||||
file_path = '%s/%s' % (mount_fs, f[0])
|
file_path = '%s/%s' % (mount_fs, f[0])
|
||||||
LOG.debug(_('Delete file path %s'), file_path)
|
LOG.debug('Delete file path %s', file_path)
|
||||||
|
|
||||||
@utils.synchronized(f[0], external=True)
|
@utils.synchronized(f[0], external=True)
|
||||||
def _do_delete():
|
def _do_delete():
|
||||||
@ -358,7 +358,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
def _delete_file(self, path):
|
def _delete_file(self, path):
|
||||||
"""Delete file from disk and return result as boolean."""
|
"""Delete file from disk and return result as boolean."""
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Deleting file at path %s'), path)
|
LOG.debug('Deleting file at path %s', path)
|
||||||
cmd = ['rm', '-f', path]
|
cmd = ['rm', '-f', path]
|
||||||
self._execute(*cmd, run_as_root=True)
|
self._execute(*cmd, run_as_root=True)
|
||||||
return True
|
return True
|
||||||
@ -415,7 +415,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
for res in cache_result:
|
for res in cache_result:
|
||||||
# Repeat tries in other shares if failed in some
|
# Repeat tries in other shares if failed in some
|
||||||
(share, file_name) = res
|
(share, file_name) = res
|
||||||
LOG.debug(_('Cache share: %s'), share)
|
LOG.debug('Cache share: %s', share)
|
||||||
if (share and
|
if (share and
|
||||||
self._is_share_vol_compatible(volume, share)):
|
self._is_share_vol_compatible(volume, share)):
|
||||||
try:
|
try:
|
||||||
@ -436,14 +436,14 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
image_location = self._construct_image_nfs_url(image_location)
|
image_location = self._construct_image_nfs_url(image_location)
|
||||||
share = self._is_cloneable_share(image_location)
|
share = self._is_cloneable_share(image_location)
|
||||||
if share and self._is_share_vol_compatible(volume, share):
|
if share and self._is_share_vol_compatible(volume, share):
|
||||||
LOG.debug(_('Share is cloneable %s'), share)
|
LOG.debug('Share is cloneable %s', share)
|
||||||
volume['provider_location'] = share
|
volume['provider_location'] = share
|
||||||
(__, ___, img_file) = image_location.rpartition('/')
|
(__, ___, img_file) = image_location.rpartition('/')
|
||||||
dir_path = self._get_mount_point_for_share(share)
|
dir_path = self._get_mount_point_for_share(share)
|
||||||
img_path = '%s/%s' % (dir_path, img_file)
|
img_path = '%s/%s' % (dir_path, img_file)
|
||||||
img_info = image_utils.qemu_img_info(img_path)
|
img_info = image_utils.qemu_img_info(img_path)
|
||||||
if img_info.file_format == 'raw':
|
if img_info.file_format == 'raw':
|
||||||
LOG.debug(_('Image is raw %s'), image_id)
|
LOG.debug('Image is raw %s', image_id)
|
||||||
self._clone_volume(
|
self._clone_volume(
|
||||||
img_file, volume['name'],
|
img_file, volume['name'],
|
||||||
volume_id=None, share=share)
|
volume_id=None, share=share)
|
||||||
@ -478,7 +478,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
|
|
||||||
def _resize_image_file(self, path, new_size):
|
def _resize_image_file(self, path, new_size):
|
||||||
"""Resize the image file on share to new size."""
|
"""Resize the image file on share to new size."""
|
||||||
LOG.debug(_('Checking file for resize'))
|
LOG.debug('Checking file for resize')
|
||||||
if self._is_file_size_equal(path, new_size):
|
if self._is_file_size_equal(path, new_size):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@ -536,8 +536,8 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
'*(/[^\/\\\\]+)$)')
|
'*(/[^\/\\\\]+)$)')
|
||||||
matched = re.match(nfs_loc_pattern, image_location, flags=0)
|
matched = re.match(nfs_loc_pattern, image_location, flags=0)
|
||||||
if not matched:
|
if not matched:
|
||||||
LOG.debug(_('Image location not in the'
|
LOG.debug('Image location not in the'
|
||||||
' expected format %s'), image_location)
|
' expected format %s', image_location)
|
||||||
else:
|
else:
|
||||||
conn = matched.group(2)
|
conn = matched.group(2)
|
||||||
dr = matched.group(3) or '/'
|
dr = matched.group(3) or '/'
|
||||||
@ -564,7 +564,7 @@ class NetAppNFSDriver(nfs.NfsDriver):
|
|||||||
if sh_exp == dir:
|
if sh_exp == dir:
|
||||||
share_candidates.append(sh)
|
share_candidates.append(sh)
|
||||||
if share_candidates:
|
if share_candidates:
|
||||||
LOG.debug(_('Found possible share matches %s'),
|
LOG.debug('Found possible share matches %s',
|
||||||
share_candidates)
|
share_candidates)
|
||||||
return self._share_match_for_ip(ip, share_candidates)
|
return self._share_match_for_ip(ip, share_candidates)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -1030,17 +1030,17 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
path = '/vol/%s/%s' % (exp_volume, file)
|
path = '/vol/%s/%s' % (exp_volume, file)
|
||||||
u_bytes = self._get_cluster_file_usage(path, vserver)
|
u_bytes = self._get_cluster_file_usage(path, vserver)
|
||||||
file_list.append((file, u_bytes))
|
file_list.append((file, u_bytes))
|
||||||
LOG.debug(_('Shortlisted del elg files %s'), file_list)
|
LOG.debug('Shortlisted del elg files %s', file_list)
|
||||||
return file_list
|
return file_list
|
||||||
|
|
||||||
def _get_cluster_file_usage(self, path, vserver):
|
def _get_cluster_file_usage(self, path, vserver):
|
||||||
"""Gets the file unique bytes."""
|
"""Gets the file unique bytes."""
|
||||||
LOG.debug(_('Getting file usage for %s'), path)
|
LOG.debug('Getting file usage for %s', path)
|
||||||
file_use = NaElement.create_node_with_children(
|
file_use = NaElement.create_node_with_children(
|
||||||
'file-usage-get', **{'path': path})
|
'file-usage-get', **{'path': path})
|
||||||
res = self._invoke_successfully(file_use, vserver)
|
res = self._invoke_successfully(file_use, vserver)
|
||||||
bytes = res.get_child_content('unique-bytes')
|
bytes = res.get_child_content('unique-bytes')
|
||||||
LOG.debug(_('file-usage for path %(path)s is %(bytes)s')
|
LOG.debug('file-usage for path %(path)s is %(bytes)s'
|
||||||
% {'path': path, 'bytes': bytes})
|
% {'path': path, 'bytes': bytes})
|
||||||
return bytes
|
return bytes
|
||||||
|
|
||||||
@ -1057,9 +1057,9 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
ip_sh = share.split(':')[0]
|
ip_sh = share.split(':')[0]
|
||||||
sh_vserver = self._get_vserver_for_ip(ip_sh)
|
sh_vserver = self._get_vserver_for_ip(ip_sh)
|
||||||
if sh_vserver == ip_vserver:
|
if sh_vserver == ip_vserver:
|
||||||
LOG.debug(_('Share match found for ip %s'), ip)
|
LOG.debug('Share match found for ip %s', ip)
|
||||||
return share
|
return share
|
||||||
LOG.debug(_('No share match found for ip %s'), ip)
|
LOG.debug('No share match found for ip %s', ip)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_vserver_for_ip(self, ip):
|
def _get_vserver_for_ip(self, ip):
|
||||||
@ -1090,7 +1090,7 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
def _is_share_vol_type_match(self, volume, share):
|
def _is_share_vol_type_match(self, volume, share):
|
||||||
"""Checks if share matches volume type."""
|
"""Checks if share matches volume type."""
|
||||||
netapp_vol = self._get_vol_for_share(share)
|
netapp_vol = self._get_vol_for_share(share)
|
||||||
LOG.debug(_("Found volume %(vol)s for share %(share)s.")
|
LOG.debug("Found volume %(vol)s for share %(share)s."
|
||||||
% {'vol': netapp_vol, 'share': share})
|
% {'vol': netapp_vol, 'share': share})
|
||||||
extra_specs = get_volume_extra_specs(volume)
|
extra_specs = get_volume_extra_specs(volume)
|
||||||
vols = ssc_utils.get_volumes_for_specs(self.ssc_vols, extra_specs)
|
vols = ssc_utils.get_volumes_for_specs(self.ssc_vols, extra_specs)
|
||||||
@ -1127,8 +1127,8 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
' offload workflow.')
|
' offload workflow.')
|
||||||
% {'img': image_id, 'vol': volume['id']})
|
% {'img': image_id, 'vol': volume['id']})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Copy offload either not configured or"
|
LOG.debug("Copy offload either not configured or"
|
||||||
" unsupported."))
|
" unsupported.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception(_('Copy offload workflow unsuccessful. %s'), e)
|
LOG.exception(_('Copy offload workflow unsuccessful. %s'), e)
|
||||||
finally:
|
finally:
|
||||||
@ -1159,12 +1159,12 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
|
|
||||||
def _copy_from_cache(self, volume, image_id, cache_result):
|
def _copy_from_cache(self, volume, image_id, cache_result):
|
||||||
"""Try copying image file_name from cached file_name."""
|
"""Try copying image file_name from cached file_name."""
|
||||||
LOG.debug(_("Trying copy from cache using copy offload."))
|
LOG.debug("Trying copy from cache using copy offload.")
|
||||||
copied = False
|
copied = False
|
||||||
for res in cache_result:
|
for res in cache_result:
|
||||||
try:
|
try:
|
||||||
(share, file_name) = res
|
(share, file_name) = res
|
||||||
LOG.debug(_("Found cache file_name on share %s."), share)
|
LOG.debug("Found cache file_name on share %s.", share)
|
||||||
if share != self._get_provider_location(volume['id']):
|
if share != self._get_provider_location(volume['id']):
|
||||||
col_path = self.configuration.netapp_copyoffload_tool_path
|
col_path = self.configuration.netapp_copyoffload_tool_path
|
||||||
src_ip = self._get_ip_verify_on_cluster(
|
src_ip = self._get_ip_verify_on_cluster(
|
||||||
@ -1178,14 +1178,14 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
src_path, dst_path, run_as_root=False,
|
src_path, dst_path, run_as_root=False,
|
||||||
check_exit_code=0)
|
check_exit_code=0)
|
||||||
self._register_image_in_cache(volume, image_id)
|
self._register_image_in_cache(volume, image_id)
|
||||||
LOG.debug(_("Copied image from cache to volume %s using"
|
LOG.debug("Copied image from cache to volume %s using"
|
||||||
" copy offload."), volume['id'])
|
" copy offload.", volume['id'])
|
||||||
else:
|
else:
|
||||||
self._clone_file_dst_exists(share, file_name,
|
self._clone_file_dst_exists(share, file_name,
|
||||||
volume['name'],
|
volume['name'],
|
||||||
dest_exists=True)
|
dest_exists=True)
|
||||||
LOG.debug(_("Copied image from cache to volume %s using"
|
LOG.debug("Copied image from cache to volume %s using"
|
||||||
" cloning."), volume['id'])
|
" cloning.", volume['id'])
|
||||||
self._post_clone_image(volume)
|
self._post_clone_image(volume)
|
||||||
copied = True
|
copied = True
|
||||||
break
|
break
|
||||||
@ -1203,7 +1203,7 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
def _copy_from_img_service(self, context, volume, image_service,
|
def _copy_from_img_service(self, context, volume, image_service,
|
||||||
image_id):
|
image_id):
|
||||||
"""Copies from the image service using copy offload."""
|
"""Copies from the image service using copy offload."""
|
||||||
LOG.debug(_("Trying copy from image service using copy offload."))
|
LOG.debug("Trying copy from image service using copy offload.")
|
||||||
image_loc = image_service.get_location(context, image_id)
|
image_loc = image_service.get_location(context, image_id)
|
||||||
image_loc = self._construct_image_nfs_url(image_loc)
|
image_loc = self._construct_image_nfs_url(image_loc)
|
||||||
conn, dr = self._check_get_nfs_path_segs(image_loc)
|
conn, dr = self._check_get_nfs_path_segs(image_loc)
|
||||||
@ -1236,19 +1236,19 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
else:
|
else:
|
||||||
self._clone_file_dst_exists(dst_share, img_file, tmp_img_file)
|
self._clone_file_dst_exists(dst_share, img_file, tmp_img_file)
|
||||||
self._discover_file_till_timeout(dst_img_local, timeout=120)
|
self._discover_file_till_timeout(dst_img_local, timeout=120)
|
||||||
LOG.debug(_('Copied image %(img)s to tmp file %(tmp)s.')
|
LOG.debug('Copied image %(img)s to tmp file %(tmp)s.'
|
||||||
% {'img': image_id, 'tmp': tmp_img_file})
|
% {'img': image_id, 'tmp': tmp_img_file})
|
||||||
dst_img_cache_local = os.path.join(dst_dir,
|
dst_img_cache_local = os.path.join(dst_dir,
|
||||||
'img-cache-%s' % (image_id))
|
'img-cache-%s' % (image_id))
|
||||||
if img_info['disk_format'] == 'raw':
|
if img_info['disk_format'] == 'raw':
|
||||||
LOG.debug(_('Image is raw %s.'), image_id)
|
LOG.debug('Image is raw %s.', image_id)
|
||||||
self._clone_file_dst_exists(dst_share, tmp_img_file,
|
self._clone_file_dst_exists(dst_share, tmp_img_file,
|
||||||
volume['name'], dest_exists=True)
|
volume['name'], dest_exists=True)
|
||||||
self._move_nfs_file(dst_img_local, dst_img_cache_local)
|
self._move_nfs_file(dst_img_local, dst_img_cache_local)
|
||||||
LOG.debug(_('Copied raw image %(img)s to volume %(vol)s.')
|
LOG.debug('Copied raw image %(img)s to volume %(vol)s.'
|
||||||
% {'img': image_id, 'vol': volume['id']})
|
% {'img': image_id, 'vol': volume['id']})
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('Image will be converted to raw %s.'), image_id)
|
LOG.debug('Image will be converted to raw %s.', image_id)
|
||||||
img_conv = str(uuid.uuid4())
|
img_conv = str(uuid.uuid4())
|
||||||
dst_img_conv_local = os.path.join(dst_dir, img_conv)
|
dst_img_conv_local = os.path.join(dst_dir, img_conv)
|
||||||
|
|
||||||
@ -1268,8 +1268,8 @@ class NetAppDirectCmodeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
dest_exists=True)
|
dest_exists=True)
|
||||||
self._move_nfs_file(dst_img_conv_local,
|
self._move_nfs_file(dst_img_conv_local,
|
||||||
dst_img_cache_local)
|
dst_img_cache_local)
|
||||||
LOG.debug(_('Copied locally converted raw image'
|
LOG.debug('Copied locally converted raw image'
|
||||||
' %(img)s to volume %(vol)s.')
|
' %(img)s to volume %(vol)s.'
|
||||||
% {'img': image_id, 'vol': volume['id']})
|
% {'img': image_id, 'vol': volume['id']})
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(dst_img_conv_local):
|
if os.path.exists(dst_img_conv_local):
|
||||||
@ -1356,7 +1356,7 @@ class NetAppDirect7modeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
msg_fmt = {'src_path': src_path, 'dest_path': dest_path}
|
msg_fmt = {'src_path': src_path, 'dest_path': dest_path}
|
||||||
LOG.debug(_("""Cloning with src %(src_path)s, dest %(dest_path)s""")
|
LOG.debug("""Cloning with src %(src_path)s, dest %(dest_path)s"""
|
||||||
% msg_fmt)
|
% msg_fmt)
|
||||||
clone_start = NaElement.create_node_with_children(
|
clone_start = NaElement.create_node_with_children(
|
||||||
'clone-start',
|
'clone-start',
|
||||||
@ -1438,17 +1438,17 @@ class NetAppDirect7modeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
path = '/vol/%s/%s' % (exp_volume, file)
|
path = '/vol/%s/%s' % (exp_volume, file)
|
||||||
u_bytes = self._get_filer_file_usage(path)
|
u_bytes = self._get_filer_file_usage(path)
|
||||||
file_list.append((file, u_bytes))
|
file_list.append((file, u_bytes))
|
||||||
LOG.debug(_('Shortlisted del elg files %s'), file_list)
|
LOG.debug('Shortlisted del elg files %s', file_list)
|
||||||
return file_list
|
return file_list
|
||||||
|
|
||||||
def _get_filer_file_usage(self, path):
|
def _get_filer_file_usage(self, path):
|
||||||
"""Gets the file unique bytes."""
|
"""Gets the file unique bytes."""
|
||||||
LOG.debug(_('Getting file usage for %s'), path)
|
LOG.debug('Getting file usage for %s', path)
|
||||||
file_use = NaElement.create_node_with_children(
|
file_use = NaElement.create_node_with_children(
|
||||||
'file-usage-get', **{'path': path})
|
'file-usage-get', **{'path': path})
|
||||||
res = self._invoke_successfully(file_use)
|
res = self._invoke_successfully(file_use)
|
||||||
bytes = res.get_child_content('unique-bytes')
|
bytes = res.get_child_content('unique-bytes')
|
||||||
LOG.debug(_('file-usage for path %(path)s is %(bytes)s')
|
LOG.debug('file-usage for path %(path)s is %(bytes)s'
|
||||||
% {'path': path, 'bytes': bytes})
|
% {'path': path, 'bytes': bytes})
|
||||||
return bytes
|
return bytes
|
||||||
|
|
||||||
@ -1485,9 +1485,9 @@ class NetAppDirect7modeNfsDriver (NetAppDirectNfsDriver):
|
|||||||
for share in shares:
|
for share in shares:
|
||||||
ip_sh = share.split(':')[0]
|
ip_sh = share.split(':')[0]
|
||||||
if self._is_filer_ip(ip_sh):
|
if self._is_filer_ip(ip_sh):
|
||||||
LOG.debug(_('Share match found for ip %s'), ip)
|
LOG.debug('Share match found for ip %s', ip)
|
||||||
return share
|
return share
|
||||||
LOG.debug(_('No share match found for ip %s'), ip)
|
LOG.debug('No share match found for ip %s', ip)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _is_share_vol_compatible(self, volume, share):
|
def _is_share_vol_compatible(self, volume, share):
|
||||||
|
@ -238,8 +238,8 @@ def create_vol_list(vol_attrs):
|
|||||||
vol.qos['qos_policy_group'] = None
|
vol.qos['qos_policy_group'] = None
|
||||||
vols.add(vol)
|
vols.add(vol)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
LOG.debug(_('Unexpected error while creating'
|
LOG.debug('Unexpected error while creating'
|
||||||
' ssc vol list. Message - %s') % (e.message))
|
' ssc vol list. Message - %s' % (e.message))
|
||||||
continue
|
continue
|
||||||
return vols
|
return vols
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ def query_aggr_options(na_server, aggr_name):
|
|||||||
if op.get_child_content('name') == 'raidtype':
|
if op.get_child_content('name') == 'raidtype':
|
||||||
attrs['raid_type'] = op.get_child_content('value')
|
attrs['raid_type'] = op.get_child_content('value')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(_("Exception querying aggr options. %s"), e)
|
LOG.debug("Exception querying aggr options. %s", e)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ def get_sis_vol_dict(na_server, vserver, volume=None):
|
|||||||
sis.get_child_content('state'))
|
sis.get_child_content('state'))
|
||||||
sis_vols[vol] = v_sis
|
sis_vols[vol] = v_sis
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(_("Exception querying sis information. %s"), e)
|
LOG.debug("Exception querying sis information. %s", e)
|
||||||
return sis_vols
|
return sis_vols
|
||||||
|
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ def get_snapmirror_vol_dict(na_server, vserver, volume=None):
|
|||||||
else:
|
else:
|
||||||
mirrored_vols[src_volume] = [v_snap]
|
mirrored_vols[src_volume] = [v_snap]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(_("Exception querying mirror information. %s"), e)
|
LOG.debug("Exception querying mirror information. %s", e)
|
||||||
return mirrored_vols
|
return mirrored_vols
|
||||||
|
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ def query_aggr_storage_disk(na_server, aggr):
|
|||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(_("Exception querying storage disk. %s"), e)
|
LOG.debug("Exception querying storage disk. %s", e)
|
||||||
return 'unknown'
|
return 'unknown'
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ def provide_ems(requester, server, stats, netapp_backend,
|
|||||||
else:
|
else:
|
||||||
na_server.set_vfiler(None)
|
na_server.set_vfiler(None)
|
||||||
na_server.invoke_successfully(ems, True)
|
na_server.invoke_successfully(ems, True)
|
||||||
LOG.debug(_("ems executed successfully."))
|
LOG.debug("ems executed successfully.")
|
||||||
except NaApiError as e:
|
except NaApiError as e:
|
||||||
LOG.warn(_("Failed to invoke ems. Message : %s") % e)
|
LOG.warn(_("Failed to invoke ems. Message : %s") % e)
|
||||||
finally:
|
finally:
|
||||||
|
@ -188,8 +188,8 @@ class NexentaISCSIDriver(driver.ISCSIDriver): # pylint: disable=R0921
|
|||||||
"""
|
"""
|
||||||
snapshot = {'volume_name': src_vref['name'],
|
snapshot = {'volume_name': src_vref['name'],
|
||||||
'name': self._get_clone_snapshot_name(volume)}
|
'name': self._get_clone_snapshot_name(volume)}
|
||||||
LOG.debug(_('Creating temp snapshot of the original volume: '
|
LOG.debug('Creating temp snapshot of the original volume: '
|
||||||
'%(volume_name)s@%(name)s'), snapshot)
|
'%(volume_name)s@%(name)s', snapshot)
|
||||||
# We don't delete this snapshot, because this snapshot will be origin
|
# We don't delete this snapshot, because this snapshot will be origin
|
||||||
# of new volume. This snapshot will be automatically promoted by NMS
|
# of new volume. This snapshot will be automatically promoted by NMS
|
||||||
# when user will delete origin volume. But when cloned volume deleted
|
# when user will delete origin volume. But when cloned volume deleted
|
||||||
@ -229,7 +229,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver): # pylint: disable=R0921
|
|||||||
:param volume: a dictionary describing the volume to migrate
|
:param volume: a dictionary describing the volume to migrate
|
||||||
:param host: a dictionary describing the host to migrate to
|
:param host: a dictionary describing the host to migrate to
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('Enter: migrate_volume: id=%(id)s, host=%(host)s') %
|
LOG.debug('Enter: migrate_volume: id=%(id)s, host=%(host)s' %
|
||||||
{'id': volume['id'], 'host': host})
|
{'id': volume['id'], 'host': host})
|
||||||
|
|
||||||
false_ret = (False, None)
|
false_ret = (False, None)
|
||||||
@ -572,7 +572,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver): # pylint: disable=R0921
|
|||||||
|
|
||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info for NexentaStor appliance."""
|
"""Retrieve stats info for NexentaStor appliance."""
|
||||||
LOG.debug(_('Updating volume stats'))
|
LOG.debug('Updating volume stats')
|
||||||
|
|
||||||
stats = self.nms.volume.get_child_props(
|
stats = self.nms.volume.get_child_props(
|
||||||
self.configuration.nexenta_volume, 'health|size|used|available')
|
self.configuration.nexenta_volume, 'health|size|used|available')
|
||||||
|
@ -80,7 +80,7 @@ class NexentaJSONProxy(object):
|
|||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Basic %s' % auth
|
'Authorization': 'Basic %s' % auth
|
||||||
}
|
}
|
||||||
LOG.debug(_('Sending JSON data: %s'), data)
|
LOG.debug('Sending JSON data: %s', data)
|
||||||
request = urllib2.Request(self.url, data, headers)
|
request = urllib2.Request(self.url, data, headers)
|
||||||
response_obj = urllib2.urlopen(request)
|
response_obj = urllib2.urlopen(request)
|
||||||
if response_obj.info().status == 'EOF in headers':
|
if response_obj.info().status == 'EOF in headers':
|
||||||
@ -93,7 +93,7 @@ class NexentaJSONProxy(object):
|
|||||||
response_obj = urllib2.urlopen(request)
|
response_obj = urllib2.urlopen(request)
|
||||||
|
|
||||||
response_data = response_obj.read()
|
response_data = response_obj.read()
|
||||||
LOG.debug(_('Got response: %s'), response_data)
|
LOG.debug('Got response: %s', response_data)
|
||||||
response = jsonutils.loads(response_data)
|
response = jsonutils.loads(response_data)
|
||||||
if response.get('error') is not None:
|
if response.get('error') is not None:
|
||||||
raise NexentaJSONException(response['error'].get('message', ''))
|
raise NexentaJSONException(response['error'].get('message', ''))
|
||||||
|
@ -111,7 +111,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
|
|||||||
|
|
||||||
vol, dataset = self._get_share_datasets(nfs_share)
|
vol, dataset = self._get_share_datasets(nfs_share)
|
||||||
folder = '%s/%s' % (dataset, volume['name'])
|
folder = '%s/%s' % (dataset, volume['name'])
|
||||||
LOG.debug(_('Creating folder on Nexenta Store %s'), folder)
|
LOG.debug('Creating folder on Nexenta Store %s', folder)
|
||||||
nms.folder.create_with_props(
|
nms.folder.create_with_props(
|
||||||
vol, folder,
|
vol, folder,
|
||||||
{'compression': self.configuration.nexenta_volume_compression}
|
{'compression': self.configuration.nexenta_volume_compression}
|
||||||
@ -362,7 +362,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
|
|||||||
'recursive': 'true',
|
'recursive': 'true',
|
||||||
'anonymous_rw': 'true',
|
'anonymous_rw': 'true',
|
||||||
}
|
}
|
||||||
LOG.debug(_('Sharing folder %s on Nexenta Store'), folder)
|
LOG.debug('Sharing folder %s on Nexenta Store', folder)
|
||||||
nms.netstorsvc.share_folder('svc:/network/nfs/server:default', path,
|
nms.netstorsvc.share_folder('svc:/network/nfs/server:default', path,
|
||||||
share_opts)
|
share_opts)
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
|
|||||||
self.shares[share_address] = share_opts
|
self.shares[share_address] = share_opts
|
||||||
self.share2nms[share_address] = self._get_nms_for_url(nms_url)
|
self.share2nms[share_address] = self._get_nms_for_url(nms_url)
|
||||||
|
|
||||||
LOG.debug(_('Shares loaded: %s') % self.shares)
|
LOG.debug('Shares loaded: %s' % self.shares)
|
||||||
|
|
||||||
def _get_capacity_info(self, nfs_share):
|
def _get_capacity_info(self, nfs_share):
|
||||||
"""Calculate available space on the NFS share.
|
"""Calculate available space on the NFS share.
|
||||||
|
@ -125,8 +125,8 @@ class RemoteFsDriver(driver.VolumeDriver):
|
|||||||
raising exception to continue working for cases
|
raising exception to continue working for cases
|
||||||
when not used with brick.
|
when not used with brick.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Driver specific implementation needs to return"
|
LOG.debug("Driver specific implementation needs to return"
|
||||||
" mount_point_base."))
|
" mount_point_base.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
@ -501,7 +501,7 @@ class NfsDriver(RemoteFsDriver):
|
|||||||
raise exception.NfsNoSuitableShareFound(
|
raise exception.NfsNoSuitableShareFound(
|
||||||
volume_size=volume_size_in_gib)
|
volume_size=volume_size_in_gib)
|
||||||
|
|
||||||
LOG.debug(_('Selected %s as target nfs share.'), target_share)
|
LOG.debug('Selected %s as target nfs share.', target_share)
|
||||||
|
|
||||||
return target_share
|
return target_share
|
||||||
|
|
||||||
@ -534,13 +534,13 @@ class NfsDriver(RemoteFsDriver):
|
|||||||
# available space but be within our oversubscription limit
|
# available space but be within our oversubscription limit
|
||||||
# therefore allowing this share to still be selected as a valid
|
# therefore allowing this share to still be selected as a valid
|
||||||
# target.
|
# target.
|
||||||
LOG.debug(_('%s is above nfs_used_ratio'), nfs_share)
|
LOG.debug('%s is above nfs_used_ratio', nfs_share)
|
||||||
return False
|
return False
|
||||||
if apparent_available <= requested_volume_size:
|
if apparent_available <= requested_volume_size:
|
||||||
LOG.debug(_('%s is above nfs_oversub_ratio'), nfs_share)
|
LOG.debug('%s is above nfs_oversub_ratio', nfs_share)
|
||||||
return False
|
return False
|
||||||
if total_allocated / total_size >= oversub_ratio:
|
if total_allocated / total_size >= oversub_ratio:
|
||||||
LOG.debug(_('%s reserved space is above nfs_oversub_ratio'),
|
LOG.debug('%s reserved space is above nfs_oversub_ratio',
|
||||||
nfs_share)
|
nfs_share)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -415,8 +415,8 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
# flatten the source before cloning. Zero rbd_max_clone_depth means
|
# flatten the source before cloning. Zero rbd_max_clone_depth means
|
||||||
# infinite is allowed.
|
# infinite is allowed.
|
||||||
if depth == CONF.rbd_max_clone_depth:
|
if depth == CONF.rbd_max_clone_depth:
|
||||||
LOG.debug(_("maximum clone depth (%d) has been reached - "
|
LOG.debug("maximum clone depth (%d) has been reached - "
|
||||||
"flattening source volume") %
|
"flattening source volume" %
|
||||||
(CONF.rbd_max_clone_depth))
|
(CONF.rbd_max_clone_depth))
|
||||||
flatten_parent = True
|
flatten_parent = True
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
pool, parent, snap = self._get_clone_info(src_volume,
|
pool, parent, snap = self._get_clone_info(src_volume,
|
||||||
src_name)
|
src_name)
|
||||||
# Flatten source volume
|
# Flatten source volume
|
||||||
LOG.debug(_("flattening source volume %s") % (src_name))
|
LOG.debug("flattening source volume %s" % (src_name))
|
||||||
src_volume.flatten()
|
src_volume.flatten()
|
||||||
# Delete parent clone snap
|
# Delete parent clone snap
|
||||||
parent_volume = self.rbd.Image(client.ioctx, parent)
|
parent_volume = self.rbd.Image(client.ioctx, parent)
|
||||||
@ -439,7 +439,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
|
|
||||||
# Create new snapshot of source volume
|
# Create new snapshot of source volume
|
||||||
clone_snap = "%s.clone_snap" % dest_name
|
clone_snap = "%s.clone_snap" % dest_name
|
||||||
LOG.debug(_("creating snapshot='%s'") % (clone_snap))
|
LOG.debug("creating snapshot='%s'" % (clone_snap))
|
||||||
src_volume.create_snap(clone_snap)
|
src_volume.create_snap(clone_snap)
|
||||||
src_volume.protect_snap(clone_snap)
|
src_volume.protect_snap(clone_snap)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@ -449,8 +449,8 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
|
|
||||||
# Now clone source volume snapshot
|
# Now clone source volume snapshot
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("cloning '%(src_vol)s@%(src_snap)s' to "
|
LOG.debug("cloning '%(src_vol)s@%(src_snap)s' to "
|
||||||
"'%(dest)s'") %
|
"'%(dest)s'" %
|
||||||
{'src_vol': src_name, 'src_snap': clone_snap,
|
{'src_vol': src_name, 'src_snap': clone_snap,
|
||||||
'dest': dest_name})
|
'dest': dest_name})
|
||||||
self.rbd.RBD().clone(client.ioctx, src_name, clone_snap,
|
self.rbd.RBD().clone(client.ioctx, src_name, clone_snap,
|
||||||
@ -463,7 +463,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
finally:
|
finally:
|
||||||
src_volume.close()
|
src_volume.close()
|
||||||
|
|
||||||
LOG.debug(_("clone created successfully"))
|
LOG.debug("clone created successfully")
|
||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
"""Creates a logical volume."""
|
"""Creates a logical volume."""
|
||||||
@ -472,7 +472,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
else:
|
else:
|
||||||
size = int(volume['size']) * units.GiB
|
size = int(volume['size']) * units.GiB
|
||||||
|
|
||||||
LOG.debug(_("creating volume '%s'") % (volume['name']))
|
LOG.debug("creating volume '%s'" % (volume['name']))
|
||||||
|
|
||||||
old_format = True
|
old_format = True
|
||||||
features = 0
|
features = 0
|
||||||
@ -491,13 +491,13 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
features=features)
|
features=features)
|
||||||
|
|
||||||
def _flatten(self, pool, volume_name):
|
def _flatten(self, pool, volume_name):
|
||||||
LOG.debug(_('flattening %(pool)s/%(img)s') %
|
LOG.debug('flattening %(pool)s/%(img)s' %
|
||||||
dict(pool=pool, img=volume_name))
|
dict(pool=pool, img=volume_name))
|
||||||
with RBDVolumeProxy(self, volume_name, pool) as vol:
|
with RBDVolumeProxy(self, volume_name, pool) as vol:
|
||||||
vol.flatten()
|
vol.flatten()
|
||||||
|
|
||||||
def _clone(self, volume, src_pool, src_image, src_snap):
|
def _clone(self, volume, src_pool, src_image, src_snap):
|
||||||
LOG.debug(_('cloning %(pool)s/%(img)s@%(snap)s to %(dst)s') %
|
LOG.debug('cloning %(pool)s/%(img)s@%(snap)s to %(dst)s' %
|
||||||
dict(pool=src_pool, img=src_image, snap=src_snap,
|
dict(pool=src_pool, img=src_image, snap=src_snap,
|
||||||
dst=volume['name']))
|
dst=volume['name']))
|
||||||
with RADOSClient(self, src_pool) as src_client:
|
with RADOSClient(self, src_pool) as src_client:
|
||||||
@ -532,7 +532,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
for snap in backup_snaps:
|
for snap in backup_snaps:
|
||||||
rbd_image.remove_snap(snap['name'])
|
rbd_image.remove_snap(snap['name'])
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("volume has no backup snaps"))
|
LOG.debug("volume has no backup snaps")
|
||||||
|
|
||||||
def _get_clone_info(self, volume, volume_name, snap=None):
|
def _get_clone_info(self, volume, volume_name, snap=None):
|
||||||
"""If volume is a clone, return its parent info.
|
"""If volume is a clone, return its parent info.
|
||||||
@ -553,7 +553,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
if parent_snap == "%s.clone_snap" % volume_name:
|
if parent_snap == "%s.clone_snap" % volume_name:
|
||||||
return pool, parent, parent_snap
|
return pool, parent, parent_snap
|
||||||
except self.rbd.ImageNotFound:
|
except self.rbd.ImageNotFound:
|
||||||
LOG.debug(_("volume %s is not a clone") % volume_name)
|
LOG.debug("volume %s is not a clone" % volume_name)
|
||||||
volume.set_snap(None)
|
volume.set_snap(None)
|
||||||
|
|
||||||
return (None, None, None)
|
return (None, None, None)
|
||||||
@ -571,7 +571,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
parent_name,
|
parent_name,
|
||||||
parent_snap)
|
parent_snap)
|
||||||
|
|
||||||
LOG.debug(_("deleting parent snapshot %s") % (parent_snap))
|
LOG.debug("deleting parent snapshot %s" % (parent_snap))
|
||||||
parent_rbd.unprotect_snap(parent_snap)
|
parent_rbd.unprotect_snap(parent_snap)
|
||||||
parent_rbd.remove_snap(parent_snap)
|
parent_rbd.remove_snap(parent_snap)
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
# If parent has been deleted in Cinder, delete the silent reference and
|
# If parent has been deleted in Cinder, delete the silent reference and
|
||||||
# keep walking up the chain if it is itself a clone.
|
# keep walking up the chain if it is itself a clone.
|
||||||
if (not parent_has_snaps) and parent_name.endswith('.deleted'):
|
if (not parent_has_snaps) and parent_name.endswith('.deleted'):
|
||||||
LOG.debug(_("deleting parent %s") % (parent_name))
|
LOG.debug("deleting parent %s" % (parent_name))
|
||||||
self.rbd.RBD().remove(client.ioctx, parent_name)
|
self.rbd.RBD().remove(client.ioctx, parent_name)
|
||||||
|
|
||||||
# Now move up to grandparent if there is one
|
# Now move up to grandparent if there is one
|
||||||
@ -614,7 +614,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
snaps = rbd_image.list_snaps()
|
snaps = rbd_image.list_snaps()
|
||||||
for snap in snaps:
|
for snap in snaps:
|
||||||
if snap['name'].endswith('.clone_snap'):
|
if snap['name'].endswith('.clone_snap'):
|
||||||
LOG.debug(_("volume has clone snapshot(s)"))
|
LOG.debug("volume has clone snapshot(s)")
|
||||||
# We grab one of these and use it when fetching parent
|
# We grab one of these and use it when fetching parent
|
||||||
# info in case the volume has been flattened.
|
# info in case the volume has been flattened.
|
||||||
clone_snap = snap['name']
|
clone_snap = snap['name']
|
||||||
@ -630,7 +630,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
rbd_image.close()
|
rbd_image.close()
|
||||||
|
|
||||||
if clone_snap is None:
|
if clone_snap is None:
|
||||||
LOG.debug(_("deleting rbd volume %s") % (volume_name))
|
LOG.debug("deleting rbd volume %s" % (volume_name))
|
||||||
try:
|
try:
|
||||||
self.rbd.RBD().remove(client.ioctx, volume_name)
|
self.rbd.RBD().remove(client.ioctx, volume_name)
|
||||||
except self.rbd.ImageBusy:
|
except self.rbd.ImageBusy:
|
||||||
@ -647,7 +647,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
# If it is a clone, walk back up the parent chain deleting
|
# If it is a clone, walk back up the parent chain deleting
|
||||||
# references.
|
# references.
|
||||||
if parent:
|
if parent:
|
||||||
LOG.debug(_("volume is a clone so cleaning references"))
|
LOG.debug("volume is a clone so cleaning references")
|
||||||
self._delete_clone_parent_refs(client, parent, parent_snap)
|
self._delete_clone_parent_refs(client, parent, parent_snap)
|
||||||
else:
|
else:
|
||||||
# If the volume has copy-on-write clones we will not be able to
|
# If the volume has copy-on-write clones we will not be able to
|
||||||
@ -704,7 +704,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
'secret_type': 'ceph',
|
'secret_type': 'ceph',
|
||||||
'secret_uuid': self.configuration.rbd_secret_uuid, }
|
'secret_uuid': self.configuration.rbd_secret_uuid, }
|
||||||
}
|
}
|
||||||
LOG.debug(_('connection data: %s'), data)
|
LOG.debug('connection data: %s', data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
@ -732,7 +732,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
try:
|
try:
|
||||||
fsid, pool, image, snapshot = self._parse_location(image_location)
|
fsid, pool, image, snapshot = self._parse_location(image_location)
|
||||||
except exception.ImageUnacceptable as e:
|
except exception.ImageUnacceptable as e:
|
||||||
LOG.debug(_('not cloneable: %s'), e)
|
LOG.debug('not cloneable: %s', e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self._get_fsid() != fsid:
|
if self._get_fsid() != fsid:
|
||||||
@ -755,7 +755,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
read_only=True):
|
read_only=True):
|
||||||
return True
|
return True
|
||||||
except self.rbd.Error as e:
|
except self.rbd.Error as e:
|
||||||
LOG.debug(_('Unable to open image %(loc)s: %(err)s') %
|
LOG.debug('Unable to open image %(loc)s: %(err)s' %
|
||||||
dict(loc=image_location, err=e))
|
dict(loc=image_location, err=e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
rbd_fd = RBDImageIOWrapper(rbd_meta)
|
rbd_fd = RBDImageIOWrapper(rbd_meta)
|
||||||
backup_service.backup(backup, rbd_fd)
|
backup_service.backup(backup, rbd_fd)
|
||||||
|
|
||||||
LOG.debug(_("volume backup complete."))
|
LOG.debug("volume backup complete.")
|
||||||
|
|
||||||
def restore_backup(self, context, backup, volume, backup_service):
|
def restore_backup(self, context, backup, volume, backup_service):
|
||||||
"""Restore an existing backup to a new or existing volume."""
|
"""Restore an existing backup to a new or existing volume."""
|
||||||
@ -841,7 +841,7 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
rbd_fd = RBDImageIOWrapper(rbd_meta)
|
rbd_fd = RBDImageIOWrapper(rbd_meta)
|
||||||
backup_service.restore(backup, volume['id'], rbd_fd)
|
backup_service.restore(backup, volume['id'], rbd_fd)
|
||||||
|
|
||||||
LOG.debug(_("volume restore complete."))
|
LOG.debug("volume restore complete.")
|
||||||
|
|
||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
"""Extend an existing volume."""
|
"""Extend an existing volume."""
|
||||||
@ -856,5 +856,5 @@ class RBDDriver(driver.VolumeDriver):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_("Extend volume from %(old_size)s GB to %(new_size)s GB."),
|
LOG.debug("Extend volume from %(old_size)s GB to %(new_size)s GB.",
|
||||||
{'old_size': old_size, 'new_size': new_size})
|
{'old_size': old_size, 'new_size': new_size})
|
||||||
|
@ -260,8 +260,8 @@ class HP3PARCommon(object):
|
|||||||
volume_name = self._get_3par_vol_name(volume['id'])
|
volume_name = self._get_3par_vol_name(volume['id'])
|
||||||
old_size = volume['size']
|
old_size = volume['size']
|
||||||
growth_size = int(new_size) - old_size
|
growth_size = int(new_size) - old_size
|
||||||
LOG.debug(_("Extending Volume %(vol)s from %(old)s to %(new)s, "
|
LOG.debug("Extending Volume %(vol)s from %(old)s to %(new)s, "
|
||||||
" by %(diff)s GB.") %
|
" by %(diff)s GB." %
|
||||||
{'vol': volume_name, 'old': old_size, 'new': new_size,
|
{'vol': volume_name, 'old': old_size, 'new': new_size,
|
||||||
'diff': growth_size})
|
'diff': growth_size})
|
||||||
growth_size_mib = growth_size * units.KiB
|
growth_size_mib = growth_size * units.KiB
|
||||||
@ -271,7 +271,7 @@ class HP3PARCommon(object):
|
|||||||
_convert_to_base=False):
|
_convert_to_base=False):
|
||||||
try:
|
try:
|
||||||
if _convert_to_base:
|
if _convert_to_base:
|
||||||
LOG.debug(_("Converting to base volume prior to growing."))
|
LOG.debug("Converting to base volume prior to growing.")
|
||||||
self._convert_to_base_volume(volume)
|
self._convert_to_base_volume(volume)
|
||||||
self.client.growVolume(volume_name, growth_size_mib)
|
self.client.growVolume(volume_name, growth_size_mib)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
@ -842,7 +842,7 @@ class HP3PARCommon(object):
|
|||||||
def _copy_volume(self, src_name, dest_name, cpg, snap_cpg=None,
|
def _copy_volume(self, src_name, dest_name, cpg, snap_cpg=None,
|
||||||
tpvv=True):
|
tpvv=True):
|
||||||
# Virtual volume sets are not supported with the -online option
|
# Virtual volume sets are not supported with the -online option
|
||||||
LOG.debug(_('Creating clone of a volume %(src)s to %(dest)s.') %
|
LOG.debug('Creating clone of a volume %(src)s to %(dest)s.' %
|
||||||
{'src': src_name, 'dest': dest_name})
|
{'src': src_name, 'dest': dest_name})
|
||||||
|
|
||||||
optional = {'tpvv': tpvv, 'online': True}
|
optional = {'tpvv': tpvv, 'online': True}
|
||||||
@ -899,7 +899,7 @@ class HP3PARCommon(object):
|
|||||||
except hpexceptions.HTTPBadRequest as ex:
|
except hpexceptions.HTTPBadRequest as ex:
|
||||||
if ex.get_code() == 29:
|
if ex.get_code() == 29:
|
||||||
if self.client.isOnlinePhysicalCopy(volume_name):
|
if self.client.isOnlinePhysicalCopy(volume_name):
|
||||||
LOG.debug(_("Found an online copy for %(volume)s")
|
LOG.debug("Found an online copy for %(volume)s"
|
||||||
% {'volume': volume_name})
|
% {'volume': volume_name})
|
||||||
# the volume is in process of being cloned.
|
# the volume is in process of being cloned.
|
||||||
# stopOnlinePhysicalCopy will also delete
|
# stopOnlinePhysicalCopy will also delete
|
||||||
@ -999,11 +999,11 @@ class HP3PARCommon(object):
|
|||||||
growth_size = volume['size'] - snapshot['volume_size']
|
growth_size = volume['size'] - snapshot['volume_size']
|
||||||
if growth_size > 0:
|
if growth_size > 0:
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Converting to base volume type: %s.') %
|
LOG.debug('Converting to base volume type: %s.' %
|
||||||
volume['id'])
|
volume['id'])
|
||||||
self._convert_to_base_volume(volume)
|
self._convert_to_base_volume(volume)
|
||||||
growth_size_mib = growth_size * units.GiB / units.MiB
|
growth_size_mib = growth_size * units.GiB / units.MiB
|
||||||
LOG.debug(_('Growing volume: %(id)s by %(size)s GiB.') %
|
LOG.debug('Growing volume: %(id)s by %(size)s GiB.' %
|
||||||
{'id': volume['id'], 'size': growth_size})
|
{'id': volume['id'], 'size': growth_size})
|
||||||
self.client.growVolume(volume_name, growth_size_mib)
|
self.client.growVolume(volume_name, growth_size_mib)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
@ -1140,14 +1140,14 @@ class HP3PARCommon(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
dbg = {'id': volume['id'], 'host': host['host']}
|
dbg = {'id': volume['id'], 'host': host['host']}
|
||||||
LOG.debug(_('enter: migrate_volume: id=%(id)s, host=%(host)s.') % dbg)
|
LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
|
||||||
|
|
||||||
false_ret = (False, None)
|
false_ret = (False, None)
|
||||||
|
|
||||||
# Make sure volume is not attached
|
# Make sure volume is not attached
|
||||||
if volume['status'] != 'available':
|
if volume['status'] != 'available':
|
||||||
LOG.debug(_('Volume is attached: migrate_volume: '
|
LOG.debug('Volume is attached: migrate_volume: '
|
||||||
'id=%(id)s, host=%(host)s.') % dbg)
|
'id=%(id)s, host=%(host)s.' % dbg)
|
||||||
return false_ret
|
return false_ret
|
||||||
|
|
||||||
if 'location_info' not in host['capabilities']:
|
if 'location_info' not in host['capabilities']:
|
||||||
@ -1162,30 +1162,30 @@ class HP3PARCommon(object):
|
|||||||
sys_info = self.client.getStorageSystemInfo()
|
sys_info = self.client.getStorageSystemInfo()
|
||||||
if not (dest_type == 'HP3PARDriver' and
|
if not (dest_type == 'HP3PARDriver' and
|
||||||
dest_id == sys_info['serialNumber']):
|
dest_id == sys_info['serialNumber']):
|
||||||
LOG.debug(_('Dest does not match: migrate_volume: '
|
LOG.debug('Dest does not match: migrate_volume: '
|
||||||
'id=%(id)s, host=%(host)s.') % dbg)
|
'id=%(id)s, host=%(host)s.' % dbg)
|
||||||
return false_ret
|
return false_ret
|
||||||
|
|
||||||
type_info = self.get_volume_settings_from_type(volume)
|
type_info = self.get_volume_settings_from_type(volume)
|
||||||
|
|
||||||
if dest_cpg == type_info['cpg']:
|
if dest_cpg == type_info['cpg']:
|
||||||
LOG.debug(_('CPGs are the same: migrate_volume: '
|
LOG.debug('CPGs are the same: migrate_volume: '
|
||||||
'id=%(id)s, host=%(host)s.') % dbg)
|
'id=%(id)s, host=%(host)s.' % dbg)
|
||||||
return false_ret
|
return false_ret
|
||||||
|
|
||||||
# Check to make sure CPGs are in the same domain
|
# Check to make sure CPGs are in the same domain
|
||||||
src_domain = self.get_domain(type_info['cpg'])
|
src_domain = self.get_domain(type_info['cpg'])
|
||||||
dst_domain = self.get_domain(dest_cpg)
|
dst_domain = self.get_domain(dest_cpg)
|
||||||
if src_domain != dst_domain:
|
if src_domain != dst_domain:
|
||||||
LOG.debug(_('CPGs in different domains: migrate_volume: '
|
LOG.debug('CPGs in different domains: migrate_volume: '
|
||||||
'id=%(id)s, host=%(host)s.') % dbg)
|
'id=%(id)s, host=%(host)s.' % dbg)
|
||||||
return false_ret
|
return false_ret
|
||||||
|
|
||||||
self._convert_to_base_volume(volume, new_cpg=dest_cpg)
|
self._convert_to_base_volume(volume, new_cpg=dest_cpg)
|
||||||
|
|
||||||
# TODO(Ramy) When volume retype is available,
|
# TODO(Ramy) When volume retype is available,
|
||||||
# use that to change the type
|
# use that to change the type
|
||||||
LOG.debug(_('leave: migrate_volume: id=%(id)s, host=%(host)s.') % dbg)
|
LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
|
||||||
return (True, None)
|
return (True, None)
|
||||||
|
|
||||||
def _convert_to_base_volume(self, volume, new_cpg=None):
|
def _convert_to_base_volume(self, volume, new_cpg=None):
|
||||||
@ -1205,8 +1205,8 @@ class HP3PARCommon(object):
|
|||||||
task_id = self._copy_volume(volume_name, temp_vol_name,
|
task_id = self._copy_volume(volume_name, temp_vol_name,
|
||||||
cpg, cpg, type_info['tpvv'])
|
cpg, cpg, type_info['tpvv'])
|
||||||
|
|
||||||
LOG.debug(_('Copy volume scheduled: convert_to_base_volume: '
|
LOG.debug('Copy volume scheduled: convert_to_base_volume: '
|
||||||
'id=%s.') % volume['id'])
|
'id=%s.' % volume['id'])
|
||||||
|
|
||||||
# Wait for the physical copy task to complete
|
# Wait for the physical copy task to complete
|
||||||
def _wait_for_task(task_id):
|
def _wait_for_task(task_id):
|
||||||
@ -1229,19 +1229,19 @@ class HP3PARCommon(object):
|
|||||||
'id=%(id)s, status=%(status)s.') % dbg
|
'id=%(id)s, status=%(status)s.') % dbg
|
||||||
raise exception.CinderException(msg)
|
raise exception.CinderException(msg)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('Copy volume completed: convert_to_base_volume: '
|
LOG.debug('Copy volume completed: convert_to_base_volume: '
|
||||||
'id=%s.') % volume['id'])
|
'id=%s.' % volume['id'])
|
||||||
|
|
||||||
comment = self._get_3par_vol_comment(volume_name)
|
comment = self._get_3par_vol_comment(volume_name)
|
||||||
if comment:
|
if comment:
|
||||||
self.client.modifyVolume(temp_vol_name, {'comment': comment})
|
self.client.modifyVolume(temp_vol_name, {'comment': comment})
|
||||||
LOG.debug(_('Volume rename completed: convert_to_base_volume: '
|
LOG.debug('Volume rename completed: convert_to_base_volume: '
|
||||||
'id=%s.') % volume['id'])
|
'id=%s.' % volume['id'])
|
||||||
|
|
||||||
# Delete source volume after the copy is complete
|
# Delete source volume after the copy is complete
|
||||||
self.client.deleteVolume(volume_name)
|
self.client.deleteVolume(volume_name)
|
||||||
LOG.debug(_('Delete src volume completed: convert_to_base_volume: '
|
LOG.debug('Delete src volume completed: convert_to_base_volume: '
|
||||||
'id=%s.') % volume['id'])
|
'id=%s.' % volume['id'])
|
||||||
|
|
||||||
# Rename the new volume to the original name
|
# Rename the new volume to the original name
|
||||||
self.client.modifyVolume(temp_vol_name, {'newName': volume_name})
|
self.client.modifyVolume(temp_vol_name, {'newName': volume_name})
|
||||||
|
@ -105,7 +105,7 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
|
|||||||
cliq_args['output'] = 'XML'
|
cliq_args['output'] = 'XML'
|
||||||
(out, _err) = self._cliq_run(verb, cliq_args, check_cliq_result)
|
(out, _err) = self._cliq_run(verb, cliq_args, check_cliq_result)
|
||||||
|
|
||||||
LOG.debug(_("CLIQ command returned %s"), out)
|
LOG.debug("CLIQ command returned %s", out)
|
||||||
|
|
||||||
result_xml = etree.fromstring(out.encode('utf8'))
|
result_xml = etree.fromstring(out.encode('utf8'))
|
||||||
if check_cliq_result:
|
if check_cliq_result:
|
||||||
@ -202,7 +202,7 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
|
|||||||
for k, v in status_node.attrib.items():
|
for k, v in status_node.attrib.items():
|
||||||
volume_attributes["permission." + k] = v
|
volume_attributes["permission." + k] = v
|
||||||
|
|
||||||
LOG.debug(_("Volume info: %(volume_name)s => %(volume_attributes)s") %
|
LOG.debug("Volume info: %(volume_name)s => %(volume_attributes)s" %
|
||||||
{'volume_name': volume_name,
|
{'volume_name': volume_name,
|
||||||
'volume_attributes': volume_attributes})
|
'volume_attributes': volume_attributes})
|
||||||
return volume_attributes
|
return volume_attributes
|
||||||
@ -258,7 +258,7 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
|
|||||||
for k, v in status_node.attrib.items():
|
for k, v in status_node.attrib.items():
|
||||||
snapshot_attributes["permission." + k] = v
|
snapshot_attributes["permission." + k] = v
|
||||||
|
|
||||||
LOG.debug(_("Snapshot info: %(name)s => %(attributes)s") %
|
LOG.debug("Snapshot info: %(name)s => %(attributes)s" %
|
||||||
{'name': snapshot_name, 'attributes': snapshot_attributes})
|
{'name': snapshot_name, 'attributes': snapshot_attributes})
|
||||||
return snapshot_attributes
|
return snapshot_attributes
|
||||||
|
|
||||||
|
@ -403,11 +403,11 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
host['host'] is its name, and host['capabilities'] is a
|
host['host'] is its name, and host['capabilities'] is a
|
||||||
dictionary of its reported capabilities.
|
dictionary of its reported capabilities.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('enter: retype: id=%(id)s, new_type=%(new_type)s,'
|
LOG.debug('enter: retype: id=%(id)s, new_type=%(new_type)s,'
|
||||||
'diff=%(diff)s, host=%(host)s') % {'id': volume['id'],
|
'diff=%(diff)s, host=%(host)s' % {'id': volume['id'],
|
||||||
'new_type': new_type,
|
'new_type': new_type,
|
||||||
'diff': diff,
|
'diff': diff,
|
||||||
'host': host})
|
'host': host})
|
||||||
try:
|
try:
|
||||||
volume_info = self.client.getVolumeByName(volume['name'])
|
volume_info = self.client.getVolumeByName(volume['name'])
|
||||||
except hpexceptions.HTTPNotFound:
|
except hpexceptions.HTTPNotFound:
|
||||||
@ -420,7 +420,7 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
new_extra_specs,
|
new_extra_specs,
|
||||||
extra_specs_key_map.keys())
|
extra_specs_key_map.keys())
|
||||||
|
|
||||||
LOG.debug(_('LH specs=%(specs)s') % {'specs': lh_extra_specs})
|
LOG.debug('LH specs=%(specs)s' % {'specs': lh_extra_specs})
|
||||||
|
|
||||||
# only set the ones that have changed
|
# only set the ones that have changed
|
||||||
changed_extra_specs = {}
|
changed_extra_specs = {}
|
||||||
@ -461,11 +461,11 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
host['host'] is its name, and host['capabilities'] is a
|
host['host'] is its name, and host['capabilities'] is a
|
||||||
dictionary of its reported capabilities.
|
dictionary of its reported capabilities.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('enter: migrate_volume: id=%(id)s, host=%(host)s, '
|
LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s, '
|
||||||
'cluster=%(cluster)s') % {
|
'cluster=%(cluster)s' % {
|
||||||
'id': volume['id'],
|
'id': volume['id'],
|
||||||
'host': host,
|
'host': host,
|
||||||
'cluster': self.configuration.hplefthand_clustername})
|
'cluster': self.configuration.hplefthand_clustername})
|
||||||
|
|
||||||
false_ret = (False, None)
|
false_ret = (False, None)
|
||||||
if 'location_info' not in host['capabilities']:
|
if 'location_info' not in host['capabilities']:
|
||||||
@ -476,7 +476,7 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
try:
|
try:
|
||||||
# get the cluster info, if it exists and compare
|
# get the cluster info, if it exists and compare
|
||||||
cluster_info = self.client.getClusterByName(cluster)
|
cluster_info = self.client.getClusterByName(cluster)
|
||||||
LOG.debug(_('Clister info: %s') % cluster_info)
|
LOG.debug('Clister info: %s' % cluster_info)
|
||||||
virtual_ips = cluster_info['virtualIPAddresses']
|
virtual_ips = cluster_info['virtualIPAddresses']
|
||||||
|
|
||||||
if driver != self.__class__.__name__:
|
if driver != self.__class__.__name__:
|
||||||
@ -498,7 +498,7 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
volume_info = self.client.getVolumeByName(volume['name'])
|
volume_info = self.client.getVolumeByName(volume['name'])
|
||||||
LOG.debug(_('Volume info: %s') % volume_info)
|
LOG.debug('Volume info: %s' % volume_info)
|
||||||
|
|
||||||
# can't migrate if server is attached
|
# can't migrate if server is attached
|
||||||
if volume_info['iscsiSessions'] is not None:
|
if volume_info['iscsiSessions'] is not None:
|
||||||
@ -511,7 +511,7 @@ class HPLeftHandRESTProxy(ISCSIDriver):
|
|||||||
snap_info = self.client.getVolume(
|
snap_info = self.client.getVolume(
|
||||||
volume_info['id'],
|
volume_info['id'],
|
||||||
'fields=snapshots,snapshots[resource[members[name]]]')
|
'fields=snapshots,snapshots[resource[members[name]]]')
|
||||||
LOG.debug(_('Snapshot info: %s') % snap_info)
|
LOG.debug('Snapshot info: %s' % snap_info)
|
||||||
if snap_info['snapshots']['resource'] is not None:
|
if snap_info['snapshots']['resource'] is not None:
|
||||||
LOG.info(_("Cannot provide backend assisted migration "
|
LOG.info(_("Cannot provide backend assisted migration "
|
||||||
"for volume: %s because the volume has "
|
"for volume: %s because the volume has "
|
||||||
|
@ -59,7 +59,7 @@ class HPMSACommon(object):
|
|||||||
self.client_logout()
|
self.client_logout()
|
||||||
|
|
||||||
def client_login(self):
|
def client_login(self):
|
||||||
LOG.debug(_("Connecting to MSA"))
|
LOG.debug("Connecting to MSA")
|
||||||
try:
|
try:
|
||||||
self.client.login()
|
self.client.login()
|
||||||
except msa.HPMSAConnectionError as ex:
|
except msa.HPMSAConnectionError as ex:
|
||||||
@ -79,7 +79,7 @@ class HPMSACommon(object):
|
|||||||
|
|
||||||
def client_logout(self):
|
def client_logout(self):
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
LOG.debug(_("Disconnected from MSA Array"))
|
LOG.debug("Disconnected from MSA Array")
|
||||||
|
|
||||||
def _get_vol_name(self, volume_id):
|
def _get_vol_name(self, volume_id):
|
||||||
volume_name = self._encode_name(volume_id)
|
volume_name = self._encode_name(volume_id)
|
||||||
@ -128,7 +128,7 @@ class HPMSACommon(object):
|
|||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
volume_id = self._get_vol_name(volume['id'])
|
volume_id = self._get_vol_name(volume['id'])
|
||||||
LOG.debug(_("Create Volume (%(display_name)s: %(name)s %(id)s)") %
|
LOG.debug("Create Volume (%(display_name)s: %(name)s %(id)s)" %
|
||||||
{'display_name': volume['display_name'],
|
{'display_name': volume['display_name'],
|
||||||
'name': volume['name'], 'id': volume_id})
|
'name': volume['name'], 'id': volume_id})
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ class HPMSACommon(object):
|
|||||||
self._assert_enough_space_for_copy(volume['size'])
|
self._assert_enough_space_for_copy(volume['size'])
|
||||||
self._assert_source_detached(src_vref)
|
self._assert_source_detached(src_vref)
|
||||||
|
|
||||||
LOG.debug(_("Cloning Volume %(source_id)s (%(dest_id)s)") %
|
LOG.debug("Cloning Volume %(source_id)s (%(dest_id)s)" %
|
||||||
{'source_id': volume['source_volid'],
|
{'source_id': volume['source_volid'],
|
||||||
'dest_id': volume['id']})
|
'dest_id': volume['id']})
|
||||||
|
|
||||||
@ -191,8 +191,8 @@ class HPMSACommon(object):
|
|||||||
self.get_volume_stats(True)
|
self.get_volume_stats(True)
|
||||||
self._assert_enough_space_for_copy(volume['size'])
|
self._assert_enough_space_for_copy(volume['size'])
|
||||||
|
|
||||||
LOG.debug(_("Creating Volume from snapshot %(source_id)s "
|
LOG.debug("Creating Volume from snapshot %(source_id)s "
|
||||||
"(%(dest_id)s)") %
|
"(%(dest_id)s)" %
|
||||||
{'source_id': snapshot['id'], 'dest_id': volume['id']})
|
{'source_id': snapshot['id'], 'dest_id': volume['id']})
|
||||||
|
|
||||||
orig_name = self._get_snap_name(snapshot['id'])
|
orig_name = self._get_snap_name(snapshot['id'])
|
||||||
@ -207,7 +207,7 @@ class HPMSACommon(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def delete_volume(self, volume):
|
def delete_volume(self, volume):
|
||||||
LOG.debug(_("Deleting Volume (%s)") % volume['id'])
|
LOG.debug("Deleting Volume (%s)" % volume['id'])
|
||||||
volume_name = self._get_vol_name(volume['id'])
|
volume_name = self._get_vol_name(volume['id'])
|
||||||
try:
|
try:
|
||||||
self.client.delete_volume(volume_name)
|
self.client.delete_volume(volume_name)
|
||||||
@ -276,7 +276,7 @@ class HPMSACommon(object):
|
|||||||
return self.client.get_active_fc_target_ports()
|
return self.client.get_active_fc_target_ports()
|
||||||
|
|
||||||
def create_snapshot(self, snapshot):
|
def create_snapshot(self, snapshot):
|
||||||
LOG.debug(_("Creating Snapshot from %(volume_id)s (%(snap_id)s)") %
|
LOG.debug("Creating Snapshot from %(volume_id)s (%(snap_id)s)" %
|
||||||
{'volume_id': snapshot['volume_id'],
|
{'volume_id': snapshot['volume_id'],
|
||||||
'snap_id': snapshot['id']})
|
'snap_id': snapshot['id']})
|
||||||
snap_name = self._get_snap_name(snapshot['id'])
|
snap_name = self._get_snap_name(snapshot['id'])
|
||||||
@ -289,7 +289,7 @@ class HPMSACommon(object):
|
|||||||
|
|
||||||
def delete_snapshot(self, snapshot):
|
def delete_snapshot(self, snapshot):
|
||||||
snap_name = self._get_snap_name(snapshot['id'])
|
snap_name = self._get_snap_name(snapshot['id'])
|
||||||
LOG.debug(_("Deleting Snapshot (%s)") % snapshot['id'])
|
LOG.debug("Deleting Snapshot (%s)" % snapshot['id'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.client.delete_snapshot(snap_name)
|
self.client.delete_snapshot(snap_name)
|
||||||
@ -304,8 +304,8 @@ class HPMSACommon(object):
|
|||||||
volume_name = self._get_vol_name(volume['id'])
|
volume_name = self._get_vol_name(volume['id'])
|
||||||
old_size = volume['size']
|
old_size = volume['size']
|
||||||
growth_size = int(new_size) - old_size
|
growth_size = int(new_size) - old_size
|
||||||
LOG.debug(_("Extending Volume %(volume_name)s from %(old_size)s to "
|
LOG.debug("Extending Volume %(volume_name)s from %(old_size)s to "
|
||||||
"%(new_size)s, by %(growth_size)s GB.") %
|
"%(new_size)s, by %(growth_size)s GB." %
|
||||||
{'volume_name': volume_name, 'old_size': old_size,
|
{'volume_name': volume_name, 'old_size': old_size,
|
||||||
'new_size': new_size, 'growth_size': growth_size})
|
'new_size': new_size, 'growth_size': growth_size})
|
||||||
try:
|
try:
|
||||||
|
@ -197,7 +197,7 @@ class SheepdogDriver(driver.VolumeDriver):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
LOG.debug(_("Extend volume from %(old_size)s GB to %(new_size)s GB."),
|
LOG.debug("Extend volume from %(old_size)s GB to %(new_size)s GB.",
|
||||||
{'old_size': old_size, 'new_size': new_size})
|
{'old_size': old_size, 'new_size': new_size})
|
||||||
|
|
||||||
def backup_volume(self, context, backup, backup_service):
|
def backup_volume(self, context, backup, backup_service):
|
||||||
|
@ -139,7 +139,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
cluster_password))[:-1]
|
cluster_password))[:-1]
|
||||||
header['Authorization'] = 'Basic %s' % auth_key
|
header['Authorization'] = 'Basic %s' % auth_key
|
||||||
|
|
||||||
LOG.debug(_("Payload for SolidFire API call: %s"), payload)
|
LOG.debug("Payload for SolidFire API call: %s", payload)
|
||||||
|
|
||||||
api_endpoint = '/json-rpc/%s' % version
|
api_endpoint = '/json-rpc/%s' % version
|
||||||
connection = httplib.HTTPSConnection(host, port)
|
connection = httplib.HTTPSConnection(host, port)
|
||||||
@ -178,7 +178,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
|
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
LOG.debug(_("Results of SolidFire API call: %s"), data)
|
LOG.debug("Results of SolidFire API call: %s", data)
|
||||||
|
|
||||||
if 'error' in data:
|
if 'error' in data:
|
||||||
if data['error']['name'] in max_simultaneous_clones:
|
if data['error']['name'] in max_simultaneous_clones:
|
||||||
@ -217,7 +217,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
params = {'username': sf_account_name}
|
params = {'username': sf_account_name}
|
||||||
data = self._issue_api_request('GetAccountByName', params)
|
data = self._issue_api_request('GetAccountByName', params)
|
||||||
if 'result' in data and 'account' in data['result']:
|
if 'result' in data and 'account' in data['result']:
|
||||||
LOG.debug(_('Found solidfire account: %s'), sf_account_name)
|
LOG.debug('Found solidfire account: %s', sf_account_name)
|
||||||
sfaccount = data['result']['account']
|
sfaccount = data['result']['account']
|
||||||
return sfaccount
|
return sfaccount
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
sf_account_name = self._get_sf_account_name(project_id)
|
sf_account_name = self._get_sf_account_name(project_id)
|
||||||
sfaccount = self._get_sfaccount_by_name(sf_account_name)
|
sfaccount = self._get_sfaccount_by_name(sf_account_name)
|
||||||
if sfaccount is None:
|
if sfaccount is None:
|
||||||
LOG.debug(_('solidfire account: %s does not exist, create it...'),
|
LOG.debug('solidfire account: %s does not exist, create it...',
|
||||||
sf_account_name)
|
sf_account_name)
|
||||||
chap_secret = self._generate_random_string(12)
|
chap_secret = self._generate_random_string(12)
|
||||||
params = {'username': sf_account_name,
|
params = {'username': sf_account_name,
|
||||||
@ -464,8 +464,8 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
if uuid in v['name']:
|
if uuid in v['name']:
|
||||||
found_count += 1
|
found_count += 1
|
||||||
sf_volref = v
|
sf_volref = v
|
||||||
LOG.debug(_("Mapped SolidFire volumeID %(sfid)s "
|
LOG.debug("Mapped SolidFire volumeID %(sfid)s "
|
||||||
"to cinder ID %(uuid)s.") %
|
"to cinder ID %(uuid)s." %
|
||||||
{'sfid': v['volumeID'],
|
{'sfid': v['volumeID'],
|
||||||
'uuid': uuid})
|
'uuid': uuid})
|
||||||
|
|
||||||
@ -545,7 +545,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
LOG.debug(_("Enter SolidFire delete_volume..."))
|
LOG.debug("Enter SolidFire delete_volume...")
|
||||||
|
|
||||||
sfaccount = self._get_sfaccount(volume['project_id'])
|
sfaccount = self._get_sfaccount(volume['project_id'])
|
||||||
if sfaccount is None:
|
if sfaccount is None:
|
||||||
@ -570,11 +570,11 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
LOG.error(_("Volume ID %s was not found on "
|
LOG.error(_("Volume ID %s was not found on "
|
||||||
"the SolidFire Cluster!"), volume['id'])
|
"the SolidFire Cluster!"), volume['id'])
|
||||||
|
|
||||||
LOG.debug(_("Leaving SolidFire delete_volume"))
|
LOG.debug("Leaving SolidFire delete_volume")
|
||||||
|
|
||||||
def ensure_export(self, context, volume):
|
def ensure_export(self, context, volume):
|
||||||
"""Verify the iscsi export info."""
|
"""Verify the iscsi export info."""
|
||||||
LOG.debug(_("Executing SolidFire ensure_export..."))
|
LOG.debug("Executing SolidFire ensure_export...")
|
||||||
try:
|
try:
|
||||||
return self._do_export(volume)
|
return self._do_export(volume)
|
||||||
except exception.SolidFireAPIException:
|
except exception.SolidFireAPIException:
|
||||||
@ -582,7 +582,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
|
|
||||||
def create_export(self, context, volume):
|
def create_export(self, context, volume):
|
||||||
"""Setup the iscsi export info."""
|
"""Setup the iscsi export info."""
|
||||||
LOG.debug(_("Executing SolidFire create_export..."))
|
LOG.debug("Executing SolidFire create_export...")
|
||||||
return self._do_export(volume)
|
return self._do_export(volume)
|
||||||
|
|
||||||
def delete_snapshot(self, snapshot):
|
def delete_snapshot(self, snapshot):
|
||||||
@ -633,7 +633,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
|
|
||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
"""Extend an existing volume."""
|
"""Extend an existing volume."""
|
||||||
LOG.debug(_("Entering SolidFire extend_volume..."))
|
LOG.debug("Entering SolidFire extend_volume...")
|
||||||
|
|
||||||
sfaccount = self._get_sfaccount(volume['project_id'])
|
sfaccount = self._get_sfaccount(volume['project_id'])
|
||||||
params = {'accountID': sfaccount['accountID']}
|
params = {'accountID': sfaccount['accountID']}
|
||||||
@ -655,12 +655,12 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
if 'result' not in data:
|
if 'result' not in data:
|
||||||
raise exception.SolidFireAPIDataException(data=data)
|
raise exception.SolidFireAPIDataException(data=data)
|
||||||
|
|
||||||
LOG.debug(_("Leaving SolidFire extend_volume"))
|
LOG.debug("Leaving SolidFire extend_volume")
|
||||||
|
|
||||||
def _update_cluster_status(self):
|
def _update_cluster_status(self):
|
||||||
"""Retrieve status info for the Cluster."""
|
"""Retrieve status info for the Cluster."""
|
||||||
|
|
||||||
LOG.debug(_("Updating cluster status info"))
|
LOG.debug("Updating cluster status info")
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
|
|
||||||
@ -699,7 +699,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
instance_uuid, host_name,
|
instance_uuid, host_name,
|
||||||
mountpoint):
|
mountpoint):
|
||||||
|
|
||||||
LOG.debug(_("Entering SolidFire attach_volume..."))
|
LOG.debug("Entering SolidFire attach_volume...")
|
||||||
sfaccount = self._get_sfaccount(volume['project_id'])
|
sfaccount = self._get_sfaccount(volume['project_id'])
|
||||||
params = {'accountID': sfaccount['accountID']}
|
params = {'accountID': sfaccount['accountID']}
|
||||||
|
|
||||||
@ -724,7 +724,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
|
|
||||||
def detach_volume(self, context, volume):
|
def detach_volume(self, context, volume):
|
||||||
|
|
||||||
LOG.debug(_("Entering SolidFire attach_volume..."))
|
LOG.debug("Entering SolidFire attach_volume...")
|
||||||
sfaccount = self._get_sfaccount(volume['project_id'])
|
sfaccount = self._get_sfaccount(volume['project_id'])
|
||||||
params = {'accountID': sfaccount['accountID']}
|
params = {'accountID': sfaccount['accountID']}
|
||||||
|
|
||||||
@ -769,7 +769,7 @@ class SolidFireDriver(SanISCSIDriver):
|
|||||||
if 'result' not in data:
|
if 'result' not in data:
|
||||||
raise exception.SolidFireAPIDataException(data=data)
|
raise exception.SolidFireAPIDataException(data=data)
|
||||||
|
|
||||||
LOG.debug(_("Leaving SolidFire transfer volume"))
|
LOG.debug("Leaving SolidFire transfer volume")
|
||||||
|
|
||||||
def retype(self, ctxt, volume, new_type, diff, host):
|
def retype(self, ctxt, volume, new_type, diff, host):
|
||||||
"""Convert the volume to be of the new type.
|
"""Convert the volume to be of the new type.
|
||||||
|
@ -234,8 +234,8 @@ class VMwareAPISession(object):
|
|||||||
# case of an inactive session. Therefore, we need a way to
|
# case of an inactive session. Therefore, we need a way to
|
||||||
# differentiate between these two cases.
|
# differentiate between these two cases.
|
||||||
if self._is_current_session_active():
|
if self._is_current_session_active():
|
||||||
LOG.debug(_("Returning empty response for "
|
LOG.debug("Returning empty response for "
|
||||||
"%(module)s.%(method)s invocation."),
|
"%(module)s.%(method)s invocation.",
|
||||||
{'module': module,
|
{'module': module,
|
||||||
'method': method})
|
'method': method})
|
||||||
return []
|
return []
|
||||||
@ -257,7 +257,7 @@ class VMwareAPISession(object):
|
|||||||
|
|
||||||
:returns: True if the session is active; False otherwise
|
:returns: True if the session is active; False otherwise
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Checking if the current session: %s is active."),
|
LOG.debug("Checking if the current session: %s is active.",
|
||||||
self._session_id)
|
self._session_id)
|
||||||
|
|
||||||
is_active = False
|
is_active = False
|
||||||
@ -302,11 +302,11 @@ class VMwareAPISession(object):
|
|||||||
# If task already completed on server, it will not return
|
# If task already completed on server, it will not return
|
||||||
# the progress.
|
# the progress.
|
||||||
if hasattr(task_info, 'progress'):
|
if hasattr(task_info, 'progress'):
|
||||||
LOG.debug(_("Task: %(task)s progress: %(prog)s.") %
|
LOG.debug("Task: %(task)s progress: %(prog)s." %
|
||||||
{'task': task, 'prog': task_info.progress})
|
{'task': task, 'prog': task_info.progress})
|
||||||
return
|
return
|
||||||
elif task_info.state == 'success':
|
elif task_info.state == 'success':
|
||||||
LOG.debug(_("Task %s status: success.") % task)
|
LOG.debug("Task %s status: success." % task)
|
||||||
else:
|
else:
|
||||||
error_msg = str(task_info.error.localizedMessage)
|
error_msg = str(task_info.error.localizedMessage)
|
||||||
LOG.exception(_("Task: %(task)s failed with error: %(err)s.") %
|
LOG.exception(_("Task: %(task)s failed with error: %(err)s.") %
|
||||||
@ -329,9 +329,9 @@ class VMwareAPISession(object):
|
|||||||
self.vim, lease, 'state')
|
self.vim, lease, 'state')
|
||||||
if state == 'ready':
|
if state == 'ready':
|
||||||
# done
|
# done
|
||||||
LOG.debug(_("Lease is ready."))
|
LOG.debug("Lease is ready.")
|
||||||
elif state == 'initializing':
|
elif state == 'initializing':
|
||||||
LOG.debug(_("Lease initializing..."))
|
LOG.debug("Lease initializing...")
|
||||||
return
|
return
|
||||||
elif state == 'error':
|
elif state == 'error':
|
||||||
error_msg = self.invoke_api(vim_util, 'get_object_property',
|
error_msg = self.invoke_api(vim_util, 'get_object_property',
|
||||||
|
@ -48,12 +48,12 @@ class ThreadSafePipe(queue.LightQueue):
|
|||||||
if self.transferred < self.max_transfer_size:
|
if self.transferred < self.max_transfer_size:
|
||||||
data_item = self.get()
|
data_item = self.get()
|
||||||
self.transferred += len(data_item)
|
self.transferred += len(data_item)
|
||||||
LOG.debug(_("Read %(bytes)s out of %(max)s from ThreadSafePipe.") %
|
LOG.debug("Read %(bytes)s out of %(max)s from ThreadSafePipe." %
|
||||||
{'bytes': self.transferred,
|
{'bytes': self.transferred,
|
||||||
'max': self.max_transfer_size})
|
'max': self.max_transfer_size})
|
||||||
return data_item
|
return data_item
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Completed transfer of size %s.") % self.transferred)
|
LOG.debug("Completed transfer of size %s." % self.transferred)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
@ -99,9 +99,9 @@ class GlanceWriteThread(object):
|
|||||||
Function to do the image data transfer through an update
|
Function to do the image data transfer through an update
|
||||||
and thereon checks if the state is 'active'.
|
and thereon checks if the state is 'active'.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Initiating image service update on image: %(image)s "
|
LOG.debug("Initiating image service update on image: %(image)s "
|
||||||
"with meta: %(meta)s") % {'image': self.image_id,
|
"with meta: %(meta)s" % {'image': self.image_id,
|
||||||
'meta': self.image_meta})
|
'meta': self.image_meta})
|
||||||
self.image_service.update(self.context,
|
self.image_service.update(self.context,
|
||||||
self.image_id,
|
self.image_id,
|
||||||
self.image_meta,
|
self.image_meta,
|
||||||
@ -114,7 +114,7 @@ class GlanceWriteThread(object):
|
|||||||
image_status = image_meta.get('status')
|
image_status = image_meta.get('status')
|
||||||
if image_status == 'active':
|
if image_status == 'active':
|
||||||
self.stop()
|
self.stop()
|
||||||
LOG.debug(_("Glance image: %s is now active.") %
|
LOG.debug("Glance image: %s is now active." %
|
||||||
self.image_id)
|
self.image_id)
|
||||||
self.done.send(True)
|
self.done.send(True)
|
||||||
# If the state is killed, then raise an exception.
|
# If the state is killed, then raise an exception.
|
||||||
|
@ -169,8 +169,8 @@ class VMwareHTTPWriteFile(VMwareHTTPFile):
|
|||||||
try:
|
try:
|
||||||
self.conn.getresponse()
|
self.conn.getresponse()
|
||||||
except Exception as excep:
|
except Exception as excep:
|
||||||
LOG.debug(_("Exception during HTTP connection close in "
|
LOG.debug("Exception during HTTP connection close in "
|
||||||
"VMwareHTTPWrite. Exception is %s.") % excep)
|
"VMwareHTTPWrite. Exception is %s." % excep)
|
||||||
super(VMwareHTTPWriteFile, self).close()
|
super(VMwareHTTPWriteFile, self).close()
|
||||||
|
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ class VMwareHTTPWriteVmdk(VMwareHTTPFile):
|
|||||||
def write(self, data):
|
def write(self, data):
|
||||||
"""Write to the file."""
|
"""Write to the file."""
|
||||||
self._progress += len(data)
|
self._progress += len(data)
|
||||||
LOG.debug(_("Written %s bytes to vmdk.") % self._progress)
|
LOG.debug("Written %s bytes to vmdk." % self._progress)
|
||||||
self.file_handle.send(data)
|
self.file_handle.send(data)
|
||||||
|
|
||||||
def update_progress(self):
|
def update_progress(self):
|
||||||
@ -240,7 +240,7 @@ class VMwareHTTPWriteVmdk(VMwareHTTPFile):
|
|||||||
"""
|
"""
|
||||||
percent = int(float(self._progress) / self._vmdk_size * 100)
|
percent = int(float(self._progress) / self._vmdk_size * 100)
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Updating progress to %s percent.") % percent)
|
LOG.debug("Updating progress to %s percent." % percent)
|
||||||
self._session.invoke_api(self._session.vim,
|
self._session.invoke_api(self._session.vim,
|
||||||
'HttpNfcLeaseProgress',
|
'HttpNfcLeaseProgress',
|
||||||
self._lease, percent=percent)
|
self._lease, percent=percent)
|
||||||
@ -256,9 +256,9 @@ class VMwareHTTPWriteVmdk(VMwareHTTPFile):
|
|||||||
if state == 'ready':
|
if state == 'ready':
|
||||||
self._session.invoke_api(self._session.vim, 'HttpNfcLeaseComplete',
|
self._session.invoke_api(self._session.vim, 'HttpNfcLeaseComplete',
|
||||||
self._lease)
|
self._lease)
|
||||||
LOG.debug(_("Lease released."))
|
LOG.debug("Lease released.")
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Lease is already in state: %s.") % state)
|
LOG.debug("Lease is already in state: %s." % state)
|
||||||
super(VMwareHTTPWriteVmdk, self).close()
|
super(VMwareHTTPWriteVmdk, self).close()
|
||||||
|
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ class VMwareHTTPReadVmdk(VMwareHTTPFile):
|
|||||||
def read(self, chunk_size):
|
def read(self, chunk_size):
|
||||||
"""Read a chunk from file."""
|
"""Read a chunk from file."""
|
||||||
self._progress += READ_CHUNKSIZE
|
self._progress += READ_CHUNKSIZE
|
||||||
LOG.debug(_("Read %s bytes from vmdk.") % self._progress)
|
LOG.debug("Read %s bytes from vmdk." % self._progress)
|
||||||
return self.file_handle.read(READ_CHUNKSIZE)
|
return self.file_handle.read(READ_CHUNKSIZE)
|
||||||
|
|
||||||
def update_progress(self):
|
def update_progress(self):
|
||||||
@ -316,7 +316,7 @@ class VMwareHTTPReadVmdk(VMwareHTTPFile):
|
|||||||
"""
|
"""
|
||||||
percent = int(float(self._progress) / self._vmdk_size * 100)
|
percent = int(float(self._progress) / self._vmdk_size * 100)
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Updating progress to %s percent.") % percent)
|
LOG.debug("Updating progress to %s percent." % percent)
|
||||||
self._session.invoke_api(self._session.vim,
|
self._session.invoke_api(self._session.vim,
|
||||||
'HttpNfcLeaseProgress',
|
'HttpNfcLeaseProgress',
|
||||||
self._lease, percent=percent)
|
self._lease, percent=percent)
|
||||||
@ -332,7 +332,7 @@ class VMwareHTTPReadVmdk(VMwareHTTPFile):
|
|||||||
if state == 'ready':
|
if state == 'ready':
|
||||||
self._session.invoke_api(self._session.vim, 'HttpNfcLeaseComplete',
|
self._session.invoke_api(self._session.vim, 'HttpNfcLeaseComplete',
|
||||||
self._lease)
|
self._lease)
|
||||||
LOG.debug(_("Lease released."))
|
LOG.debug("Lease released.")
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Lease is already in state: %s.") % state)
|
LOG.debug("Lease is already in state: %s." % state)
|
||||||
super(VMwareHTTPReadVmdk, self).close()
|
super(VMwareHTTPReadVmdk, self).close()
|
||||||
|
@ -121,17 +121,17 @@ def _get_volume_type_extra_spec(type_id, spec_key, possible_values=None,
|
|||||||
spec_value = volume_types.get_volume_type_extra_specs(type_id,
|
spec_value = volume_types.get_volume_type_extra_specs(type_id,
|
||||||
spec_key)
|
spec_key)
|
||||||
if not spec_value:
|
if not spec_value:
|
||||||
LOG.debug(_("Returning default spec value: %s.") % default_value)
|
LOG.debug("Returning default spec value: %s." % default_value)
|
||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
if possible_values is None:
|
if possible_values is None:
|
||||||
return spec_value
|
return spec_value
|
||||||
|
|
||||||
if spec_value in possible_values:
|
if spec_value in possible_values:
|
||||||
LOG.debug(_("Returning spec value %s") % spec_value)
|
LOG.debug("Returning spec value %s" % spec_value)
|
||||||
return spec_value
|
return spec_value
|
||||||
|
|
||||||
LOG.debug(_("Invalid spec value: %s specified.") % spec_value)
|
LOG.debug("Invalid spec value: %s specified." % spec_value)
|
||||||
|
|
||||||
|
|
||||||
class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
||||||
@ -249,7 +249,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
"%s.") % volume['name']
|
"%s.") % volume['name']
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
raise error_util.VimFaultException([excep], msg)
|
raise error_util.VimFaultException([excep], msg)
|
||||||
LOG.debug(_("Verified volume %s can be created."), volume['name'])
|
LOG.debug("Verified volume %s can be created.", volume['name'])
|
||||||
|
|
||||||
def create_volume(self, volume):
|
def create_volume(self, volume):
|
||||||
"""Creates a volume.
|
"""Creates a volume.
|
||||||
@ -342,8 +342,8 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise error_util.VimException(msg)
|
raise error_util.VimException(msg)
|
||||||
|
|
||||||
LOG.debug(_("Selected datastore: %(datastore)s with %(host_count)d "
|
LOG.debug("Selected datastore: %(datastore)s with %(host_count)d "
|
||||||
"connected host(s) for the volume.") %
|
"connected host(s) for the volume." %
|
||||||
{'datastore': best_summary, 'host_count': max_host_count})
|
{'datastore': best_summary, 'host_count': max_host_count})
|
||||||
return best_summary
|
return best_summary
|
||||||
|
|
||||||
@ -367,8 +367,8 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
:return: subset of datastores that match storage_profile, or empty list
|
:return: subset of datastores that match storage_profile, or empty list
|
||||||
if none of the datastores match
|
if none of the datastores match
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Filter datastores matching storage profile %(profile)s: "
|
LOG.debug("Filter datastores matching storage profile %(profile)s: "
|
||||||
"%(dss)s."),
|
"%(dss)s.",
|
||||||
{'profile': storage_profile, 'dss': datastores})
|
{'profile': storage_profile, 'dss': datastores})
|
||||||
profileId = self.volumeops.retrieve_profile_id(storage_profile)
|
profileId = self.volumeops.retrieve_profile_id(storage_profile)
|
||||||
if not profileId:
|
if not profileId:
|
||||||
@ -394,7 +394,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
folder = self._get_volume_group_folder(datacenter)
|
folder = self._get_volume_group_folder(datacenter)
|
||||||
storage_profile = self._get_storage_profile(volume)
|
storage_profile = self._get_storage_profile(volume)
|
||||||
if self._storage_policy_enabled and storage_profile:
|
if self._storage_policy_enabled and storage_profile:
|
||||||
LOG.debug(_("Storage profile required for this volume: %s."),
|
LOG.debug("Storage profile required for this volume: %s.",
|
||||||
storage_profile)
|
storage_profile)
|
||||||
datastores = self._filter_ds_by_profile(datastores,
|
datastores = self._filter_ds_by_profile(datastores,
|
||||||
storage_profile)
|
storage_profile)
|
||||||
@ -546,8 +546,8 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
if 'instance' in connector:
|
if 'instance' in connector:
|
||||||
# The instance exists
|
# The instance exists
|
||||||
instance = vim.get_moref(connector['instance'], 'VirtualMachine')
|
instance = vim.get_moref(connector['instance'], 'VirtualMachine')
|
||||||
LOG.debug(_("The instance: %s for which initialize connection "
|
LOG.debug("The instance: %s for which initialize connection "
|
||||||
"is called, exists.") % instance)
|
"is called, exists." % instance)
|
||||||
# Get host managing the instance
|
# Get host managing the instance
|
||||||
host = self.volumeops.get_host(instance)
|
host = self.volumeops.get_host(instance)
|
||||||
if not backing:
|
if not backing:
|
||||||
@ -561,8 +561,8 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
self._relocate_backing(volume, backing, host)
|
self._relocate_backing(volume, backing, host)
|
||||||
else:
|
else:
|
||||||
# The instance does not exist
|
# The instance does not exist
|
||||||
LOG.debug(_("The instance for which initialize connection "
|
LOG.debug("The instance for which initialize connection "
|
||||||
"is called, does not exist."))
|
"is called, does not exist.")
|
||||||
if not backing:
|
if not backing:
|
||||||
# Create a backing in case it does not exist. It is a bad use
|
# Create a backing in case it does not exist. It is a bad use
|
||||||
# case to boot from an empty volume.
|
# case to boot from an empty volume.
|
||||||
@ -833,7 +833,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
timeout = self.configuration.vmware_image_transfer_timeout_secs
|
timeout = self.configuration.vmware_image_transfer_timeout_secs
|
||||||
host_ip = self.configuration.vmware_host_ip
|
host_ip = self.configuration.vmware_host_ip
|
||||||
cookies = self.session.vim.client.options.transport.cookiejar
|
cookies = self.session.vim.client.options.transport.cookiejar
|
||||||
LOG.debug(_("Fetching glance image: %(id)s to server: %(host)s.") %
|
LOG.debug("Fetching glance image: %(id)s to server: %(host)s." %
|
||||||
{'id': image_id, 'host': host_ip})
|
{'id': image_id, 'host': host_ip})
|
||||||
vmware_images.fetch_flat_image(context, timeout, image_service,
|
vmware_images.fetch_flat_image(context, timeout, image_service,
|
||||||
image_id, image_size=image_size,
|
image_id, image_size=image_size,
|
||||||
@ -870,8 +870,8 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
raise exception.VolumeBackendAPIException(data=err_msg)
|
raise exception.VolumeBackendAPIException(data=err_msg)
|
||||||
|
|
||||||
size_gb = volume['size']
|
size_gb = volume['size']
|
||||||
LOG.debug(_("Selected datastore %(ds)s for new volume of size "
|
LOG.debug("Selected datastore %(ds)s for new volume of size "
|
||||||
"%(size)s GB.") % {'ds': summary.name, 'size': size_gb})
|
"%(size)s GB." % {'ds': summary.name, 'size': size_gb})
|
||||||
|
|
||||||
# prepare create spec for backing vm
|
# prepare create spec for backing vm
|
||||||
disk_type = VMwareEsxVmdkDriver._get_disk_type(volume)
|
disk_type = VMwareEsxVmdkDriver._get_disk_type(volume)
|
||||||
@ -892,7 +892,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
# fetching image from glance will also create the backing
|
# fetching image from glance will also create the backing
|
||||||
timeout = self.configuration.vmware_image_transfer_timeout_secs
|
timeout = self.configuration.vmware_image_transfer_timeout_secs
|
||||||
host_ip = self.configuration.vmware_host_ip
|
host_ip = self.configuration.vmware_host_ip
|
||||||
LOG.debug(_("Fetching glance image: %(id)s to server: %(host)s.") %
|
LOG.debug("Fetching glance image: %(id)s to server: %(host)s." %
|
||||||
{'id': image_id, 'host': host_ip})
|
{'id': image_id, 'host': host_ip})
|
||||||
vmware_images.fetch_stream_optimized_image(context, timeout,
|
vmware_images.fetch_stream_optimized_image(context, timeout,
|
||||||
image_service,
|
image_service,
|
||||||
@ -964,7 +964,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
:param image_service: Glance image service
|
:param image_service: Glance image service
|
||||||
:param image_id: Glance image id
|
:param image_id: Glance image id
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Copy glance image: %s to create new volume.") % image_id)
|
LOG.debug("Copy glance image: %s to create new volume." % image_id)
|
||||||
# Record the volume size specified by the user, if the size is input
|
# Record the volume size specified by the user, if the size is input
|
||||||
# from the API.
|
# from the API.
|
||||||
volume_size_in_gb = volume['size']
|
volume_size_in_gb = volume['size']
|
||||||
@ -1023,7 +1023,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
|
|||||||
raise exception.InvalidVolume(msg)
|
raise exception.InvalidVolume(msg)
|
||||||
|
|
||||||
# validate disk format is vmdk
|
# validate disk format is vmdk
|
||||||
LOG.debug(_("Copy Volume: %s to new image.") % volume['name'])
|
LOG.debug("Copy Volume: %s to new image." % volume['name'])
|
||||||
VMwareEsxVmdkDriver._validate_disk_format(image_meta['disk_format'])
|
VMwareEsxVmdkDriver._validate_disk_format(image_meta['disk_format'])
|
||||||
|
|
||||||
# get backing vm of volume and its vmdk path
|
# get backing vm of volume and its vmdk path
|
||||||
|
@ -91,8 +91,8 @@ def start_transfer(context, timeout_secs, read_file_handle, max_data_size,
|
|||||||
|
|
||||||
def fetch_flat_image(context, timeout_secs, image_service, image_id, **kwargs):
|
def fetch_flat_image(context, timeout_secs, image_service, image_id, **kwargs):
|
||||||
"""Download flat image from the glance image server."""
|
"""Download flat image from the glance image server."""
|
||||||
LOG.debug(_("Downloading image: %s from glance image server as a flat vmdk"
|
LOG.debug("Downloading image: %s from glance image server as a flat vmdk"
|
||||||
" file.") % image_id)
|
" file." % image_id)
|
||||||
file_size = int(kwargs.get('image_size'))
|
file_size = int(kwargs.get('image_size'))
|
||||||
read_iter = image_service.download(context, image_id)
|
read_iter = image_service.download(context, image_id)
|
||||||
read_handle = rw_util.GlanceFileRead(read_iter)
|
read_handle = rw_util.GlanceFileRead(read_iter)
|
||||||
@ -110,8 +110,8 @@ def fetch_flat_image(context, timeout_secs, image_service, image_id, **kwargs):
|
|||||||
def fetch_stream_optimized_image(context, timeout_secs, image_service,
|
def fetch_stream_optimized_image(context, timeout_secs, image_service,
|
||||||
image_id, **kwargs):
|
image_id, **kwargs):
|
||||||
"""Download stream optimized image from glance image server."""
|
"""Download stream optimized image from glance image server."""
|
||||||
LOG.debug(_("Downloading image: %s from glance image server using HttpNfc"
|
LOG.debug("Downloading image: %s from glance image server using HttpNfc"
|
||||||
" import.") % image_id)
|
" import." % image_id)
|
||||||
file_size = int(kwargs.get('image_size'))
|
file_size = int(kwargs.get('image_size'))
|
||||||
read_iter = image_service.download(context, image_id)
|
read_iter = image_service.download(context, image_id)
|
||||||
read_handle = rw_util.GlanceFileRead(read_iter)
|
read_handle = rw_util.GlanceFileRead(read_iter)
|
||||||
@ -129,8 +129,8 @@ def fetch_stream_optimized_image(context, timeout_secs, image_service,
|
|||||||
def upload_image(context, timeout_secs, image_service, image_id, owner_id,
|
def upload_image(context, timeout_secs, image_service, image_id, owner_id,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""Upload the vm's disk file to Glance image server."""
|
"""Upload the vm's disk file to Glance image server."""
|
||||||
LOG.debug(_("Uploading image: %s to the Glance image server using HttpNfc"
|
LOG.debug("Uploading image: %s to the Glance image server using HttpNfc"
|
||||||
" export.") % image_id)
|
" export." % image_id)
|
||||||
file_size = kwargs.get('vmdk_size')
|
file_size = kwargs.get('vmdk_size')
|
||||||
read_handle = rw_util.VMwareHTTPReadVmdk(kwargs.get('session'),
|
read_handle = rw_util.VMwareHTTPReadVmdk(kwargs.get('session'),
|
||||||
kwargs.get('host'),
|
kwargs.get('host'),
|
||||||
|
@ -85,17 +85,17 @@ class VMwareVolumeOps(object):
|
|||||||
# Result not obtained, continue retrieving results.
|
# Result not obtained, continue retrieving results.
|
||||||
retrieve_result = self.continue_retrieval(retrieve_result)
|
retrieve_result = self.continue_retrieval(retrieve_result)
|
||||||
|
|
||||||
LOG.debug(_("Did not find any backing with name: %s") % name)
|
LOG.debug("Did not find any backing with name: %s" % name)
|
||||||
|
|
||||||
def delete_backing(self, backing):
|
def delete_backing(self, backing):
|
||||||
"""Delete the backing.
|
"""Delete the backing.
|
||||||
|
|
||||||
:param backing: Managed object reference to the backing
|
:param backing: Managed object reference to the backing
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Deleting the VM backing: %s.") % backing)
|
LOG.debug("Deleting the VM backing: %s." % backing)
|
||||||
task = self._session.invoke_api(self._session.vim, 'Destroy_Task',
|
task = self._session.invoke_api(self._session.vim, 'Destroy_Task',
|
||||||
backing)
|
backing)
|
||||||
LOG.debug(_("Initiated deletion of VM backing: %s.") % backing)
|
LOG.debug("Initiated deletion of VM backing: %s." % backing)
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Deleted the VM backing: %s.") % backing)
|
LOG.info(_("Deleted the VM backing: %s.") % backing)
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ class VMwareVolumeOps(object):
|
|||||||
datastores = prop.val.ManagedObjectReference
|
datastores = prop.val.ManagedObjectReference
|
||||||
elif prop.name == 'parent':
|
elif prop.name == 'parent':
|
||||||
compute_resource = prop.val
|
compute_resource = prop.val
|
||||||
LOG.debug(_("Datastores attached to host %(host)s are: %(ds)s."),
|
LOG.debug("Datastores attached to host %(host)s are: %(ds)s.",
|
||||||
{'host': host, 'ds': datastores})
|
{'host': host, 'ds': datastores})
|
||||||
# Filter datastores based on if it is accessible, mounted and writable
|
# Filter datastores based on if it is accessible, mounted and writable
|
||||||
valid_dss = []
|
valid_dss = []
|
||||||
@ -241,7 +241,7 @@ class VMwareVolumeOps(object):
|
|||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise error_util.VimException(msg)
|
raise error_util.VimException(msg)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Valid datastores are: %s"), valid_dss)
|
LOG.debug("Valid datastores are: %s", valid_dss)
|
||||||
return (valid_dss, resource_pool)
|
return (valid_dss, resource_pool)
|
||||||
|
|
||||||
def _get_parent(self, child, parent_type):
|
def _get_parent(self, child, parent_type):
|
||||||
@ -291,8 +291,8 @@ class VMwareVolumeOps(object):
|
|||||||
:return: Reference to the child folder with input name if it already
|
:return: Reference to the child folder with input name if it already
|
||||||
exists, else create one and return the reference
|
exists, else create one and return the reference
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Creating folder: %(child_folder_name)s under parent "
|
LOG.debug("Creating folder: %(child_folder_name)s under parent "
|
||||||
"folder: %(parent_folder)s.") %
|
"folder: %(parent_folder)s." %
|
||||||
{'child_folder_name': child_folder_name,
|
{'child_folder_name': child_folder_name,
|
||||||
'parent_folder': parent_folder})
|
'parent_folder': parent_folder})
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ class VMwareVolumeOps(object):
|
|||||||
continue
|
continue
|
||||||
child_entity_name = self.get_entity_name(child_entity)
|
child_entity_name = self.get_entity_name(child_entity)
|
||||||
if child_entity_name == child_folder_name:
|
if child_entity_name == child_folder_name:
|
||||||
LOG.debug(_("Child folder already present: %s.") %
|
LOG.debug("Child folder already present: %s." %
|
||||||
child_entity)
|
child_entity)
|
||||||
return child_entity
|
return child_entity
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ class VMwareVolumeOps(object):
|
|||||||
child_folder = self._session.invoke_api(self._session.vim,
|
child_folder = self._session.invoke_api(self._session.vim,
|
||||||
'CreateFolder', parent_folder,
|
'CreateFolder', parent_folder,
|
||||||
name=child_folder_name)
|
name=child_folder_name)
|
||||||
LOG.debug(_("Created child folder: %s.") % child_folder)
|
LOG.debug("Created child folder: %s." % child_folder)
|
||||||
return child_folder
|
return child_folder
|
||||||
|
|
||||||
def extend_virtual_disk(self, requested_size_in_gb, name, dc_ref,
|
def extend_virtual_disk(self, requested_size_in_gb, name, dc_ref,
|
||||||
@ -329,7 +329,7 @@ class VMwareVolumeOps(object):
|
|||||||
:param eager_zero: Boolean determining if the free space
|
:param eager_zero: Boolean determining if the free space
|
||||||
is zeroed out
|
is zeroed out
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Extending the volume %(name)s to %(size)s GB."),
|
LOG.debug("Extending the volume %(name)s to %(size)s GB.",
|
||||||
{'name': name, 'size': requested_size_in_gb})
|
{'name': name, 'size': requested_size_in_gb})
|
||||||
diskMgr = self._session.vim.service_content.virtualDiskManager
|
diskMgr = self._session.vim.service_content.virtualDiskManager
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ class VMwareVolumeOps(object):
|
|||||||
vmProfile.profileId = profileId
|
vmProfile.profileId = profileId
|
||||||
create_spec.vmProfile = [vmProfile]
|
create_spec.vmProfile = [vmProfile]
|
||||||
|
|
||||||
LOG.debug(_("Spec for creating the backing: %s.") % create_spec)
|
LOG.debug("Spec for creating the backing: %s." % create_spec)
|
||||||
return create_spec
|
return create_spec
|
||||||
|
|
||||||
def create_backing(self, name, size_kb, disk_type, folder, resource_pool,
|
def create_backing(self, name, size_kb, disk_type, folder, resource_pool,
|
||||||
@ -422,10 +422,10 @@ class VMwareVolumeOps(object):
|
|||||||
:param profileId: storage profile ID to be associated with backing
|
:param profileId: storage profile ID to be associated with backing
|
||||||
:return: Reference to the created backing entity
|
:return: Reference to the created backing entity
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Creating volume backing name: %(name)s "
|
LOG.debug("Creating volume backing name: %(name)s "
|
||||||
"disk_type: %(disk_type)s size_kb: %(size_kb)s at "
|
"disk_type: %(disk_type)s size_kb: %(size_kb)s at "
|
||||||
"folder: %(folder)s resourse pool: %(resource_pool)s "
|
"folder: %(folder)s resourse pool: %(resource_pool)s "
|
||||||
"datastore name: %(ds_name)s profileId: %(profile)s.") %
|
"datastore name: %(ds_name)s profileId: %(profile)s." %
|
||||||
{'name': name, 'disk_type': disk_type, 'size_kb': size_kb,
|
{'name': name, 'disk_type': disk_type, 'size_kb': size_kb,
|
||||||
'folder': folder, 'resource_pool': resource_pool,
|
'folder': folder, 'resource_pool': resource_pool,
|
||||||
'ds_name': ds_name, 'profile': profileId})
|
'ds_name': ds_name, 'profile': profileId})
|
||||||
@ -435,7 +435,7 @@ class VMwareVolumeOps(object):
|
|||||||
task = self._session.invoke_api(self._session.vim, 'CreateVM_Task',
|
task = self._session.invoke_api(self._session.vim, 'CreateVM_Task',
|
||||||
folder, config=create_spec,
|
folder, config=create_spec,
|
||||||
pool=resource_pool, host=host)
|
pool=resource_pool, host=host)
|
||||||
LOG.debug(_("Initiated creation of volume backing: %s.") % name)
|
LOG.debug("Initiated creation of volume backing: %s." % name)
|
||||||
task_info = self._session.wait_for_task(task)
|
task_info = self._session.wait_for_task(task)
|
||||||
backing = task_info.result
|
backing = task_info.result
|
||||||
LOG.info(_("Successfully created volume backing: %s.") % backing)
|
LOG.info(_("Successfully created volume backing: %s.") % backing)
|
||||||
@ -478,7 +478,7 @@ class VMwareVolumeOps(object):
|
|||||||
relocate_spec.host = host
|
relocate_spec.host = host
|
||||||
relocate_spec.diskMoveType = disk_move_type
|
relocate_spec.diskMoveType = disk_move_type
|
||||||
|
|
||||||
LOG.debug(_("Spec for relocating the backing: %s.") % relocate_spec)
|
LOG.debug("Spec for relocating the backing: %s." % relocate_spec)
|
||||||
return relocate_spec
|
return relocate_spec
|
||||||
|
|
||||||
def relocate_backing(self, backing, datastore, resource_pool, host):
|
def relocate_backing(self, backing, datastore, resource_pool, host):
|
||||||
@ -492,8 +492,8 @@ class VMwareVolumeOps(object):
|
|||||||
:param resource_pool: Reference to the resource pool
|
:param resource_pool: Reference to the resource pool
|
||||||
:param host: Reference to the host
|
:param host: Reference to the host
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Relocating backing: %(backing)s to datastore: %(ds)s "
|
LOG.debug("Relocating backing: %(backing)s to datastore: %(ds)s "
|
||||||
"and resource pool: %(rp)s.") %
|
"and resource pool: %(rp)s." %
|
||||||
{'backing': backing, 'ds': datastore, 'rp': resource_pool})
|
{'backing': backing, 'ds': datastore, 'rp': resource_pool})
|
||||||
|
|
||||||
# Relocate the volume backing
|
# Relocate the volume backing
|
||||||
@ -502,7 +502,7 @@ class VMwareVolumeOps(object):
|
|||||||
disk_move_type)
|
disk_move_type)
|
||||||
task = self._session.invoke_api(self._session.vim, 'RelocateVM_Task',
|
task = self._session.invoke_api(self._session.vim, 'RelocateVM_Task',
|
||||||
backing, spec=relocate_spec)
|
backing, spec=relocate_spec)
|
||||||
LOG.debug(_("Initiated relocation of volume backing: %s.") % backing)
|
LOG.debug("Initiated relocation of volume backing: %s." % backing)
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Successfully relocated volume backing: %(backing)s "
|
LOG.info(_("Successfully relocated volume backing: %(backing)s "
|
||||||
"to datastore: %(ds)s and resource pool: %(rp)s.") %
|
"to datastore: %(ds)s and resource pool: %(rp)s.") %
|
||||||
@ -514,13 +514,13 @@ class VMwareVolumeOps(object):
|
|||||||
:param backing: Reference to the backing
|
:param backing: Reference to the backing
|
||||||
:param folder: Reference to the folder
|
:param folder: Reference to the folder
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Moving backing: %(backing)s to folder: %(fol)s.") %
|
LOG.debug("Moving backing: %(backing)s to folder: %(fol)s." %
|
||||||
{'backing': backing, 'fol': folder})
|
{'backing': backing, 'fol': folder})
|
||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
'MoveIntoFolder_Task', folder,
|
'MoveIntoFolder_Task', folder,
|
||||||
list=[backing])
|
list=[backing])
|
||||||
LOG.debug(_("Initiated move of volume backing: %(backing)s into the "
|
LOG.debug("Initiated move of volume backing: %(backing)s into the "
|
||||||
"folder: %(fol)s.") % {'backing': backing, 'fol': folder})
|
"folder: %(fol)s." % {'backing': backing, 'fol': folder})
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Successfully moved volume backing: %(backing)s into the "
|
LOG.info(_("Successfully moved volume backing: %(backing)s into the "
|
||||||
"folder: %(fol)s.") % {'backing': backing, 'fol': folder})
|
"folder: %(fol)s.") % {'backing': backing, 'fol': folder})
|
||||||
@ -534,15 +534,15 @@ class VMwareVolumeOps(object):
|
|||||||
:param quiesce: Whether to quiesce the backing when taking snapshot
|
:param quiesce: Whether to quiesce the backing when taking snapshot
|
||||||
:return: Created snapshot entity reference
|
:return: Created snapshot entity reference
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Snapshoting backing: %(backing)s with name: %(name)s.") %
|
LOG.debug("Snapshoting backing: %(backing)s with name: %(name)s." %
|
||||||
{'backing': backing, 'name': name})
|
{'backing': backing, 'name': name})
|
||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
'CreateSnapshot_Task',
|
'CreateSnapshot_Task',
|
||||||
backing, name=name,
|
backing, name=name,
|
||||||
description=description,
|
description=description,
|
||||||
memory=False, quiesce=quiesce)
|
memory=False, quiesce=quiesce)
|
||||||
LOG.debug(_("Initiated snapshot of volume backing: %(backing)s "
|
LOG.debug("Initiated snapshot of volume backing: %(backing)s "
|
||||||
"named: %(name)s.") % {'backing': backing, 'name': name})
|
"named: %(name)s." % {'backing': backing, 'name': name})
|
||||||
task_info = self._session.wait_for_task(task)
|
task_info = self._session.wait_for_task(task)
|
||||||
snapshot = task_info.result
|
snapshot = task_info.result
|
||||||
LOG.info(_("Successfully created snapshot: %(snap)s for volume "
|
LOG.info(_("Successfully created snapshot: %(snap)s for volume "
|
||||||
@ -593,8 +593,8 @@ class VMwareVolumeOps(object):
|
|||||||
:param backing: Reference to the backing entity
|
:param backing: Reference to the backing entity
|
||||||
:param name: Snapshot name
|
:param name: Snapshot name
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Deleting the snapshot: %(name)s from backing: "
|
LOG.debug("Deleting the snapshot: %(name)s from backing: "
|
||||||
"%(backing)s.") %
|
"%(backing)s." %
|
||||||
{'name': name, 'backing': backing})
|
{'name': name, 'backing': backing})
|
||||||
snapshot = self.get_snapshot(backing, name)
|
snapshot = self.get_snapshot(backing, name)
|
||||||
if not snapshot:
|
if not snapshot:
|
||||||
@ -605,8 +605,8 @@ class VMwareVolumeOps(object):
|
|||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
'RemoveSnapshot_Task',
|
'RemoveSnapshot_Task',
|
||||||
snapshot, removeChildren=False)
|
snapshot, removeChildren=False)
|
||||||
LOG.debug(_("Initiated snapshot: %(name)s deletion for backing: "
|
LOG.debug("Initiated snapshot: %(name)s deletion for backing: "
|
||||||
"%(backing)s.") %
|
"%(backing)s." %
|
||||||
{'name': name, 'backing': backing})
|
{'name': name, 'backing': backing})
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Successfully deleted snapshot: %(name)s of backing: "
|
LOG.info(_("Successfully deleted snapshot: %(name)s of backing: "
|
||||||
@ -637,7 +637,7 @@ class VMwareVolumeOps(object):
|
|||||||
clone_spec.template = False
|
clone_spec.template = False
|
||||||
clone_spec.snapshot = snapshot
|
clone_spec.snapshot = snapshot
|
||||||
|
|
||||||
LOG.debug(_("Spec for cloning the backing: %s.") % clone_spec)
|
LOG.debug("Spec for cloning the backing: %s." % clone_spec)
|
||||||
return clone_spec
|
return clone_spec
|
||||||
|
|
||||||
def clone_backing(self, name, backing, snapshot, clone_type, datastore):
|
def clone_backing(self, name, backing, snapshot, clone_type, datastore):
|
||||||
@ -653,9 +653,9 @@ class VMwareVolumeOps(object):
|
|||||||
:param clone_type: Whether a full clone or linked clone is to be made
|
:param clone_type: Whether a full clone or linked clone is to be made
|
||||||
:param datastore: Reference to the datastore entity
|
:param datastore: Reference to the datastore entity
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Creating a clone of backing: %(back)s, named: %(name)s, "
|
LOG.debug("Creating a clone of backing: %(back)s, named: %(name)s, "
|
||||||
"clone type: %(type)s from snapshot: %(snap)s on "
|
"clone type: %(type)s from snapshot: %(snap)s on "
|
||||||
"datastore: %(ds)s") %
|
"datastore: %(ds)s" %
|
||||||
{'back': backing, 'name': name, 'type': clone_type,
|
{'back': backing, 'name': name, 'type': clone_type,
|
||||||
'snap': snapshot, 'ds': datastore})
|
'snap': snapshot, 'ds': datastore})
|
||||||
folder = self._get_folder(backing)
|
folder = self._get_folder(backing)
|
||||||
@ -667,7 +667,7 @@ class VMwareVolumeOps(object):
|
|||||||
task = self._session.invoke_api(self._session.vim, 'CloneVM_Task',
|
task = self._session.invoke_api(self._session.vim, 'CloneVM_Task',
|
||||||
backing, folder=folder, name=name,
|
backing, folder=folder, name=name,
|
||||||
spec=clone_spec)
|
spec=clone_spec)
|
||||||
LOG.debug(_("Initiated clone of backing: %s.") % name)
|
LOG.debug("Initiated clone of backing: %s." % name)
|
||||||
task_info = self._session.wait_for_task(task)
|
task_info = self._session.wait_for_task(task)
|
||||||
new_backing = task_info.result
|
new_backing = task_info.result
|
||||||
LOG.info(_("Successfully created clone: %s.") % new_backing)
|
LOG.info(_("Successfully created clone: %s.") % new_backing)
|
||||||
@ -678,7 +678,7 @@ class VMwareVolumeOps(object):
|
|||||||
|
|
||||||
:param file_path: Datastore path of the file or folder
|
:param file_path: Datastore path of the file or folder
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Deleting file: %(file)s under datacenter: %(dc)s.") %
|
LOG.debug("Deleting file: %(file)s under datacenter: %(dc)s." %
|
||||||
{'file': file_path, 'dc': datacenter})
|
{'file': file_path, 'dc': datacenter})
|
||||||
fileManager = self._session.vim.service_content.fileManager
|
fileManager = self._session.vim.service_content.fileManager
|
||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
@ -686,7 +686,7 @@ class VMwareVolumeOps(object):
|
|||||||
fileManager,
|
fileManager,
|
||||||
name=file_path,
|
name=file_path,
|
||||||
datacenter=datacenter)
|
datacenter=datacenter)
|
||||||
LOG.debug(_("Initiated deletion via task: %s.") % task)
|
LOG.debug("Initiated deletion via task: %s." % task)
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Successfully deleted file: %s.") % file_path)
|
LOG.info(_("Successfully deleted file: %s.") % file_path)
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ class VMwareVolumeOps(object):
|
|||||||
:param src_vmdk_file_path: Source vmdk file path
|
:param src_vmdk_file_path: Source vmdk file path
|
||||||
:param dest_vmdk_file_path: Destination vmdk file path
|
:param dest_vmdk_file_path: Destination vmdk file path
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('Copying disk data before snapshot of the VM'))
|
LOG.debug('Copying disk data before snapshot of the VM')
|
||||||
diskMgr = self._session.vim.service_content.virtualDiskManager
|
diskMgr = self._session.vim.service_content.virtualDiskManager
|
||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
'CopyVirtualDisk_Task',
|
'CopyVirtualDisk_Task',
|
||||||
@ -751,7 +751,7 @@ class VMwareVolumeOps(object):
|
|||||||
destName=dest_vmdk_file_path,
|
destName=dest_vmdk_file_path,
|
||||||
destDatacenter=dc_ref,
|
destDatacenter=dc_ref,
|
||||||
force=True)
|
force=True)
|
||||||
LOG.debug(_("Initiated copying disk data via task: %s.") % task)
|
LOG.debug("Initiated copying disk data via task: %s." % task)
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Successfully copied disk at: %(src)s to: %(dest)s.") %
|
LOG.info(_("Successfully copied disk at: %(src)s to: %(dest)s.") %
|
||||||
{'src': src_vmdk_file_path, 'dest': dest_vmdk_file_path})
|
{'src': src_vmdk_file_path, 'dest': dest_vmdk_file_path})
|
||||||
@ -762,14 +762,14 @@ class VMwareVolumeOps(object):
|
|||||||
:param vmdk_file_path: VMDK file path to be deleted
|
:param vmdk_file_path: VMDK file path to be deleted
|
||||||
:param dc_ref: Reference to datacenter that contains this VMDK file
|
:param dc_ref: Reference to datacenter that contains this VMDK file
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Deleting vmdk file: %s.") % vmdk_file_path)
|
LOG.debug("Deleting vmdk file: %s." % vmdk_file_path)
|
||||||
diskMgr = self._session.vim.service_content.virtualDiskManager
|
diskMgr = self._session.vim.service_content.virtualDiskManager
|
||||||
task = self._session.invoke_api(self._session.vim,
|
task = self._session.invoke_api(self._session.vim,
|
||||||
'DeleteVirtualDisk_Task',
|
'DeleteVirtualDisk_Task',
|
||||||
diskMgr,
|
diskMgr,
|
||||||
name=vmdk_file_path,
|
name=vmdk_file_path,
|
||||||
datacenter=dc_ref)
|
datacenter=dc_ref)
|
||||||
LOG.debug(_("Initiated deleting vmdk file via task: %s.") % task)
|
LOG.debug("Initiated deleting vmdk file via task: %s." % task)
|
||||||
self._session.wait_for_task(task)
|
self._session.wait_for_task(task)
|
||||||
LOG.info(_("Deleted vmdk file: %s.") % vmdk_file_path)
|
LOG.info(_("Deleted vmdk file: %s.") % vmdk_file_path)
|
||||||
|
|
||||||
@ -778,7 +778,7 @@ class VMwareVolumeOps(object):
|
|||||||
|
|
||||||
:return: PbmProfile data objects from VC
|
:return: PbmProfile data objects from VC
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get all profiles defined in current VC."))
|
LOG.debug("Get all profiles defined in current VC.")
|
||||||
pbm = self._session.pbm
|
pbm = self._session.pbm
|
||||||
profile_manager = pbm.service_content.profileManager
|
profile_manager = pbm.service_content.profileManager
|
||||||
res_type = pbm.client.factory.create('ns0:PbmProfileResourceType')
|
res_type = pbm.client.factory.create('ns0:PbmProfileResourceType')
|
||||||
@ -786,7 +786,7 @@ class VMwareVolumeOps(object):
|
|||||||
profileIds = self._session.invoke_api(pbm, 'PbmQueryProfile',
|
profileIds = self._session.invoke_api(pbm, 'PbmQueryProfile',
|
||||||
profile_manager,
|
profile_manager,
|
||||||
resourceType=res_type)
|
resourceType=res_type)
|
||||||
LOG.debug(_("Got profile IDs: %s"), profileIds)
|
LOG.debug("Got profile IDs: %s", profileIds)
|
||||||
return self._session.invoke_api(pbm, 'PbmRetrieveContent',
|
return self._session.invoke_api(pbm, 'PbmRetrieveContent',
|
||||||
profile_manager,
|
profile_manager,
|
||||||
profileIds=profileIds)
|
profileIds=profileIds)
|
||||||
@ -797,11 +797,11 @@ class VMwareVolumeOps(object):
|
|||||||
:param profile_name: profile name as string
|
:param profile_name: profile name as string
|
||||||
:return: profile id as string
|
:return: profile id as string
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Trying to retrieve profile id for %s"), profile_name)
|
LOG.debug("Trying to retrieve profile id for %s", profile_name)
|
||||||
for profile in self.get_all_profiles():
|
for profile in self.get_all_profiles():
|
||||||
if profile.name == profile_name:
|
if profile.name == profile_name:
|
||||||
profileId = profile.profileId
|
profileId = profile.profileId
|
||||||
LOG.debug(_("Got profile id %(id)s for profile %(name)s."),
|
LOG.debug("Got profile id %(id)s for profile %(name)s.",
|
||||||
{'id': profileId, 'name': profile_name})
|
{'id': profileId, 'name': profile_name})
|
||||||
return profileId
|
return profileId
|
||||||
|
|
||||||
@ -812,13 +812,13 @@ class VMwareVolumeOps(object):
|
|||||||
:param profile_id: profile id string
|
:param profile_id: profile id string
|
||||||
:return: subset of hubs that match given profile_id
|
:return: subset of hubs that match given profile_id
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Filtering hubs %(hubs)s that match profile "
|
LOG.debug("Filtering hubs %(hubs)s that match profile "
|
||||||
"%(profile)s."), {'hubs': hubs, 'profile': profile_id})
|
"%(profile)s.", {'hubs': hubs, 'profile': profile_id})
|
||||||
pbm = self._session.pbm
|
pbm = self._session.pbm
|
||||||
placement_solver = pbm.service_content.placementSolver
|
placement_solver = pbm.service_content.placementSolver
|
||||||
filtered_hubs = self._session.invoke_api(pbm, 'PbmQueryMatchingHub',
|
filtered_hubs = self._session.invoke_api(pbm, 'PbmQueryMatchingHub',
|
||||||
placement_solver,
|
placement_solver,
|
||||||
hubsToSearch=hubs,
|
hubsToSearch=hubs,
|
||||||
profile=profile_id)
|
profile=profile_id)
|
||||||
LOG.debug(_("Filtered hubs: %s"), filtered_hubs)
|
LOG.debug("Filtered hubs: %s", filtered_hubs)
|
||||||
return filtered_hubs
|
return filtered_hubs
|
||||||
|
@ -99,7 +99,7 @@ class WindowsDriver(driver.ISCSIDriver):
|
|||||||
def local_path(self, volume):
|
def local_path(self, volume):
|
||||||
base_vhd_folder = self.configuration.windows_iscsi_lun_path
|
base_vhd_folder = self.configuration.windows_iscsi_lun_path
|
||||||
if not os.path.exists(base_vhd_folder):
|
if not os.path.exists(base_vhd_folder):
|
||||||
LOG.debug(_('Creating folder %s '), base_vhd_folder)
|
LOG.debug('Creating folder %s ', base_vhd_folder)
|
||||||
os.makedirs(base_vhd_folder)
|
os.makedirs(base_vhd_folder)
|
||||||
return os.path.join(base_vhd_folder, str(volume['name']) + ".vhd")
|
return os.path.join(base_vhd_folder, str(volume['name']) + ".vhd")
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ class WindowsDriver(driver.ISCSIDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info for Windows device."""
|
"""Retrieve stats info for Windows device."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
backend_name = self.__class__.__name__
|
backend_name = self.__class__.__name__
|
||||||
if self.configuration:
|
if self.configuration:
|
||||||
@ -220,7 +220,7 @@ class WindowsDriver(driver.ISCSIDriver):
|
|||||||
def extend_volume(self, volume, new_size):
|
def extend_volume(self, volume, new_size):
|
||||||
"""Extend an Existing Volume."""
|
"""Extend an Existing Volume."""
|
||||||
old_size = volume['size']
|
old_size = volume['size']
|
||||||
LOG.debug(_("Extend volume from %(old_size)s GB to %(new_size)s GB."),
|
LOG.debug("Extend volume from %(old_size)s GB to %(new_size)s GB.",
|
||||||
{'old_size': old_size, 'new_size': new_size})
|
{'old_size': old_size, 'new_size': new_size})
|
||||||
additional_size = (new_size - old_size) * 1024
|
additional_size = (new_size - old_size) * 1024
|
||||||
self.utils.extend(volume['name'], additional_size)
|
self.utils.extend(volume['name'], additional_size)
|
||||||
|
@ -150,8 +150,8 @@ class WindowsUtils(object):
|
|||||||
try:
|
try:
|
||||||
disk = self._conn_wmi.WT_Disk(Description=vol_name)
|
disk = self._conn_wmi.WT_Disk(Description=vol_name)
|
||||||
if not disk:
|
if not disk:
|
||||||
LOG.debug(_('Skipping deleting disk %s as it does not '
|
LOG.debug('Skipping deleting disk %s as it does not '
|
||||||
'exist.') % vol_name)
|
'exist.' % vol_name)
|
||||||
return
|
return
|
||||||
wt_disk = disk[0]
|
wt_disk = disk[0]
|
||||||
wt_disk.Delete_()
|
wt_disk.Delete_()
|
||||||
@ -242,8 +242,8 @@ class WindowsUtils(object):
|
|||||||
try:
|
try:
|
||||||
host = self._conn_wmi.WT_Host(HostName=target_name)
|
host = self._conn_wmi.WT_Host(HostName=target_name)
|
||||||
if not host:
|
if not host:
|
||||||
LOG.debug(_('Skipping removing target %s as it does not '
|
LOG.debug('Skipping removing target %s as it does not '
|
||||||
'exist.') % target_name)
|
'exist.' % target_name)
|
||||||
return
|
return
|
||||||
wt_host = host[0]
|
wt_host = host[0]
|
||||||
wt_host.RemoveAllWTDisks()
|
wt_host.RemoveAllWTDisks()
|
||||||
|
@ -233,7 +233,7 @@ class ZadaraVPSAConnection(object):
|
|||||||
self.ensure_connection(cmd)
|
self.ensure_connection(cmd)
|
||||||
|
|
||||||
(method, url, body) = self._generate_vpsa_cmd(cmd, **kwargs)
|
(method, url, body) = self._generate_vpsa_cmd(cmd, **kwargs)
|
||||||
LOG.debug(_('Sending %(method)s to %(url)s. Body "%(body)s"'),
|
LOG.debug('Sending %(method)s to %(url)s. Body "%(body)s"',
|
||||||
{'method': method, 'url': url, 'body': body})
|
{'method': method, 'url': url, 'body': body})
|
||||||
|
|
||||||
if self.conf.zadara_vpsa_use_ssl:
|
if self.conf.zadara_vpsa_use_ssl:
|
||||||
@ -257,7 +257,7 @@ class ZadaraVPSAConnection(object):
|
|||||||
raise exception.FailedCmdWithDump(status=status, data=data)
|
raise exception.FailedCmdWithDump(status=status, data=data)
|
||||||
|
|
||||||
if method in ['POST', 'DELETE']:
|
if method in ['POST', 'DELETE']:
|
||||||
LOG.debug(_('Operation completed. %(data)s'), {'data': data})
|
LOG.debug('Operation completed. %(data)s', {'data': data})
|
||||||
return xml_tree
|
return xml_tree
|
||||||
|
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
if pool is not None:
|
if pool is not None:
|
||||||
total = int(pool.findtext('capacity'))
|
total = int(pool.findtext('capacity'))
|
||||||
free = int(float(pool.findtext('available-capacity')))
|
free = int(float(pool.findtext('available-capacity')))
|
||||||
LOG.debug(_('Pool %(name)s: %(total)sGB total, %(free)sGB free'),
|
LOG.debug('Pool %(name)s: %(total)sGB total, %(free)sGB free',
|
||||||
{'name': pool_name, 'total': total, 'free': free})
|
{'name': pool_name, 'total': total, 'free': free})
|
||||||
return (total, free)
|
return (total, free)
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
def create_snapshot(self, snapshot):
|
def create_snapshot(self, snapshot):
|
||||||
"""Creates a snapshot."""
|
"""Creates a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('Create snapshot: %s'), snapshot['name'])
|
LOG.debug('Create snapshot: %s', snapshot['name'])
|
||||||
|
|
||||||
# Retrieve the CG name for the base volume
|
# Retrieve the CG name for the base volume
|
||||||
volume_name = self.configuration.zadara_vol_name_template\
|
volume_name = self.configuration.zadara_vol_name_template\
|
||||||
@ -453,7 +453,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
def delete_snapshot(self, snapshot):
|
def delete_snapshot(self, snapshot):
|
||||||
"""Deletes a snapshot."""
|
"""Deletes a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('Delete snapshot: %s'), snapshot['name'])
|
LOG.debug('Delete snapshot: %s', snapshot['name'])
|
||||||
|
|
||||||
# Retrieve the CG name for the base volume
|
# Retrieve the CG name for the base volume
|
||||||
volume_name = self.configuration.zadara_vol_name_template\
|
volume_name = self.configuration.zadara_vol_name_template\
|
||||||
@ -480,7 +480,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Creates a volume from a snapshot."""
|
"""Creates a volume from a snapshot."""
|
||||||
|
|
||||||
LOG.debug(_('Creating volume from snapshot: %s') % snapshot['name'])
|
LOG.debug('Creating volume from snapshot: %s' % snapshot['name'])
|
||||||
|
|
||||||
# Retrieve the CG name for the base volume
|
# Retrieve the CG name for the base volume
|
||||||
volume_name = self.configuration.zadara_vol_name_template\
|
volume_name = self.configuration.zadara_vol_name_template\
|
||||||
@ -506,7 +506,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
def create_cloned_volume(self, volume, src_vref):
|
def create_cloned_volume(self, volume, src_vref):
|
||||||
"""Creates a clone of the specified volume."""
|
"""Creates a clone of the specified volume."""
|
||||||
|
|
||||||
LOG.debug(_('Creating clone of volume: %s') % src_vref['name'])
|
LOG.debug('Creating clone of volume: %s' % src_vref['name'])
|
||||||
|
|
||||||
# Retrieve the CG name for the base volume
|
# Retrieve the CG name for the base volume
|
||||||
volume_name = self.configuration.zadara_vol_name_template\
|
volume_name = self.configuration.zadara_vol_name_template\
|
||||||
@ -611,7 +611,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
properties['auth_username'] = ctrl['chap_user']
|
properties['auth_username'] = ctrl['chap_user']
|
||||||
properties['auth_password'] = ctrl['chap_passwd']
|
properties['auth_password'] = ctrl['chap_passwd']
|
||||||
|
|
||||||
LOG.debug(_('Attach properties: %(properties)s'),
|
LOG.debug('Attach properties: %(properties)s',
|
||||||
{'properties': properties})
|
{'properties': properties})
|
||||||
return {'driver_volume_type': 'iscsi',
|
return {'driver_volume_type': 'iscsi',
|
||||||
'data': properties}
|
'data': properties}
|
||||||
@ -647,7 +647,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
def _update_volume_stats(self):
|
def _update_volume_stats(self):
|
||||||
"""Retrieve stats info from volume group."""
|
"""Retrieve stats info from volume group."""
|
||||||
|
|
||||||
LOG.debug(_("Updating volume stats"))
|
LOG.debug("Updating volume stats")
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
backend_name = self.configuration.safe_get('volume_backend_name')
|
backend_name = self.configuration.safe_get('volume_backend_name')
|
||||||
|
@ -50,7 +50,7 @@ def restore_source_status(context, db, volume_spec):
|
|||||||
source_volid = volume_spec['source_volid']
|
source_volid = volume_spec['source_volid']
|
||||||
source_status = volume_spec['source_volstatus']
|
source_status = volume_spec['source_volstatus']
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Restoring source %(source_volid)s status to %(status)s') %
|
LOG.debug('Restoring source %(source_volid)s status to %(status)s' %
|
||||||
{'status': source_status, 'source_volid': source_volid})
|
{'status': source_status, 'source_volid': source_volid})
|
||||||
db.volume_update(context, source_volid, {'status': source_status})
|
db.volume_update(context, source_volid, {'status': source_status})
|
||||||
except exception.CinderException:
|
except exception.CinderException:
|
||||||
@ -81,10 +81,10 @@ def error_out_volume(context, db, volume_id, reason=None):
|
|||||||
# if reason:
|
# if reason:
|
||||||
# status['details'] = reason
|
# status['details'] = reason
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Updating volume: %(volume_id)s with %(update)s'
|
LOG.debug('Updating volume: %(volume_id)s with %(update)s'
|
||||||
' due to: %(reason)s') % {'volume_id': volume_id,
|
' due to: %(reason)s' % {'volume_id': volume_id,
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
'update': update})
|
'update': update})
|
||||||
db.volume_update(context, volume_id, update)
|
db.volume_update(context, volume_id, update)
|
||||||
except exception.CinderException:
|
except exception.CinderException:
|
||||||
# Don't let this cause further exceptions.
|
# Don't let this cause further exceptions.
|
||||||
|
@ -98,8 +98,8 @@ class OnFailureRescheduleTask(flow_utils.CinderTask):
|
|||||||
num_attempts = retry_info.get('num_attempts', 0)
|
num_attempts = retry_info.get('num_attempts', 0)
|
||||||
request_spec['volume_id'] = volume_id
|
request_spec['volume_id'] = volume_id
|
||||||
|
|
||||||
LOG.debug(_("Volume %(volume_id)s: re-scheduling %(method)s "
|
LOG.debug("Volume %(volume_id)s: re-scheduling %(method)s "
|
||||||
"attempt %(num)d due to %(reason)s") %
|
"attempt %(num)d due to %(reason)s" %
|
||||||
{'volume_id': volume_id,
|
{'volume_id': volume_id,
|
||||||
'method': common.make_pretty_name(create_volume),
|
'method': common.make_pretty_name(create_volume),
|
||||||
'num': num_attempts,
|
'num': num_attempts,
|
||||||
@ -117,7 +117,7 @@ class OnFailureRescheduleTask(flow_utils.CinderTask):
|
|||||||
def _post_reschedule(self, context, volume_id):
|
def _post_reschedule(self, context, volume_id):
|
||||||
"""Actions that happen after the rescheduling attempt occur here."""
|
"""Actions that happen after the rescheduling attempt occur here."""
|
||||||
|
|
||||||
LOG.debug(_("Volume %s: re-scheduled"), volume_id)
|
LOG.debug("Volume %s: re-scheduled", volume_id)
|
||||||
|
|
||||||
def _pre_reschedule(self, context, volume_id):
|
def _pre_reschedule(self, context, volume_id):
|
||||||
"""Actions that happen before the rescheduling attempt occur here."""
|
"""Actions that happen before the rescheduling attempt occur here."""
|
||||||
@ -134,7 +134,7 @@ class OnFailureRescheduleTask(flow_utils.CinderTask):
|
|||||||
'status': 'creating',
|
'status': 'creating',
|
||||||
'scheduled_at': timeutils.utcnow(),
|
'scheduled_at': timeutils.utcnow(),
|
||||||
}
|
}
|
||||||
LOG.debug(_("Updating volume %(volume_id)s with %(update)s.") %
|
LOG.debug("Updating volume %(volume_id)s with %(update)s." %
|
||||||
{'update': update, 'volume_id': volume_id})
|
{'update': update, 'volume_id': volume_id})
|
||||||
self.db.volume_update(context, volume_id, update)
|
self.db.volume_update(context, volume_id, update)
|
||||||
except exception.CinderException:
|
except exception.CinderException:
|
||||||
@ -406,7 +406,7 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
|
|||||||
|
|
||||||
def _enable_bootable_flag(self, context, volume_id):
|
def _enable_bootable_flag(self, context, volume_id):
|
||||||
try:
|
try:
|
||||||
LOG.debug(_('Marking volume %s as bootable.'), volume_id)
|
LOG.debug('Marking volume %s as bootable.', volume_id)
|
||||||
self.db.volume_update(context, volume_id, {'bootable': True})
|
self.db.volume_update(context, volume_id, {'bootable': True})
|
||||||
except exception.CinderException as ex:
|
except exception.CinderException as ex:
|
||||||
LOG.exception(_("Failed updating volume %(volume_id)s bootable"
|
LOG.exception(_("Failed updating volume %(volume_id)s bootable"
|
||||||
@ -436,8 +436,8 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
|
|||||||
"""Downloads Glance image to the specified volume."""
|
"""Downloads Glance image to the specified volume."""
|
||||||
copy_image_to_volume = self.driver.copy_image_to_volume
|
copy_image_to_volume = self.driver.copy_image_to_volume
|
||||||
volume_id = volume_ref['id']
|
volume_id = volume_ref['id']
|
||||||
LOG.debug(_("Attempting download of %(image_id)s (%(image_location)s)"
|
LOG.debug("Attempting download of %(image_id)s (%(image_location)s)"
|
||||||
" to volume %(volume_id)s.") %
|
" to volume %(volume_id)s." %
|
||||||
{'image_id': image_id, 'volume_id': volume_id,
|
{'image_id': image_id, 'volume_id': volume_id,
|
||||||
'image_location': image_location})
|
'image_location': image_location})
|
||||||
try:
|
try:
|
||||||
@ -463,8 +463,8 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
|
|||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
LOG.debug(_("Downloaded image %(image_id)s (%(image_location)s)"
|
LOG.debug("Downloaded image %(image_id)s (%(image_location)s)"
|
||||||
" to volume %(volume_id)s successfully.") %
|
" to volume %(volume_id)s successfully." %
|
||||||
{'image_id': image_id, 'volume_id': volume_id,
|
{'image_id': image_id, 'volume_id': volume_id,
|
||||||
'image_location': image_location})
|
'image_location': image_location})
|
||||||
|
|
||||||
@ -500,8 +500,8 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
|
|||||||
# which means we can have partial create/update failure.
|
# which means we can have partial create/update failure.
|
||||||
volume_metadata = dict(property_metadata)
|
volume_metadata = dict(property_metadata)
|
||||||
volume_metadata.update(base_metadata)
|
volume_metadata.update(base_metadata)
|
||||||
LOG.debug(_("Creating volume glance metadata for volume %(volume_id)s"
|
LOG.debug("Creating volume glance metadata for volume %(volume_id)s"
|
||||||
" backed by image %(image_id)s with: %(vol_metadata)s.") %
|
" backed by image %(image_id)s with: %(vol_metadata)s." %
|
||||||
{'volume_id': volume_id, 'image_id': image_id,
|
{'volume_id': volume_id, 'image_id': image_id,
|
||||||
'vol_metadata': volume_metadata})
|
'vol_metadata': volume_metadata})
|
||||||
for (key, value) in volume_metadata.items():
|
for (key, value) in volume_metadata.items():
|
||||||
@ -514,8 +514,8 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask):
|
|||||||
def _create_from_image(self, context, volume_ref,
|
def _create_from_image(self, context, volume_ref,
|
||||||
image_location, image_id, image_meta,
|
image_location, image_id, image_meta,
|
||||||
image_service, **kwargs):
|
image_service, **kwargs):
|
||||||
LOG.debug(_("Cloning %(volume_id)s from image %(image_id)s "
|
LOG.debug("Cloning %(volume_id)s from image %(image_id)s "
|
||||||
" at location %(image_location)s.") %
|
" at location %(image_location)s." %
|
||||||
{'volume_id': volume_ref['id'],
|
{'volume_id': volume_ref['id'],
|
||||||
'image_location': image_location, 'image_id': image_id})
|
'image_location': image_location, 'image_id': image_id})
|
||||||
# Create the volume from an image.
|
# Create the volume from an image.
|
||||||
|
@ -98,7 +98,7 @@ class _ExportMixin(object):
|
|||||||
volume['name'] not in volume['provider_location']):
|
volume['name'] not in volume['provider_location']):
|
||||||
|
|
||||||
msg = _('Detected inconsistency in provider_location id')
|
msg = _('Detected inconsistency in provider_location id')
|
||||||
LOG.debug(_('%s'), msg)
|
LOG.debug('%s', msg)
|
||||||
old_name = self._fix_id_migration(context, volume)
|
old_name = self._fix_id_migration(context, volume)
|
||||||
if 'in-use' in volume['status']:
|
if 'in-use' in volume['status']:
|
||||||
old_name = None
|
old_name = None
|
||||||
@ -181,7 +181,7 @@ class _ExportMixin(object):
|
|||||||
except putils.ProcessExecutionError:
|
except putils.ProcessExecutionError:
|
||||||
link_path = '/dev/%s/%s' % (CONF.volume_group,
|
link_path = '/dev/%s/%s' % (CONF.volume_group,
|
||||||
old_name)
|
old_name)
|
||||||
LOG.debug(_('Symbolic link %s not found') % link_path)
|
LOG.debug('Symbolic link %s not found' % link_path)
|
||||||
os.chdir(start)
|
os.chdir(start)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ class LioAdm(_ExportMixin, iscsi.LioAdm):
|
|||||||
auth_user,
|
auth_user,
|
||||||
auth_pass)
|
auth_pass)
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
LOG.debug(_("volume_info:%s"), volume_info)
|
LOG.debug("volume_info:%s", volume_info)
|
||||||
LOG.info(_("Skipping ensure_export. No iscsi_target "
|
LOG.info(_("Skipping ensure_export. No iscsi_target "
|
||||||
"provision for volume: %s"), volume_id)
|
"provision for volume: %s"), volume_id)
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
return
|
return
|
||||||
|
|
||||||
volumes = self.db.volume_get_all_by_host(ctxt, self.host)
|
volumes = self.db.volume_get_all_by_host(ctxt, self.host)
|
||||||
LOG.debug(_("Re-exporting %s volumes"), len(volumes))
|
LOG.debug("Re-exporting %s volumes", len(volumes))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sum = 0
|
sum = 0
|
||||||
@ -262,7 +262,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
# at this point the driver is considered initialized.
|
# at this point the driver is considered initialized.
|
||||||
self.driver.set_initialized()
|
self.driver.set_initialized()
|
||||||
|
|
||||||
LOG.debug(_('Resuming any in progress delete operations'))
|
LOG.debug('Resuming any in progress delete operations')
|
||||||
for volume in volumes:
|
for volume in volumes:
|
||||||
if volume['status'] == 'deleting':
|
if volume['status'] == 'deleting':
|
||||||
LOG.info(_('Resuming delete on volume: %s') % volume['id'])
|
LOG.info(_('Resuming delete on volume: %s') % volume['id'])
|
||||||
@ -376,9 +376,9 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
# and the volume status updated.
|
# and the volume status updated.
|
||||||
utils.require_driver_initialized(self.driver)
|
utils.require_driver_initialized(self.driver)
|
||||||
|
|
||||||
LOG.debug(_("volume %s: removing export"), volume_ref['id'])
|
LOG.debug("volume %s: removing export", volume_ref['id'])
|
||||||
self.driver.remove_export(context, volume_ref)
|
self.driver.remove_export(context, volume_ref)
|
||||||
LOG.debug(_("volume %s: deleting"), volume_ref['id'])
|
LOG.debug("volume %s: deleting", volume_ref['id'])
|
||||||
if unmanage_only:
|
if unmanage_only:
|
||||||
self.driver.unmanage(volume_ref)
|
self.driver.unmanage(volume_ref)
|
||||||
else:
|
else:
|
||||||
@ -445,7 +445,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
# and the snapshot status updated.
|
# and the snapshot status updated.
|
||||||
utils.require_driver_initialized(self.driver)
|
utils.require_driver_initialized(self.driver)
|
||||||
|
|
||||||
LOG.debug(_("snapshot %(snap_id)s: creating"),
|
LOG.debug("snapshot %(snap_id)s: creating",
|
||||||
{'snap_id': snapshot_ref['id']})
|
{'snap_id': snapshot_ref['id']})
|
||||||
|
|
||||||
# Pass context so that drivers that want to use it, can,
|
# Pass context so that drivers that want to use it, can,
|
||||||
@ -505,7 +505,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
# and the snapshot status updated.
|
# and the snapshot status updated.
|
||||||
utils.require_driver_initialized(self.driver)
|
utils.require_driver_initialized(self.driver)
|
||||||
|
|
||||||
LOG.debug(_("snapshot %s: deleting"), snapshot_ref['id'])
|
LOG.debug("snapshot %s: deleting", snapshot_ref['id'])
|
||||||
|
|
||||||
# Pass context so that drivers that want to use it, can,
|
# Pass context so that drivers that want to use it, can,
|
||||||
# but it is not a requirement for all drivers.
|
# but it is not a requirement for all drivers.
|
||||||
@ -697,8 +697,8 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
glance.get_remote_image_service(context, image_meta['id'])
|
glance.get_remote_image_service(context, image_meta['id'])
|
||||||
self.driver.copy_volume_to_image(context, volume, image_service,
|
self.driver.copy_volume_to_image(context, volume, image_service,
|
||||||
image_meta)
|
image_meta)
|
||||||
LOG.debug(_("Uploaded volume %(volume_id)s to "
|
LOG.debug("Uploaded volume %(volume_id)s to "
|
||||||
"image (%(image_id)s) successfully"),
|
"image (%(image_id)s) successfully",
|
||||||
{'volume_id': volume_id, 'image_id': image_id})
|
{'volume_id': volume_id, 'image_id': image_id})
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
LOG.error(_("Error occurred while uploading volume %(volume_id)s "
|
LOG.error(_("Error occurred while uploading volume %(volume_id)s "
|
||||||
@ -786,7 +786,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
volume = self.db.volume_get(context, volume_id)
|
volume = self.db.volume_get(context, volume_id)
|
||||||
model_update = None
|
model_update = None
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Volume %s: creating export"), volume_id)
|
LOG.debug("Volume %s: creating export", volume_id)
|
||||||
model_update = self.driver.create_export(context.elevated(),
|
model_update = self.driver.create_export(context.elevated(),
|
||||||
volume)
|
volume)
|
||||||
if model_update:
|
if model_update:
|
||||||
@ -840,7 +840,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
# FCZoneManager to add access control via FC zoning.
|
# FCZoneManager to add access control via FC zoning.
|
||||||
vol_type = conn_info.get('driver_volume_type', None)
|
vol_type = conn_info.get('driver_volume_type', None)
|
||||||
mode = self.configuration.zoning_mode
|
mode = self.configuration.zoning_mode
|
||||||
LOG.debug(_("Zoning Mode: %s"), mode)
|
LOG.debug("Zoning Mode: %s", mode)
|
||||||
if vol_type == 'fibre_channel' and self.zonemanager:
|
if vol_type == 'fibre_channel' and self.zonemanager:
|
||||||
self._add_or_delete_fc_connection(conn_info, 1)
|
self._add_or_delete_fc_connection(conn_info, 1)
|
||||||
return conn_info
|
return conn_info
|
||||||
@ -865,7 +865,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
if conn_info:
|
if conn_info:
|
||||||
vol_type = conn_info.get('driver_volume_type', None)
|
vol_type = conn_info.get('driver_volume_type', None)
|
||||||
mode = self.configuration.zoning_mode
|
mode = self.configuration.zoning_mode
|
||||||
LOG.debug(_("Zoning Mode: %s"), mode)
|
LOG.debug("Zoning Mode: %s", mode)
|
||||||
if vol_type == 'fibre_channel' and self.zonemanager:
|
if vol_type == 'fibre_channel' and self.zonemanager:
|
||||||
self._add_or_delete_fc_connection(conn_info, 0)
|
self._add_or_delete_fc_connection(conn_info, 0)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
@ -875,7 +875,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
raise exception.VolumeBackendAPIException(data=err_msg)
|
raise exception.VolumeBackendAPIException(data=err_msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("volume %s: removing export"), volume_id)
|
LOG.debug("volume %s: removing export", volume_id)
|
||||||
self.driver.remove_export(context.elevated(), volume_ref)
|
self.driver.remove_export(context.elevated(), volume_ref)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.exception(_("Error detaching volume %(volume)s, "
|
LOG.exception(_("Error detaching volume %(volume)s, "
|
||||||
@ -1047,7 +1047,7 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
{'migration_status': 'migrating'})
|
{'migration_status': 'migrating'})
|
||||||
if not force_host_copy and new_type_id is None:
|
if not force_host_copy and new_type_id is None:
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("volume %s: calling driver migrate_volume"),
|
LOG.debug("volume %s: calling driver migrate_volume",
|
||||||
volume_ref['id'])
|
volume_ref['id'])
|
||||||
moved, model_update = self.driver.migrate_volume(ctxt,
|
moved, model_update = self.driver.migrate_volume(ctxt,
|
||||||
volume_ref,
|
volume_ref,
|
||||||
@ -1326,12 +1326,12 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
_initiator_target_map = None
|
_initiator_target_map = None
|
||||||
if 'initiator_target_map' in conn_info['data']:
|
if 'initiator_target_map' in conn_info['data']:
|
||||||
_initiator_target_map = conn_info['data']['initiator_target_map']
|
_initiator_target_map = conn_info['data']['initiator_target_map']
|
||||||
LOG.debug(_("Initiator Target map:%s"), _initiator_target_map)
|
LOG.debug("Initiator Target map:%s", _initiator_target_map)
|
||||||
# NOTE(skolathur): Invoke Zonemanager to handle automated FC zone
|
# NOTE(skolathur): Invoke Zonemanager to handle automated FC zone
|
||||||
# management when vol_type is fibre_channel and zoning_mode is fabric
|
# management when vol_type is fibre_channel and zoning_mode is fabric
|
||||||
# Initiator_target map associating each initiator WWN to one or more
|
# Initiator_target map associating each initiator WWN to one or more
|
||||||
# target WWN is passed to ZoneManager to add or update zone config.
|
# target WWN is passed to ZoneManager to add or update zone config.
|
||||||
LOG.debug(_("Zoning op: %s"), zone_op)
|
LOG.debug("Zoning op: %s", zone_op)
|
||||||
if _initiator_target_map is not None:
|
if _initiator_target_map is not None:
|
||||||
try:
|
try:
|
||||||
if zone_op == 1:
|
if zone_op == 1:
|
||||||
|
@ -237,7 +237,7 @@ def get_all_specs(context, inactive=False, search_opts={}):
|
|||||||
qos_specs = db.qos_specs_get_all(context, inactive)
|
qos_specs = db.qos_specs_get_all(context, inactive)
|
||||||
|
|
||||||
if search_opts:
|
if search_opts:
|
||||||
LOG.debug(_("Searching by: %s") % search_opts)
|
LOG.debug("Searching by: %s" % search_opts)
|
||||||
|
|
||||||
def _check_specs_match(qos_specs, searchdict):
|
def _check_specs_match(qos_specs, searchdict):
|
||||||
for k, v in searchdict.iteritems():
|
for k, v in searchdict.iteritems():
|
||||||
|
@ -64,7 +64,7 @@ def get_all_types(context, inactive=0, search_opts={}):
|
|||||||
vol_types = db.volume_type_get_all(context, inactive)
|
vol_types = db.volume_type_get_all(context, inactive)
|
||||||
|
|
||||||
if search_opts:
|
if search_opts:
|
||||||
LOG.debug(_("Searching by: %s") % search_opts)
|
LOG.debug("Searching by: %s" % search_opts)
|
||||||
|
|
||||||
def _check_extra_specs_match(vol_type, searchdict):
|
def _check_extra_specs_match(vol_type, searchdict):
|
||||||
for k, v in searchdict.iteritems():
|
for k, v in searchdict.iteritems():
|
||||||
|
@ -52,7 +52,7 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
config = self.configuration
|
config = self.configuration
|
||||||
|
|
||||||
fabric_names = [x.strip() for x in config.fc_fabric_names.split(',')]
|
fabric_names = [x.strip() for x in config.fc_fabric_names.split(',')]
|
||||||
LOG.debug(_('Fabric Names: %s'), fabric_names)
|
LOG.debug('Fabric Names: %s', fabric_names)
|
||||||
|
|
||||||
# There can be more than one SAN in the network and we need to
|
# There can be more than one SAN in the network and we need to
|
||||||
# get credentials for each for SAN context lookup later.
|
# get credentials for each for SAN context lookup later.
|
||||||
@ -106,7 +106,7 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
"param - fc_fabric_names"))
|
"param - fc_fabric_names"))
|
||||||
|
|
||||||
fabrics = [x.strip() for x in fabric_names.split(',')]
|
fabrics = [x.strip() for x in fabric_names.split(',')]
|
||||||
LOG.debug(_("FC Fabric List: %s"), fabrics)
|
LOG.debug("FC Fabric List: %s", fabrics)
|
||||||
if fabrics:
|
if fabrics:
|
||||||
for t in target_wwn_list:
|
for t in target_wwn_list:
|
||||||
formatted_target_list.append(self.get_formatted_wwn(t))
|
formatted_target_list.append(self.get_formatted_wwn(t))
|
||||||
@ -132,8 +132,8 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
# logged in
|
# logged in
|
||||||
nsinfo = ''
|
nsinfo = ''
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Getting name server data for "
|
LOG.debug("Getting name server data for "
|
||||||
"fabric %s"), fabric_ip)
|
"fabric %s", fabric_ip)
|
||||||
self.client.connect(
|
self.client.connect(
|
||||||
fabric_ip, fabric_port, fabric_user, fabric_pwd)
|
fabric_ip, fabric_port, fabric_user, fabric_pwd)
|
||||||
nsinfo = self.get_nameserver_info()
|
nsinfo = self.get_nameserver_info()
|
||||||
@ -149,24 +149,24 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
raise exception.FCSanLookupServiceException(message=msg)
|
raise exception.FCSanLookupServiceException(message=msg)
|
||||||
finally:
|
finally:
|
||||||
self.close_connection()
|
self.close_connection()
|
||||||
LOG.debug(_("Lookup service:nsinfo-%s"), nsinfo)
|
LOG.debug("Lookup service:nsinfo-%s", nsinfo)
|
||||||
LOG.debug(_("Lookup service:initiator list from "
|
LOG.debug("Lookup service:initiator list from "
|
||||||
"caller-%s"), formatted_initiator_list)
|
"caller-%s", formatted_initiator_list)
|
||||||
LOG.debug(_("Lookup service:target list from "
|
LOG.debug("Lookup service:target list from "
|
||||||
"caller-%s"), formatted_target_list)
|
"caller-%s", formatted_target_list)
|
||||||
visible_targets = filter(lambda x: x in formatted_target_list,
|
visible_targets = filter(lambda x: x in formatted_target_list,
|
||||||
nsinfo)
|
nsinfo)
|
||||||
visible_initiators = filter(lambda x: x in
|
visible_initiators = filter(lambda x: x in
|
||||||
formatted_initiator_list, nsinfo)
|
formatted_initiator_list, nsinfo)
|
||||||
|
|
||||||
if visible_targets:
|
if visible_targets:
|
||||||
LOG.debug(_("Filtered targets is: %s"), visible_targets)
|
LOG.debug("Filtered targets is: %s", visible_targets)
|
||||||
# getting rid of the : before returning
|
# getting rid of the : before returning
|
||||||
for idx, elem in enumerate(visible_targets):
|
for idx, elem in enumerate(visible_targets):
|
||||||
elem = str(elem).replace(':', '')
|
elem = str(elem).replace(':', '')
|
||||||
visible_targets[idx] = elem
|
visible_targets[idx] = elem
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No targets are in the nameserver for SAN %s"),
|
LOG.debug("No targets are in the nameserver for SAN %s",
|
||||||
fabric_name)
|
fabric_name)
|
||||||
|
|
||||||
if visible_initiators:
|
if visible_initiators:
|
||||||
@ -175,15 +175,15 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
elem = str(elem).replace(':', '')
|
elem = str(elem).replace(':', '')
|
||||||
visible_initiators[idx] = elem
|
visible_initiators[idx] = elem
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No initiators are in the nameserver "
|
LOG.debug("No initiators are in the nameserver "
|
||||||
"for SAN %s"), fabric_name)
|
"for SAN %s", fabric_name)
|
||||||
|
|
||||||
fabric_map = {
|
fabric_map = {
|
||||||
'initiator_port_wwn_list': visible_initiators,
|
'initiator_port_wwn_list': visible_initiators,
|
||||||
'target_port_wwn_list': visible_targets
|
'target_port_wwn_list': visible_targets
|
||||||
}
|
}
|
||||||
device_map[fabric_principal_wwn] = fabric_map
|
device_map[fabric_principal_wwn] = fabric_map
|
||||||
LOG.debug(_("Device map for SAN context: %s"), device_map)
|
LOG.debug("Device map for SAN context: %s", device_map)
|
||||||
return device_map
|
return device_map
|
||||||
|
|
||||||
def get_nameserver_info(self):
|
def get_nameserver_info(self):
|
||||||
@ -208,7 +208,7 @@ class BrcdFCSanLookupService(FCSanLookupService):
|
|||||||
LOG.error(_("Failed collecting nscamshow"))
|
LOG.error(_("Failed collecting nscamshow"))
|
||||||
if cli_output:
|
if cli_output:
|
||||||
nsinfo_list.extend(self._parse_ns_output(cli_output))
|
nsinfo_list.extend(self._parse_ns_output(cli_output))
|
||||||
LOG.debug(_("Connector returning nsinfo-%s"), nsinfo_list)
|
LOG.debug("Connector returning nsinfo-%s", nsinfo_list)
|
||||||
return nsinfo_list
|
return nsinfo_list
|
||||||
|
|
||||||
def close_connection(self):
|
def close_connection(self):
|
||||||
|
@ -127,14 +127,14 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
}
|
}
|
||||||
activate - True/False
|
activate - True/False
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Add Zones - Zones passed: %s"), zones)
|
LOG.debug("Add Zones - Zones passed: %s", zones)
|
||||||
cfg_name = None
|
cfg_name = None
|
||||||
iterator_count = 0
|
iterator_count = 0
|
||||||
zone_with_sep = ''
|
zone_with_sep = ''
|
||||||
active_zone_set = self.get_active_zone_set()
|
active_zone_set = self.get_active_zone_set()
|
||||||
LOG.debug(_("Active zone set:%s"), active_zone_set)
|
LOG.debug("Active zone set:%s", active_zone_set)
|
||||||
zone_list = active_zone_set[ZoneConstant.CFG_ZONES]
|
zone_list = active_zone_set[ZoneConstant.CFG_ZONES]
|
||||||
LOG.debug(_("zone list:%s"), zone_list)
|
LOG.debug("zone list:%s", zone_list)
|
||||||
for zone in zones.keys():
|
for zone in zones.keys():
|
||||||
# if zone exists, its an update. Delete & insert
|
# if zone exists, its an update. Delete & insert
|
||||||
# TODO(skolathur): This can be optimized to an update call later
|
# TODO(skolathur): This can be optimized to an update call later
|
||||||
@ -145,16 +145,16 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
except exception.BrocadeZoningCliException:
|
except exception.BrocadeZoningCliException:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.error(_("Deleting zone failed %s"), zone)
|
LOG.error(_("Deleting zone failed %s"), zone)
|
||||||
LOG.debug(_("Deleted Zone before insert : %s"), zone)
|
LOG.debug("Deleted Zone before insert : %s", zone)
|
||||||
zone_members_with_sep = ';'.join(str(member) for
|
zone_members_with_sep = ';'.join(str(member) for
|
||||||
member in zones[zone])
|
member in zones[zone])
|
||||||
LOG.debug(_("Forming command for add zone"))
|
LOG.debug("Forming command for add zone")
|
||||||
cmd = 'zonecreate "%(zone)s", "%(zone_members_with_sep)s"' % {
|
cmd = 'zonecreate "%(zone)s", "%(zone_members_with_sep)s"' % {
|
||||||
'zone': zone,
|
'zone': zone,
|
||||||
'zone_members_with_sep': zone_members_with_sep}
|
'zone_members_with_sep': zone_members_with_sep}
|
||||||
LOG.debug(_("Adding zone, cmd to run %s"), cmd)
|
LOG.debug("Adding zone, cmd to run %s", cmd)
|
||||||
self.apply_zone_change(cmd.split())
|
self.apply_zone_change(cmd.split())
|
||||||
LOG.debug(_("Created zones on the switch"))
|
LOG.debug("Created zones on the switch")
|
||||||
if(iterator_count > 0):
|
if(iterator_count > 0):
|
||||||
zone_with_sep += ';'
|
zone_with_sep += ';'
|
||||||
iterator_count += 1
|
iterator_count += 1
|
||||||
@ -169,7 +169,7 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
else:
|
else:
|
||||||
cmd = 'cfgadd "%(zoneset)s", "%(zones)s"' \
|
cmd = 'cfgadd "%(zoneset)s", "%(zones)s"' \
|
||||||
% {'zoneset': cfg_name, 'zones': zone_with_sep}
|
% {'zoneset': cfg_name, 'zones': zone_with_sep}
|
||||||
LOG.debug(_("New zone %s"), cmd)
|
LOG.debug("New zone %s", cmd)
|
||||||
self.apply_zone_change(cmd.split())
|
self.apply_zone_change(cmd.split())
|
||||||
self._cfg_save()
|
self._cfg_save()
|
||||||
if activate:
|
if activate:
|
||||||
@ -220,7 +220,7 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
% {'active_zoneset_name': active_zoneset_name,
|
% {'active_zoneset_name': active_zoneset_name,
|
||||||
'zone_names': zone_names
|
'zone_names': zone_names
|
||||||
}
|
}
|
||||||
LOG.debug(_("Delete zones: Config cmd to run:%s"), cmd)
|
LOG.debug("Delete zones: Config cmd to run:%s", cmd)
|
||||||
self.apply_zone_change(cmd.split())
|
self.apply_zone_change(cmd.split())
|
||||||
for zone in zones:
|
for zone in zones:
|
||||||
self._zone_delete(zone)
|
self._zone_delete(zone)
|
||||||
@ -297,7 +297,7 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
not expected.
|
not expected.
|
||||||
"""
|
"""
|
||||||
stdout, stderr = None, None
|
stdout, stderr = None, None
|
||||||
LOG.debug(_("Executing command via ssh: %s"), cmd_list)
|
LOG.debug("Executing command via ssh: %s", cmd_list)
|
||||||
stdout, stderr = self._run_ssh(cmd_list, True, 1)
|
stdout, stderr = self._run_ssh(cmd_list, True, 1)
|
||||||
# no output expected, so output means there is an error
|
# no output expected, so output means there is an error
|
||||||
if stdout:
|
if stdout:
|
||||||
@ -320,7 +320,7 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
if (stdout):
|
if (stdout):
|
||||||
for line in stdout:
|
for line in stdout:
|
||||||
if 'Fabric OS: v' in line:
|
if 'Fabric OS: v' in line:
|
||||||
LOG.debug(_("Firmware version string:%s"), line)
|
LOG.debug("Firmware version string:%s", line)
|
||||||
ver = line.split('Fabric OS: v')[1].split('.')
|
ver = line.split('Fabric OS: v')[1].split('.')
|
||||||
if (ver):
|
if (ver):
|
||||||
firmware = int(ver[0] + ver[1])
|
firmware = int(ver[0] + ver[1])
|
||||||
@ -430,7 +430,7 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
min_size=1,
|
min_size=1,
|
||||||
max_size=5)
|
max_size=5)
|
||||||
stdin, stdout, stderr = None, None, None
|
stdin, stdout, stderr = None, None, None
|
||||||
LOG.debug(_("Executing command via ssh: %s") % command)
|
LOG.debug("Executing command via ssh: %s" % command)
|
||||||
last_exception = None
|
last_exception = None
|
||||||
try:
|
try:
|
||||||
with self.sshpool.item() as ssh:
|
with self.sshpool.item() as ssh:
|
||||||
@ -442,10 +442,10 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
stdin.write("%s\n" % ZoneConstant.YES)
|
stdin.write("%s\n" % ZoneConstant.YES)
|
||||||
channel = stdout.channel
|
channel = stdout.channel
|
||||||
exit_status = channel.recv_exit_status()
|
exit_status = channel.recv_exit_status()
|
||||||
LOG.debug(_("Exit Status from ssh:%s"), exit_status)
|
LOG.debug("Exit Status from ssh:%s", exit_status)
|
||||||
# exit_status == -1 if no exit code was returned
|
# exit_status == -1 if no exit code was returned
|
||||||
if exit_status != -1:
|
if exit_status != -1:
|
||||||
LOG.debug(_('Result was %s') % exit_status)
|
LOG.debug('Result was %s' % exit_status)
|
||||||
if check_exit_code and exit_status != 0:
|
if check_exit_code and exit_status != 0:
|
||||||
raise processutils.ProcessExecutionError(
|
raise processutils.ProcessExecutionError(
|
||||||
exit_code=exit_status,
|
exit_code=exit_status,
|
||||||
@ -460,8 +460,8 @@ class BrcdFCZoneClientCLI(object):
|
|||||||
LOG.error(e)
|
LOG.error(e)
|
||||||
last_exception = e
|
last_exception = e
|
||||||
greenthread.sleep(random.randint(20, 500) / 100.0)
|
greenthread.sleep(random.randint(20, 500) / 100.0)
|
||||||
LOG.debug(_("Handling error case after "
|
LOG.debug("Handling error case after "
|
||||||
"SSH:%s"), last_exception)
|
"SSH:%s", last_exception)
|
||||||
try:
|
try:
|
||||||
raise processutils.ProcessExecutionError(
|
raise processutils.ProcessExecutionError(
|
||||||
exit_code=last_exception.exit_code,
|
exit_code=last_exception.exit_code,
|
||||||
|
@ -130,7 +130,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
:param fabric: Fabric name from cinder.conf file
|
:param fabric: Fabric name from cinder.conf file
|
||||||
:param initiator_target_map: Mapping of initiator to list of targets
|
:param initiator_target_map: Mapping of initiator to list of targets
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Add connection for Fabric:%s"), fabric)
|
LOG.debug("Add connection for Fabric:%s", fabric)
|
||||||
LOG.info(_("BrcdFCZoneDriver - Add connection "
|
LOG.info(_("BrcdFCZoneDriver - Add connection "
|
||||||
"for I-T map: %s"), initiator_target_map)
|
"for I-T map: %s"), initiator_target_map)
|
||||||
fabric_ip = self.fabric_configs[fabric].safe_get('fc_fabric_address')
|
fabric_ip = self.fabric_configs[fabric].safe_get('fc_fabric_address')
|
||||||
@ -226,7 +226,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
LOG.error(e)
|
LOG.error(e)
|
||||||
msg = _("Failed to add zoning configuration %s") % e
|
msg = _("Failed to add zoning configuration %s") % e
|
||||||
raise exception.FCZoneDriverException(msg)
|
raise exception.FCZoneDriverException(msg)
|
||||||
LOG.debug(_("Zones added successfully: %s"), zone_map)
|
LOG.debug("Zones added successfully: %s", zone_map)
|
||||||
|
|
||||||
@lockutils.synchronized('brcd', 'fcfabric-', True)
|
@lockutils.synchronized('brcd', 'fcfabric-', True)
|
||||||
def delete_connection(self, fabric, initiator_target_map):
|
def delete_connection(self, fabric, initiator_target_map):
|
||||||
@ -239,7 +239,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
:param fabric: Fabric name from cinder.conf file
|
:param fabric: Fabric name from cinder.conf file
|
||||||
:param initiator_target_map: Mapping of initiator to list of targets
|
:param initiator_target_map: Mapping of initiator to list of targets
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Delete connection for fabric:%s"), fabric)
|
LOG.debug("Delete connection for fabric:%s", fabric)
|
||||||
LOG.info(_("BrcdFCZoneDriver - Delete connection for I-T map: %s"),
|
LOG.info(_("BrcdFCZoneDriver - Delete connection for I-T map: %s"),
|
||||||
initiator_target_map)
|
initiator_target_map)
|
||||||
fabric_ip = self.fabric_configs[fabric].safe_get('fc_fabric_address')
|
fabric_ip = self.fabric_configs[fabric].safe_get('fc_fabric_address')
|
||||||
@ -283,7 +283,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
# Based on zoning policy, get zone member list and push changes to
|
# Based on zoning policy, get zone member list and push changes to
|
||||||
# fabric. This operation could result in an update for zone config
|
# fabric. This operation could result in an update for zone config
|
||||||
# with new member list or deleting zones from active cfg.
|
# with new member list or deleting zones from active cfg.
|
||||||
LOG.debug(_("zone config from Fabric: %s"), cfgmap_from_fabric)
|
LOG.debug("zone config from Fabric: %s", cfgmap_from_fabric)
|
||||||
for initiator_key in initiator_target_map.keys():
|
for initiator_key in initiator_target_map.keys():
|
||||||
initiator = initiator_key.lower()
|
initiator = initiator_key.lower()
|
||||||
formatted_initiator = self.get_formatted_wwn(initiator)
|
formatted_initiator = self.get_formatted_wwn(initiator)
|
||||||
@ -298,7 +298,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
self.configuration.zone_name_prefix
|
self.configuration.zone_name_prefix
|
||||||
+ initiator.replace(':', '')
|
+ initiator.replace(':', '')
|
||||||
+ target.replace(':', ''))
|
+ target.replace(':', ''))
|
||||||
LOG.debug(_("Zone name to del: %s"), zone_name)
|
LOG.debug("Zone name to del: %s", zone_name)
|
||||||
if len(zone_names) > 0 and (zone_name in zone_names):
|
if len(zone_names) > 0 and (zone_name in zone_names):
|
||||||
# delete zone.
|
# delete zone.
|
||||||
LOG.debug(("Added zone to delete to "
|
LOG.debug(("Added zone to delete to "
|
||||||
@ -324,22 +324,22 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
# filtered list and if it is non-empty, add initiator
|
# filtered list and if it is non-empty, add initiator
|
||||||
# to it and update zone if filtered list is empty, we
|
# to it and update zone if filtered list is empty, we
|
||||||
# remove that zone.
|
# remove that zone.
|
||||||
LOG.debug(_("Zone delete - I mode: "
|
LOG.debug("Zone delete - I mode: "
|
||||||
"filtered targets:%s"), filtered_members)
|
"filtered targets:%s", filtered_members)
|
||||||
if filtered_members:
|
if filtered_members:
|
||||||
filtered_members.append(formatted_initiator)
|
filtered_members.append(formatted_initiator)
|
||||||
LOG.debug(_("Filtered zone members to "
|
LOG.debug("Filtered zone members to "
|
||||||
"update: %s"), filtered_members)
|
"update: %s", filtered_members)
|
||||||
zone_map[zone_name] = filtered_members
|
zone_map[zone_name] = filtered_members
|
||||||
LOG.debug(_("Filtered zone Map to "
|
LOG.debug("Filtered zone Map to "
|
||||||
"update: %s"), zone_map)
|
"update: %s", zone_map)
|
||||||
else:
|
else:
|
||||||
zones_to_delete.append(zone_name)
|
zones_to_delete.append(zone_name)
|
||||||
else:
|
else:
|
||||||
LOG.info(_("Zoning Policy: %s, not "
|
LOG.info(_("Zoning Policy: %s, not "
|
||||||
"recognized"), zoning_policy)
|
"recognized"), zoning_policy)
|
||||||
LOG.debug(_("Final Zone map to update: %s"), zone_map)
|
LOG.debug("Final Zone map to update: %s", zone_map)
|
||||||
LOG.debug(_("Final Zone list to delete: %s"), zones_to_delete)
|
LOG.debug("Final Zone list to delete: %s", zones_to_delete)
|
||||||
try:
|
try:
|
||||||
# Update zone membership.
|
# Update zone membership.
|
||||||
if zone_map:
|
if zone_map:
|
||||||
@ -377,13 +377,13 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
fabric_map = {}
|
fabric_map = {}
|
||||||
fc_fabric_names = self.configuration.fc_fabric_names
|
fc_fabric_names = self.configuration.fc_fabric_names
|
||||||
fabrics = [x.strip() for x in fc_fabric_names.split(',')]
|
fabrics = [x.strip() for x in fc_fabric_names.split(',')]
|
||||||
LOG.debug(_("Fabric List: %s"), fabrics)
|
LOG.debug("Fabric List: %s", fabrics)
|
||||||
LOG.debug(_("Target wwn List: %s"), target_wwn_list)
|
LOG.debug("Target wwn List: %s", target_wwn_list)
|
||||||
if len(fabrics) > 0:
|
if len(fabrics) > 0:
|
||||||
for t in target_wwn_list:
|
for t in target_wwn_list:
|
||||||
formatted_target_list.append(self.get_formatted_wwn(t.lower()))
|
formatted_target_list.append(self.get_formatted_wwn(t.lower()))
|
||||||
LOG.debug(_("Formatted Target wwn List:"
|
LOG.debug("Formatted Target wwn List:"
|
||||||
" %s"), formatted_target_list)
|
" %s", formatted_target_list)
|
||||||
for fabric_name in fabrics:
|
for fabric_name in fabrics:
|
||||||
fabric_ip = self.fabric_configs[fabric_name].safe_get(
|
fabric_ip = self.fabric_configs[fabric_name].safe_get(
|
||||||
'fc_fabric_address')
|
'fc_fabric_address')
|
||||||
@ -419,7 +419,7 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
nsinfo = None
|
nsinfo = None
|
||||||
try:
|
try:
|
||||||
nsinfo = conn.get_nameserver_info()
|
nsinfo = conn.get_nameserver_info()
|
||||||
LOG.debug(_("name server info from fabric:%s"), nsinfo)
|
LOG.debug("name server info from fabric:%s", nsinfo)
|
||||||
conn.cleanup()
|
conn.cleanup()
|
||||||
except exception.BrocadeZoningCliException as ex:
|
except exception.BrocadeZoningCliException as ex:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
@ -442,9 +442,9 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
visible_targets[idx]).replace(':', '')
|
visible_targets[idx]).replace(':', '')
|
||||||
fabric_map[fabric_name] = visible_targets
|
fabric_map[fabric_name] = visible_targets
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("No targets are in the nameserver for SAN %s"),
|
LOG.debug("No targets are in the nameserver for SAN %s",
|
||||||
fabric_name)
|
fabric_name)
|
||||||
LOG.debug(_("Return SAN context output:%s"), fabric_map)
|
LOG.debug("Return SAN context output:%s", fabric_map)
|
||||||
return fabric_map
|
return fabric_map
|
||||||
|
|
||||||
def get_active_zone_set(self, fabric_ip,
|
def get_active_zone_set(self, fabric_ip,
|
||||||
@ -453,8 +453,8 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
cfgmap = {}
|
cfgmap = {}
|
||||||
conn = None
|
conn = None
|
||||||
try:
|
try:
|
||||||
LOG.debug(_("Southbound connector:"
|
LOG.debug("Southbound connector:"
|
||||||
" %s"), self.configuration.brcd_sb_connector)
|
" %s", self.configuration.brcd_sb_connector)
|
||||||
conn = importutils.import_object(
|
conn = importutils.import_object(
|
||||||
self.configuration.brcd_sb_connector,
|
self.configuration.brcd_sb_connector,
|
||||||
ipaddress=fabric_ip, username=fabric_user,
|
ipaddress=fabric_ip, username=fabric_user,
|
||||||
@ -473,5 +473,5 @@ class BrcdFCZoneDriver(FCZoneDriver):
|
|||||||
msg = (_("Failed to access active zoning configuration:%s") % e)
|
msg = (_("Failed to access active zoning configuration:%s") % e)
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.FCZoneDriverException(msg)
|
raise exception.FCZoneDriverException(msg)
|
||||||
LOG.debug(_("Active zone set from fabric: %s"), cfgmap)
|
LOG.debug("Active zone set from fabric: %s", cfgmap)
|
||||||
return cfgmap
|
return cfgmap
|
||||||
|
@ -41,7 +41,7 @@ class FCZoneDriver(fc_common.FCCommon):
|
|||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(FCZoneDriver, self).__init__(**kwargs)
|
super(FCZoneDriver, self).__init__(**kwargs)
|
||||||
LOG.debug(_("Initializing FCZoneDriver"))
|
LOG.debug("Initializing FCZoneDriver")
|
||||||
|
|
||||||
def add_connection(self, fabric, initiator_target_map):
|
def add_connection(self, fabric, initiator_target_map):
|
||||||
"""Add connection control.
|
"""Add connection control.
|
||||||
|
@ -74,8 +74,8 @@ class FCSanLookupService(fc_common.FCCommon):
|
|||||||
# Initialize vendor specific implementation of FCZoneDriver
|
# Initialize vendor specific implementation of FCZoneDriver
|
||||||
if (self.configuration.fc_san_lookup_service):
|
if (self.configuration.fc_san_lookup_service):
|
||||||
lookup_service = self.configuration.fc_san_lookup_service
|
lookup_service = self.configuration.fc_san_lookup_service
|
||||||
LOG.debug(_("Lookup service to invoke: "
|
LOG.debug("Lookup service to invoke: "
|
||||||
"%s"), lookup_service)
|
"%s", lookup_service)
|
||||||
self.lookup_service = importutils.import_object(
|
self.lookup_service = importutils.import_object(
|
||||||
lookup_service, configuration=self.configuration)
|
lookup_service, configuration=self.configuration)
|
||||||
else:
|
else:
|
||||||
|
@ -80,7 +80,7 @@ class ZoneManager(fc_common.FCCommon):
|
|||||||
self.configuration.append_config_values(zone_manager_opts)
|
self.configuration.append_config_values(zone_manager_opts)
|
||||||
|
|
||||||
zone_driver = self.configuration.zone_driver
|
zone_driver = self.configuration.zone_driver
|
||||||
LOG.debug(_("Zone Driver from config: {%s}"), zone_driver)
|
LOG.debug("Zone Driver from config: {%s}", zone_driver)
|
||||||
|
|
||||||
zm_config = config.Configuration(zone_manager_opts, 'fc-zone-manager')
|
zm_config = config.Configuration(zone_manager_opts, 'fc-zone-manager')
|
||||||
# Initialize vendor specific implementation of FCZoneDriver
|
# Initialize vendor specific implementation of FCZoneDriver
|
||||||
@ -114,11 +114,11 @@ class ZoneManager(fc_common.FCCommon):
|
|||||||
try:
|
try:
|
||||||
for initiator in initiator_target_map.keys():
|
for initiator in initiator_target_map.keys():
|
||||||
target_list = initiator_target_map[initiator]
|
target_list = initiator_target_map[initiator]
|
||||||
LOG.debug(_("Target List :%s"), {initiator: target_list})
|
LOG.debug("Target List :%s", {initiator: target_list})
|
||||||
|
|
||||||
# get SAN context for the target list
|
# get SAN context for the target list
|
||||||
fabric_map = self.get_san_context(target_list)
|
fabric_map = self.get_san_context(target_list)
|
||||||
LOG.debug(_("Fabric Map after context lookup:%s"), fabric_map)
|
LOG.debug("Fabric Map after context lookup:%s", fabric_map)
|
||||||
# iterate over each SAN and apply connection control
|
# iterate over each SAN and apply connection control
|
||||||
for fabric in fabric_map.keys():
|
for fabric in fabric_map.keys():
|
||||||
connected_fabric = fabric
|
connected_fabric = fabric
|
||||||
@ -162,8 +162,8 @@ class ZoneManager(fc_common.FCCommon):
|
|||||||
|
|
||||||
# get SAN context for the target list
|
# get SAN context for the target list
|
||||||
fabric_map = self.get_san_context(target_list)
|
fabric_map = self.get_san_context(target_list)
|
||||||
LOG.debug(_("Delete connection Fabric Map from SAN "
|
LOG.debug("Delete connection Fabric Map from SAN "
|
||||||
"context: %s"), fabric_map)
|
"context: %s", fabric_map)
|
||||||
|
|
||||||
# iterate over each SAN and apply connection control
|
# iterate over each SAN and apply connection control
|
||||||
for fabric in fabric_map.keys():
|
for fabric in fabric_map.keys():
|
||||||
@ -180,8 +180,8 @@ class ZoneManager(fc_common.FCCommon):
|
|||||||
if len(valid_i_t_map) > 0:
|
if len(valid_i_t_map) > 0:
|
||||||
self.driver.delete_connection(fabric, valid_i_t_map)
|
self.driver.delete_connection(fabric, valid_i_t_map)
|
||||||
|
|
||||||
LOG.debug(_("Delete Connection - Finished iterating over all"
|
LOG.debug("Delete Connection - Finished iterating over all"
|
||||||
" target list"))
|
" target list")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = _("Failed removing connection for fabric=%(fabric)s: "
|
msg = _("Failed removing connection for fabric=%(fabric)s: "
|
||||||
"Error:%(err)s") % {'fabric': connected_fabric,
|
"Error:%(err)s") % {'fabric': connected_fabric,
|
||||||
@ -196,7 +196,7 @@ class ZoneManager(fc_common.FCCommon):
|
|||||||
to list of target WWNs visible to the fabric.
|
to list of target WWNs visible to the fabric.
|
||||||
"""
|
"""
|
||||||
fabric_map = self.driver.get_san_context(target_wwn_list)
|
fabric_map = self.driver.get_san_context(target_wwn_list)
|
||||||
LOG.debug(_("Got SAN context:%s"), fabric_map)
|
LOG.debug("Got SAN context:%s", fabric_map)
|
||||||
return fabric_map
|
return fabric_map
|
||||||
|
|
||||||
def get_valid_initiator_target_map(self, initiator_target_map,
|
def get_valid_initiator_target_map(self, initiator_target_map,
|
||||||
|
3
tox.ini
3
tox.ini
@ -46,3 +46,6 @@ commands = {posargs}
|
|||||||
ignore = E711,E712,F403,H302,H803
|
ignore = E711,E712,F403,H302,H803
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build
|
exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build
|
||||||
|
|
||||||
|
[hacking]
|
||||||
|
local-check-factory = cinder.hacking.checks.factory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user