Skip to content

Some BlockStorage composite operations throw a 404/NotAuthorizedOrNotFound for Cross Region operations #344

@github-anurag

Description

@github-anurag

The copy_boot_volume_backup_and_wait_for_state() and copy_volume_backup_and_wait_for_state() from the BlockStorage Client Composite operations throw a 404/NotAuthorizedOrNotFound when copying a backup from one region to another.

Example:-

region = "us-ashburn-1"
dr_region = "us-phoenix-1"
backup_item_id = "ocid1.volumebackup.oc1.iad.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
backup_item_display_name = "abc"
config = from_file() # gets ~./.oci/config and reads to the object
storage_client = BlockstorageClient(config) # storage instance primary region
storage_composite_client = BlockstorageClientCompositeOperations(storage_client)

replication_request_response = storage_composite_client.copy_volume_backup_and_wait_for_state(
    volume_backup_id = backup_item_id,
    copy_volume_backup_details = CopyVolumeBackupDetails(
        destination_region = dr_region,
        display_name = backup_item_display_name
    ),
    wait_for_states = ["AVAILABLE"]
).data

ServiceError: {'opc-request-id': '123456789', 'code': 'NotAuthorizedOrNotFound', 'message': 'Authorization failed or requested resource not found.', 'status': 404}

A workaround would be to use two different clients for this operation. A client in Source Region to send the request for the backup copy from Region A to Region B, and a client in Destination region which would then wait for the backup to become available.

An example using this approach can be found at:-
CopyVolumeBackup
CopyBootVolumeBackup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions