Skip to content

fields-pvc-name-template#895

Draft
Jenny-Anne wants to merge 3 commits intokubev2v:mainfrom
Jenny-Anne:MTV-3092-pvc-name-template
Draft

fields-pvc-name-template#895
Jenny-Anne wants to merge 3 commits intokubev2v:mainfrom
Jenny-Anne:MTV-3092-pvc-name-template

Conversation

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forklift-documentation Ready Ready Preview, Comment Apr 2, 2026 1:24pm

When creating a migration plan, you can use template variables to customize the names of persistent volume claims (PVCs) for migrated virtual machine disks. The template follows Go template syntax.

PVC names must be DNS-compliant: they must consist of lowercase alphanumeric characters or hyphens (`-`), start with an alphanumeric character, and not exceed 63 characters. {project-short} validates the `pvcNameTemplate` against the actual VM inventory when you create a migration plan. If the template syntax is invalid or if the resulting PVC names are not DNS-compliant, {project-short} adds an error to the plan conditions and prevents the migration from running.
// TODO: Check with SME - Confirm MTV validates PVC templates at plan creation time (unlike network/volume templates which aren't validated).
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.

Does MTV validate PVC templates at plan creation time (unlike network/volume templates which aren't validated)?

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.

yes, it's validated when you create the plan

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.

we also validate the network and volum name templates at plan creation,

the fact that we do validation or not is an internal implementation for forklift internal use, a user must set valid templates, they should not assume we will validate templates for them

* `.WinDriveLetter`: Windows drive letter in lowercase (for example, `c`, `d`). Only applicable to Windows guests.
+
This variable requires the QEMU Guest Agent (or {vmw} Tools) to be active and reachable on the source VM. It also requires a disk key mapping between the guest operating system and the hardware disk. This mapping may be missing for some disk configurations, particularly IDE disks. When the mapping is missing, {project-short} raises an information-level concern and the variable cannot be resolved in the PVC name template.
// TODO: Check with SME - Does .WinDriveLetter resolve to empty string when used on Linux VM or when mapping is missing? Original Jira mentioned "may resolve to an empty string or trigger a validation warning"
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.

Does .WinDriveLetter resolve to empty string when used on Linux VM or when mapping is missing? Original Jira mentioned "may resolve to an empty string or trigger a validation warning"

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.

it will be empty in any case we can't parse a drive letter, for example on linux there are no drive letters, or on windows when win drive is not set explicitly, if user assume it's a letter exist, and create a template that become invalid in case it's not, they will get a validation error.


== Available variables

The `pvcNameTemplate` field has access to the following variables:
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.

@coderabbitai, can you validate the fields in this documentation match the fields defined in https://github.com/kubev2v/forklift/blob/main/pkg/apis/forklift/v1beta1/plan.go#L528 ?

can you check the network and volumen too ?

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.

https://github.com/kubev2v/forklift/blob/main/pkg/apis/forklift/v1beta1/plan.go#L528

type VSpherePVCNameTemplateData struct {
	VmName         string `json:"vmName"`
	TargetVmName   string `json:"targetVmName"`
	PlanName       string `json:"planName"`
	DiskIndex      int    `json:"diskIndex"`
	WinDriveLetter string `json:"winDriveLetter,omitempty"`
	RootDiskIndex  int    `json:"rootDiskIndex"`
	Shared         bool   `json:"shared,omitempty"`
	FileName       string `json:"fileName,omitempty"`
}

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