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.<br><br><div class="gmail_quote">On Fri, May 22, 2009 at 12:39 PM, Scott Seago <span dir="ltr"><<a href="mailto:sseago@redhat.com">sseago@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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.<br>
<br>
Signed-off-by: Scott Seago <<a href="mailto:sseago@redhat.com">sseago@redhat.com</a>><br>
---<br>
src/app/controllers/hardware_controller.rb | 5 +----<br>
src/app/controllers/pool_controller.rb | 6 ++++--<br>
src/app/controllers/resources_controller.rb | 6 ------<br>
src/app/services/hardware_pool_service.rb | 4 ++--<br>
src/app/services/smart_pool_service.rb | 4 ++--<br>
src/app/services/vm_resource_pool_service.rb | 4 ++--<br>
6 files changed, 11 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/src/app/controllers/hardware_controller.rb b/src/app/controllers/hardware_controller.rb<br>
index 4d93e2f..6d879b9 100644<br>
--- a/src/app/controllers/hardware_controller.rb<br>
+++ b/src/app/controllers/hardware_controller.rb<br>
@@ -187,10 +187,7 @@ class HardwareController < PoolController<br>
end<br>
<br>
def additional_create_params<br>
- ret_hash = {:resource_ids => params[:resource_ids],<br>
- :parent_id => (params[:hardware_pool] ?<br>
- params[:hardware_pool][:parent_id] :<br>
- params[:parent_id])}<br>
+ ret_hash = {:resource_ids => params[:resource_ids]}<br>
ret_hash[:resource_type] = Host if params[:resource_type] == "hosts"<br>
ret_hash[:resource_type] = Storage if params[:resource_type] == "storage"<br>
ret_hash<br>
diff --git a/src/app/controllers/pool_controller.rb b/src/app/controllers/pool_controller.rb<br>
index 1a65718..74a958c 100644<br>
--- a/src/app/controllers/pool_controller.rb<br>
+++ b/src/app/controllers/pool_controller.rb<br>
@@ -112,7 +112,7 @@ class PoolController < ApplicationController<br>
# FIXME: REST and browsers send params differently. Should be fixed<br>
# in the views<br>
alert = svc_create(params[:pool] ? params[:pool] : params[:hardware_pool],<br>
- additional_create_params)<br>
+ get_parent_id, additional_create_params)<br>
respond_to do |format|<br>
format.json {<br>
reply = { :object => "pool", :success => true,<br>
@@ -164,6 +164,8 @@ class PoolController < ApplicationController<br>
<br>
protected<br>
def get_parent_id<br>
- params[:parent_id]<br>
+ params[:hardware_pool] ?<br>
+ params[:hardware_pool][:parent_id] :<br>
+ params[:parent_id]<br>
end<br>
end<br>
diff --git a/src/app/controllers/resources_controller.rb b/src/app/controllers/resources_controller.rb<br>
index efd3cb6..9d1074a 100644<br>
--- a/src/app/controllers/resources_controller.rb<br>
+++ b/src/app/controllers/resources_controller.rb<br>
@@ -66,12 +66,6 @@ class ResourcesController < PoolController<br>
super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)<br>
end<br>
<br>
- def additional_create_params<br>
- {:parent_id => (params[:hardware_pool] ?<br>
- params[:hardware_pool][:parent_id] :<br>
- params[:parent_id])}<br>
- end<br>
-<br>
def delete<br>
vm_pool_ids = params[:vm_pool_ids].split(",")<br>
successes = []<br>
diff --git a/src/app/services/hardware_pool_service.rb b/src/app/services/hardware_pool_service.rb<br>
index 8b53515..f12330b 100644<br>
--- a/src/app/services/hardware_pool_service.rb<br>
+++ b/src/app/services/hardware_pool_service.rb<br>
@@ -43,8 +43,8 @@ module HardwarePoolService<br>
# +parent_id+<br>
# === Required permissions<br>
# [<tt>Privilege::MODIFY</tt>] for the parent pool<br>
- def svc_create(pool_hash, other_args)<br>
- svc_new(other_args[:parent_id], pool_hash)<br>
+ def svc_create(pool_hash, parent_id, other_args)<br>
+ svc_new(parent_id, pool_hash)<br>
<br>
Pool.transaction do<br>
@pool.create_with_parent(@parent)<br>
diff --git a/src/app/services/smart_pool_service.rb b/src/app/services/smart_pool_service.rb<br>
index 28bdaf3..15218ed 100644<br>
--- a/src/app/services/smart_pool_service.rb<br>
+++ b/src/app/services/smart_pool_service.rb<br>
@@ -43,8 +43,8 @@ module SmartPoolService<br>
# +parent_id+<br>
# === Required permissions<br>
# [<tt>Privilege::MODIFY</tt>] for the pool<br>
- def svc_create(pool_hash, other_args)<br>
- svc_new(nil, pool_hash)<br>
+ def svc_create(pool_hash, parent_id, other_args)<br>
+ svc_new(parent_id, pool_hash)<br>
@pool.create_with_parent(@parent)<br>
return "Smart Pool was successfully created."<br>
end<br>
diff --git a/src/app/services/vm_resource_pool_service.rb b/src/app/services/vm_resource_pool_service.rb<br>
index 8930a4b..1d55d67 100644<br>
--- a/src/app/services/vm_resource_pool_service.rb<br>
+++ b/src/app/services/vm_resource_pool_service.rb<br>
@@ -54,8 +54,8 @@ module VmResourcePoolService<br>
# +parent_id+<br>
# === Required permissions<br>
# [<tt>Privilege::MODIFY</tt>] for the parent pool<br>
- def svc_create(pool_hash, other_args)<br>
- svc_new(other_args[:parent_id], pool_hash)<br>
+ def svc_create(pool_hash, parent_id, other_args)<br>
+ svc_new(parent_id, pool_hash)<br>
@pool.create_with_parent(@parent)<br>
return "VM Pool was successfully created."<br>
end<br>
<font color="#888888">--<br>
1.6.0.6<br>
<br>
_______________________________________________<br>
Ovirt-devel mailing list<br>
<a href="mailto:Ovirt-devel@redhat.com">Ovirt-devel@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/ovirt-devel" target="_blank">https://www.redhat.com/mailman/listinfo/ovirt-devel</a><br>
</font></blockquote></div><br>