-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/models/manageiq/providers/vmware/infra_manager/inventory.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
45 changes: 45 additions & 0 deletions
45
app/models/manageiq/providers/vmware/infra_manager/inventory/inventory_collections.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
42 changes: 42 additions & 0 deletions
42
app/models/manageiq/providers/vmware/infra_manager/inventory/persister.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |