Skip to content

MTV-3504 | Change to DiskTransfer step only on PreflightInspection#2964

Merged
yaacov merged 1 commit intokubev2v:mainfrom
solenoci:mtv-3504
Sep 29, 2025
Merged

MTV-3504 | Change to DiskTransfer step only on PreflightInspection#2964
yaacov merged 1 commit intokubev2v:mainfrom
solenoci:mtv-3504

Conversation

@solenoci
Copy link
Copy Markdown
Collaborator

@solenoci solenoci commented Sep 29, 2025

Issue: When running Preflight inspection, we need the CreateDataVolume phase to be present in the DiskTransfer step. However it was present in the the DiskTransfer step alson when running cold migration.

Fix: Only assign CreateDataVolume phase to DiskTransfer step, when running Preflight Inspection.

Ref: https://issues.redhat.com/browse/MTV-3504

Resolves: MTV-3504

Summary by CodeRabbit

  • Bug Fixes
    • Pipeline step mapping corrected so data-volume creation follows preflight inspection settings for warm vSphere migrations.
    • Pipeline display updated: shows Initialize when preflight inspection is disabled; shows Disk Transfer only when inspection runs.
    • Inspection gating logic simplified to more accurately reflect when preflight inspection should run, preventing incorrect pipeline steps.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 29, 2025

Walkthrough

Step handling now treats PhaseCreateDataVolumes separately: Migrator.Step queries Plan.ShouldRunPreflightInspection (which encapsulates vSphere, warm, skip-guest-conversion, and RunPreflightInspection checks) and routes the phase to DiskTransfer only when that predicate is true; otherwise it routes to Initialize. Plan gained the ShouldRunPreflightInspection method.

Changes

Cohort / File(s) Summary
Migrator phase routing
pkg/controller/plan/migrator/base/migrator.go
Extracted handling for PhaseCreateDataVolumes into its own branch in Step; route to DiskTransfer only if ShouldRunPreflightInspection() is true, otherwise route to Initialize.
Plan predicate
pkg/apis/forklift/v1beta1/plan.go
Added func (r *Plan) ShouldRunPreflightInspection() bool which returns true when source provider is vSphere, plan is warm, guest conversion is not skipped, and RunPreflightInspection flag is set.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Step as Migrator.Step
  participant Plan as Plan.ShouldRunPreflightInspection
  participant DT as DiskTransfer
  participant I as Initialize

  Step->>Plan: ShouldRunPreflightInspection()
  alt returns true
    Step->>DT: route PhaseCreateDataVolumes -> DiskTransfer
    Note right of DT #DDEFEF: preflight path (vSphere + warm + guest-conversion + flag)
  else returns false
    Step->>I: route PhaseCreateDataVolumes -> Initialize
    Note right of I #F7F0DD: non-preflight/default path
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Possibly related PRs

Suggested reviewers

  • mrnold
  • mnecas
  • Hazanel

Poem

I hop through branches, quick and bright,
CreateDataVolumes picks left or right.
If preflight, warm, and vSphere agree,
To DiskTransfer I bound with glee.
Else Initialize keeps me snug and light. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the core change by indicating that the DiskTransfer step is now applied only during Preflight Inspection, which aligns directly with the modifications in the migrator logic; the inclusion of the Jira ticket identifier is a common convention and does not detract from clarity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba3b7c9 and 9321b31.

📒 Files selected for processing (2)
  • pkg/apis/forklift/v1beta1/plan.go (1 hunks)
  • pkg/controller/plan/migrator/base/migrator.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

**/*.go: Review the code as if you are a friendly but pedantic very senior developer in our team. We generally expect the following:

  • Clarity and Simplicity: Write idiomatic Go. Code should be self-documenting. Complexity should be justified.
  • Concurrency: Ensure goroutine safety. Use channels for communication and synchronization. Avoid race conditions.
  • Error Handling: No silent failures. Errors must be checked, wrapped with context, and propagated. Use errors.Is and errors.As.
  • Resource Management: Prevent resource leaks. Defer close() or cleanup() calls immediately after allocation. Manage goroutine lifecycles.
  • API Design: APIs (REST, gRPC) must be well-defined, versioned, and backward-compatible. Input validation is mandatory.
  • Observability: Instrument code with structured logging, metrics (e.g., Prometheus), and tracing. Logs should provide context, not just messages.
  • Security: Be vigilant against vulnerabilities (e.g., injection, insecure direct object references). Sanitize inputs. Do not hardcode secrets.
  • Performance: Write efficient code, but avoid premature optimization. Be mindful of algorithmic complexity and memory allocations.
  • coverage: Make sure that the code has unit tests.

Files:

  • pkg/apis/forklift/v1beta1/plan.go
  • pkg/controller/plan/migrator/base/migrator.go
🧠 Learnings (1)
📚 Learning: 2025-09-19T03:47:22.164Z
Learnt from: mrnold
PR: kubev2v/forklift#2807
File: pkg/controller/plan/adapter/vsphere/builder.go:0-0
Timestamp: 2025-09-19T03:47:22.164Z
Learning: In forklift vSphere builder, the pvcMap population (for warm migration with volume populators) and dvSource type determination (based on useV2vForTransfer) are independent conditions. This means pvcMap can be non-nil while dvSource.VDDK is nil, leading to potential nil dereference when accessing dvSource.VDDK.BackingFile. The backing file key should be computed from disk.File instead.

Applied to files:

  • pkg/controller/plan/migrator/base/migrator.go
🧬 Code graph analysis (2)
pkg/apis/forklift/v1beta1/plan.go (1)
pkg/apis/forklift/v1beta1/plan/vm.go (1)
  • Warm (170-176)
pkg/controller/plan/migrator/base/migrator.go (4)
pkg/apis/forklift/v1beta1/doc.go (3)
  • PhaseConvertOpenstackSnapshot (67-67)
  • PhaseWaitForDataVolumesStatus (86-86)
  • PhaseCreateDataVolumes (71-71)
pkg/controller/plan/migrator/base/doc.go (2)
  • DiskTransfer (29-29)
  • Initialize (26-26)
pkg/controller/plan/context/migration.go (1)
  • Context (43-67)
pkg/apis/forklift/v1beta1/plan.go (1)
  • Plan (271-279)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Red Hat Konflux / forklift-controller-dev-preview-on-pull-request
  • GitHub Check: Red Hat Konflux / forklift-api-dev-preview-on-pull-request
🔇 Additional comments (5)
pkg/apis/forklift/v1beta1/plan.go (2)

368-374: Logic looks correct; central predicate is clean.
Warm detection via Type==MigrationWarm || Warm plus vSphere/skip/run gates is consistent with intent.


368-374: Add Go doc comment and tests for this exported predicate.
This method is exported and should carry a doc comment; also add table-driven tests for vSphere/type/warm/skip/run permutations.

Would you like me to open a follow-up with a doc+tests patch?

pkg/controller/plan/migrator/base/migrator.go (3)

257-258: OK to keep WaitForDataVolumesStatus under DiskTransfer.
This preserves the expected grouping for warm flows.


259-266: Correctly gate CreateDataVolumes step -> DiskTransfer only during preflight.
This removes the cold‑flow UI artifact while preserving warm preflight behavior. Please add unit tests for Step() covering both branches.

I can draft a small table-driven test for BaseMigrator.Step with plans where ShouldRunPreflightInspection returns true/false—want me to push that?


409-410: Explicit RequiresConversion() guard is redundant
Provider.RequiresConversion() returns true only for VSphere (and OVA), and ShouldRunPreflightInspection already gates inspection to VSphere warm migrations that aren’t skipped, so removing the extra conversion check has no effect.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@solenoci solenoci changed the title MTV-3504 | Change to DiskTransfer step only PreflightInspection MTV-3504 | Change to DiskTransfer step only on PreflightInspection Sep 29, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83362ef and bf712db.

📒 Files selected for processing (1)
  • pkg/controller/plan/migrator/base/migrator.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

**/*.go: Review the code as if you are a friendly but pedantic very senior developer in our team. We generally expect the following:

  • Clarity and Simplicity: Write idiomatic Go. Code should be self-documenting. Complexity should be justified.
  • Concurrency: Ensure goroutine safety. Use channels for communication and synchronization. Avoid race conditions.
  • Error Handling: No silent failures. Errors must be checked, wrapped with context, and propagated. Use errors.Is and errors.As.
  • Resource Management: Prevent resource leaks. Defer close() or cleanup() calls immediately after allocation. Manage goroutine lifecycles.
  • API Design: APIs (REST, gRPC) must be well-defined, versioned, and backward-compatible. Input validation is mandatory.
  • Observability: Instrument code with structured logging, metrics (e.g., Prometheus), and tracing. Logs should provide context, not just messages.
  • Security: Be vigilant against vulnerabilities (e.g., injection, insecure direct object references). Sanitize inputs. Do not hardcode secrets.
  • Performance: Write efficient code, but avoid premature optimization. Be mindful of algorithmic complexity and memory allocations.
  • coverage: Make sure that the code has unit tests.

Files:

  • pkg/controller/plan/migrator/base/migrator.go
🧠 Learnings (1)
📚 Learning: 2025-09-19T03:47:22.164Z
Learnt from: mrnold
PR: kubev2v/forklift#2807
File: pkg/controller/plan/adapter/vsphere/builder.go:0-0
Timestamp: 2025-09-19T03:47:22.164Z
Learning: In forklift vSphere builder, the pvcMap population (for warm migration with volume populators) and dvSource type determination (based on useV2vForTransfer) are independent conditions. This means pvcMap can be non-nil while dvSource.VDDK is nil, leading to potential nil dereference when accessing dvSource.VDDK.BackingFile. The backing file key should be computed from disk.File instead.

Applied to files:

  • pkg/controller/plan/migrator/base/migrator.go
🧬 Code graph analysis (1)
pkg/controller/plan/migrator/base/migrator.go (5)
pkg/apis/forklift/v1beta1/doc.go (3)
  • PhaseConvertOpenstackSnapshot (67-67)
  • PhaseWaitForDataVolumesStatus (86-86)
  • PhaseCreateDataVolumes (71-71)
pkg/controller/plan/migrator/base/doc.go (2)
  • DiskTransfer (29-29)
  • Initialize (26-26)
pkg/controller/plan/context/migration.go (1)
  • Context (43-67)
pkg/apis/forklift/v1beta1/plan.go (1)
  • Plan (271-279)
pkg/apis/forklift/v1beta1/plan/vm.go (1)
  • Warm (170-176)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Red Hat Konflux / forklift-api-dev-preview-on-pull-request
  • GitHub Check: Red Hat Konflux / forklift-controller-dev-preview-on-pull-request
  • GitHub Check: lint
  • GitHub Check: build

Comment thread pkg/controller/plan/migrator/base/migrator.go
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 29, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.26%. Comparing base (f1fe5d0) to head (9321b31).
⚠️ Report is 2086 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/plan/migrator/base/migrator.go 0.00% 10 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff            @@
##             main   #2964      +/-   ##
=========================================
- Coverage   15.45%   8.26%   -7.19%     
=========================================
  Files         112     381     +269     
  Lines       23377   53199   +29822     
=========================================
+ Hits         3613    4398     +785     
- Misses      19479   48453   +28974     
- Partials      285     348      +63     
Flag Coverage Δ
unittests 8.26% <0.00%> (-7.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf712db and ba3b7c9.

📒 Files selected for processing (2)
  • pkg/apis/forklift/v1beta1/plan.go (1 hunks)
  • pkg/controller/plan/migrator/base/migrator.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

**/*.go: Review the code as if you are a friendly but pedantic very senior developer in our team. We generally expect the following:

  • Clarity and Simplicity: Write idiomatic Go. Code should be self-documenting. Complexity should be justified.
  • Concurrency: Ensure goroutine safety. Use channels for communication and synchronization. Avoid race conditions.
  • Error Handling: No silent failures. Errors must be checked, wrapped with context, and propagated. Use errors.Is and errors.As.
  • Resource Management: Prevent resource leaks. Defer close() or cleanup() calls immediately after allocation. Manage goroutine lifecycles.
  • API Design: APIs (REST, gRPC) must be well-defined, versioned, and backward-compatible. Input validation is mandatory.
  • Observability: Instrument code with structured logging, metrics (e.g., Prometheus), and tracing. Logs should provide context, not just messages.
  • Security: Be vigilant against vulnerabilities (e.g., injection, insecure direct object references). Sanitize inputs. Do not hardcode secrets.
  • Performance: Write efficient code, but avoid premature optimization. Be mindful of algorithmic complexity and memory allocations.
  • coverage: Make sure that the code has unit tests.

Files:

  • pkg/apis/forklift/v1beta1/plan.go
  • pkg/controller/plan/migrator/base/migrator.go
🧠 Learnings (1)
📚 Learning: 2025-09-19T03:47:22.164Z
Learnt from: mrnold
PR: kubev2v/forklift#2807
File: pkg/controller/plan/adapter/vsphere/builder.go:0-0
Timestamp: 2025-09-19T03:47:22.164Z
Learning: In forklift vSphere builder, the pvcMap population (for warm migration with volume populators) and dvSource type determination (based on useV2vForTransfer) are independent conditions. This means pvcMap can be non-nil while dvSource.VDDK is nil, leading to potential nil dereference when accessing dvSource.VDDK.BackingFile. The backing file key should be computed from disk.File instead.

Applied to files:

  • pkg/controller/plan/migrator/base/migrator.go
🧬 Code graph analysis (2)
pkg/apis/forklift/v1beta1/plan.go (1)
pkg/apis/forklift/v1beta1/plan/vm.go (1)
  • Warm (170-176)
pkg/controller/plan/migrator/base/migrator.go (4)
pkg/apis/forklift/v1beta1/doc.go (3)
  • PhaseConvertOpenstackSnapshot (67-67)
  • PhaseWaitForDataVolumesStatus (86-86)
  • PhaseCreateDataVolumes (71-71)
pkg/controller/plan/migrator/base/doc.go (2)
  • DiskTransfer (29-29)
  • Initialize (26-26)
pkg/controller/plan/context/migration.go (1)
  • Context (43-67)
pkg/apis/forklift/v1beta1/plan.go (1)
  • Plan (271-279)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Red Hat Konflux / forklift-api-dev-preview-on-pull-request
  • GitHub Check: Red Hat Konflux / forklift-controller-dev-preview-on-pull-request
  • GitHub Check: build
  • GitHub Check: lint
🔇 Additional comments (2)
pkg/controller/plan/migrator/base/migrator.go (2)

260-266: CreateDataVolumes now maps to DiskTransfer only when preflight will run — good.

Please confirm expected UI for these cases:

  • Cold migration: CreateDataVolumes appears under Initialize.
  • Warm vSphere with RunPreflightInspection=false: Initialize.
  • Warm vSphere with RunPreflightInspection=true: DiskTransfer.
    Add unit tests for Step() to lock this behavior.

409-410: RunInspection predicate dropped RequiresConversion — intended?

Previously RunInspection required provider.RequiresConversion in addition to other gates. Now it solely defers to ShouldRunPreflightInspection, changing behavior. If this removal is intentional, please note it in the PR and tests. If not, reintroduce the check:

-	case RunInspection:
-		allowed = r.context.Plan.ShouldRunPreflightInspection()
+	case RunInspection:
+		allowed = r.context.Plan.ShouldRunPreflightInspection() &&
+			r.context.Source.Provider.RequiresConversion()

Would you like me to push tests to assert predicate behavior across providers and SkipGuestConversion?

Comment on lines +368 to +373
func (r *Plan) ShouldRunPreflightInspection() bool {
return r.IsSourceProviderVSphere() &&
r.Spec.Warm &&
!r.Spec.SkipGuestConversion &&
r.Spec.RunPreflightInspection
}
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Sep 29, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Honor Type=warm (not only Spec.Warm) and add doc comment.

ShouldRunPreflightInspection ignores Spec.Type and will return false for plans using Type=warm (Warm is deprecated). Also, the exported method lacks a doc comment.

Apply:

- func (r *Plan) ShouldRunPreflightInspection() bool {
- 	return r.IsSourceProviderVSphere() &&
- 		r.Spec.Warm &&
- 		!r.Spec.SkipGuestConversion &&
- 		r.Spec.RunPreflightInspection
- }
+// ShouldRunPreflightInspection reports whether a preflight inspection should run.
+// It applies only to warm migrations from vSphere when guest conversion is not skipped.
+// Note: Type supersedes the deprecated Warm boolean.
+func (r *Plan) ShouldRunPreflightInspection() bool {
+	isWarm := r.Spec.Type == MigrationWarm || r.Spec.Warm
+	return r.IsSourceProviderVSphere() &&
+		isWarm &&
+		!r.Spec.SkipGuestConversion &&
+		r.Spec.RunPreflightInspection
+}

Please add table-driven tests covering:

  • vSphere + Type=warm + RunPreflightInspection=true + SkipGuestConversion=false => true
  • vSphere + Warm=true (Type unset) => true
  • vSphere + Type=cold => false
  • vSphere + SkipGuestConversion=true => false
  • Non‑vSphere => false

🏁 Script executed:

#!/bin/bash
set -eux

# Find PlanSpec definition and its fields
rg -n 'type PlanSpec' -n -C5 pkg/apis/forklift/v1beta1

# Inspect PlanSpec fields for Type, Warm, SkipGuestConversion, RunPreflightInspection
rg -n 'PlanSpec' -n -C10 pkg/apis/forklift/v1beta1

# Locate MigrationWarm constant
rg -n 'MigrationWarm' -n -C5 pkg/apis/forklift/v1beta1

# Confirm IsSourceProviderVSphere signature
rg -n 'func (r \*Plan) IsSourceProviderVSphere' -n -C3 pkg/apis/forklift/v1beta1/plan.go

Length of output: 11213



---

🏁 Script executed:

```shell
#!/bin/bash
set -eux
# PlanSpec struct definition with key fields
rg -nP 'type PlanSpec struct' -n -C15 pkg/apis/forklift/v1beta1/plan.go
# Check Warm field
rg -nP 'Warm ' -n -C3 pkg/apis/forklift/v1beta1/plan.go
# Check SkipGuestConversion field
rg -nP 'SkipGuestConversion' -n -C3 pkg/apis/forklift/v1beta1/plan.go
# Check RunPreflightInspection field
rg -nP 'RunPreflightInspection' -n -C3 pkg/apis/forklift/v1beta1/plan.go
# Check Type field
rg -nP 'Type ' -n -C3 pkg/apis/forklift/v1beta1/plan.go
# Locate IsSourceProviderVSphere method
rg -nP 'func \\(r \\*Plan\\) IsSourceProviderVSphere' -n -C3 pkg/apis/forklift/v1beta1/plan.go

Length of output: 8812


Honor Spec.Type in ShouldRunPreflightInspection and add doc comment

  • Update ShouldRunPreflightInspection to treat Type==MigrationWarm or the deprecated Warm flag as warm migrations, and prepend a Go doc comment:
- func (r *Plan) ShouldRunPreflightInspection() bool {
-   return r.IsSourceProviderVSphere() &&
-     r.Spec.Warm &&
-     !r.Spec.SkipGuestConversion &&
-     r.Spec.RunPreflightInspection
- }
+// ShouldRunPreflightInspection reports whether a preflight inspection should run.
// It applies only to warm migrations from vSphere when guest conversion is not skipped.
// Note: Type supersedes the deprecated Warm boolean.
+func (r *Plan) ShouldRunPreflightInspection() bool {
+   isWarm := r.Spec.Type == MigrationWarm || r.Spec.Warm
+   return r.IsSourceProviderVSphere() &&
+     isWarm &&
+     !r.Spec.SkipGuestConversion &&
+     r.Spec.RunPreflightInspection
+}
  • Add table-driven tests covering:
    • vSphere + Type=warm + RunPreflightInspection=true + SkipGuestConversion=false ⇒ true
    • vSphere + Warm=true (Type unset) ⇒ true
    • vSphere + Type=cold ⇒ false
    • vSphere + SkipGuestConversion=true ⇒ false
    • Non-vSphere ⇒ false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (r *Plan) ShouldRunPreflightInspection() bool {
return r.IsSourceProviderVSphere() &&
r.Spec.Warm &&
!r.Spec.SkipGuestConversion &&
r.Spec.RunPreflightInspection
}
// ShouldRunPreflightInspection reports whether a preflight inspection should run.
// It applies only to warm migrations from vSphere when guest conversion is not skipped.
// Note: Type supersedes the deprecated Warm boolean.
func (r *Plan) ShouldRunPreflightInspection() bool {
isWarm := r.Spec.Type == MigrationWarm || r.Spec.Warm
return r.IsSourceProviderVSphere() &&
isWarm &&
!r.Spec.SkipGuestConversion &&
r.Spec.RunPreflightInspection
}
🤖 Prompt for AI Agents
In pkg/apis/forklift/v1beta1/plan.go around lines 368 to 373, the
ShouldRunPreflightInspection method currently only checks the deprecated
Spec.Warm boolean and misses honoring Spec.Type; update the method so it treats
a migration as warm when Spec.Type == MigrationWarm OR Spec.Warm is true, and
keep the other checks (IsSourceProviderVSphere, !Spec.SkipGuestConversion,
Spec.RunPreflightInspection); add a concise Go doc comment above the method
explaining that it returns true for vSphere warm migrations (determined by
Spec.Type==MigrationWarm or legacy Spec.Warm) when preflight inspection is
requested and guest conversion is not skipped; then add table-driven unit tests
covering: vSphere + Type=warm + RunPreflightInspection=true +
SkipGuestConversion=false ⇒ true; vSphere + Warm=true (Type unset) ⇒ true;
vSphere + Type=cold ⇒ false; vSphere + SkipGuestConversion=true ⇒ false;
Non-vSphere ⇒ false.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@solenoci I agree with code rabbit on this

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point, thank you

Issue: When running Preflight inspection, we need the CreateDataVolume
phase to be present in the DiskTransfer step. However it was present in
the the DiskTransfer step alson when running cold migration.

Fix: Only assign CreateDataVolume phase to DiskTransfer step, when
running Preflight Inspection.

Ref: https://issues.redhat.com/browse/MTV-3504

Resolves: MTV-3504

Signed-off-by: Stefan Olenocin <solenoci@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

@yaacov yaacov merged commit 6b10026 into kubev2v:main Sep 29, 2025
15 of 16 checks passed
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