From b5b6443adc4bcb1f169f64b45298c37216a2f201 Mon Sep 17 00:00:00 2001 From: yenai Date: Tue, 12 Nov 2019 17:10:08 +0800 Subject: [PATCH] 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 --- cinder/backup/manager.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index a44cc19d8bc..d7d88ad1f8a 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -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