Remove unnecessary saving of host and availability_zone
1. When doing backup creation, we have already used method `_get_available_backup_service_host`(in cinder/backup/api.py) to check and select availability zone and host, and then save them in DB across the API service. 2. When in restore and delete operation, the host of backup will never be modified. So it's safe to remove them from the manager code, since we are not actually changing the contents. This removes an unnecessary DB request in backup create, restore, and delete operations. Change-Id: If6dc705db18e138ed13fe3e9a5eecd366c33fe89
This commit is contained in:
parent
121d9f512b
commit
b5b6443adc
|
@ -358,10 +358,6 @@ class BackupManager(manager.ThreadPoolManager):
|
|||
|
||||
self._notify_about_backup_usage(context, backup, "create.start")
|
||||
|
||||
backup.host = self.host
|
||||
backup.availability_zone = self.az
|
||||
backup.save()
|
||||
|
||||
expected_status = "backing-up"
|
||||
if snapshot_id:
|
||||
actual_status = snapshot['status']
|
||||
|
@ -536,9 +532,6 @@ class BackupManager(manager.ThreadPoolManager):
|
|||
volume = objects.Volume.get_by_id(context, volume_id)
|
||||
self._notify_about_backup_usage(context, backup, "restore.start")
|
||||
|
||||
backup.host = self.host
|
||||
backup.save()
|
||||
|
||||
expected_status = [fields.VolumeStatus.RESTORING_BACKUP,
|
||||
fields.VolumeStatus.CREATING]
|
||||
volume_previous_status = volume['status']
|
||||
|
@ -715,8 +708,6 @@ class BackupManager(manager.ThreadPoolManager):
|
|||
LOG.info('Delete backup started, backup: %s.', backup.id)
|
||||
|
||||
self._notify_about_backup_usage(context, backup, "delete.start")
|
||||
backup.host = self.host
|
||||
backup.save()
|
||||
|
||||
expected_status = fields.BackupStatus.DELETING
|
||||
actual_status = backup.status
|
||||
|
|
Loading…
Reference in New Issue