Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTV 1595: PVC name template #1310

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Jan 20, 2025

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

Issue:
Users operating automation want the capability to know the disk names in the OS in the yamls for the PVC's so they can easily know which PVC is liked to specific volume in a VM.

Fix:
Adding pvcNameTemplate field to the Plan CR and to each VM in the VM list of the plan.

PVCNameTemplate is a template for generating PVC names for VM disks.
The VM specific template will override the template set in the plan.

It follows Go template syntax and has access to the following variables:
 - .vmName: name of the VM
 - .planName: name of the migration plan
 - .diskIndex: initial volume index of the disk
 - .rootDiskIndex: index of the root disk
  
Examples:
   "{{.vmName}}-disk-{{.diskIndex}}"
   "{{if eq .DiskIndex .RootDiskIndex}}root{{else}}data{{end}}-{{.DiskIndex}}"

In the plan YAML:

spec:
   ...
   pvcNameTemplate:   "{{.vmName}}-disk-{{.diskIndex}}"

   vms:
    - name: some-vm
      pvcNameTemplate:   "{{.vmName}}-disk-{{.diskIndex}}"

@yaacov yaacov force-pushed the pvc-name-template branch 2 times, most recently from e8ff800 to 6f84b65 Compare January 21, 2025 08:53
Signed-off-by: yaacov <kobi.zamir@gmail.com>
@yaacov yaacov force-pushed the pvc-name-template branch from 6f84b65 to d3a7d0f Compare January 21, 2025 12:49
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.

1 participant