[Ovirt-devel] [PATCH server] fixed smart pool 'save' regression.

Jason Guiditta jason.guiditta at gmail.com
Thu May 28 16:02:22 UTC 2009


ACK, I can create new smart pools.  Also made sure I could still create new
hardware and vm pools since it looked like their code was touched.  They
continue to work as well.

On Fri, May 22, 2009 at 12:39 PM, Scott Seago <sseago at redhat.com> wrote:

> The recent refactoring didn't work properly for new smart pools, so I've
>  cleaned jup the parameter handling for the various pool 'create' actions.
>
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
>  src/app/controllers/hardware_controller.rb   |    5 +----
>  src/app/controllers/pool_controller.rb       |    6 ++++--
>  src/app/controllers/resources_controller.rb  |    6 ------
>  src/app/services/hardware_pool_service.rb    |    4 ++--
>  src/app/services/smart_pool_service.rb       |    4 ++--
>  src/app/services/vm_resource_pool_service.rb |    4 ++--
>  6 files changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/src/app/controllers/hardware_controller.rb
> b/src/app/controllers/hardware_controller.rb
> index 4d93e2f..6d879b9 100644
> --- a/src/app/controllers/hardware_controller.rb
> +++ b/src/app/controllers/hardware_controller.rb
> @@ -187,10 +187,7 @@ class HardwareController < PoolController
>   end
>
>   def additional_create_params
> -    ret_hash = {:resource_ids => params[:resource_ids],
> -                :parent_id => (params[:hardware_pool] ?
> -                               params[:hardware_pool][:parent_id] :
> -                               params[:parent_id])}
> +    ret_hash = {:resource_ids => params[:resource_ids]}
>     ret_hash[:resource_type] = Host if params[:resource_type] == "hosts"
>     ret_hash[:resource_type] = Storage if params[:resource_type] ==
> "storage"
>     ret_hash
> diff --git a/src/app/controllers/pool_controller.rb
> b/src/app/controllers/pool_controller.rb
> index 1a65718..74a958c 100644
> --- a/src/app/controllers/pool_controller.rb
> +++ b/src/app/controllers/pool_controller.rb
> @@ -112,7 +112,7 @@ class PoolController < ApplicationController
>     # FIXME: REST and browsers send params differently. Should be fixed
>     # in the views
>     alert = svc_create(params[:pool] ? params[:pool] :
> params[:hardware_pool],
> -                       additional_create_params)
> +                       get_parent_id, additional_create_params)
>     respond_to do |format|
>       format.json {
>         reply = { :object => "pool", :success => true,
> @@ -164,6 +164,8 @@ class PoolController < ApplicationController
>
>   protected
>   def get_parent_id
> -    params[:parent_id]
> +    params[:hardware_pool] ?
> +    params[:hardware_pool][:parent_id] :
> +      params[:parent_id]
>   end
>  end
> diff --git a/src/app/controllers/resources_controller.rb
> b/src/app/controllers/resources_controller.rb
> index efd3cb6..9d1074a 100644
> --- a/src/app/controllers/resources_controller.rb
> +++ b/src/app/controllers/resources_controller.rb
> @@ -66,12 +66,6 @@ class ResourcesController < PoolController
>     super(:full_items => @pool.vms, :find_opts => {}, :include_pool =>
> :true)
>   end
>
> -  def additional_create_params
> -    {:parent_id => (params[:hardware_pool] ?
> -                    params[:hardware_pool][:parent_id] :
> -                    params[:parent_id])}
> -  end
> -
>   def delete
>     vm_pool_ids = params[:vm_pool_ids].split(",")
>     successes = []
> diff --git a/src/app/services/hardware_pool_service.rb
> b/src/app/services/hardware_pool_service.rb
> index 8b53515..f12330b 100644
> --- a/src/app/services/hardware_pool_service.rb
> +++ b/src/app/services/hardware_pool_service.rb
> @@ -43,8 +43,8 @@ module HardwarePoolService
>   #                    +parent_id+
>   # === Required permissions
>   # [<tt>Privilege::MODIFY</tt>] for the parent pool
> -  def svc_create(pool_hash, other_args)
> -    svc_new(other_args[:parent_id], pool_hash)
> +  def svc_create(pool_hash, parent_id, other_args)
> +    svc_new(parent_id, pool_hash)
>
>     Pool.transaction do
>       @pool.create_with_parent(@parent)
> diff --git a/src/app/services/smart_pool_service.rb
> b/src/app/services/smart_pool_service.rb
> index 28bdaf3..15218ed 100644
> --- a/src/app/services/smart_pool_service.rb
> +++ b/src/app/services/smart_pool_service.rb
> @@ -43,8 +43,8 @@ module SmartPoolService
>   #                    +parent_id+
>   # === Required permissions
>   # [<tt>Privilege::MODIFY</tt>] for the pool
> -  def svc_create(pool_hash, other_args)
> -    svc_new(nil, pool_hash)
> +  def svc_create(pool_hash, parent_id, other_args)
> +    svc_new(parent_id, pool_hash)
>     @pool.create_with_parent(@parent)
>     return "Smart Pool was successfully created."
>   end
> diff --git a/src/app/services/vm_resource_pool_service.rb
> b/src/app/services/vm_resource_pool_service.rb
> index 8930a4b..1d55d67 100644
> --- a/src/app/services/vm_resource_pool_service.rb
> +++ b/src/app/services/vm_resource_pool_service.rb
> @@ -54,8 +54,8 @@ module VmResourcePoolService
>   #                    +parent_id+
>   # === Required permissions
>   # [<tt>Privilege::MODIFY</tt>] for the parent pool
> -  def svc_create(pool_hash, other_args)
> -    svc_new(other_args[:parent_id], pool_hash)
> +  def svc_create(pool_hash, parent_id, other_args)
> +    svc_new(parent_id, pool_hash)
>     @pool.create_with_parent(@parent)
>     return "VM Pool was successfully created."
>   end
> --
> 1.6.0.6
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090528/d75f5a8f/attachment.htm>


More information about the ovirt-devel mailing list