-
Notifications
You must be signed in to change notification settings - Fork 914
[WIP] Don't include all types in Vm children #23604
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
base: master
Are you sure you want to change the base?
Conversation
|
[DELETED COMMENT] - I removed this noise and merged into the code |
58cf199 to
c058255
Compare
|
update:
|
c058255 to
83ba063
Compare
|
update:
|
|
FYI: I tried class Vm
self.abstract_class = true
end
type = Vm.first.type
type == "Vm" # expected value
type == "ManageIQ::Providers::Vmware::InfraManager::Vm"` # actual valueThis may be due to the factory issue, but guessing not |
83ba063 to
3823b28
Compare
3823b28 to
fd4e3f2
Compare
|
update:
|
|
WIP: It is having trouble instantiating a class of type Think this needs to depend upon us changing the factories to not try and instantiate the theoretically abstract classes (technically, Vm is not abstract) |
fd4e3f2 to
3c98c98
Compare
|
update:
update: update:
Now that this code has simplified and we know why the tests were failing, this has changed from a pipe dream to me and is now something I would like. WIP: only a wip to wait for commit 1 / factories to stop instantiating abstract classes. |
Don't create entries in the database with parent abstract classes Avoid Infra or Vm -- instead do a vendor specific vm (would have preferred to use the dummy provider)
3c98c98 to
886a994
Compare
The parent class includes all classes (that are VMs)
No reason to include a `type` query.
Before
======
```
vmdb(dev)> puts Vm.all.to_sql
SELECT "vms".* FROM "vms"
WHERE "vms"."type" IN ('Vm', 'VmServer',
'ManageIQ::Providers::PhysicalInfraManager::Vm', 'ManageIQ::Providers::InfraManager::Vm',
'ManageIQ::Providers::CloudManager::Vm', 'ManageIQ::Providers::CiscoIntersight::PhysicalInfraManager::Vm',
'ManageIQ::Providers::Vmware::InfraManager::Vm', 'ManageIQ::Providers::Ovirt::InfraManager::Vm',
'ManageIQ::Providers::Nutanix::InfraManager::Vm', 'ManageIQ::Providers::Kubevirt::InfraManager::Vm',
'ManageIQ::Providers::IbmPowerHmc::InfraManager::Vm', 'ManageIQ::Providers::Redhat::InfraManager::Vm',
'ManageIQ::Providers::Openshift::InfraManager::Vm', 'ManageIQ::Providers::IbmPowerHmc::InfraManager::Vios',
'ManageIQ::Providers::IbmPowerHmc::InfraManager::Lpar', 'ManageIQ::Providers::Vmware::CloudManager::Vm',
'ManageIQ::Providers::OracleCloud::CloudManager::Vm', 'ManageIQ::Providers::Openstack::CloudManager::Vm',
'ManageIQ::Providers::IbmCloud::VPC::CloudManager::Vm', 'ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm',
'ManageIQ::Providers::Google::CloudManager::Vm', 'ManageIQ::Providers::AzureStack::CloudManager::Vm',
'ManageIQ::Providers::Azure::CloudManager::Vm', 'ManageIQ::Providers::Amazon::CloudManager::Vm',
'ManageIQ::Providers::IbmPowerVc::CloudManager::Vm', 'ManageIQ::Providers::IbmCic::CloudManager::Vm')
AND "vms"."template" = FALSE
=> nil
vmdb(dev)> puts ManageIQ::Providers::Vmware::InfraManager::Vm.all.to_sql
SELECT "vms".* FROM "vms"
WHERE "vms"."type" = 'ManageIQ::Providers::Vmware::InfraManager::Vm'
AND "vms"."template" = FALSE
```
After
=====
```
vmdb(dev)> puts Vm.all.to_sql
SELECT "vms".* FROM "vms"
WHERE "vms"."template" = FALSE
=> nil
vmdb(dev)> puts ManageIQ::Providers::Vmware::InfraManager::Vm.all.to_sql
SELECT "vms".* FROM "vms"
WHERE "vms"."type" = 'ManageIQ::Providers::Vmware::InfraManager::Vm'
AND "vms"."template" = FALSE
```
886a994 to
2375319
Compare
|
update:
update:
|
|
I'm curious why this depends on #23608. We're not actually making Vm and MiqTemplate abstract here. |
|
@Fryguy yea. I thought it was a tangent, pulled it out and the tests started failing. This change freaks out when you create a vm of Think it was failing HERE self notesrspec ./spec/models/manageiq/providers/network_manager_spec.rb:8
rspec ./spec/models/miq_report/generator_spec.rb:71
rspec ./spec/models/mixins/ci_feature_mixin_spec.rb:4
rspec ./spec/models/mixins/relationship_mixin_spec.rb:437
rspec ./spec/models/mixins/relationship_mixin_spec.rb:446
rspec ./spec/models/mixins/relationship_mixin_spec.rb:408
rspec ./spec/models/mixins/relationship_mixin_spec.rb:419
rspec ./spec/models/vim_performance_state_spec.rb:139 |
|
@Fryguy ok, for a |
|
I see, so queries to the base VmOrTemplate fail? |
|
Well, a query on |
Trying out various methods of not including every model in the
Vm.allorMiqTemplate.allqueries.Dependes upon:
Before
After
Side Effect
Saving a
Vmdoes not setVm#typeso it comes back as a genericVmOrTemplate.