You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2013/02/28 15:17:13 UTC
[15/15] git commit: RHEV-M: avoid failure of GET instance details
Updated Branches:
refs/heads/master 91112fddc -> d96847ba9
RHEV-M: avoid failure of GET instance details
A backtrace was sporadically produced for a
GET /api/instance/<instance id>
When one instance is being destroyed during a GET for
another instance, a backtrace is produced. This is because
a query for all instances (vms) was being done. The list of
all instances is gathered, one instance is destroyed, then the
list contained an invalid instance ID which when queried
produced
"Entity not found: id "
Fixes https://issues.apache.org/jira/browse/DTACLOUD-462
This change also caused automated VCR test failures which
has resulted in the re-recording of those tests. The new
recording has instituted changes to prevent the exposure
of test bed credentials.
TrackedAt: http://tracker.deltacloud.org/patch/2db40fc62c97d9333a69dd1d94a37e09693f3b72
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/d96847ba
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/d96847ba
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/d96847ba
Branch: refs/heads/master
Commit: d96847ba97a0a7e167ebd00f16ee2677b4e613c0
Parents: 91112fd
Author: Joe VLcek <jv...@redhat.com>
Authored: Wed Feb 27 18:08:36 2013 -0500
Committer: marios <ma...@redhat.com>
Committed: Thu Feb 28 16:03:23 2013 +0200
----------------------------------------------------------------------
.../lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 17 +-
server/tests/drivers/rhevm/common.rb | 6 +-
...001_must_throw_error_when_wrong_credentials.yml | 115 +-
.../test_0002_must_return_list_of_instances.yml | 6186 +++--
.../test_0003_must_allow_to_filter_instances.yml |14472 ++++-----
...0004_must_allow_to_retrieve_single_instance.yml | 9276 +++---
..._to_create_a_new_instance_and_destroy_it-10.yml | 2035 +-
...w_to_create_a_new_instance_and_destroy_it-8.yml | 132 +
...w_to_create_a_new_instance_and_destroy_it-9.yml | 2035 +-
...te_a_new_instance_and_destroy_it-destroy-10.yml | 2035 +-
...ate_a_new_instance_and_destroy_it-destroy-9.yml | 1781 +-
...low_to_create_a_new_instance_and_destroy_it.yml |22009 ++++++-------
...reate_a_new_instance_and_make_it_running-10.yml | 2035 +-
...create_a_new_instance_and_make_it_running-8.yml | 132 +
...create_a_new_instance_and_make_it_running-9.yml | 2035 +-
...o_create_a_new_instance_and_make_it_running.yml |24894 ++++++---------
server/tests/drivers/rhevm/instance_test.rb | 62 +-
server/tests/test_helper.rb | 25 +
18 files changed, 40926 insertions(+), 48356 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d96847ba/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index 65ba26d..724c6b3 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -127,12 +127,17 @@ class RhevmDriver < Deltacloud::BaseDriver
inst_arr = []
safely do
if opts[:id]
- vms = client.vms(:id => opts[:id])
+ begin
+ vm = client.vm(opts[:id])
+ inst_arr << convert_instance(client, vm)
+ rescue => e
+ raise e unless e.message =~ /Resource Not Found/
+ end
else
vms = client.vms
- end
- vms.each do |vm|
- inst_arr << convert_instance(client, vm)
+ vms.each do |vm|
+ inst_arr << convert_instance(client, vm)
+ end
end
end
inst_arr = filter_on( inst_arr, :id, opts )
@@ -286,7 +291,7 @@ class RhevmDriver < Deltacloud::BaseDriver
# UNASSIGNED, DOWN, UP, POWERING_UP, POWERED_DOWN, PAUSED, MIGRATING_FROM,
# MIGRATING_TO, UNKNOWN, NOT_RESPONDING, WAIT_FOR_LAUNCH, REBOOT_IN_PROGRESS,
# SAVING_STATE, RESTORING_STATE, SUSPENDED, IMAGE_ILLEGAL,
- # IMAGE_LOCKED or POWERING_DOWN
+ # IMAGE_LOCKED, MIGRATING or POWERING_DOWN
#
def convert_state(state)
unless state.respond_to?(:upcase)
@@ -295,7 +300,7 @@ class RhevmDriver < Deltacloud::BaseDriver
state = state.gsub('\\', '').strip.upcase
return 'PENDING' if ['WAIT_FOR_LAUNCH', 'REBOOT_IN_PROGRESS', 'SAVING_STATE',
'RESTORING_STATE', 'POWERING_UP', 'IMAGE_LOCKED', 'SAVING_STATE'].include? state
- return 'STOPPING' if state == 'POWERING_DOWN'
+ return 'STOPPING' if ['POWERING_DOWN', 'MIGRATING'].include? state
return 'STOPPED' if ['UNASSIGNED', 'DOWN', 'NOT_RESPONDING',
'IMAGE_ILLEGAL', 'UNKNOWN'].include? state
return 'RUNNING' if ['UP', 'MIGRATING_TO', 'MIGRATING_FROM'].include? state
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d96847ba/server/tests/drivers/rhevm/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb
index 1437659..14a51f9 100644
--- a/server/tests/drivers/rhevm/common.rb
+++ b/server/tests/drivers/rhevm/common.rb
@@ -18,7 +18,9 @@ VCR.configure do |c|
# NOTE: Empty this directory before re-recording
c.cassette_library_dir = File.join(File.dirname(__FILE__), 'fixtures')
c.hook_into :webmock
- # Set this to :new_episodes when you want to 're-record'
- #c.default_cassette_options = { :record => :new_episodes }
+ # Set :record to :all, when re-recording and between re-record attemps
+ # be sure to clear fixtures/*.yml files which can be done with "git checkout".
+ # e.g.:
+ # c.default_cassette_options = { :record => :all }
c.default_cassette_options = { :record => :none }
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d96847ba/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml b/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml
index e5ea2e6..6128e1d 100644
--- a/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml
+++ b/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml
@@ -1,42 +1,107 @@
----
-http_interactions:
-- request:
+---
+http_interactions:
+- request:
method: get
uri: https://unknown:wrong@dell-per610-02.lab.eng.brq.redhat.com/api/datacenters/9df72b84-0234-11e2-9b87-9386d9b09d4a
- body:
- string: ""
- headers:
- Content-Type:
+ body:
+ encoding: UTF-8
+ string: ''
+ headers:
+ Content-Type:
- application/xml
- Accept:
+ Accept:
- application/xml
- Accept-Encoding:
+ Accept-Encoding:
- gzip, deflate
- response:
- status:
+ response:
+ status:
code: 401
message: Unauthorized
- headers:
- Cache-Control:
+ headers:
+ Cache-Control:
- no-cache
- Www-Authenticate:
+ Www-Authenticate:
- Basic realm="ENGINE"
- Content-Type:
+ Content-Type:
- text/html;charset=utf-8
- Set-Cookie:
+ Set-Cookie:
- JSESSIONID=GAKFIJcON-ahGoQHZfVzT5vm; Path=/api; Secure
- Content-Length:
- - "978"
- Pragma:
+ Content-Length:
+ - '978'
+ Pragma:
- No-cache
- Expires:
+ Expires:
- Thu, 01 Jan 1970 01:00:00 CET
- Connection:
+ Connection:
- close
- Date:
+ Date:
- Fri, 09 Nov 2012 08:52:52 GMT
- body:
- string: "<html><head><title>JBoss Web/7.0.16..Final-redhat-1 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size=\"1\" noshade=\"noshade\"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication ().</u></p><HR size=\"1\" noshade=\"noshade\"><h3>JBoss Web/7.0.16..Final-redhat-1</h3></body></h
tml>"
+ body:
+ encoding: UTF-8
+ string: ! '<html><head><title>JBoss Web/7.0.16..Final-redhat-1 - Error report</title><style><!--H1
+ {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
+ H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
+ H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
+ BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
+ B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
+ P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
+ {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP
+ Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
+ <u></u></p><p><b>description</b> <u>This request requires HTTP authentication
+ ().</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.16..Final-redhat-1</h3></body></html>'
http_version:
recorded_at: Fri, 09 Nov 2012 08:52:53 GMT
-recorded_with: VCR 2.2.5
+- request:
+ method: get
+ uri: https://unknown:wrong@10.16.120.71/api/datacenters/b9bb11c2-f397-4f41-a57b-7ac15a894779
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 401
+ message: Unauthorized
+ headers:
+ Date:
+ - Wed, 27 Feb 2013 22:30:56 GMT
+ Pragma:
+ - No-cache
+ Cache-Control:
+ - no-cache
+ Expires:
+ - Wed, 31 Dec 1969 19:00:00 EST
+ Set-Cookie:
+ - JSESSIONID=AfmfC00x3rgE0rhq-nYHIgSv; Path=/api; Secure
+ Www-Authenticate:
+ - Basic realm="ENGINE"
+ Content-Type:
+ - text/html;charset=utf-8
+ Content-Length:
+ - '978'
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '<html><head><title>JBoss Web/7.0.16..Final-redhat-1 - Error report</title><style><!--H1
+ {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
+ H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
+ H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
+ BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
+ B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
+ P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
+ {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP
+ Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
+ <u></u></p><p><b>description</b> <u>This request requires HTTP authentication
+ ().</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.16..Final-redhat-1</h3></body></html>'
+ http_version:
+ recorded_at: Wed, 27 Feb 2013 22:30:47 GMT
+recorded_with: VCR 2.4.0