feat: support vm_dest_name for OpenStack resource naming#222
Open
miguelntt wants to merge 2 commits intoos-migrate:mainfrom
Open
feat: support vm_dest_name for OpenStack resource naming#222miguelntt wants to merge 2 commits intoos-migrate:mainfrom
miguelntt wants to merge 2 commits intoos-migrate:mainfrom
Conversation
Allow specifying an optional destination name (vm_dest_name) for a VM being migrated. When provided, it is used instead of the VMware VM name when naming OpenStack resources (Cinder volumes, Nova instance, Neutron ports). The original vm_name continues to be used to locate the VM in vCenter. This is useful when the target name in OpenStack must differ from the source name in VMware, for example to apply a naming convention or to avoid conflicts.
Author
|
Hey @fdiazbra, would love to get your eyes on this one when you get a chance! |
fdiazbra
requested changes
Mar 3, 2026
| if args.DestName != "" { | ||
| return args.DestName | ||
| } | ||
| return moduleutils.SafeVmName(args.Name) |
Contributor
There was a problem hiding this comment.
It seems that the import of the module is missing at the beginning of the file. Something like:
moduleutils "vmware-migration-kit/plugins/module_utils"
Author
There was a problem hiding this comment.
You were right! Yesterday while testing a new build I fixed it locally and forgot to push it. Sorry about that!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VM names in VMware environments often contain spaces, accented characters
or other characters that are not valid or practical in OpenStack resource
names. This PR adds an optional
vm_dest_namefield to the migrationworkload data. When provided, it is used instead of the VMware display
name when naming all OpenStack resources (Cinder volumes, Nova instance,
Neutron ports).
The original
vm_nameis not affected: it continues to be used tolocate the VM in vCenter and to organise local data directories.
If
vm_dest_nameis omitted, behaviour is identical to before.Usage
No new parameters are required. To override the destination name:
Files changed
roles/convert_metadata/tasks/main.yml— propagatesvm_dest_nameinto the migration JSONroles/convert_metadata/templates/import_workloads.json.j2— addsvm_dest_nameto the JSON templateplaybooks/run_migration_from_conversion_host.yml— passesvm_dest_nameto the import roleroles/import_workloads/tasks/nbdkit.yml— passesdestnameto themigrateGo moduleroles/import_workloads/tasks/create_network_port.yml— passesdestnameto thecreate_network_portGo moduleroles/import_workloads/tasks/create_os_instance.yml— looks up volumes byvm_dest_name, passesdestnametocreate_serverplugins/modules/src/migrate/migrate.go— addsDestNamefield andresourceName()methodplugins/modules/src/create_server/create_server.go— addsDestNamefield andresolveInstanceName()functionplugins/modules/src/create_network_port/create_network_port.go— addsDestNamefield