Skip to content

fix: reliable inventory refresh and safe resource creation - #870

Closed
AmenB wants to merge 1 commit into
RedHatQE:mainfrom
AmenB:fix/harness-inventory-and-resource-safety
Closed

AmenB wants to merge 1 commit into
RedHatQE:mainfrom
AmenB:fix/harness-inventory-and-resource-safety

Conversation

@AmenB

@AmenB AmenB commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Four harness fixes that are independent of any feature work, plus one constant rename. The first three address a real CI failure: run #27 (tier0 vSphere, TestSharedDiskRhelMigration) errored at class setup with Inventory NIC MACs … did not converge with live vCenter MACs after 180s, and raising the timeout from 60s to 180s changed nothing — the inventory refresh was never triggered, it was only hoped for.

Changes

1. Trigger the inventory refresh instead of polling for one (utilities/provider_inventory.py)

_wait_for_inventory_mac_convergence() now takes the whole clone batch, refreshes the provider inventory when any VM's MACs are not already converged, then polls. The measured behaviour is stale data for an object inventory already lists, not slow discovery: CI runs #22/#25/#27 served pre-clone MACs for longer than 180s, so polling alone cannot converge.

One refresh is shared by the batch (the provider-Ready wait is not paid once per VM) and repeated at offsets 0/60/120s while any VM is still stale, so a refresh lost to a race between the collector snapshot and the controller reconcile is retried. Staleness is reported with warnings.warn, so it appears in the run summary instead of being absorbed silently.

2. Make the refresh token monotonic (utilities/provider_inventory.py)

_refresh is an opaque trigger the provider controller reconciles on — writing the same value again is a no-op — and it is second-granular. str(int(time.time())) meant two refreshes in the same second wrote the identical value, so the second request silently did nothing and its caller polled an inventory that was never refreshed. New _next_refresh_timestamp() returns a value strictly greater than the provider's current one, per provider, without module-level state.

3. Keep the MAC wait resilient to transient inventory reads (utilities/provider_inventory.py)

  • nics can be present-but-null while a refresh reconciles; vm.get("nics", []) evaluates to None there, so the wait now uses vm.get("nics") or [] and treats that state as "not yet converged".
  • A single inventory read is retried for 30s (_read_inventory_vm() inside a TimeoutSampler); a transient ValueError from get_vm or an API hiccup no longer aborts clone setup, which is what the previous sampler-based check guaranteed.
  • The loop reads once more after the last scheduled refresh, so an update landing during the refresh wait still converges.
  • The provider-Ready wait is clamped to the remaining convergence window, so a refresh cannot consume the whole timeout.

4. Safe creation for callers that own a fixed name (utilities/resources.py)

Creation and the existence wait are now separate steps with different teardown ordering:

  • Created by this run → recorded for teardown before the existence wait, so a create that succeeds and then fails its existence wait is still cleaned up.
  • Adopted on ConflictError → recorded after it proves usable, so a failed wait leaves no teardown entry, and teardown never deletes an object this run did not create.

store_resource_for_teardown() was extracted for that, and create_and_store_resource() now fails fast with a clear ValueError when fixture_store carries no base_resource_name instead of a bare KeyError.

5. K8S_NAME_MAX_LENGTH is public (utilities/naming.py)

Was _K8S_NAME_MAX_LENGTH; modules that validate a fixed resource name against the Kubernetes limit should not duplicate the constant.

Not in this PR

  • No --toehold option, no appliance code, no test changes — these fixes were extracted from the copy-appliance work so they can land and be reviewed on their own merits.
  • No conflict policy. An on_conflict: Literal["reuse", "fail"] option was prototyped here and dropped: nothing in the repository would pass it, so it was dead code. It comes back in WIP: feat: toehold (copy appliance) transfer path as a --toehold run toggle (VIRTSTRAT-757) #835 together with its only consumer (create_provider_copy_appliance_template() creates a fixed-name CopyApplianceTemplate).

Testing

  • pre-commit run --all-files — all hooks pass.
  • Recommended live validation, both on a vSphere tier0 run:
    • tests/cold/test_mtv_cold_migration.py::TestSanityColdMtvMigration — sanity that nothing else changed (clone → plan → migrate → check).
    • tests/shared_disk/test_shared_disk_rhel_migration.py::TestSharedDiskRhelMigration — the class that failed in Collect logs for failed tests #27; the run should now log Inventory NIC MACs are stale for cloned VM(s) …; refreshing the provider inventory on demand, then converge — and never did not converge.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@rh-bot-1

Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

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

🔄 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 (PR author or approvers)
  • /hold cancel - Unblock PR merging (PR author or approvers)
  • /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 (effective maintainers and approvers only)
  • /automerge cancel - Remove automerge label (effective 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:

  • krcmarik
  • myakove
  • solenoci

Reviewers:

  • krcmarik
  • myakove
  • solenoci
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
  • automerge
AI Features
  • Conventional Title: Mode: fix (EnMaaS/rits/deepseek-ai/DeepSeek-V4.1-Flash-1017)
  • Cherry-Pick Conflict Resolution: Enabled (EnMaaS/rits/deepseek-ai/DeepSeek-V4.1-Flash-1017)
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.

@qodo-code-review

qodo-code-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Trigger inventory refresh and improve resource creation safety

🐞 Bug fix ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Trigger provider refresh when cloned VM MACs differ, rather than waiting for scheduled inventory
 updates.
• Make refresh tokens monotonic and tolerate null NIC lists during reconciliation.
• Add conflict handling and earlier teardown tracking for resource creation; expose the Kubernetes
 name limit.
Merge Risk 🟡 Medium

Blast radius 🔴 High 💥 2 capabilities

  • 2 affected capabilities span independent functional scopes: Kubernetes test-resource provisioning and teardown, vSphere clone inventory synchronization.
  • The changed helper is called after cloned VMs are created and before the clone fixture proceeds to later NetworkMap and migration preparation.
  • Live-MAC capture, inventory reads, refreshes, and the final gate are one bounded end-to-end synchronization behavior rather than separate capabilities for each helper or provider hop.
  • The helper is consumed by the repository's fixture and utility resource-provisioning paths.
  • The changed behavior covers one end-to-end lifecycle outcome—name resolution, deployment or adoption, readiness, and teardown tracking—across resource kinds; resource kinds are implementation variants of the same fixture lifecycle scope.
Sources

utilities/resources.py[63-74]

        _resource.deploy(wait=False)
    except ConflictError:
        LOGGER.warning(f"{_resource.kind} {_resource_name} already exists, reusing it.")
        # Adoption path: the object predates this run, so it is tracked only after it proves
        # usable — a failed wait must leave no entry behind.
        _resource.wait()
        _store_resource_for_teardown(fixture_store=fixture_store, resource=_resource, test_name=test_name)
        return _resource

    # Created by this run: track before the existence wait so a failed wait is still cleaned up.
    _store_resource_for_teardown(fixture_store=fixture_store, resource=_resource, test_name=test_name)
    _resource.wait()

utilities/resources.py[43-47]

        if "base_resource_name" not in fixture_store:
            raise ValueError(
                "fixture_store carries no 'base_resource_name': the base_resource_name fixture "
                "did not run before this resource creation (check fixture ordering)."
            )
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Coordinated invariants

  • Before: each VM used the prior per-VM convergence arrangement.
  • After: the helper captures a batch-wide live-MAC map, performs repeated reads for every VM, schedules multiple refreshes, bounds provider-ready waits by the remaining shared deadline, and performs a final stale-state read.
  • New correctness conditions: each VM's stale/converged state, refresh ordering, provider readiness, repeated-read behavior, and the shared monotonic deadline must agree so that refreshes are not lost and one VM's reads do not incorrectly consume the batch window.
  • The external controller reconciliation protocol remains outside this repository.
Sources

utilities/provider_inventory.py[454-490]

        for vm in TimeoutSampler(
            wait_timeout=_INVENTORY_READ_RETRY_TIMEOUT,
            sleep=_MAC_CONVERGENCE_SLEEP,
            func=_read_inventory_vm,
            source_provider_inventory=source_provider_inventory,
            vm_name=vm_name,
        ):
            return {mac.lower() for nic in vm.get("nics") or [] if (mac := nic.get("mac"))}
    except TimeoutExpiredError:
        LOGGER.warning(
            f"Inventory read for VM '{vm_name}' kept failing for {_INVENTORY_READ_RETRY_TIMEOUT}s; "
            "treating its MACs as not yet converged"
        )
        return set()
    return set()


def _read_inventory_vm(
    source_provider_inventory: ForkliftInventory,
    vm_name: str,
) -> dict[str, Any]:
    """Read one VM from the provider inventory.

    A transient absence (``ValueError`` from ``get_vm``) is reported as an empty record so the
    surrounding sampler retries instead of failing the run.

    Args:
        source_provider_inventory (ForkliftInventory): Forklift inventory client.
        vm_name (str): VM name.

    Returns:
        dict[str, Any]: The VM record, or an empty dict when it is not listed yet.
    """
    try:
        return source_provider_inventory.get_vm(name=vm_name)
    except ValueError:
        return {}
Potential damage 🟡 Medium 🩹 Temporary loss

  • A supported failure prevents the affected vSphere clone batch from completing inventory synchronization and therefore blocks subsequent migration preparation.
  • The repository does not establish incorrect migrated data, persistent inventory corruption, or external compensation effects.
  • Recoverable after provider inventory reconciliation or correction of the inventory condition, followed by rerunning the setup/test.
  • Reverting the code restores the previous polling arrangement but does not repair an already stale external inventory cache.
  • No automatic recovery beyond the changed convergence loop is established.
Sources

utilities/provider_inventory.py[454-490]

        for vm in TimeoutSampler(
            wait_timeout=_INVENTORY_READ_RETRY_TIMEOUT,
            sleep=_MAC_CONVERGENCE_SLEEP,
            func=_read_inventory_vm,
            source_provider_inventory=source_provider_inventory,
            vm_name=vm_name,
        ):
            return {mac.lower() for nic in vm.get("nics") or [] if (mac := nic.get("mac"))}
    except TimeoutExpiredError:
        LOGGER.warning(
            f"Inventory read for VM '{vm_name}' kept failing for {_INVENTORY_READ_RETRY_TIMEOUT}s; "
            "treating its MACs as not yet converged"
        )
        return set()
    return set()


def _read_inventory_vm(
    source_provider_inventory: ForkliftInventory,
    vm_name: str,
) -> dict[str, Any]:
    """Read one VM from the provider inventory.

    A transient absence (``ValueError`` from ``get_vm``) is reported as an empty record so the
    surrounding sampler retries instead of failing the run.

    Args:
        source_provider_inventory (ForkliftInventory): Forklift inventory client.
        vm_name (str): VM name.

    Returns:
        dict[str, Any]: The VM record, or an empty dict when it is not listed yet.
    """
    try:
        return source_provider_inventory.get_vm(name=vm_name)
    except ValueError:
        return {}
Assessed commit fb2b965
Diagram

graph TD
  A["Clone MACs"] --> B{"MACs match?"} -->|No| C["Refresh token"] --> D["Provider reconcile"] --> E["Inventory poll"]
  B -->|Yes| E
  F["Resource creation"] --> G["Teardown ledger"] --> H["Deploy policy"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Remove teardown entry on fail-on-conflict
  • ➕ Preserves tracking when creation succeeds but its existence wait fails.
  • ➕ Prevents a known conflicting resource from remaining scheduled for deletion.
  • ➖ Requires explicit cleanup of the ledger entry on that error path.
2. Separate resource creation from its existence wait
  • ➕ Allows teardown registration after successful creation but before a fallible wait.
  • ➕ Tracks only resources this run created.
  • ➖ Requires changing how deployment and waiting are orchestrated.

Recommendation: Keep the explicit inventory refresh and monotonic token. Before relying on on_conflict=&quot;fail&quot; for safety, address its teardown path: registration currently precedes deployment, so a conflict raises ValueError but leaves the pre-existing resource scheduled for deletion. Removing that entry on conflict is the smallest fix; separating creation from its wait offers clearer ownership if the deployment API permits it.

Files changed (3) +86 / -19

Enhancement (1) +2 / -2
naming.pyExpose the Kubernetes resource-name length limit +2/-2

Expose the Kubernetes resource-name length limit

• Renames the private 63-character limit to 'K8S_NAME_MAX_LENGTH' and keeps it as the default for resource-name truncation.

utilities/naming.py

Bug fix (2) +84 / -17
provider_inventory.pyActively refresh inventory before waiting for cloned MACs +45/-8

Actively refresh inventory before waiting for cloned MACs

• Triggers a provider refresh when cloned-VM inventory MACs differ from live MACs, using a token greater than both the process's last token and the provider's current value. Extends the convergence timeout to 180 seconds and treats null NIC lists as not yet converged.

utilities/provider_inventory.py

resources.pyAdd a conflict policy and register teardown before deployment +39/-9

Add a conflict policy and register teardown before deployment

• Adds an opt-in fail-on-conflict policy while retaining reuse by default, and extracts teardown registration so resources remain tracked if deployment's existence wait fails. Also reports a missing fixture base name explicitly and imports the public name-length constant; the new import is not yet used. A fail-on-conflict still leaves its pre-deployment teardown entry in place.

utilities/resources.py

@qodo-code-review

qodo-code-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Transient inventory errors abort migrations ✓ Resolved

Resolving commit: fec2d35

Resolution reason
Per-VM inventory reads are now wrapped in a TimeoutSampler with a 30s retry window, so transient
read failures are retried instead of immediately ending clone setup; persistent failures degrade to
not-converged rather than aborting.
Description
_wait_for_inventory_mac_convergence() now calls _stale_vms() directly, bypassing the
timeout-sampler retry behavior that previously covered inventory reads. If the
openshift-python-wrapper inventory request raises during a temporary API interruption, that
exception ends clone setup instead of allowing MAC convergence polling to continue.

2. Clones can fail after the last refresh ✓ Resolved

Resolving commit: fec2d35

Resolution reason
The convergence loop now checks inventory before deciding to wait, caps the forced refresh's
ready_timeout to the remaining window so it cannot consume the whole deadline, and caps sleeps to
the remaining time, guaranteeing a final poll after the last refresh before the timeout error.
Description
_wait_for_inventory_mac_convergence() schedules a refresh at 120 seconds within a 180-second
deadline, then makes only one inventory check after a provider-ready wait that can take 60 seconds.
If that wait consumes the remaining time and inventory updates just afterward, the loop raises
ValueError without polling for the update, so the final retry cannot resolve a stale clone.

3. Cloned VMs can time out despite refresh ✓ Resolved

Resolving commit: f68ae8d

Resolution reason
Removed allow_refresh gating so the batch wait always keeps its scheduled refresh retries; one
shared deadline across all cloned VMs, with refreshes repeated at bounded offsets while any VM is
stale.
Description
wait_for_cloned_vms_in_forklift_inventory() passes allow_refresh=False whenever the batch
refresh runs, causing _wait_for_inventory_mac_convergence() to discard its scheduled refresh
retries. If that single refresh misses the collector snapshot during the documented reconciliation
race, the stale VMs only poll for 180 seconds before class setup fails.

View high (2)
4. Failed creates can delete existing resources ✓ Resolved

Resolving commit: 1bd34ce

Resolution reason
Teardown registration is deferred until creation is confirmed; rejected conflict creates are never
registered, and the reuse path registers only after a successful wait. Newly created resources are
still registered before the existence wait so cleanup still reaches them if the wait fails.
Description
create_and_store_resource() registers a teardown entry before deploy(wait=True) confirms
creation, and removes that entry only for ConflictError under the "fail" policy. If validation
fails before creation, or an existing resource triggers the reuse path and _resource.wait() fails,
session teardown can use the retained entry to clean up an object this run did not create.

5. Conflicts delete pre-existing resources ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
On the on_conflict="fail" ConflictError path, the teardown entry recorded before deploy() is now
unregistered before the ValueError is raised, so session teardown no longer deletes a pre-existing
resource with the conflicting name.
Description
create_and_store_resource() registers a resource for teardown before deploy() but does not
remove the entry when on_conflict="fail" rejects an existing resource without creating anything.
When a fixed name already belongs to another run, session teardown calls clean_up() using the
recorded name and namespace and can delete that pre-existing object.


Remediation recommended

6. Loose type in new helper lacks a reason ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
Added an inline comment above fixture_store: dict[str, Any] in the (renamed to
_store_resource_for_teardown) signature explaining that the store mixes heterogeneous per-kind
entries, which justifies the use of Any as the finding requested.
Description
The new store_resource_for_teardown signature types fixture_store as dict[str, Any] with no
comment explaining why a narrower type cannot be used. A future caller or maintainer copying this
signature will inherit the untyped store without knowing whether Any was a deliberate choice.


Informational

7. Internal helper looks like public API ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
The author renamed the function to _store_resource_for_teardown at its definition (line 27) and
updated the call site (line 9), exactly as the fix prompt recommends. The author also added a
comment and an unregister step on conflict, which are unrelated extras but do not affect the rename
fix.
Description
store_resource_for_teardown was extracted from create_and_store_resource and keeps a
public-looking name with no leading underscore. Its only consumer is the call at line 62 of the same
module, and a repository-wide search finds no other references, so it is an internal sub-task
helper. Because the name reads as public, another module could start importing it and treat it as a
stable interface, and a later reader cannot tell from the name that it is an internal detail of
resource creation.

Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #27
✅ Compliance rules (platform): 93 rules
✅ Skills: remote-debugging
✅ Web pages:
  +2 more
✅ Cross-repo context — repo relationships
  Explored: repo: RedHatQE/timeout-sampler (sha: 4a2caa88) — View relationship
  Explored: repo: RedHatQE/openshift-python-wrapper (sha: 9ffbfb17) — View relationship
Review mode: Auto: ⚖️ Balanced: Substantial runtime polling and refresh logic carries real behavioral risk.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit fb2b965

Results up to commit 0e0d930 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Conflicts delete pre-existing resources ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
On the on_conflict="fail" ConflictError path, the teardown entry recorded before deploy() is now
unregistered before the ValueError is raised, so session teardown no longer deletes a pre-existing
resource with the conflicting name.
Description
create_and_store_resource() registers a resource for teardown before deploy() but does not
remove the entry when on_conflict="fail" rejects an existing resource without creating anything.
When a fixed name already belongs to another run, session teardown calls clean_up() using the
recorded name and namespace and can delete that pre-existing object.


Remediation recommended
2. Loose type in new helper lacks a reason ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
Added an inline comment above fixture_store: dict[str, Any] in the (renamed to
_store_resource_for_teardown) signature explaining that the store mixes heterogeneous per-kind
entries, which justifies the use of Any as the finding requested.
Description
The new store_resource_for_teardown signature types fixture_store as dict[str, Any] with no
comment explaining why a narrower type cannot be used. A future caller or maintainer copying this
signature will inherit the untyped store without knowing whether Any was a deliberate choice.


Informational
3. Internal helper looks like public API ✓ Resolved

Resolving commit: 3fb07f3

Resolution reason
The author renamed the function to _store_resource_for_teardown at its definition (line 27) and
updated the call site (line 9), exactly as the fix prompt recommends. The author also added a
comment and an unregister step on conflict, which are unrelated extras but do not affect the rename
fix.
Description
store_resource_for_teardown was extracted from create_and_store_resource and keeps a
public-looking name with no leading underscore. Its only consumer is the call at line 62 of the same
module, and a repository-wide search finds no other references, so it is an internal sub-task
helper. Because the name reads as public, another module could start importing it and treat it as a
stable interface, and a later reader cannot tell from the name that it is an internal detail of
resource creation.

Results up to commit 3fb07f3 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Failed creates can delete existing resources ✓ Resolved

Resolving commit: 1bd34ce

Resolution reason
Teardown registration is deferred until creation is confirmed; rejected conflict creates are never
registered, and the reuse path registers only after a successful wait. Newly created resources are
still registered before the existence wait so cleanup still reaches them if the wait fails.
Description
create_and_store_resource() registers a teardown entry before deploy(wait=True) confirms
creation, and removes that entry only for ConflictError under the "fail" policy. If validation
fails before creation, or an existing resource triggers the reuse path and _resource.wait() fails,
session teardown can use the retained entry to clean up an object this run did not create.

Results up to commit 304f342 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Cloned VMs can time out despite refresh ✓ Resolved

Resolving commit: f68ae8d

Resolution reason
Removed allow_refresh gating so the batch wait always keeps its scheduled refresh retries; one
shared deadline across all cloned VMs, with refreshes repeated at bounded offsets while any VM is
stale.
Description
wait_for_cloned_vms_in_forklift_inventory() passes allow_refresh=False whenever the batch
refresh runs, causing _wait_for_inventory_mac_convergence() to discard its scheduled refresh
retries. If that single refresh misses the collector snapshot during the documented reconciliation
race, the stale VMs only poll for 180 seconds before class setup fails.

Results up to commit f68ae8d ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Transient inventory errors abort migrations ✓ Resolved

Resolving commit: fec2d35

Resolution reason
Per-VM inventory reads are now wrapped in a TimeoutSampler with a 30s retry window, so transient
read failures are retried instead of immediately ending clone setup; persistent failures degrade to
not-converged rather than aborting.
Description
_wait_for_inventory_mac_convergence() now calls _stale_vms() directly, bypassing the
timeout-sampler retry behavior that previously covered inventory reads. If the
openshift-python-wrapper inventory request raises during a temporary API interruption, that
exception ends clone setup instead of allowing MAC convergence polling to continue.

2. Clones can fail after the last refresh ✓ Resolved

Resolving commit: fec2d35

Resolution reason
The convergence loop now checks inventory before deciding to wait, caps the forced refresh's
ready_timeout to the remaining window so it cannot consume the whole deadline, and caps sleeps to
the remaining time, guaranteeing a final poll after the last refresh before the timeout error.
Description
_wait_for_inventory_mac_convergence() schedules a refresh at 120 seconds within a 180-second
deadline, then makes only one inventory check after a provider-ready wait that can take 60 seconds.
If that wait consumes the remaining time and inventory updates just afterward, the loop raises
ValueError without polling for the update, so the final retry cannot resolve a stale clone.

Grey Divider

Qodo Logo

Comment thread utilities/resources.py Resolved
Comment thread utilities/resources.py Resolved
@redhat-qe-bot2

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (0e0d930).
The following labels were preserved: commented-qodo-code-review[bot].

@AmenB

AmenB commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/qodo

The following review comments were reviewed and a decision was made:

utilities/resources.py:62 (qodo cross repo) — Conflicts delete pre-existing resources

Addressed: addressed — fixed in 3fb07f3: on the on_conflict="fail" path the teardown entry recorded before deploy is now removed with unregister_teardown_resource(fixture_store=fixture_store, resource=_resource) before raising ValueError. A rejected conflict therefore leaves no tracked resource, so session teardown can never call clean_up() on an object this run did not create.

utilities/resources.py:79 (qodo rule violation) — Loose type in new helper lacks a reason

Addressed: addressed — fixed in 3fb07f3: the helper is now private: _store_resource_for_teardown, with its single caller in this module updated. It is an internal sub-step, so it should not read as a stable public API.

utilities/resources.py:79 (qodo rule violation) — Internal helper looks like public API

Addressed: addressed — fixed in 3fb07f3: the helper is now private: _store_resource_for_teardown, with its single caller in this module updated. It is an internal sub-step, so it should not read as a stable public API.

@qodo-code-review

Copy link
Copy Markdown

The following review comments were reviewed and a decision was made:

utilities/resources.py:62 (qodo cross repo) — Conflicts delete pre-existing resources

Addressed: addressed — fixed in 3fb07f3: on the on_conflict="fail" path the teardown entry recorded before deploy is now removed with unregister_teardown_resource(fixture_store=fixture_store, resource=_resource) before raising ValueError. A rejected conflict therefore leaves no tracked resource, so session teardown can never call clean_up() on an object this run did not create.

utilities/resources.py:79 (qodo rule violation) — Loose type in new helper lacks a reason

Addressed: addressed — fixed in 3fb07f3: the helper is now private: _store_resource_for_teardown, with its single caller in this module updated. It is an internal sub-step, so it should not read as a stable public API.

utilities/resources.py:79 (qodo rule violation) — Internal helper looks like public API

Addressed: addressed — fixed in 3fb07f3: the helper is now private: _store_resource_for_teardown, with its single caller in this module updated. It is an internal sub-step, so it should not read as a stable public API.

Your latest message reads as a status update rather than a question, so here is where the three findings stand. All three are marked resolved in commit 3fb07f3, and the catalog shows 0 active findings.

  • finding 1 (Conflicts delete pre-existing resources, utilities/resources.py:62): Fixed. On the on_conflict="fail" path, the teardown entry recorded before deploy() is removed with unregister_teardown_resource(...) before the ValueError is raised. Session teardown therefore won't delete an object this run didn't create.
  • finding 2 (Loose type in new helper lacks a reason, utilities/resources.py:79-80): Fixed. An inline comment above fixture_store: dict[str, Any] explains that the store mixes heterogeneous per-kind entries, which justifies Any.
  • finding 3 (Internal helper looks like public API, utilities/resources.py:79-81): Fixed. The helper is renamed to _store_resource_for_teardown and its single call site in the module is updated.

If you want a re-review of the new on_conflict behavior, I can run one, or I can explain any of these in more detail.

Comment thread utilities/resources.py Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3fb07f3

@AmenB

AmenB commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/qodo

The following review comments were reviewed and a decision was made:

utilities/resources.py:62 (qodo cross repo) — Failed creates can delete existing resources

Addressed: addressed — fixed in 1bd34ce: creation and the existence wait are now separate steps, so a teardown entry is recorded only once creation is confirmed. _resource.deploy(wait=False) runs first; on ConflictError with on_conflict="fail" the ValueError is raised with nothing recorded; on the reuse path the object is waited on first and tracked only afterwards, so a failed _resource.wait() leaves no entry pointing at foreign state; for a freshly created resource the entry is recorded after the successful create and before wait(), so a failed wait is still cleaned up. A validation/API failure raises before any entry exists. Using deploy(wait=False) (rather than create()) also preserves the REUSE_IF_RESOURCE_EXISTS handling that lives inside deploy().

@AmenB

AmenB commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/qodo Please re-evaluate all remaining sticky findings against the current code.
For each finding, check if the referenced code has been fixed in subsequent commits.
Remove findings that are fully addressed. Keep any findings where the issue is still present in the code.

@qodo-code-review

Copy link
Copy Markdown

The following review comments were reviewed and a decision was made:

utilities/resources.py:62 (qodo cross repo) — Failed creates can delete existing resources

Addressed: addressed — fixed in 1bd34ce: creation and the existence wait are now separate steps, so a teardown entry is recorded only once creation is confirmed. _resource.deploy(wait=False) runs first; on ConflictError with on_conflict="fail" the ValueError is raised with nothing recorded; on the reuse path the object is waited on first and tracked only afterwards, so a failed _resource.wait() leaves no entry pointing at foreign state; for a freshly created resource the entry is recorded after the successful create and before wait(), so a failed wait is still cleaned up. A validation/API failure raises before any entry exists. Using deploy(wait=False) (rather than create()) also preserves the REUSE_IF_RESOURCE_EXISTS handling that lives inside deploy().

The current diff appears to address finding 1 (005dd7db-bd20-496a-adfc-e25763f20202, "Failed creates can delete existing resources"). The catalog still shows it as active because the published review was generated at 3fb07f3, before the fix in 1bd34ce.

What create_and_store_resource does now (utilities/resources.py)

  • Failure before creation: deploy(wait=False) raises before anything is recorded, so no teardown entry exists.
  • ConflictError with on_conflict="fail": raises ValueError and records nothing.
  • ConflictError with on_conflict="reuse": calls wait() first and records the entry only if the wait succeeds.
  • Freshly created resource: the entry is recorded after a confirmed create and before wait(), so a failed wait still gets cleaned up.

deploy(wait=False) is used instead of create() so that REUSE_IF_RESOURCE_EXISTS handling still applies. Resource.deploy in External repo: RedHatQE/openshift-python-wrapper, ocp_resources/resource.py [831-863] checks that variable before calling self.create(wait=wait).

Caveats

  • A fresh review is needed to close finding 1 in the catalog.
  • If REUSE_IF_RESOURCE_EXISTS skips creation, deploy() returns an existing object without raising ConflictError. That object is recorded for teardown on the "created" path. The original code did the same, so this is not a regression, but it is the same ownership concern the finding raised.

@qodo-code-review

Copy link
Copy Markdown

Please re-evaluate all remaining sticky findings against the current code.
For each finding, check if the referenced code has been fixed in subsequent commits.
Remove findings that are fully addressed. Keep any findings where the issue is still present in the code.

None of the four sticky findings is still active. The catalog already marks all of them implemented, and I checked the current code in utilities/resources.py to confirm the fixes are still in place.

  • Failed creates can delete existing resources (finding 1 in the published report): Fixed. Teardown registration now happens only after creation is confirmed, or after the adoption wait succeeds. A created resource is still registered before its existence wait, so cleanup reaches it if the wait fails (utilities/resources.py:63-81).
  • Conflicts delete pre-existing resources (finding 2): Fixed. With on_conflict="fail", a ConflictError raises a ValueError before anything is registered, so teardown never sees the foreign object (utilities/resources.py:65-71).
  • Loose type in new helper lacks a reason (finding 3): Fixed. _store_resource_for_teardown has an inline comment explaining why fixture_store is dict[str, Any] (utilities/resources.py:86-88).
  • Internal helper looks like public API (finding 4): Fixed. The helper is renamed to _store_resource_for_teardown, and its only callers are the two sites in the same module (utilities/resources.py:76 and :80).

I haven't removed anything from the published report, and I haven't dismissed any findings. You only asked me to re-evaluate them, and they are already closed. If you want the report cleaned up further, tell me to dismiss them by title and I'll do it. Only the PR author can dismiss.

@rh-bot-1

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (1bd34ce).
The following labels were preserved: commented-AmenB.

@krcmarik krcmarik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Found 3 issue(s) in this PR:

🔴 Critical Issues (1)

File Line Issue
utilities/provider_inventory.py 365 Forced refresh + 3x timeout masks the inventory defects this check exists to cat

⚠️ Warnings (2)

File Line Issue
utilities/provider_inventory.py 371 One-shot refresh has no recovery path
utilities/resources.py 24 on_conflict="fail" is dead code and the two conflict-path comments contradict

Review generated by Claude Code

Comment thread utilities/provider_inventory.py Outdated
last_inventory_macs = {mac.lower() for nic in vm.get("nics") or [] if (mac := nic.get("mac"))}
return last_inventory_macs == live_macs

# The provider inventory refreshes on its own cadence (minutes for vSphere), so polling

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL] Forced refresh + 3x timeout masks the inventory defects this check exists to catch

The justification comment ("The provider inventory refreshes on its own cadence (minutes for vSphere)") is asserted as fact but cites no ticket, measurement, or upstream reference - and it is contradicted by the code itself:

  • The function's own (unchanged) docstring says "vCenter finalizes them almost immediately, but inventory can briefly lag". Both statements cannot be true.
  • The code polls first and only refreshes on failure, implicitly conceding that polling does converge.
  • By the time this runs, wait_for_cloned_vms_in_forklift_inventory has already confirmed the cloned VM exists in inventory - with stale (pre-clone) MACs. That is not "slow inventory"; that is inventory serving inconsistent data for an object it already lists: exactly the condition this convergence check was built to detect. Making it self-heal means the suite can no longer surface it.

vSphere inventory is expected to update near real-time; if it does not, that is a product bug that should be filed upstream and referenced here, not worked around client-side. As merged, a forklift regression in vSphere inventory updates would pass green across the whole suite because every test force-refreshes past the stale window - end users without the workaround get stale-MAC migrations.

Note the sibling functions that force refresh (wait_for_added_nics_in_forklift_inventory, wait_for_shared_rdm_disk_in_forklift_inventory) do so for live reconfigurations of an already-inventoried VM - a categorically different, documented case, so they are not precedent for this one.

Please either back the "minutes" claim with evidence (upstream issue / measured refresh interval) and reconcile the docstring, or drop the forced refresh and the 60s->180s timeout and file the inventory bug instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — you're right on the substance, and the "minutes" sentence was an unbacked inference on my side. Reworked in 304f342:

Evidence instead of the claim. The measured behaviour is stale data for an object inventory already lists, not slow discovery: CI #22 / #25 / #27 (tier0 vSphere) all failed with Inventory NIC MACs … did not converge after 60s/180s, inventory reporting 00:50:56:9d:73:f4 while live vCenter reported 00:50:56:9d:93:a7; same signature on both vCenters (10.6.46.248 vSphere 7.0.3, 10.6.46.250 vSphere 8.0.1). In every run wait_for_cloned_vms_in_forklift_inventory() had already confirmed the VM exists, so the cache was serving pre-clone MACs for a listed VM. The "refreshes on its own cadence (minutes)" wording is gone; the comment and the _wait_for_inventory_mac_convergence() docstring now state the same thing (eventually-consistent cache, observed stale window >180s).

Order inverted. The batch now refreshes before polling, so the code no longer implies that polling converges on its own.

Staleness is no longer silent. When cached MACs are stale the wait emits warnings.warn(...) with both MAC sets, so it shows up in the pytest warnings summary and in the code path, instead of being absorbed by a refresh.

Sibling helpers. Agreed — wait_for_added_nics_* / wait_for_shared_rdm_disk_* cover live reconfiguration of an already-inventoried VM, which is a different case; the comment no longer frames them as precedent and states why this one differs.

On filing upstream: a bug is being opened for "vSphere provider inventory serves stale NIC MACs for an already-inventoried cloned VM"; I'll link the ID here as soon as it exists. Meanwhile the warning names the symptom and both MAC sets, so a change in inventory behaviour stays visible.

I did keep the refresh (i.e. I did not take the "drop the refresh and the 60→180 bump" branch): dropping it returns the suite to failing class setup on this behaviour. The intent — don't hide it — is covered by the warning + the bug reference.

Comment thread utilities/provider_inventory.py Outdated
if not _check_mac_convergence():
if source_provider.ocp_resource is None:
raise ValueError("source_provider.ocp_resource is not set")
force_inventory_refresh(source_provider.ocp_resource)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[WARNING] One-shot refresh has no recovery path

The refresh fires at most once (only when the initial check fails) and the poll loop never re-triggers it. If that single refresh is lost - e.g. the collector snapshot races vCenter and commits stale MACs, or the controller is mid-reconcile for a previous trigger during the clone burst this PR cites as motivation - the only remaining convergence mechanism is the natural refresh cadence the PR itself declares insufficient. The test then burns the full window and fails with a misleading "MACs did not converge" error, since the inventory was never re-read after the lost refresh.

Worst case is also significant: force_inventory_refresh blocks up to 180s on the Ready condition, then the loop polls another 180s - up to ~6 minutes per VM, sequentially per cloned VM, under exactly the burst conditions the PR claims to fix.

If refreshes are needed here, consider triggering one refresh for the whole batch of clones before polling all VMs' MACs - that would also remove the need for the module-level _last_refresh_timestamp counter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both points taken, implemented in 304f342:

  • One refresh per clone burst. wait_for_cloned_vms_in_forklift_inventory() now refreshes once for all cloned VMs before the per-VM waits (and those waits run with allow_refresh=False), so we no longer pay the provider-Ready wait once per clone.
  • Bounded re-trigger. Inside _wait_for_inventory_mac_convergence() refreshes happen at offsets (0, 60, 120) seconds, so a refresh lost to a race (collector snapshot vs. controller reconcile) is retried rather than leaving us polling a cache nobody re-read. The failure message therefore now genuinely means "we re-read after refreshing and it still didn't converge".
  • Bounded refresh wait. The refresh in this path uses _CONVERGENCE_REFRESH_READY_TIMEOUT = 60 instead of 180, so the worst case is no longer 180s (Ready) + 180s (poll) per VM.
  • Module-level counter removed. The _refresh value is derived from the provider's own current value (int(current) + 1 when it is ahead of now, otherwise now), which keeps it strictly increasing per provider without _last_refresh_timestamp — as you suggested.

Comment thread utilities/resources.py Outdated
fixture_store: dict[str, Any],
resource: type[Resource],
test_name: str | None = None,
on_conflict: Literal["reuse", "fail"] = "reuse",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[WARNING] on_conflict="fail" is dead code and the two conflict-path comments contradict each other

Nothing in this PR (or the repo) passes on_conflict - every call site keeps the default "reuse", so the headline "safe resource creation" behavior is never exercised.

More importantly, the comments disagree with the default: the "fail" branch says "adopting foreign state would mean deleting it later", yet the default "reuse" path does exactly that - on ConflictError it waits, registers the pre-existing object in fixture_store["teardown"], and session teardown deletes it. Either that hazard is real (then the default is the bug, and the collision-prone call sites - e.g. the fixed-name plan-initial in resume_conversion.py or the get_or_create_namespace explicit-name path - should be converted to "fail"), or it is not (then the "fail" branch's comment is wrong).

As merged, the PR advertises a safety property it does not deliver at any call site. Suggest either wiring up the callers that need "fail" or dropping the parameter until a consumer exists.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on both halves, and acted on the scope one: on_conflict is removed from this PR in 304f342 — nothing in the repo passes it yet, so it was dead code here.

It will come back in the toehold/copy-appliance PR (#835) together with its only consumer: create_provider_copy_appliance_template() creates a CopyApplianceTemplate with a fixed name (<provider>-copy-appliance-template), which is exactly the case where adopting (and later deleting) a pre-existing object is wrong. Nothing in #870 depends on it.

The contradiction will be resolved there as a stated position rather than leaving it implicit: reuse (default) keeps legacy behaviour — adopt the existing object and let session teardown delete it; fail is for callers that own a fixed name and must never delete foreign state. I'm not converting existing collision-prone call sites (e.g. get_or_create_namespace explicit-name path) in that PR — that changes behaviour for unrelated tests and deserves its own justification — but I'll open a follow-up for it if you think it's in scope.

Kept in this PR: the teardown-ordering fix (a teardown entry is recorded only once creation is confirmed, or after the adoption wait succeeds), which is independent of the conflict policy.

Comment thread utilities/provider_inventory.py Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 304f342

@AmenB

AmenB commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

/qodo

The following review comments were reviewed and a decision was made:

utilities/provider_inventory.py:530 (qodo bug) — Cloned VMs can time out despite refresh

Addressed: addressed — fixed in f68ae8d: the convergence wait is now batch-level. _wait_for_inventory_mac_convergence() takes the whole clone list, captures each VM's live MACs once, and polls the batch against one deadline. Provider refreshes are scheduled at the _MAC_CONVERGENCE_REFRESH_OFFSETS (0/60/120 s) while any VM is still stale, so a refresh lost to the collector/controller race is retried for the whole batch instead of leaving it to poll stale inventory until timeout. There is one refresh per offset and one provider-ready wait (no per-VM readiness waits), allow_refresh and the one-shot batch helper are gone, and both the warning and the timeout error now list the stale VMs with inventory-vs-live MAC sets.

Comment thread utilities/provider_inventory.py Resolved
Comment thread utilities/provider_inventory.py Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit f68ae8d

@AmenB

AmenB commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

/qodo

The following review comments were reviewed and a decision was made:

utilities/provider_inventory.py:378 (qodo cross repo) — Transient inventory errors abort migrations

Addressed: addressed — fixed in fec2d35: _inventory_nic_macs() reads through a short TimeoutSampler (_INVENTORY_READ_RETRY_TIMEOUT = 30, default retry-all exceptions_dict) around the new _read_inventory_vm() helper, so a transient inventory/API error retries instead of ending clone setup; if the retry window is exhausted the read logs a warning and counts as not-yet-converged, which the outer convergence loop handles like any other stale sample.

utilities/provider_inventory.py:398 (qodo bug) — Clones can fail after the last refresh

Addressed: addressed — fixed in fec2d35: the loop is now check-then-wait (while True), so the last scheduled refresh is always followed by another inventory read before the deadline can expire, and the refresh's provider-ready wait is clamped to the remaining window (max(1, min(_CONVERGENCE_REFRESH_READY_TIMEOUT, int(remaining)))) so it cannot consume the rest of the convergence timeout.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit fec2d35

@qodo-code-review

Copy link
Copy Markdown

The following review comments were reviewed and a decision was made:

utilities/provider_inventory.py:378 (qodo cross repo) — Transient inventory errors abort migrations

Addressed: addressed — fixed in fec2d35: _inventory_nic_macs() reads through a short TimeoutSampler (_INVENTORY_READ_RETRY_TIMEOUT = 30, default retry-all exceptions_dict) around the new _read_inventory_vm() helper, so a transient inventory/API error retries instead of ending clone setup; if the retry window is exhausted the read logs a warning and counts as not-yet-converged, which the outer convergence loop handles like any other stale sample.

utilities/provider_inventory.py:398 (qodo bug) — Clones can fail after the last refresh

Addressed: addressed — fixed in fec2d35: the loop is now check-then-wait (while True), so the last scheduled refresh is always followed by another inventory read before the deadline can expire, and the refresh's provider-ready wait is clamped to the remaining window (max(1, min(_CONVERGENCE_REFRESH_READY_TIMEOUT, int(remaining)))) so it cannot consume the rest of the convergence timeout.

Both review comments check out against the code in fec2d35, and the catalog shows all 7 findings as implemented, with 0 active.

  • Transient inventory errors (utilities/provider_inventory.py:378, finding 1): _inventory_nic_macs() now wraps _read_inventory_vm() in a TimeoutSampler with a 30s window. _read_inventory_vm() turns a ValueError from get_vm() into an empty record. The sampler's default exceptions_dict is {Exception: []}, so other exceptions are retried too rather than propagating (see /cross_repos/timeout-sampler/docs/api-timeout-sampler.md line 41). If the window runs out, the read logs a warning and counts as not converged. Nothing escapes to end clone setup.
  • Clones failing after the last refresh (utilities/provider_inventory.py:398, finding 2): The loop in _wait_for_inventory_mac_convergence() checks inventory before it decides whether to wait. The loop only exits after a check, so the last scheduled refresh is always followed by a read. The refresh's ready_timeout is clamped to the remaining window, and sleeps are capped to it as well.

Neither fix needs a follow-up from you. If you meant a different finding or a different question, tell me which one.

- trigger the provider inventory refresh from the MAC convergence wait instead of
  polling a cache known to lag; one refresh is shared by the clone batch and
  retried at fixed offsets while any VM's MACs are still stale
- make the _refresh trigger strictly monotonic per provider (it is
  second-granular, so same-second rewrites were silently ignored)
- treat a null nics list as "not converged" and retry transient inventory reads
  for 30s; re-read after the last refresh and clamp the provider-Ready wait to
  the remaining convergence window
- record a resource for teardown only once creation is confirmed, and fail fast
  when fixture_store has no base_resource_name
- make K8S_NAME_MAX_LENGTH public
@AmenB
AmenB force-pushed the fix/harness-inventory-and-resource-safety branch from fec2d35 to fb2b965 Compare November 25, 2026 10:11
@redhat-qe-bot1

Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (fec2d35).
The following labels were preserved: commented-AmenB.

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.

6 participants