Skip to content

HEP: support CDI way for non-root volume [skip ci]#10326

Open
Vicente-Cheng wants to merge 1 commit intoharvester:masterfrom
Vicente-Cheng:hep-non-root-volume
Open

HEP: support CDI way for non-root volume [skip ci]#10326
Vicente-Cheng wants to merge 1 commit intoharvester:masterfrom
Vicente-Cheng:hep-non-root-volume

Conversation

@Vicente-Cheng
Copy link
Copy Markdown
Contributor

Problem:

HEP: support CDI way for non-root volume

Solution:

HEP: support CDI way for non-root volume

Related Issue(s):

#9412

Test plan:

Additional documentation or context

We discussed the feature offline. This HEP is the record for the discussion summary.

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Harvester Enhancement Proposal (HEP) documenting how to extend CDI/StorageProfile behavior to non-root volumes and introduce an offline volume data migration action.

Changes:

  • Proposes an opt-in non-root volume creation flow using CDI DataVolumes alongside the existing PVC flow
  • Describes new “Advanced Options” in the UI (access mode / volume mode) and a new “Data Migration” volume action/API
  • Documents removal of the legacy volumeForVirtualMachine + filesystem blank-source workaround

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +11
This enhancement addresses this limitation by:
1. Providing an optional CDI DataVolume creation path alongside the existing PVC creation path, allowing users to opt in to CDI StorageProfile support when creating non-root volumes.
2. Exposing advanced volume creation options (access mode, volume mode) in the UI.
3. Adding a **Data Migration** action on the Volume page to allow offline storage migration between StorageClasses via CDI.
4. Removing the legacy `volumeForVirtualMachine` annotation mechanism and its associated filesystem blank source workaround, which are no longer needed.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The proposed approach in this HEP relies on an optional DataVolume creation path, but the linked issue (#9412) describes solving non-root PVCs via CDI PVC rendering (enabling the WebhookPvcRendering feature gate and labeling opt-in PVCs with cdi.kubevirt.io/applyStorageProfile: "true"). Please either align the proposal/implementation overview with that PVC-rendering approach or explicitly document why the DataVolume path is chosen and how it satisfies the issue requirements (including any needed CDI config/labels).

Copilot uses AI. Check for mistakes.

Before this enhancement, migrating data from a volume on one StorageClass to another required manual steps: creating a new volume, attaching both to a VM, and copying data.

After this enhancement, the user can select "Data Migration" from the volume actions menu. They specify a target volume name and target StorageClass, and the system creates a CDI DataVolume that clones the data automatically. The action is only available when the volume is not attached to any running VM.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The conditions for showing/allowing the Data Migration action are inconsistent: Story 3 says "not attached to any running VM", while later the UX section says "not attached to any VM" and the validation list mentions "not in use by any Pod". Please define a single, precise eligibility rule (e.g., “PVC not mounted by any Pod”) and use the same wording throughout.

Suggested change
After this enhancement, the user can select "Data Migration" from the volume actions menu. They specify a target volume name and target StorageClass, and the system creates a CDI DataVolume that clones the data automatically. The action is only available when the volume is not attached to any running VM.
After this enhancement, the user can select "Data Migration" from the volume actions menu. They specify a target volume name and target StorageClass, and the system creates a CDI DataVolume that clones the data automatically. The action is only available when the volume's PVC is not mounted by any Pod.

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +106
**Input type:**
```go
type DataMigrationInput struct {
TargetVolumeName string `json:"targetVolumeName"`
TargetStorageClassName string `json:"targetStorageClassName"`
}
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The Go example for DataMigrationInput includes literal \t and escaped struct tag quotes (e.g., json:\"targetVolumeName\"), which is not valid Go and will copy/paste incorrectly. In a fenced markdown code block you can use normal indentation and json:"..." tags without escaping.

Copilot uses AI. Check for mistakes.

## Motivation

The StorageProfile of CDI provide a centralized way to configure storage attributes (access modes, volume modes, clone strategies, snapshot classes) per StorageClass. However, these profiles only apply to CDI DataVolumes, not to standard PVCs. When a user creates a non-root volume from the Harvester UI, it is created as a plain PVC. This means:
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Grammar: "The StorageProfile of CDI provide" should be singular (e.g., "The StorageProfile of CDI provides" or "CDI StorageProfiles provide").

Suggested change
The StorageProfile of CDI provide a centralized way to configure storage attributes (access modes, volume modes, clone strategies, snapshot classes) per StorageClass. However, these profiles only apply to CDI DataVolumes, not to standard PVCs. When a user creates a non-root volume from the Harvester UI, it is created as a plain PVC. This means:
The StorageProfile of CDI provides a centralized way to configure storage attributes (access modes, volume modes, clone strategies, snapshot classes) per StorageClass. However, these profiles only apply to CDI DataVolumes, not to standard PVCs. When a user creates a non-root volume from the Harvester UI, it is created as a plain PVC. This means:

Copilot uses AI. Check for mistakes.

### Upgrade strategy

Upgrade would not affected with this change. The new DataVolume creation path and data migration action are additive features that do not interfere with existing PVC creation or VM workflows. The removal of the legacy `volumeForVirtualMachine` annotation and filesystem blank source mechanism is safe.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Grammar: "Upgrade would not affected" is ungrammatical; consider "Upgrade will not be affected" (or "Upgrades are not affected") for clarity.

Suggested change
Upgrade would not affected with this change. The new DataVolume creation path and data migration action are additive features that do not interfere with existing PVC creation or VM workflows. The removal of the legacy `volumeForVirtualMachine` annotation and filesystem blank source mechanism is safe.
The upgrade process will not be affected by this change. The new DataVolume creation path and data migration action are additive features that do not interfere with existing PVC creation or VM workflows. The removal of the legacy `volumeForVirtualMachine` annotation and filesystem blank source mechanism is safe.

Copilot uses AI. Check for mistakes.
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.

2 participants