Skip to content

Commit

Permalink
Add a Storage subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Dec 10, 2019
1 parent 35277b9 commit 43bdb80
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Vmware::InfraManager < InfraManager
require_nested :RefreshWorker
require_nested :RefreshParser
require_nested :ResourcePool
require_nested :Storage
require_nested :MetricsCapture
require_nested :MetricsCollectorWorker
require_nested :Refresher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def self.storage_inv_to_hashes(inv)
new_result = {
:ems_ref => mor,
:ems_ref_type => mor.vimType,
:type => "ManageIQ::Providers::Vmware::InfraManager::Storage",
:name => summary["name"],
:store_type => summary["type"].to_s.upcase,
:total_space => summary["capacity"],
Expand Down
3 changes: 3 additions & 0 deletions app/models/manageiq/providers/vmware/infra_manager/storage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ManageIQ::Providers::Vmware::InfraManager::Storage < ManageIQ::Providers::InfraManager::Storage
include ManageIQ::Providers::Vmware::InfraManager::EmsRefObjMixin
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def raw_clone(name, folder, pool = nil, host = nil, datastore = nil, powerOn = f
folder_mor = folder.ems_ref_obj if folder.respond_to?(:ems_ref_obj)
pool_mor = pool.ems_ref_obj if pool.respond_to?(:ems_ref_obj)
host_mor = host.ems_ref_obj if host.respond_to?(:ems_ref_obj)
datastore_mor = VimString.new(datastore.ems_ref, datastore.ems_ref_type, :ManagedObjectReference) if datastore
datastore_mor = datastore.ems_ref_obj if datastore.respond_to?(:ems_ref_obj)
run_command_via_parent(:vm_clone, :name => name, :folder => folder_mor, :pool => pool_mor, :host => host_mor, :datastore => datastore_mor, :powerOn => powerOn, :template => template_flag, :transform => transform, :config => config, :customization => customization, :disk => disk)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def raw_relocate(host, pool = nil, datastore = nil, disk_move_type = nil, transf
end
end

host_mor = host.ems_ref_obj if host
pool_mor = pool.ems_ref_obj if pool
datastore_mor = VimString.new(datastore.ems_ref, datastore.ems_ref_type, :ManagedObjectReference) if datastore
host_mor = host.ems_ref_obj if host
pool_mor = pool.ems_ref_obj if pool
datastore_mor = datastore.ems_ref_obj if datastore

run_command_via_parent(:vm_relocate, :host => host_mor, :pool => pool_mor, :datastore => datastore_mor, :disk_move_type => disk_move_type, :transform => transform, :priority => priority, :disk => disk)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ def assert_specific_datastore
:name => "GlobalDS_0",
:store_type => "VMFS",
:total_space => 1_099_511_627_776,
:type => "ManageIQ::Providers::Vmware::InfraManager::Storage",
:free_space => 824_633_720_832,
:multiplehostaccess => 1,
:directory_hierarchy_supported => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def assert_specific_storage
expect(@storage).to have_attributes(
:ems_ref => "datastore-953",
:ems_ref_type => "Datastore",
:type => "ManageIQ::Providers::Vmware::InfraManager::Storage",
:name => "StarM1-Prod1 (1)",
:store_type => "VMFS",
:total_space => 524254445568,
Expand Down

0 comments on commit 43bdb80

Please sign in to comment.