Merge "Fix mypy errors"
This commit is contained in:
commit
a357d009fa
@ -384,7 +384,7 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
self._notify_about_backup_usage(context, backup, "create.start")
|
self._notify_about_backup_usage(context, backup, "create.start")
|
||||||
|
|
||||||
expected_status = "backing-up"
|
expected_status = "backing-up"
|
||||||
if snapshot_id:
|
if snapshot:
|
||||||
actual_status = snapshot['status']
|
actual_status = snapshot['status']
|
||||||
if actual_status != expected_status:
|
if actual_status != expected_status:
|
||||||
err = _('Create backup aborted, expected snapshot status '
|
err = _('Create backup aborted, expected snapshot status '
|
||||||
@ -546,7 +546,7 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
message_field.Detail.DETACH_ERROR)
|
message_field.Detail.DETACH_ERROR)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
if snapshot_id:
|
if snapshot:
|
||||||
snapshot.status = fields.SnapshotStatus.AVAILABLE
|
snapshot.status = fields.SnapshotStatus.AVAILABLE
|
||||||
snapshot.save()
|
snapshot.save()
|
||||||
else:
|
else:
|
||||||
@ -838,7 +838,7 @@ class BackupManager(manager.SchedulerDependentManager):
|
|||||||
{'volume_id': volume.id, 'backup_id': backup.id})
|
{'volume_id': volume.id, 'backup_id': backup.id})
|
||||||
|
|
||||||
key_mgr = key_manager.API(CONF)
|
key_mgr = key_manager.API(CONF)
|
||||||
if orig_key_id is not None:
|
if orig_key_id:
|
||||||
LOG.debug('Deleting original volume encryption key ID.')
|
LOG.debug('Deleting original volume encryption key ID.')
|
||||||
volume_utils.delete_encryption_key(context,
|
volume_utils.delete_encryption_key(context,
|
||||||
key_mgr,
|
key_mgr,
|
||||||
|
@ -356,11 +356,12 @@ class ExtractVolumeRequestTask(flow_utils.CinderTask):
|
|||||||
self,
|
self,
|
||||||
key_manager,
|
key_manager,
|
||||||
context: context.RequestContext,
|
context: context.RequestContext,
|
||||||
volume_type_id: str,
|
volume_type_id: Optional[str],
|
||||||
snapshot: Optional[objects.Snapshot],
|
snapshot: Optional[objects.Snapshot],
|
||||||
source_volume: Optional[objects.Volume],
|
source_volume: Optional[objects.Volume],
|
||||||
image_metadata: Optional[dict[str, Any]]) -> Optional[str]:
|
image_metadata: Optional[dict[str, Any]]) -> Optional[str]:
|
||||||
if volume_types.is_encrypted(context, volume_type_id):
|
if volume_type_id and volume_types.is_encrypted(
|
||||||
|
context, volume_type_id):
|
||||||
encryption_key_id = None
|
encryption_key_id = None
|
||||||
|
|
||||||
if snapshot is not None: # creating from snapshot
|
if snapshot is not None: # creating from snapshot
|
||||||
|
@ -324,7 +324,7 @@ def remove_volume_type_access(context: context.RequestContext,
|
|||||||
|
|
||||||
|
|
||||||
def is_encrypted(context: context.RequestContext,
|
def is_encrypted(context: context.RequestContext,
|
||||||
volume_type_id: str) -> bool:
|
volume_type_id: Optional[str]) -> bool:
|
||||||
return get_volume_type_encryption(context, volume_type_id) is not None
|
return get_volume_type_encryption(context, volume_type_id) is not None
|
||||||
|
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ def volume_types_diff(context: context.RequestContext,
|
|||||||
|
|
||||||
def volume_types_encryption_changed(
|
def volume_types_encryption_changed(
|
||||||
context: context.RequestContext,
|
context: context.RequestContext,
|
||||||
vol_type_id1: str, vol_type_id2: str) -> bool:
|
vol_type_id1: Optional[str], vol_type_id2: Optional[str]) -> bool:
|
||||||
"""Return whether encryptions of two volume types are same."""
|
"""Return whether encryptions of two volume types are same."""
|
||||||
def _get_encryption(enc: dict) -> dict:
|
def _get_encryption(enc: dict) -> dict:
|
||||||
enc = dict(enc)
|
enc = dict(enc)
|
||||||
|
Loading…
Reference in New Issue
Block a user