Phase 2: Cloud provider abstraction and snapshot_utils refactor#29
Open
wdvr wants to merge 1 commit into
Open
Conversation
Phase 2 of cloud-agnostic migration: - Add providers/ module with CloudProvider and AuthProvider interfaces - Implement AWSProvider wrapping existing boto3 code - Add GCP and Custom provider stubs with documentation - Refactor snapshot_utils.py to use provider interface: - Replace direct boto3 ec2_client with _get_provider() - Replace s3_client with provider.upload/download_from_object_storage() - Update all snapshot operations to use provider methods - Support pagination in list_snapshots for large result sets - Add volume_id and status filtering to snapshot queries Provider interface supports: - Block storage (create/delete/attach/detach volumes) - Snapshots (create/delete/list/wait) - Object storage (upload/download) - Compute node queries Next steps: Refactor disk_reconciler.py (requires adding tag operations to provider interface) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements Phase 2 of the cloud-agnostic migration plan:
providers/module with abstractCloudProviderandAuthProviderinterfacesAWSProviderimplementation wrapping existing boto3 codeGCPProviderandCustomProvider** stubs with extensive documentationsnapshot_utils.pyto use provider interface instead of direct boto3 callsProvider Interface
Changes to
snapshot_utils.pyimport boto3; ec2_client = boto3.client("ec2")from providers import get_cloud_provider; provider = _get_provider()ec2_client.describe_snapshots(Filters=[...])provider.list_snapshots(filters={...}, status=[...])ec2_client.create_snapshot(VolumeId=...)provider.create_snapshot(volume_id, tags={...})s3_client.put_object(Bucket=..., Key=...)provider.upload_to_object_storage(bucket, key, content)Next Steps
disk_reconciler.pyneeds refactoring (requires addingcreate_tags()/delete_tags()to interface)Test plan
🤖 Generated with Claude Code