You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by rl...@redhat.com on 2013/02/27 00:02:01 UTC

Deltacloud - Tests - adding testpoint for creating an image from a stopped instance - if supported

We lost this testing when all instances were started prior to running the instances testpoints. This patch:

 - checks if the create_image op exists on the running instance 
 - if not, stops the instance
 - and checks if the create_image op now exists
 - if so, carries on with the test and creates the image
 - starts the instabce if it was stopped in step 2

I've dons some preliminary testing on RHEVM, Mock ... assuming that there will be little fallout for the providers that support image creation from a running instance (fgcp and c2) - where this code will just be skipped over.


Re: Deltacloud - Tests - adding testpoint for creating an image from a stopped instance - if supported

Posted by Ronelle Landy <rl...@redhat.com>.
> From: "Dies Koper" <di...@fast.au.fujitsu.com>
> To: dev@deltacloud.apache.org
> Sent: Tuesday, February 26, 2013 7:24:38 PM
> Subject: RE: Deltacloud - Tests - adding testpoint for creating an image from a stopped instance - if supported
> 
> Hi Ronelle,
> 
> Thanks for picking this up. It was on my todo list but have been
> focusing on cimi system first.
> 
> >  - checks if the create_image op exists on the running instance
> >  - if not, stops the instance
> >  - and checks if the create_image op now exists
> 
> Should the test also cater for the possibility that a provider
> supports create_image for both running and stopped instances?
> I don't know if we have any such providers. If not, I suppose we can
> revisit the test when we do.

Dies, thanks for the review. I don't know of any providers that allow a user to create and image from both a running and a stopped instance so I think we're ok with switching on the instance state here. If you find such a provider, let me know :)

> 
> >  - starts the instance if it was stopped in step 2
> 
> Maybe there is no need for this?
> None of the other tests rely on the instance to be running so it
> could be left in the stopped state.

Agreed, I didn't see an exact need to restart the instance other than that I wanted to cleanup. Could likely remove this.

> 
> Regards,
> Dies Koper
> 
> --
> Dies KÖPER
> Software & Solutions Architect
> 
> Fujitsu Australia Software Technology (FAST) - Cloud Computing
> Tel. +61 2 9452 9061 (Fujitsu internal 7985-29061)
> diesk@fast.au.fujitsu.com
> 
> 
> > -----Original Message-----
> > From: rlandy@redhat.com [mailto:rlandy@redhat.com]
> > Sent: Wednesday, 27 February 2013 10:02 AM
> > To: dev@deltacloud.apache.org
> > Subject: Deltacloud - Tests - adding testpoint for creating an
> > image from
> > a stopped instance - if supported
> > 
> > 
> > We lost this testing when all instances were started prior to
> > running
> > the instances testpoints. This patch:
> > 
> >  - checks if the create_image op exists on the running instance
> >  - if not, stops the instance
> >  - and checks if the create_image op now exists
> >  - if so, carries on with the test and creates the image
> >  - starts the instabce if it was stopped in step 2
> > 
> > I've dons some preliminary testing on RHEVM, Mock ... assuming that
> > there
> > will be little fallout for the providers that support image
> > creation from
> > a running instance (fgcp and c2) - where this code will just be
> > skipped
> > over.
> > 
> 
> 
> 

RE: Deltacloud - Tests - adding testpoint for creating an image from a stopped instance - if supported

Posted by "Koper, Dies" <di...@fast.au.fujitsu.com>.
Hi Ronelle,

Thanks for picking this up. It was on my todo list but have been focusing on cimi system first.

>  - checks if the create_image op exists on the running instance
>  - if not, stops the instance
>  - and checks if the create_image op now exists

Should the test also cater for the possibility that a provider supports create_image for both running and stopped instances?
I don't know if we have any such providers. If not, I suppose we can revisit the test when we do.

>  - starts the instabce if it was stopped in step 2

Maybe there is no need for this?
None of the other tests rely on the instance to be running so it could be left in the stopped state.

Regards,
Dies Koper

--
Dies KÖPER
Software & Solutions Architect

Fujitsu Australia Software Technology (FAST) - Cloud Computing
Tel. +61 2 9452 9061 (Fujitsu internal 7985-29061)
diesk@fast.au.fujitsu.com


> -----Original Message-----
> From: rlandy@redhat.com [mailto:rlandy@redhat.com]
> Sent: Wednesday, 27 February 2013 10:02 AM
> To: dev@deltacloud.apache.org
> Subject: Deltacloud - Tests - adding testpoint for creating an image from
> a stopped instance - if supported
> 
> 
> We lost this testing when all instances were started prior to running
> the instances testpoints. This patch:
> 
>  - checks if the create_image op exists on the running instance
>  - if not, stops the instance
>  - and checks if the create_image op now exists
>  - if so, carries on with the test and creates the image
>  - starts the instabce if it was stopped in step 2
> 
> I've dons some preliminary testing on RHEVM, Mock ... assuming that there
> will be little fallout for the providers that support image creation from
> a running instance (fgcp and c2) - where this code will just be skipped
> over.
> 



[PATCH] Deltacloud - Tests - adding testpoint for creating an image from a stopped instance - if supported

Posted by rl...@redhat.com.
From: Ronelle Landy <rl...@redhat.com>

---
 tests/deltacloud/instances_test.rb |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tests/deltacloud/instances_test.rb b/tests/deltacloud/instances_test.rb
index 7395062..0edf359 100644
--- a/tests/deltacloud/instances_test.rb
+++ b/tests/deltacloud/instances_test.rb
@@ -295,6 +295,13 @@ puts "CLEANUP attempt finished... resources looks like: #{@@created_resources.in
     (res.xml/'instance/state').text.must_match /RUNNING/
     #check if created instance allows creating image
     instance_actions = (res.xml/'actions/link').to_a.inject([]){|actions, current| actions << current[:rel]; actions}
+    #check if the create_image action is available for stopped instances
+    unless instance_actions.include?("create_image")
+      stop_res = post(INSTANCES+"/"+@@my_instance_id+"/stop", "")
+      res = get(INSTANCES+"/"+@@my_instance_id)
+      wait_until_running_or_stopped(res, @@my_instance_id)
+      instance_actions = (res.xml/'actions/link').to_a.inject([]){|actions, current| actions << current[:rel]; actions}
+    end
     skip "no create image support for instance #{@@my_instance_id}" unless instance_actions.include?("create_image")
     #create image
     res = post("/images", :instance_id => @@my_instance_id, :name => random_name)
@@ -302,7 +309,15 @@ puts "CLEANUP attempt finished... resources looks like: #{@@created_resources.in
     my_image_id = (res.xml/'image')[0][:id]
     #mark for deletion later:
     @@created_resources[:images] << my_image_id
+    res = get(INSTANCES+"/"+@@my_instance_id)
+    #start instance if it was stopped
+    if (res.xml/'instance/state').text  == "STOPPED"
+      start_res = post(INSTANCES+"/"+@@my_instance_id+"/start", "")
+      res = get(INSTANCES+"/"+@@my_instance_id)
+      wait_until_running_or_stopped(res, @@my_instance_id)
+    end
   end
+
 #
 #create with key
 
-- 
1.7.7.6