From: Martyn Taylor mtaylor@redhat.com
--- src/app/controllers/quotas_controller.rb | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/quotas_controller.rb b/src/app/controllers/quotas_controller.rb index e9937fb..26a8f15 100644 --- a/src/app/controllers/quotas_controller.rb +++ b/src/app/controllers/quotas_controller.rb @@ -72,6 +72,32 @@ class QuotasController < ApplicationController redirect_to :action => 'show', :id => @parent, :parent_type => @parent_type end
+ def can_create_instance + begin + cloud_account = CloudAccount.find(params[:cloud_account_id]) + instance = Instance.find(params[:instance_id]) + params = { :request => "can_create_instance", :result => Quota.can_create_instance?(instance, cloud_account) } + render :layout => false, :xml => params.to_xml + rescue ActiveRecord::RecordNotFound + head :not_found + rescue Exception + head :internal_server_error + end + end + + def can_start_instance + begin + cloud_account = CloudAccount.find(params[:cloud_account_id]) + instance = Instance.find(params[:instance_id]) + params = { :request => "can_start_instance", :result => Quota.can_start_instance?(instance, cloud_account) } + render :layout => false, :xml => params.to_xml + rescue ActiveRecord::RecordNotFound + head :not_found + rescue Exception + head :internal_server_error + end + end + private def get_parent_object(params) if params[:parent_type] == "pool" @@ -100,5 +126,4 @@ class QuotasController < ApplicationController return params end
- end