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

storage manager volume create: basic and advanced modes #194

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -42,4 +42,8 @@ def wwpn_candidates
def host_initiator_groups
@host_initiator_groups ||= @manager.autosde_client.HostClusterApi.host_clusters_get
end

def capability_values
@capability_values ||= @manager.autosde_client.ServiceAbstractCapabilityValueApi.service_abstract_capability_values_get
end
end
Expand Up @@ -56,6 +56,10 @@ def host_initiator_groups
[]
end

def capability_values
[]
end

private

def parse_targets!
Expand Down
Expand Up @@ -11,6 +11,7 @@ class ManageIQ::Providers::Autosde::Inventory::Parser::StorageManager < ManageIQ
# :ems_ref => "s2", :name => "Storage 3", :ems_id=>persister.manager.id
# )#
def parse
ext_management_system
physical_storage_families
physical_storages
storage_resources
Expand All @@ -23,6 +24,13 @@ def parse
wwpn_candidates
end

def ext_management_system
persister.ext_management_system.build(
:guid => persister.manager.guid,
:capabilities => collector.capability_values
)
end

def physical_storage_families
collector.physical_storage_families.each do |storage_family|
persister.physical_storage_families.build(
Expand Down Expand Up @@ -116,10 +124,11 @@ def volume_mappings
def storage_services
collector.storage_services.each do |service|
persister.storage_services.build(
:name => service.name,
:description => service.description,
:version => service.version,
:ems_ref => service.uuid
:name => service.name,
:description => service.description,
:version => service.version,
:ems_ref => service.uuid,
:capabilities => parse_capabilities(service.capability_values_json)
)
end
end
Expand Down
Expand Up @@ -16,5 +16,6 @@ def initialize_inventory_collections
add_collection(storage, :storage_resources)
add_collection(storage, :storage_services)
add_collection(storage, :cloud_volumes)
add_collection(storage, :ext_management_system)
end
end
Expand Up @@ -10,12 +10,21 @@ class ManageIQ::Providers::Autosde::StorageManager::CloudVolume < ::CloudVolume

def self.raw_create_volume(ext_management_system, options = {})
# @type [StorageService]
vol_to_create = ext_management_system.autosde_client.VolumeCreate(
:service => ext_management_system.storage_services.find(options["storage_service_id"]).ems_ref,
creation_hash = {
:service => "",
:name => options["name"],
:size => options["size"],
:count => options["count"]
)
}

if options['mode'] == 'Basic'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is options['mode'] coming from? I don't see it in the DDF params

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it used to be in cloud-volume-form.schema.js but I moved it to cloud_voume.rb following @Fryguy's request:
ManageIQ/manageiq-ui-classic#8582 (comment)

creation_hash[:service] = ext_management_system.storage_services.find(options["storage_service_id"]).ems_ref
agrare marked this conversation as resolved.
Show resolved Hide resolved
else
creation_hash[:service_name] = options["new_service_name"]
creation_hash[:resources] = ext_management_system.storage_resources.find(options["storage_resource_id"].to_a).pluck(:ems_ref)
end

vol_to_create = ext_management_system.autosde_client.VolumeCreate(creation_hash)
task_id = ext_management_system.autosde_client.VolumeApi.volumes_post(vol_to_create).task_id

options = {
Expand Down Expand Up @@ -100,21 +109,12 @@ def params_for_update
end

def self.params_for_create(provider)
services = provider.storage_services.map { |service| {:value => service.id.to_s, :label => service.name} }
capabilities = provider.capabilities.map do |capability|
{:label => "#{capability['abstract_capability']}: #{capability['value']}", :value => capability['uuid']}
end

{
:fields => [
{
:component => "select",
:name => "storage_service_id",
:id => "storage_service_id",
:label => _("Storage Pool"),
:isRequired => true,
:validate => [{:type => "required"}],
:options => services,
:includeEmpty => true,
:isDisabled => false
},
{
:component => "text-field",
:id => "size",
Expand All @@ -134,6 +134,25 @@ def self.params_for_create(provider)
:validate => [{:type => "required"},
{:type => "pattern", :pattern => '^[-+]?[0-9]\\d*$', :message => _("Must be an integer")},
{:type => "min-number-value", :value => 1, :message => _('Must be greater than or equal to 1')}],
},
{
:component => "radio",
:name => "mode",
:id => "mode",
:label => _("Mode"),
:options => [{:label => 'Basic', :value => 'Basic'}, {:label => 'Advanced', :value => 'Advanced'}],
:isRequired => true,
:validate => [{:type => "required"}]
},
{
:component => "select",
:name => "required_capabilities",
:id => "required_capabilities",
:label => _("Required Capabilities (filters by exact match)"),
:options => capabilities,
:isRequired => true,
:isMulti => true,
:validate => [{:type => "required"}]
}
]
}
Expand Down
Expand Up @@ -212,7 +212,7 @@ def run_targeted_refresh(targets = [])
def assert_ems
expect(ems.physical_storages.count).to(eq(1))
expect(ems.physical_storage_families.count).to(eq(2))
expect(ems.storage_resources.count).to(eq(8))
expect(ems.storage_resources.count).to(eq(9))
expect(ems.storage_services.count).to(eq(7))
expect(ems.cloud_volumes.count).to(eq(13))
expect(ems.wwpn_candidates.count).to(eq(2))
Expand Down Expand Up @@ -251,15 +251,15 @@ def assert_specific_physical_storage_family
end

def assert_specific_storage_resource
storage_resource = ems.storage_resources.find_by(:ems_ref => "e6833c27-374b-4a4a-8d76-455cfe5f4270")
storage_resource = ems.storage_resources.find_by(:ems_ref => "41e4e6fb-d670-4db9-8325-464c138dee6f")
expect(storage_resource).to(have_attributes(
:name => "9.151.159.178:ilyak_test_pool",
:ems_ref => "e6833c27-374b-4a4a-8d76-455cfe5f4270",
:logical_free => 601_295_421_440,
:logical_total => 0,
:physical_storage => ems.physical_storages.find_by(:ems_ref => "980f3ceb-c599-49c4-9db3-fdc793cb8666"),
:name => "test_or_30:test_pool",
:ems_ref => "41e4e6fb-d670-4db9-8325-464c138dee6f",
:logical_free => 472_446_402_560,
:logical_total => 515_396_075_520,
:physical_storage => ems.physical_storages.find_by(:ems_ref => "9b1cedc0-b476-47f1-8f25-7a7da2b7d91c"),
:type => "ManageIQ::Providers::Autosde::StorageManager::StorageResource",
:capabilities => [{"name" => "compression", "uuid" => "29ac2ba7-1e55-411e-9828-472c935bb882", "value" => "True"}, {"name" => "thin_provision", "uuid" => "63a2dfbe-bb1b-408c-8e94-36c9d7791df2", "value" => "True"}]
:capabilities => [{"name" => "compression", "uuid" => "45e0cf41-1842-45e8-b83b-17de54be406d", "value" => "True"}, {"name" => "thin_provision", "uuid" => "2fddfc81-2561-40d8-bd84-cec6ec26d551", "value" => "True"}]
))
end

Expand Down
47 changes: 46 additions & 1 deletion spec/vcr_cassettes/ems_refresh_v1.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.