ManageIQ / manageiq-providers-openstack

ManageIQ plugin for the OpenStack provider.
https://www.openstack.org/
Apache License 2.0
12 stars 91 forks source link

Validation failed: ManageIQ::providers::openstack::cloudmanager::template cannot be a descendant of itself. #862

Open SanthoshRam-03 opened 9 months ago

SanthoshRam-03 commented 9 months ago

Hi @Fryguy @agrare

I am facing this issue when we connecting with provider openstack it is showing the validation failed error.

I shared the screenshot below,

image

evm.log

image

Can you suggest me any solution for this issue.

agrare commented 9 months ago

That is an interesting one @SanthoshRam-03 , what version is this and did it start happening e.g. after an upgrade or just randomly?

SanthoshRam-03 commented 9 months ago

Hi @agrare

Thanks for quick response,

We are using Petrosian-1 version.

When we connect with default domain it works as expected.

When we try to connect with different domain (other than the default openstack domain) it's not working as expected and gives us errors.

remo233 commented 9 months ago

Hi @agrare ,

Is there any update on the same. We are facing the same issue in our manageiq environment too

agrare commented 9 months ago

@remo233 is it also failing for you in non-default domains? Did this start happening on an upgrade to a specific version?

remo233 commented 9 months ago

Hi @agrare ,

Yes, its failing for non-default domains. Also its happening in najdrof, oparin and petrosian.

I think it is happening in particular snapshots. So, can we please provide me the commands or steps to check the exact errored template from manageiq.

agrare commented 9 months ago

Okay I'm surprised we haven't seen this before if it is failing all the way back in najdorf. Okay let me create another domain in my local openstack environment and see if I can reproduce it.

SanthoshRam-03 commented 8 months ago

Hi @agrare any update for this above issue?

remo233 commented 7 months ago

Hi |

@agrare , any update on this ?

SanthoshRam-03 commented 6 months ago

Hi @remo233

FILE PATH: manageiq/providers/inventory/persister/builder/cloud_manager.rb

In the above file, I commented out the particular lines in the source code, and it worked.

def vm_and_miq_template_ancestry_save_block lambda do |_ems, inventory_collection| vms_inventory_collection = inventory_collection.dependency_attributes[:vms].try(:first) miq_templates_inventory_collection = inventory_collection.dependency_attributes[:miq_templates].try(:first)

      return if vms_inventory_collection.blank? || miq_templates_inventory_collection.blank?

      # Fetch IDs of all vms and genealogy_parents, only if genealogy_parent is present
             #       vms_genealogy_parents = vms_inventory_collection.data.each_with_object({}) do |x, obj|
             #         unless x.data[:genealogy_parent].nil?
             #           genealogy_parent_id = x.data[:genealogy_parent].load.try(:id)
             #           obj[[x.id](http://x.id/)] = genealogy_parent_id if genealogy_parent_id
             #         end
             #      end

             #       miq_template_genealogy_parents = miq_templates_inventory_collection.data.each_with_object({}) do |x, obj|
             #         unless x.data[:genealogy_parent].nil?
             #           genealogy_parent_id = x.data[:genealogy_parent].load.try(:id)
             #           obj[[x.id](http://x.id/)] = genealogy_parent_id if genealogy_parent_id
             #         end
             #       end

             #       ActiveRecord::Base.transaction do
                      # associate parent templates to child instances
             #        parent_miq_templates = miq_templates_inventory_collection.model_class
             #                                                                  .where(:id => vms_genealogy_parents.values).find_each.index_by(&:id)
             #         vms_inventory_collection.model_class
             #                                 .where(:id => vms_genealogy_parents.keys).find_each do |vm|
             #           vm.update!(:genealogy_parent => parent_miq_templates[vms_genealogy_parents[[vm.id](http://vm.id/)]])
             #         end
             #       end

             #       ActiveRecord::Base.transaction do
                      # associate parent instances to child templates
             #         parent_vms = vms_inventory_collection.model_class
             #                                              .where(:id => miq_template_genealogy_parents.values).find_each.index_by(&:id)
             #         miq_templates_inventory_collection.model_class
             #                                           .where(:id => miq_template_genealogy_parents.keys).find_each do |miq_template|
             #           miq_template.update!(:genealogy_parent => parent_vms[miq_template_genealogy_parents[[miq_template.id](http://miq_template.id/)]])
             #         end
             #       end
    end

    **EXPLANATION:**

If the "vm_and_miq_template_ancestry_save_block" references the non-existent genealogy_parent column and you've ensured that this column is not required for the refresh functionality to work, then these changes should not negatively affect the refresh process.

Hi @agrare Is this correct?

miq-bot commented 3 months ago

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

miq-bot commented 2 weeks ago

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.