Created attachment 1509975 [details]
Description of problem:
If I create a new migration plan, using CSV import and select some VMs that have status "VM is already Migrated". Then I save that plan. Go to Edit plan and let it discover VMs instead of providing CSV. If I look at status of all selected VMs I will be able to see some of the VMs marked as "Available for Migration" even though previously those were showing "Already Migrated".
See recording attached here for more clarification.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.See recording attached
See recording attached
VM status should be displayed correctly in "Edit Migration Plan" wizard
The reason this is happening is because of how we handle populating the list of VMs when editing a migration plan. The VM discovery service does not return VMs which are already part of a plan, because they must be excluded when creating new plans. As a result, when editing a plan and using VM discovery mode, in order to include the VMs that should be pre-selected in that list, we must merge together the discovery results with a list of the VMs already in the plan.
In doing this merge, we have no status information about the VMs being merged in (because that VM data is not coming from the discovery service), so we display "available for migration", which is technically correct but just inconsistent with what you get when you import a CSV containing those VMs and you see the "already migrated" status. It's only possible to see this corner case by creating a plan which includes VMs which have already been migrated (only possible via a CSV) and then editing that plan and choosing discovery mode.
After a discussion with Vince and Mike Ro, we determined that we have a 3 options for how to address this:
1. Do nothing because technically nothing is broken (the VMs are available for migration even though they are already migrated, we just display the best info we have available)
2. Remove the "VM has already been migrated" warning that appears during CSV import, to avoid this inconsistency
3. Figure out a way to query the discovery service twice in this scenario, once to discover new VMs and once with a CSV of the VMs already existing in the plan, and then merge those results so we have correct status information when merging. This seems tricky and excessive for such a small corner case.
Adding Brett and Marco to see what they think we should do here.
I believe this is an edge use case. We maintain the .csv import as the only way to migrate previously migrated VM's. We shouldn't allow those same VM's to be selectable though the VM selection UI if they have been previously migrated.
So @Brett if I understand you correctly we should still be able to allow these previously migrated VMs to be selectable via .csv import? The problem here is what happens after you do that, when you try to edit that plan. If you select the "discover VMs" mode when editing, we need to include and pre-select VMs that are already in the plan, at which time we don't know whether they have already been migrated.
We already don't allow those previously migrated VMs to be selected in discovery mode in a new plan, but in the editing case, it's a little more tricky.
Opened a GitHub Issue to track this: https://github.com/ManageIQ/manageiq-v2v/issues/835
This bug will be fixed by this PR: https://github.com/ManageIQ/manageiq-v2v/pull/841
Fabien, can we approve this one for release in 5.10.3? It's required for https://bugzilla.redhat.com/show_bug.cgi?id=1666352
Verified on: 184.108.40.206