fix: update volume metadata when skipping V2V conversion#218
fix: update volume metadata when skipping V2V conversion#218miguelntt wants to merge 5 commits intoos-migrate:mainfrom
Conversation
fdiazbra
left a comment
There was a problem hiding this comment.
Great catch! The fix is correct — without updating the volume metadata, Ansible can't proceed with instance creation.
The code change looks good to merge. However, please remove the changes to CHANGELOG.md. We group multiple PRs together and update the CHANGELOG when we create the release tag. This helps us maintain consistency and avoid merge conflicts.
Otherwise LGTM!
When skip_conversion is true (useful for appliances or OSes not recognized by virt-v2v), the disk copy was completing correctly but the Cinder volume metadata was never updated to converted=true. Ansible reads this metadata to decide whether to create the instance, so it was silently skipping instance creation after a successful copy. This adds the same metadata update that exists in the normal V2V path.
a7cfda5 to
38b1348
Compare
| logger.Log.Infof("Skipping V2V conversion...") | ||
| volMetadata = map[string]string{ | ||
| "osm": "true", | ||
| "converted": "true", |
There was a problem hiding this comment.
Thank you for this PR, and you are correct, when we want to skip v2v we should mention it in the metadata, but I dont like the idea to set "converted" to true, because it's not what happened.
Maybe we can create a new flag, in order to specify that the volume is migrated and ready to be used by OpenStack, something like:
"osm_state": "ready" or "migrated"
So we need a checks also line 158, like this one:
if state == "ready" {
logger.Log.Infof("Volume already migrated and ready to be used by OpenStack, skipping...")
return volume.ID, nil
}
|
Thanks for the suggestion! Updated to use |
Summary
When
skip_conversion: trueis set (useful for appliances or OSes not recognized by virt-v2v), the disk copy via nbdcopy completes successfully but the Cinder volume metadata was never updated toconverted=true. Ansible reads this metadata to decide whether to create the instance in OpenStack, so it was silently skipping instance creation after an otherwise successful migration.Root cause
In
migrate.go, theelsebranch (whenrunV2V=false) only logged a message but never calledUpdateVolumeMetadata. Theif runV2Vbranch correctly setsosm=trueandconverted=trueafter conversion, but the skip path had no equivalent.Fix
Added the same metadata update call that exists in the
runV2V=truepath:Both keys are required:
osm=truebecauseUpdateVolumeMetadatacallsvolumes.Updatewhich replaces all metadata (not a merge), andconverted=trueto unblock the Ansible instance creation step.Usage
No new parameters needed. The existing variable already works correctly with this fix:
Files changed
plugins/modules/src/migrate/migrate.go— 8 lines added in theelsebranchCHANGELOG.md— version entry for v2.2.2