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

Rename Amazon block storage manager #107

Merged
merged 3 commits into from
Jan 18, 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

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 7 additions & 7 deletions app/models/manageiq/providers/amazon/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ class ManageIQ::Providers::Amazon::CloudManager < ManageIQ::Providers::CloudMana
:to => :network_manager,
:allow_nil => true

has_one :block_storage_manager,
has_one :ebs_storage_manager,
:foreign_key => :parent_ems_id,
:class_name => "ManageIQ::Providers::Amazon::BlockStorageManager",
:class_name => "ManageIQ::Providers::Amazon::StorageManager::Ebs",
:autosave => true,
:dependent => :destroy

delegate :cloud_volumes,
:cloud_volume_snapshots,
:to => :block_storage_manager,
:to => :ebs_storage_manager,
:allow_nil => true

before_create :ensure_managers
Expand All @@ -70,10 +70,10 @@ def ensure_managers
network_manager.zone_id = zone_id
network_manager.provider_region = provider_region

build_block_storage_manager unless block_storage_manager
block_storage_manager.name = "#{name} Block Storage Manager"
block_storage_manager.zone_id = zone_id
block_storage_manager.provider_region = provider_region
build_ebs_storage_manager unless ebs_storage_manager
ebs_storage_manager.name = "#{name} EBS Storage Manager"
ebs_storage_manager.zone_id = zone_id
ebs_storage_manager.provider_region = provider_region
end

def self.ems_type
Expand Down
4 changes: 2 additions & 2 deletions app/models/manageiq/providers/amazon/inventory/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def target(ems, target)
ManageIQ::Providers::Amazon::Inventory::Targets::CloudManager.new(ems, target)
when ManageIQ::Providers::Amazon::NetworkManager
ManageIQ::Providers::Amazon::Inventory::Targets::NetworkManager.new(ems, target)
when ManageIQ::Providers::Amazon::BlockStorageManager
ManageIQ::Providers::Amazon::Inventory::Targets::BlockStorageManager.new(ems, target)
when ManageIQ::Providers::Amazon::StorageManager::Ebs
ManageIQ::Providers::Amazon::Inventory::Targets::StorageManager::Ebs.new(ems, target)
else
ManageIQ::Providers::Amazon::Inventory::Targets::CloudManager.new(ems, target)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ def cloud_volumes_init_data(extra_attributes = {})
:association => :cloud_volumes,
}

init_data(::ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolume, attributes, extra_attributes)
init_data(::ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume, attributes, extra_attributes)
end

def cloud_volume_snapshots_init_data(extra_attributes = {})
attributes = {
:association => :cloud_volume_snapshots,
}

init_data(::ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolumeSnapshot, attributes, extra_attributes)
init_data(::ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolumeSnapshot, attributes, extra_attributes)
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::Amazon::Inventory::Targets::BlockStorageManager < ManageIQ::Providers::Amazon::Inventory::Targets
class ManageIQ::Providers::Amazon::Inventory::Targets::StorageManager::Ebs < ManageIQ::Providers::Amazon::Inventory::Targets
def initialize_inventory_collections
add_inventory_collections(%i(cloud_volumes cloud_volume_snapshots))
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::Amazon::BlockStorageManager < ManageIQ::Providers::StorageManager
class ManageIQ::Providers::Amazon::StorageManager::Ebs < ManageIQ::Providers::StorageManager
require_nested :RefreshParser
require_nested :RefreshWorker
require_nested :Refresher
Expand All @@ -24,7 +24,7 @@ class ManageIQ::Providers::Amazon::BlockStorageManager < ManageIQ::Providers::St
:allow_nil => true

def self.ems_type
@ems_type ||= "ec2_block_storage".freeze
@ems_type ||= "ec2_ebs_storage".freeze
end

def self.description
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume < ::CloudVolume
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolumeSnapshot < ::CloudVolumeSnapshot
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::Amazon::BlockStorageManager::RefreshParser
class ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshParser
include ManageIQ::Providers::Amazon::RefreshHelperMethods

def initialize(ems, options = nil)
Expand Down Expand Up @@ -66,11 +66,11 @@ def parse_snapshot(snap)

class << self
def volume_type
"ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolume"
"ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume"
end

def volume_snapshot_type
"ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolumeSnapshot"
"ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolumeSnapshot"
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ManageIQ::Providers::Amazon::BlockStorageManager::RefreshParserInventoryObject < ::ManagerRefresh::RefreshParserInventoryObject
class ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshParserInventoryObject < ::ManagerRefresh::RefreshParserInventoryObject
include ManageIQ::Providers::Amazon::RefreshHelperMethods

def populate_inventory_collections
Expand Down Expand Up @@ -53,11 +53,11 @@ def parse_snapshot(snap)

class << self
def volume_type
"ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolume"
"ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolume"
end

def volume_snapshot_type
"ManageIQ::Providers::Amazon::BlockStorageManager::CloudVolumeSnapshot"
"ManageIQ::Providers::Amazon::StorageManager::Ebs::CloudVolumeSnapshot"
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshWorker < ::MiqEmsRefreshWorker
require_nested :Runner

def self.ems_class
ManageIQ::Providers::Amazon::StorageManager::Ebs
end

def self.settings_name
:ems_refresh_worker_amazon_ebs_storage
end
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class ManageIQ::Providers::Amazon::BlockStorageManager::RefreshWorker::Runner <
class ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshWorker::Runner <
ManageIQ::Providers::BaseManager::RefreshWorker::Runner
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ManageIQ::Providers
class Amazon::BlockStorageManager::Refresher < ManageIQ::Providers::BaseManager::Refresher
class Amazon::StorageManager::Ebs::Refresher < ManageIQ::Providers::BaseManager::Refresher
include ::EmsRefresh::Refreshers::EmsRefresherMixin

def collect_inventory_for_targets(ems, targets)
Expand All @@ -26,9 +26,9 @@ def parse_targeted_inventory(ems, _target, inventory)
_log.debug "#{log_header} Parsing inventory..."
hashes, = Benchmark.realtime_block(:parse_inventory) do
if refresher_options.try(:[], :inventory_object_refresh)
ManageIQ::Providers::Amazon::BlockStorageManager::RefreshParserInventoryObject.new(inventory).populate_inventory_collections
ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshParserInventoryObject.new(inventory).populate_inventory_collections
else
ManageIQ::Providers::Amazon::BlockStorageManager::RefreshParser.ems_inv_to_hashes(ems, refresher_options)
ManageIQ::Providers::Amazon::StorageManager::Ebs::RefreshParser.ems_inv_to_hashes(ems, refresher_options)
end
end
_log.debug "#{log_header} Parsing inventory...Complete"
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
:ems_refresh_worker:
:ems_refresh_worker_amazon: {}
:ems_refresh_worker_amazon_network: {}
:ems_refresh_worker_amazon_block_storage: {}
:ems_refresh_worker_amazon_ebs_storage: {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../aws_helper'
require_relative '../aws_stubs'
require_relative '../../aws_helper'
require_relative '../../aws_stubs'

describe ManageIQ::Providers::Amazon::BlockStorageManager::Refresher do
describe ManageIQ::Providers::Amazon::StorageManager::Ebs::Refresher do
include AwsStubs

describe "refresh" do
Expand All @@ -19,7 +19,7 @@
].each do |settings|
context "with settings #{settings}" do
before :each do
allow(Settings.ems_refresh).to receive(:ec2_block_storage).and_return(settings)
allow(Settings.ems_refresh).to receive(:ec2_ebs_storage).and_return(settings)
end

it "2 refreshes, first creates all entities, second updates all entitites" do
Expand Down Expand Up @@ -65,7 +65,7 @@ def refresh_spec
@ems.reload

with_aws_stubbed(stub_responses) do
EmsRefresh.refresh(@ems.block_storage_manager)
EmsRefresh.refresh(@ems.ebs_storage_manager)
end

@ems.reload
Expand Down Expand Up @@ -174,7 +174,7 @@ def assert_table_counts
end

def assert_ems
ems = @ems.block_storage_manager
ems = @ems.ebs_storage_manager

expect(ems).to have_attributes(:api_version => nil, # TODO: Should be 3.0
:uid_ems => nil)
Expand Down