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-1596 | Add new VolumeNameTemplate field to plan CR #1332

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

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented Feb 3, 2025

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

RFE:
Requesting the ability for choosing a custom name for the network and disks during migration for VM's. Currently migrations end up with 'net-0' or 'vol-1' and cannot be modified. A newly created vm typically allows for you to name these.

Fix:
Add an optional network template:

 VolumeNameTemplate is a template for generating volume interface names in the target virtual machine.
 It follows Go template syntax and has access to the following variables:
   - .PVCName: name of the PVC mounted to the VM using this volume
   - .VolumeIndex: sequential index of the volume interface (0-based)
 Note:
   - This template can be overridden at the individual VM level
   - If not specified on VM level and on Plan leverl, default naming conventions will be used
 Examples:
   "disk-{{.VolumeIndex}}"
   "pvc-{{.PVCName}}"

In the plan YAML:

spec:
   ...
   volumeNameTemplate:  "disk-{{.VolumeIndex}}"

   vms:
    - name: some-vm
      volumeNameTemplate:   "pvc-{{.PVCName}}"

Screenshots:
vol-template-vm-yaml

vol-template-plan-yaml

@yaacov yaacov requested a review from mnecas as a code owner February 3, 2025 08:19
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2025

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

Codecov Report

Attention: Patch coverage is 0% with 118 lines in your changes missing coverage. Please review.

Project coverage is 15.26%. Comparing base (f1fe5d0) to head (9138f56).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/plan/validation.go 0.00% 66 Missing ⚠️
pkg/controller/plan/adapter/vsphere/builder.go 0.00% 52 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1332      +/-   ##
==========================================
- Coverage   15.45%   15.26%   -0.19%     
==========================================
  Files         112      112              
  Lines       23377    23617     +240     
==========================================
- Hits         3613     3606       -7     
- Misses      19479    19724     +245     
- Partials      285      287       +2     
Flag Coverage Δ
unittests 15.26% <0.00%> (-0.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.

@yaacov yaacov force-pushed the mtv-1596-allow-for-customizing-names-for-disks branch from 8fb91fc to 9138f56 Compare February 6, 2025 11:08
Copy link

sonarqubecloud bot commented Feb 6, 2025

@yaacov
Copy link
Member Author

yaacov commented Feb 6, 2025

@mnecas hi, rebased and added a log line for template failing case

Copy link
Member

@mnecas mnecas left a comment

Choose a reason for hiding this comment

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

lgtm

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