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

bug 1570570: cloud volume create fixes #3878

Merged
merged 1 commit into from
May 7, 2018
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
28 changes: 13 additions & 15 deletions app/controllers/cloud_volume_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/views/cloud_volume/_common_new_edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down