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

Fix multiple parents error moving vm to new folder #17525

Conversation

agrare
Copy link
Member

@agrare agrare commented Jun 5, 2018

Linking inventory when doing a targeted refresh switches when to
disconnect relationships depending on what the target type is. This is
due to the fact that the full list of items for e.g. folders/clustes is
only known when running a full refresh, otherwise it has a sparse list.

Currently the folders_to_vms relat is only disconnected when refreshing
a full ems.

When moving a vm to a new folder the Move Into event queues a full
refresh, and the VM Relocate event queues a host targeted refresh.

The issue is when moving a vm to a new host and a new folder, the host
event queues a targeted refresh but the vm being moved to a new folder
is picked up in this targeted refresh also.

This leads to the do_disconnect value being false when processing the
folders_to_vms relationship leading to the multiple parents error.

To fix this we can process the folders_to_vms under the section where it
disconnects if the target type is a VmOrTemplate.

Steps for Testing

  1. If evmserverd is running, stop it (important to not have the event
    catcher running).
  2. From the rails console run a full refresh
    EmsRefresh.refresh(ExtManagementSystem.first)
  3. Go to the vmware web console and move a vm to a different folder
  4. Run a targeted refresh from the rails console vm = Vm.find_by(:name => "vm name"); EmsRefresh.refresh(vm)
  5. Check the parent folder of the vm vm.reload.parent_blue_folder

@agrare agrare changed the title Fix multiple parents error moving vm to new folder [WIP] Fix multiple parents error moving vm to new folder Jun 5, 2018
@miq-bot miq-bot added the wip label Jun 5, 2018
Linking inventory when doing a targeted refresh switches when to
disconnect relationships depending on what the target type is.  This is
due to the fact that the full list of items for e.g. folders/clustes is
only known when running a full refresh, otherwise it has a sparse list.

Currently the folders_to_vms relat is only disconnected when refreshing
a full ems.

When moving a vm to a new folder the Move Into event queues a full
refresh, and the VM Relocate event queues a host targeted refresh.

The issue is when moving a vm to a new host _and_ a new folder, the host
event queues a targeted refresh but the vm being moved to a new folder
is picked up in this targeted refresh also.

This leads to the do_disconnect value being false when processing the
folders_to_vms relationship leading to the multiple parents error.
@agrare agrare force-pushed the fix_targeted_vm_refresh_not_disconnecting_previous_folder branch from 24529e3 to 90a9f98 Compare June 6, 2018 15:38
@agrare agrare changed the title [WIP] Fix multiple parents error moving vm to new folder Fix multiple parents error moving vm to new folder Jun 6, 2018
@agrare agrare removed the wip label Jun 6, 2018
@miq-bot
Copy link
Member

miq-bot commented Jun 6, 2018

Checked commit agrare@90a9f98 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@Fryguy Fryguy merged commit a4e3284 into ManageIQ:master Jun 7, 2018
@Fryguy Fryguy added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 7, 2018
@agrare agrare deleted the fix_targeted_vm_refresh_not_disconnecting_previous_folder branch June 7, 2018 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants