Skip to content

Commit

Permalink
fix(bucket-locations): add templating to backup_bucket_location
Browse files Browse the repository at this point in the history
since now we are doing backup/restore in the test region
and `backup_bucket_region` was remove.

the code for this configuration need to be templated as it was done
for restore nemesis

otherwise we fail like the following:
```
23:22:43  Command: 'sudo sctool backup -c a05d9ea2-312c-4c8d-99b0-9f9b57e8cbde
          --keyspace scylla_bench,keyspace1  --location s3:manager-backup-tests-us-east-1 '
23:22:43  Exit code: 1
23:22:43  Stdout:
23:22:43  Stderr:
23:22:43  Error: create backup target: location is not accessible
23:22:43  10.4.2.70: agent [HTTP 400] operation put: s3 upload: 301 Moved Permanently:
          The bucket you are attempting to access must be addressed using the specified endpoint.
          Please send all future requests to this endpoint. (code:PermanentRedirect) - make sure the location
          is correct and credentials are set, to debug SSH to 10.4.2.70 and run
          "scylla-manager-agent check-location -L s3:manager-backup-tests-us-east-1 --debug"
23:22:43  Trace ID: DXvyKGPjQMKUCkJpyxlKCQ (grep in scylla-manager logs)
```

(cherry picked from commit fe55645)
  • Loading branch information
fruch committed Jan 14, 2025
1 parent e8565c6 commit 4be7457
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion defaults/aws_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ami_id_db_oracle: ''
use_preinstalled_scylla: true

backup_bucket_backend: 's3'
backup_bucket_location: 'manager-backup-tests-us-east-1'
backup_bucket_location: 'manager-backup-tests-{region}'

data_volume_disk_num: 0
data_volume_disk_type: 'gp2'
Expand Down
3 changes: 2 additions & 1 deletion functional_tests/scylla_operator/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ def test_mgmt_backup(db_cluster, manager_version):

# Run manager backup operation
mgr_cluster = db_cluster.get_cluster_manager()
backup_bucket_location = db_cluster.params.get('backup_bucket_location')
region = next(iter(db_cluster.params.region_names), '')
backup_bucket_location = db_cluster.params.get('backup_bucket_location').format(region=region)
bucket_name = f"s3:{backup_bucket_location.split()[0]}"
mgr_task = mgr_cluster.create_backup_task(location_list=[bucket_name, ])
assert mgr_task, "Failed to create backup task"
Expand Down
3 changes: 2 additions & 1 deletion mgmt_cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ def test_restore_multiple_backup_snapshots(self): # pylint: disable=too-many-lo
self.log.error("Test supports only AWS ATM")
return
persistent_manager_snapshots_dict = get_persistent_snapshots()
target_bucket = persistent_manager_snapshots_dict[cluster_backend]["bucket"]
region = next(iter(self.params.region_names), '')
target_bucket = persistent_manager_snapshots_dict[cluster_backend]["bucket"].format(region=region)
backup_bucket_backend = self.params.get("backup_bucket_backend")
location_list = [f"{backup_bucket_backend}:{target_bucket}"]
confirmation_stress_template = persistent_manager_snapshots_dict[cluster_backend]["confirmation_stress_template"]
Expand Down
3 changes: 2 additions & 1 deletion sdcm/nemesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3127,7 +3127,8 @@ def _mgmt_backup(self, backup_specific_tables):
raise UnsupportedNemesis('backup bucket location configuration is not defined!')

backup_bucket_backend = self.cluster.params.get("backup_bucket_backend")
backup_bucket_location = self.cluster.params.get("backup_bucket_location")
region = next(iter(self.cluster.params.region_names), '')
backup_bucket_location = self.cluster.params.get("backup_bucket_location").format(region=region)
location = f"{backup_bucket_backend}:{backup_bucket_location.split()[0]}"
self._delete_existing_backups(mgr_cluster)
if backup_specific_tables:
Expand Down

0 comments on commit 4be7457

Please sign in to comment.