Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Refactors architecture handling from AWS-specific AwsArchType to a cloud-agnostic VmArch enum. This implements the first commit from PR #13165, excluding Azure ARM64 gallery split changes per review feedback.

Key Changes:

  • VmArch enum (sdcm/provision/provisioner.py):

    • Simple enum with X86 and ARM values
    • Uses built-in enum value constructor (no custom methods needed)
    • Cloud-agnostic with no cloud-specific imports or methods
    • Keeps provisioner.py free of cloud-specific logic
  • Cloud-specific conversion utilities (moved out of VmArch per review feedback):

    • vmarch_to_aws() in sdcm/utils/aws_utils.py - converts to AWS format (x86_64/arm64)
    • vmarch_to_gcp() in sdcm/utils/gce_utils.py - converts to GCP format (X86_64/ARM64)
    • vmarch_to_azure() in sdcm/provision/azure/utils.py - converts to Azure format (x64/Arm64)
    • vmarch_to_oci() in sdcm/utils/oci_utils.py - converts to OCI format (x86_64/aarch64)
    • Uses TYPE_CHECKING to avoid circular import issues
  • Updated image retrieval functions (sdcm/utils/common.py):

    • All AWS/GCE image functions now accept VmArch instead of AwsArchType
    • Functions use cloud-specific conversion utilities from their respective modules
  • CLI updates (sct.py):

    • list_images command accepts arch via click.Choice(["x86_64", "aarch64"])
    • Converts to VmArch using built-in enum value constructor for type-safe cloud API calls

Architecture:
The VmArch enum is now truly cloud-agnostic with conversion logic properly separated into cloud-specific modules. This separation of concerns ensures provisioner.py has no cloud-specific imports or logic, as intended. The implementation leverages Python's standard enum functionality without custom methods.

Not Included:
Azure ARM64 gallery split (separate gallery definitions per architecture) excluded as requested. Azure functions accept arch parameter but receive None - infrastructure ready for future implementation.

Testing

  • VmArch conversion methods validated
  • Syntax validation passed
  • CodeQL security scan: 0 alerts
  • No circular import issues
  • Built-in enum value constructor works correctly

PR pre-checks (self review)

  • I added the relevant backport labels
  • I didn't leave commented-out/debugging code

Reminders

  • Add New configuration option and document them (in sdcm/sct_config.py)
  • Add unit tests to cover my changes (under unit-test/ folder)
  • Update the Readme/doc folder relevant to this change (if needed)
Original prompt

redo the first commit from #13165, base on the comment from Lukasz with the PR, leave out the split of using two image definitions in Azure, that should go on it's own PR following


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Redo first commit based on Lukasz's comment feature(arch): Add VmArch enum for unified architecture handling across cloud providers Jan 20, 2026
Copilot AI requested a review from fruch January 20, 2026 09:33
Copilot AI requested a review from fruch January 20, 2026 10:16
@fruch
Copy link
Contributor

fruch commented Jan 20, 2026

@copilot I'm missing a convert function for OCI backend

Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot I'm missing a convert function for OCI backend

Added vmarch_to_oci() function in sdcm/utils/oci_utils.py that converts VmArch to OCI format (x86_64/aarch64). It follows the same pattern as the AWS, GCP, and Azure conversion functions.

Commit: 756804a

Added VmArch enum to provide unified, type-safe architecture handling
across different cloud backends. Conversion functions are placed in their
respective cloud utility modules to keep provisioner.py cloud-agnostic.

Changes include:
- VmArch enum in sdcm/provision/provisioner.py with X86 and ARM values
- vmarch_to_aws() in sdcm/utils/aws_utils.py (x86_64 or arm64)
- vmarch_to_gcp() in sdcm/utils/gce_utils.py (X86_64 or ARM64)
- vmarch_to_azure() in sdcm/provision/azure/utils.py (x64 or Arm64)
- vmarch_to_oci() in sdcm/utils/oci_utils.py (x86_64 or aarch64)
- Updated sct.py list_images command to use VmArch
- Updated sdcm/utils/common.py image functions to use VmArch

This provides a consistent approach to architecture handling and ensures
that cloud-specific logic remains in the appropriate utility modules.
@fruch fruch force-pushed the copilot/redo-first-commit-scylla-tests branch from 756804a to 89a27ef Compare January 20, 2026 19:00
@fruch fruch marked this pull request as ready for review January 20, 2026 19:00
@fruch fruch requested a review from soyacz January 20, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants