You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by "Michal Fojtik (Resolved) (JIRA)" <ji...@apache.org> on 2012/03/08 13:25:58 UTC
[jira] [Resolved] (DTACLOUD-41) RHEVM driver returns 500 Internal
Server Error if a instance name has been entered > 50chars
[ https://issues.apache.org/jira/browse/DTACLOUD-41?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michal Fojtik resolved DTACLOUD-41.
-----------------------------------
Resolution: Fixed
Exception was not captured by our exception handling system. Putting that raise to safely..end block did that trick:
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 8a0764c..dfe77b3 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -177,10 +177,10 @@ class RHEVMDriver < Deltacloud::BaseDriver
def create_instance(credentials, image_id, opts={})
client = new_client(credentials)
params = {}
- if opts[:name]
- raise "Parameter name must be #{USER_NAME_MAX} characters or less" if opts[:name].length > USER_NAME_MAX
- end
safely do
+ if opts[:name]
+ raise "Parameter name must be #{USER_NAME_MAX} characters or less" if opts[:name].length > USER_NAME_MAX
+ end
params[:name] = opts[:name]
params[:template] = opts[:image_id]
params[:cluster] = opts[:realm_id] if opts[:realm_id]
@@ -327,10 +327,6 @@ class RHEVMDriver < Deltacloud::BaseDriver
exceptions do
- on /Bad Request/ do
- status 400
- end
-
on /Unauthorized/ do
status 401
end
@@ -351,7 +347,7 @@ class RHEVMDriver < Deltacloud::BaseDriver
status 500
end
- on /Parameter name/ do
+ on /(Bad Request|Parameter name)/ do
status 400
end
Current results:
Processing /api/instances (for 127.0.0.1 at 2012-03-08 13:23:19 +0100) [POST] [RHEVM]
Parameters: {"image_id"=>"73cde5ef-1759-4b7a-9dd8-6e955fa9efa0", "name"=>"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii", "user_data"=>"", "hwp_id"=>"SERVER", "hwp_cpu"=>"1", "hwp_memory"=>"512", "hwp_storage"=>"1", "realm_id"=>"3c8af388-cff6-11e0-9267-52540013f702"}
Provider: https://x-x.x.x.x.x.com:8443/api;645e425e-66fe-4ac9-8874-537bd10ef08d
Authentication: Basic
Server: thin 1.3.1 codename Triple Espresso
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
RuntimeError:Parameter name must be 50 characters or less
/Users/mfojtik/code/core/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb:182:in `block in create_instance'
/Users/mfojtik/code/core/server/lib/deltacloud/base_driver/exceptions.rb:173:in `call'
/Users/mfojtik/code/core/server/lib/deltacloud/base_driver/exceptions.rb:173:in `safely'
/Users/mfojtik/code/core/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb:180:in `create_instance'
/Users/mfojtik/code/core/server/lib/deltacloud/server.rb:480:in `block (3 levels) in <top (required)>'
/Users/mfojtik/code/core/server/lib/sinatra/rabbit.rb:125:in `instance_eval'
/Users/mfojtik/code/core/server/lib/sinatra/rabbit.rb:125:in `block in control'
/Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:in `call'
/Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:in `block in compile!'
/Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `[]'
/Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `block (3 levels) in route!'
Completed in 0.000000 | 0.000000 | 400 | | http://localhost:3009/api/instances
Pushed in d488054051d98699a7f43669c5ed2e97b3173688
> RHEVM driver returns 500 Internal Server Error if a instance name has been entered > 50chars
> --------------------------------------------------------------------------------------------
>
> Key: DTACLOUD-41
> URL: https://issues.apache.org/jira/browse/DTACLOUD-41
> Project: DeltaCloud
> Issue Type: Bug
> Components: Server
> Reporter: Martyn Taylor
> Assignee: Michal Fojtik
> Attachments: error-message.png
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> On an instance create request for server using RHEV-M backend, when trying to create with an instance name > 50 chars. The Server returns an Internal Server Error HTTP 500. This is because the RHEV-M backend does not support Instances names of this length.
> Some validation Checks should be applied before requests are sent to the RHEV-M backend to make sure that these errors do not occur and to make sure a relevant Error message is returned to the client
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira