Skip to content

Commit

Permalink
Merge pull request #3878 from sseago/bz1570570
Browse files Browse the repository at this point in the history
bug 1570570:  cloud volume create fixes
(cherry picked from commit 5624822)

https://bugzilla.redhat.com/show_bug.cgi?id=1578964
  • Loading branch information
h-kataria authored and simaishi committed May 16, 2018
1 parent 719dfae commit 0b6fc23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
28 changes: 13 additions & 15 deletions app/controllers/cloud_volume_controller.rb
Expand Up @@ -231,8 +231,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 @@ -243,7 +243,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 @@ -255,11 +255,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 @@ -307,8 +307,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 @@ -318,19 +318,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 @@ -595,7 +593,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
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

0 comments on commit 0b6fc23

Please sign in to comment.