Skip to content

CherryPicked: [v2.10] fix: support vSphere template cloning with configurable resource pool - #587

Open
manage-repositories-app[bot] wants to merge 1 commit into
v2.10from
CherryPicked-so-source-template-9mzCN
Open

CherryPicked: [v2.10] fix: support vSphere template cloning with configurable resource pool#587
manage-repositories-app[bot] wants to merge 1 commit into
v2.10from
CherryPicked-so-source-template-9mzCN

Conversation

@manage-repositories-app

Copy link
Copy Markdown

Cherry-pick from main branch, original PR: #583, PR owner: tshefi

…#583)

* fix: support vSphere template cloning with configurable resource pool

Add priority-based resource pool selection for VM cloning operations to
support cloning from vSphere templates. Resolves DVS port conflicts by
enabling template usage as clone sources.

Priority order:
1. Configured copyoffload.resource_pool (explicit override)
2. Target ESXi host's pool (automatic compatibility)
3. Source VM's pool (preserve original location)
4. Cluster-wide pool search (fallback for templates)

Related: MTV-5787

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: query vSphere directly for template networks when not in inventory

Forklift inventory only lists VMs, not templates. When a VM is converted
to a template, it no longer appears in the inventory VM list, causing
network mapping queries to fail.

Add fallback logic to query vSphere API directly for template network
information when inventory lookup fails. This allows copy-offload tests
to work with template-based clone sources.

Changes:
- get_vm_or_template_networks: Try inventory first, fall back to vSphere API
- _get_networks_from_vsphere: Extract network names from VM/template devices

Related: MTV-5787

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: query networks from cloned VMs not original template names

The multus_network_name fixture was querying networks using the original
template names from class_plan_config instead of the cloned VM names from
prepared_plan. This caused Forklift inventory lookups to fail because:

1. Template is cloned to new VM (e.g., auto-zzsx-xcopy-template-test-...)
2. Fixture queried original template name (xcopy-template-test)
3. Template not in Forklift VM inventory
4. Fallback to vSphere API queried wrong object

Fix: Use prepared_plan which contains the cloned VM names that exist in
Forklift inventory, eliminating the need for template fallback logic.

Related: MTV-5787

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: address CodeRabbit review feedback

Address all high and medium priority review comments:

1. Exception Handling (HIGH):
   - Distinguish "VM not found" from "networks not found" errors
   - Only fall back to vSphere when inventory lookup fails (template case)
   - Propagate network mapping failures immediately

2. Network Query Coverage (HIGH):
   - Reuse _get_network_name_from_device() for complete backing type support
   - Properly handle DVS portgroups via portgroupKey resolution
   - Remove duplicate network extraction logic

3. Resource Pool Compatibility (HIGH):
   - Add datastore compatibility check in cluster fallback logic
   - Verify target datastore is accessible from compute resource
   - Prevent incompatible pool selection

4. Resource Cleanup (MEDIUM):
   - Add try/finally for container view cleanup
   - Follow established pattern from get_obj method

5. Documentation (Required):
   - Document resource_pool configuration in .providers.json.example
   - Explain priority order and automatic selection behavior
   - Clarify when explicit configuration is needed vs automatic

Related: MTV-5787

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@redhat-qe-bot2

Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

Note: You are an auto-verified user. Your PRs will be automatically verified and may be auto-merged when all requirements are met.

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: Disabled for this repository
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: All label categories are enabled (default configuration)

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message
  • /security-override - Set security check runs to pass (maintainers only)
  • /security-override cancel - Re-run security checks

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /automerge - Enable automatic merging when all requirements are met (maintainers and approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest conventional-title - Validate commit message format
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3
  • /cherry-pick-retry <branch> - Retry a failed cherry-pick (merged PRs only)

Branch Management

  • /rebase - Rebase this PR branch onto its base branch

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. Status Checks: All required status checks must pass
  3. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  4. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • myakove
  • solenoci

Reviewers:

  • krcmarik
  • myakove
  • solenoci
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (claude/claude-opus-4-6-1m)
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6-1m)
  • Test Oracle: Triggers: approved (cursor/gpt-5.4-xhigh-fast); /test-oracle can be used anytime
Security Checks
  • Suspicious Path Detection: Monitors paths: .claude/, .vscode/, .cursor/, .devcontainer/, .pi/, .github/workflows/, .github/actions/
  • Committer Identity Check: Verifies last committer matches PR author
  • Mandatory: Security checks block merge (use /security-override to bypass — maintainers only)

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@redhat-qe-bot

Copy link
Copy Markdown

⚠️ This cherry-pick had conflicts resolved by AI (claude/claude-opus-4-6-1m)

@tshefi — AI automatically resolved merge conflicts for this cherry-pick. Please review the changes carefully and verify correctness before merging.

@myakove

myakove commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

/lgtm
/approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants