From 622627282f4e79cb6812018db464d5e23ce9ed8e Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Tue, 19 Apr 2016 09:38:52 -0400 Subject: [PATCH] init_host offload to default to true The backup_service_inithost_offload (introduced in If9d9e454cdd48669db6e4b8d96f340bbb6f99fad) configuration option is false by default. Lots of deleting backups will block the startup of the service for longer than acceptable. We should also default this option to True to avoid delaying startup. UpgradeImpact Change-Id: Ia280dba770f4509cdf80563a89738cdc058015ee --- cinder/backup/manager.py | 8 +++++--- cinder/tests/unit/test_backup.py | 5 ++++- releasenotes/notes/bug-1570845-efdb0206718f4ca4.yaml | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/bug-1570845-efdb0206718f4ca4.yaml diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index 77cf6aea7f4..2b1ecdf1411 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -61,9 +61,11 @@ backup_manager_opts = [ default='cinder.backup.drivers.swift', help='Driver to use for backups.',), cfg.BoolOpt('backup_service_inithost_offload', - default=False, + default=True, help='Offload pending backup delete during ' - 'backup service startup.',), + 'backup service startup. If false, the backup service ' + 'will remain down until all pending backups are ' + 'deleted.',), ] # This map doesn't need to be extended in the future since it's only @@ -192,7 +194,7 @@ class BackupManager(manager.SchedulerDependentManager): # from being blocked. self._add_to_threadpool(self.delete_backup, ctxt, backup) else: - # By default, delete backups sequentially + # Delete backups sequentially self.delete_backup(ctxt, backup) def _detach_all_attachments(self, ctxt, volume): diff --git a/cinder/tests/unit/test_backup.py b/cinder/tests/unit/test_backup.py index de1453829ae..ca93747cd45 100644 --- a/cinder/tests/unit/test_backup.py +++ b/cinder/tests/unit/test_backup.py @@ -211,6 +211,8 @@ class BackupTestCase(BaseBackupTest): def get_admin_context(): return self.ctxt + self.override_config('backup_service_inithost_offload', False) + vol1_id = self._create_volume_db_entry() self._create_volume_attach(vol1_id) db.volume_update(self.ctxt, vol1_id, {'status': 'backing-up'}) @@ -276,7 +278,6 @@ class BackupTestCase(BaseBackupTest): def test_init_host_with_service_inithost_offload(self, mock_add_threadpool, mock_get_all_by_host): - self.override_config('backup_service_inithost_offload', True) vol1_id = self._create_volume_db_entry() db.volume_update(self.ctxt, vol1_id, {'status': 'available'}) backup1 = self._create_backup_db_entry( @@ -410,6 +411,8 @@ class BackupTestCase(BaseBackupTest): def test_cleanup_one_deleting_backup(self): """Test cleanup_one_backup for volume status 'deleting'.""" + self.override_config('backup_service_inithost_offload', False) + backup = self._create_backup_db_entry( status=fields.BackupStatus.DELETING) diff --git a/releasenotes/notes/bug-1570845-efdb0206718f4ca4.yaml b/releasenotes/notes/bug-1570845-efdb0206718f4ca4.yaml new file mode 100644 index 00000000000..b247a818052 --- /dev/null +++ b/releasenotes/notes/bug-1570845-efdb0206718f4ca4.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - The 'backup_service_inithost_offload' configuration + option now defaults to 'True' instead of 'False'.