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

Add VMware inventory collections #71

Merged
merged 1 commit into from
Jul 12, 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
@@ -0,0 +1,3 @@
class ManageIQ::Providers::Vmware::InfraManager::Inventory < ManagerRefresh::Inventory
require_nested :Persister
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
class ManageIQ::Providers::Vmware::InfraManager::Inventory::InventoryCollections < ManagerRefresh::InventoryCollectionDefault::InfraManager
class << self
def customization_specs(extra_attributes = {})
attributes = {
:model_class => ::CustomizationSpec,
:association => :customization_specs,
:manager_ref => [:name],
:builder_params => {
:ems_id => ->(persister) { persister.manager.id },
},
}

attributes.merge!(extra_attributes)
end

def vms_and_templates(extra_attributes = {})
attributes = {
:model_class => ::VmOrTemplate,
:association => :vms_and_templates,
:builder_params => {
:ems_id => ->(persister) { persister.manager.id },
},
}

attributes.merge!(extra_attributes)
end

def storage_profiles(extra_attributes = {})
attributes = {
:model_class => ::StorageProfile,
:association => :storage_profiles,
:builder_params => {
:ems_id => ->(persister) { persister.manager.id },
},
}

attributes.merge!(extra_attributes)
end

def hosts(extra_attributes = {})
attributes = {:model_class => ManageIQ::Providers::Vmware::InfraManager::HostEsx}
super(attributes.merge(extra_attributes))
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class ManageIQ::Providers::Vmware::InfraManager::Inventory::Persister < ManagerRefresh::Inventory::Persister
def initialize_inventory_collections
add_inventory_collections(
default_inventory_collections, inventory_collection_names, inventory_collection_options
)
end

def default_inventory_collections
ManageIQ::Providers::Vmware::InfraManager::Inventory::InventoryCollections
end

def inventory_collection_names
%i(
custom_attributes
customization_specs
disks
ems_clusters
ems_folders
guest_devices
hardwares
hosts
host_hardwares
host_networks
host_storages
host_switches
host_operating_systems
lans
networks
operating_systems
resource_pools
snapshots
storages
storage_profiles
switches
vms_and_templates
)
end

def inventory_collection_options
{}
end
end