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

Misc fixes

These patches address a variety of small problems, modtly to do with load
balancers. In particular, they address Jira issues 36 and 37 filed by
clalancette.

I haven't been able to run all tests on them - my local setup seems fairly
busted for tests. Unclear, why.

David

Re: Misc fixes

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2011-05-05 at 11:43 +0200, Michal Fojtik wrote:
> On May 5, 2011, at 12:42 AM, lutter@redhat.com wrote:
>
> Patches 1-3 and 5 applied cleanly on HEAD, unfortunately patch 4/5 throws
> this error for me:
> 
> mfojtik@firefly ~/code/core/server $ git am ~/Desktop/patches/\[PATCH\ 4_5\]\ load_balancers_\ advertise\ the\ \'register\'\ action.eml
> Applying: load_balancers: advertise the 'register' action
> error: patch failed: server/views/load_balancers/show.xml.haml:3
> error: server/views/load_balancers/show.xml.haml: patch does not apply
> Patch failed at 0001 load_balancers: advertise the 'register' action
> 
> Dunno why, after brief inspection I added action line manually and it works.

Strange.

> > 
> > I haven't been able to run all tests on them - my local setup seems fairly
> > busted for tests. Unclear, why.
> 
> To install all necessary gems for Cucumber you can use 'bundle install' in
> server directory. Normal unit tests should work without that (but you'll need
> to install 'vcr' and 'webmock' gem).

My problem is with the client tests:

        > rake spec
        ...........F......F/usr/lib/ruby/gems/1.8/gems/nokogiri-1.4.3.1/lib/nokogiri/xml/node.rb:141: [BUG] Segmentation fault
        ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
        
        rake aborted!
        
This is on an up-to-date Fedora 14 box.

David


Re: Misc fixes

Posted by Michal Fojtik <mf...@redhat.com>.
On May 5, 2011, at 12:42 AM, lutter@redhat.com wrote:

Hi,

> 
> These patches address a variety of small problems, modtly to do with load
> balancers. In particular, they address Jira issues 36 and 37 filed by
> clalancette.

ACK

Patches 1-3 and 5 applied cleanly on HEAD, unfortunately patch 4/5 throws
this error for me:

mfojtik@firefly ~/code/core/server $ git am ~/Desktop/patches/\[PATCH\ 4_5\]\ load_balancers_\ advertise\ the\ \'register\'\ action.eml
Applying: load_balancers: advertise the 'register' action
error: patch failed: server/views/load_balancers/show.xml.haml:3
error: server/views/load_balancers/show.xml.haml: patch does not apply
Patch failed at 0001 load_balancers: advertise the 'register' action

Dunno why, after brief inspection I added action line manually and it works.

> 
> I haven't been able to run all tests on them - my local setup seems fairly
> busted for tests. Unclear, why.

To install all necessary gems for Cucumber you can use 'bundle install' in
server directory. Normal unit tests should work without that (but you'll need
to install 'vcr' and 'webmock' gem).

rake test:mock
66 tests, 0 assertions, 0 failures, 0 errors

rake test:rackspace
28 tests, 0 assertions, 0 failures, 0 errors


  -- Michal

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


[PATCH 2/5] load_balancers: properly show instance_port in HTML

Posted by lu...@redhat.com.
From: David Lutterkort <lu...@redhat.com>


Signed-off-by: David Lutterkort <lu...@redhat.com>
---
 server/views/load_balancers/index.html.haml |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/server/views/load_balancers/index.html.haml b/server/views/load_balancers/index.html.haml
index f75b1c6..dcf7b80 100644
--- a/server/views/load_balancers/index.html.haml
+++ b/server/views/load_balancers/index.html.haml
@@ -23,11 +23,10 @@
             ="#{listener.protocol}[#{listener.load_balancer_port}]<br/>"
         %td
           - balancer.listeners.each do |listener|
-            ="#{listener.protocol}[#{listener.load_balancer_port}]<br/>"
+            ="#{listener.protocol}[#{listener.instance_port}]<br/>"
         %td
           =link_to_action 'Destroy', destroy_load_balancer_url(balancer.id), :delete
   %tfoot
     %tr
       %td{:colspan => 6, :style => "text-align:right;"}
         =link_to 'Create &raquo;', "#{url_for('/api/load_balancers/new')}", :class => 'button'
-
-- 
1.7.4.4


[PATCH 3/5] client: make objects die loudly when trying to invoke an undefined method

Posted by lu...@redhat.com.
From: David Lutterkort <lu...@redhat.com>

Right now, objects from the client just return nil when a completely
undefined method is invoked on them. With this change, they produce the
proper exception complaining about a missing method.

Signed-off-by: David Lutterkort <lu...@redhat.com>
---
 client/lib/base_object.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index 43d7ee5..f6ef149 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -109,7 +109,7 @@ module DeltaCloud
         # First of all search throught array for method name
         m = search_for_method(method_name)
         if m.nil?
-          return nil
+          super
         else
           # Call appropriate handler for method
           method_handler(m, args)
-- 
1.7.4.4


[PATCH 4/5] load_balancers: advertise the 'register' action

Posted by lu...@redhat.com.
From: David Lutterkort <lu...@redhat.com>

Fixes https://issues.apache.org/jira/browse/DTACLOUD-36

Signed-off-by: David Lutterkort <lu...@redhat.com>
---
 server/views/load_balancers/show.xml.haml |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/views/load_balancers/show.xml.haml b/server/views/load_balancers/show.xml.haml
index 996bd8d..2eeb09e 100644
--- a/server/views/load_balancers/show.xml.haml
+++ b/server/views/load_balancers/show.xml.haml
@@ -3,6 +3,7 @@
 %load_balancer{ :href => load_balancer_url(@load_balancer.id), :id => @load_balancer.id}
   %actions
     %link{ :rel => "destroy", :method => "delete", :href => destroy_load_balancer_url(@load_balancer.id)}
+    %link{ :rel => "register", :method => "post", :href => register_load_balancer_url(@load_balancer.id)}
   %public_addresses
     - @load_balancer.public_addresses.each do |address|
       %address #{address}
@@ -18,4 +19,3 @@
     - @load_balancer.instances.each do |instance|
       %instance{:href => instance_url(instance.id), :id => instance.id}
         %link{:rel => "unregister", :href => unregister_load_balancer_url(@load_balancer.id, { :instance_id => instance.id})}
-
-- 
1.7.4.4


[PATCH 1/5] * server/server.rb: do not use 'return' in respond_to blocks

Posted by lu...@redhat.com.
From: David Lutterkort <lu...@redhat.com>

Because these blocks are stroed as procs, return in them doesn't do what
one would think; instead, they cause a return of the method calling the
Proc. There is actually no need to use return here.

Fixes https://issues.apache.org/jira/browse/DTACLOUD-37

Signed-off-by: David Lutterkort <lu...@redhat.com>
---
 server/server.rb |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/server/server.rb b/server/server.rb
index c62e0d3..c48315b 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -343,9 +343,9 @@ collection :load_balancers do
     control do
       driver.destroy_load_balancer(credentials, params[:id])
       respond_to do |format|
-        format.xml { return 204 }
-        format.json { return 204 }
-        format.html { return redirect(load_balancers_url) }
+        format.xml { 204 }
+        format.json { 204 }
+        format.html { redirect(load_balancers_url) }
       end
     end
   end
@@ -529,9 +529,9 @@ collection :storage_snapshots do
     control do
       driver.destroy_storage_snapshot(credentials, params)
       respond_to do |format|
-        format.xml { return 204 }
-        format.json { return 204 }
-        format.html { return redirect(storage_snapshots_url) }
+        format.xml { 204 }
+        format.json { 204 }
+        format.html { redirect(storage_snapshots_url) }
       end
     end
   end
@@ -616,9 +616,9 @@ collection :storage_volumes do
     control do
       driver.destroy_storage_volume(credentials, params)
       respond_to do |format|
-        format.xml { return 204 }
-        format.json { return 204 }
-        format.html { return redirect(storage_volumes_url) }
+        format.xml { 204 }
+        format.json { 204 }
+        format.html { redirect(storage_volumes_url) }
       end
     end
   end
-- 
1.7.4.4


[PATCH 5/5] load_balancers (register, unregister): respond with 204 for XML/JSON

Posted by lu...@redhat.com.
From: David Lutterkort <lu...@redhat.com>


Signed-off-by: David Lutterkort <lu...@redhat.com>
---
 server/server.rb |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/server/server.rb b/server/server.rb
index c48315b..89c3274 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -323,7 +323,11 @@ collection :load_balancers do
     param :instance_id, :string,  :required
     control do
       driver.lb_register_instance(credentials, params)
-      redirect(load_balancer_url(params[:id]))
+      respond_to do |format|
+        format.xml { 204 }
+        format.json { 204 }
+        format.html { redirect(load_balancer_url(params[:id])) }
+      end
     end
   end
 
@@ -333,7 +337,11 @@ collection :load_balancers do
     param :instance_id, :string,  :required
     control do
       driver.lb_unregister_instance(credentials, params)
-      redirect(load_balancer_url(params[:id]))
+      respond_to do |format|
+        format.xml { 204 }
+        format.json { 204 }
+        format.html { redirect(load_balancer_url(params[:id])) }
+      end
     end
   end
 
-- 
1.7.4.4