diff --git a/app/controllers/cloud_volume_controller.rb b/app/controllers/cloud_volume_controller.rb index 56e96fa1a5c..94d8b02c559 100644 --- a/app/controllers/cloud_volume_controller.rb +++ b/app/controllers/cloud_volume_controller.rb @@ -206,8 +206,8 @@ def create @volume = CloudVolume.new options = form_params_create ext_management_system = options.delete(:ems) - valid_action, action_details = CloudVolume.validate_create_volume(ext_management_system) - if valid_action + validate_results = CloudVolume.validate_create_volume(ext_management_system) + if validate_results[:available] task_id = CloudVolume.create_volume_queue(session[:userid], ext_management_system, options) if task_id.kind_of?(Integer) @@ -218,7 +218,7 @@ def create end else @in_a_form = true - add_flash(_(action_details), :error) unless action_details.nil? + add_flash(_(validate_results[:message]), :error) unless validate_results[:message].nil? drop_breadcrumb( :name => _("Add New Cloud Volume"), :url => "/cloud_volume/new" @@ -230,11 +230,11 @@ def create @in_a_form = true options = form_params cloud_tenant = find_record_with_rbac(CloudTenant, options[:cloud_tenant_id]) - valid_action, action_details = CloudVolume.validate_create_volume(cloud_tenant.ext_management_system) - if valid_action + validate_results = CloudVolume.validate_create_volume(cloud_tenant.ext_management_system) + if validate_results[:available] add_flash(_("Validation successful")) else - add_flash(_(action_details), :error) unless details.nil? + add_flash(_(validate_results[:message]), :error) unless validate_results[:message].nil? end javascript_flash end @@ -281,8 +281,8 @@ def update when "save" options = form_params - valid_update, update_details = @volume.validate_update_volume - if valid_update + validate_results = @volume.validate_update_volume + if validate_results[:available] task_id = @volume.update_volume_queue(session[:userid], options) if task_id.kind_of?(Integer) @@ -292,19 +292,17 @@ def update javascript_flash(:spinner_off => true) end else - add_flash(_(update_details), :error) + add_flash(_(validate_results[:message]), :error) unless validate_results[:message].nil? javascript_flash end when "validate" @in_a_form = true - options = form_params - cloud_tenant = find_record_with_rbac(CloudTenant, options[:cloud_tenant_id]) - valid_action, action_details = CloudVolume.validate_create_volume(cloud_tenant.ext_management_system) - if valid_action + validate_results = @volume.validate_update_volume + if validate_results[:available] add_flash(_("Validation successful")) else - add_flash(_(action_details), :error) unless details.nil? + add_flash(_(validate_results[:message]), :error) unless validate_results[:message].nil? end end end @@ -562,7 +560,7 @@ def form_params_create # Depending on the storage manager type, collect required form params. case params[:emstype] - when "ManageIQ::Providers::StorageManager::CinderManager" + when "ManageIQ::Providers::StorageManager::CinderManager", "ManageIQ::Providers::Openstack::StorageManager::CinderManager" options.merge!(cinder_manager_options) when "ManageIQ::Providers::Amazon::StorageManager::Ebs" options.merge!(aws_ebs_options) diff --git a/app/views/cloud_volume/_common_new_edit.html.haml b/app/views/cloud_volume/_common_new_edit.html.haml index f5cdf58f7b4..d614e5eec41 100644 --- a/app/views/cloud_volume/_common_new_edit.html.haml +++ b/app/views/cloud_volume/_common_new_edit.html.haml @@ -16,7 +16,7 @@ = _("Required") .form-group{"ng-class" => "{'has-error': angularForm.cloud_tenant_id.$invalid}", - "ng-if" => "vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::StorageManager::CinderManager'"} + "ng-if" => "(vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::StorageManager::CinderManager') || (vm.cloudVolumeModel.emstype == 'ManageIQ::Providers::Openstack:: StorageManager::CinderManager')"} %label.col-md-2.control-label = _('Cloud Tenant') .col-md-8