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

Needed config for Cloud batch saver_strategy #15708

Merged
merged 1 commit into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ class ManagerRefresh::InventoryCollectionDefault::CloudManager < ManagerRefresh:
class << self
def vms(extra_attributes = {})
attributes = {
:model_class => ::ManageIQ::Providers::CloudManager::Vm,
:association => :vms,
:delete_method => :disconnect_inv,
:attributes_blacklist => [:genealogy_parent],
:unique_index_columns => [:ems_id, :ems_ref],
:builder_params => {
:model_class => ::ManageIQ::Providers::CloudManager::Vm,
:association => :vms,
:delete_method => :disconnect_inv,
:attributes_blacklist => [:genealogy_parent],
:unique_index_columns => [:ems_id, :ems_ref],
:use_ar_object => true, # Because of raw_power_state setter
:batch_extra_attributes => [:power_state, :state_changed_on, :previous_state],
:builder_params => {
:ems_id => ->(persister) { persister.manager.id },
:name => "unknown",
:location => "unknown",
Expand All @@ -19,12 +21,14 @@ def vms(extra_attributes = {})

def miq_templates(extra_attributes = {})
attributes = {
:model_class => ::ManageIQ::Providers::CloudManager::Template,
:association => :miq_templates,
:delete_method => :disconnect_inv,
:attributes_blacklist => [:genealogy_parent],
:unique_index_columns => [:ems_id, :ems_ref],
:builder_params => {
:model_class => ::ManageIQ::Providers::CloudManager::Template,
:association => :miq_templates,
:delete_method => :disconnect_inv,
:attributes_blacklist => [:genealogy_parent],
:unique_index_columns => [:ems_id, :ems_ref],
:use_ar_object => true, # Because of raw_power_state setter
:batch_extra_attributes => [:power_state, :state_changed_on, :previous_state],
:builder_params => {
:ems_id => ->(persister) { persister.manager.id },
:name => "unknown",
:location => "unknown",
Expand Down Expand Up @@ -79,6 +83,8 @@ def hardwares(extra_attributes = {})
:manager_ref => [:vm_or_template],
:association => :hardwares,
:parent_inventory_collections => [:vms, :miq_templates],
# TODO(lsmola) just because of default value on cpu_sockets, this can be fixed by separating instances_hardwares and images_hardwares
:use_ar_object => true,
}

attributes[:custom_manager_uuid] = lambda do |hardware|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def network_ports(extra_attributes = {})
attributes = {
:model_class => ::NetworkPort,
:association => :network_ports,
:use_ar_object => true,
:builder_params => {
:ems_id => ->(persister) { persister.manager.try(:network_manager).try(:id) || persister.manager.id },
}
Expand Down Expand Up @@ -171,6 +172,7 @@ def load_balancer_listeners(extra_attributes = {})
:model_class => ::LoadBalancerListener,
:association => :load_balancer_listeners,
:parent_inventory_collections => [:load_balancers],
:use_ar_object => true,
:builder_params => {
:ems_id => ->(persister) { persister.manager.try(:network_manager).try(:id) || persister.manager.id },
}
Expand Down