incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962217 - in /incubator/deltacloud/trunk: client/bin/ server/libexec/ server/libexec/lib/deltacloud/drivers/ec2/ server/libexec/lib/deltacloud/drivers/mock/ server/libexec/lib/deltacloud/drivers/opennebula/ server/libexec/lib/deltacloud/dri...
Date Thu, 08 Jul 2010 23:37:21 GMT
Author: lutter
Date: Thu Jul  8 23:37:21 2010
New Revision: 962217

URL: http://svn.apache.org/viewvc?rev=962217&view=rev
Log:
Added filtering by instance state

Modified:
    incubator/deltacloud/trunk/client/bin/deltacloudc
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/ec2/ec2_driver.rb
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
    incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rimu/rimu_hosting_driver.rb
    incubator/deltacloud/trunk/server/libexec/server.rb

Modified: incubator/deltacloud/trunk/client/bin/deltacloudc
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/bin/deltacloudc?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/bin/deltacloudc (original)
+++ incubator/deltacloud/trunk/client/bin/deltacloudc Thu Jul  8 23:37:21 2010
@@ -39,6 +39,7 @@ BANNER
   opts.on( nil, '--arch ARCH', 'Architecture (x86, x86_64)') { |id| options[:architecture]
= id }
   opts.on( nil, '--flavor_id FLAVOR', 'Flavor') { |id| options[:flavor_id] = id }
   opts.on( nil, '--name NAME', 'Name (for instance eg.)') { |name| options[:name] = name
}
+  opts.on( '-s STATE', '--state STATE', 'Instance state (RUNNING, STOPPED)') { |state| options[:state]
= state }
   opts.on( '-u', '--url URL', 'API url ($API_URL variable)') { |url| options[:api_url] =
url }
   opts.on( '-l', '--list', 'List collections/operations') { |id| options[:list] = true }
   opts.on( '-h', '--help', 'Display this screen' ) { puts opts ; exit }
@@ -101,6 +102,7 @@ if options[:collection] and ( options[:o
   params = {}
   params.merge!(:architecture => options[:architecture]) if options[:architecture]
   params.merge!(:id => options[:id]) if options[:id]
+  params.merge!(:state => options[:state]) if options[:state]
   client.send(options[:collection].to_s, params).each do |model|
     puts model.to_plain
   end

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/ec2/ec2_driver.rb Thu
Jul  8 23:37:21 2010
@@ -179,6 +179,8 @@ class EC2Driver < Deltacloud::BaseDriver
         instances << convert_instance( ec2_instance )
       end
     end
+    instances = filter_on( instances, :id, opts )
+    instances = filter_on( instances, :state, opts )
     instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb (original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/mock/mock_driver.rb Thu
Jul  8 23:37:21 2010
@@ -135,6 +135,7 @@ class MockDriver < Deltacloud::BaseDrive
   #
 
   def instances(credentials, opts=nil)
+    $stderr.puts opts.inspect
     check_credentials( credentials )
     instances = []
     Dir[ "#{STORAGE_ROOT}/instances/*.yml" ].each do |instance_file|
@@ -146,6 +147,7 @@ class MockDriver < Deltacloud::BaseDrive
       end
     end
     instances = filter_on( instances, :id, opts )
+    instances = filter_on( instances, :state, opts )
     instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/opennebula/opennebula_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/opennebula/opennebula_driver.rb
Thu Jul  8 23:37:21 2010
@@ -141,6 +141,8 @@ class OpennebulaDriver < Deltacloud::Bas
 
 		instances << convert_instance(computexml.to_s(), credentials)
 	end
+        instances = filter_on( instances, :id, opts )
+        instances = filter_on( instances, :state, opts )
 	instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rackspace/rackspace_driver.rb
Thu Jul  8 23:37:21 2010
@@ -106,6 +106,7 @@ class RackspaceDriver < Deltacloud::Base
       instances << convert_srv_to_instance(racks.load_server_details(opts[:id]))
     end
     instances = filter_on( instances, :id, opts )
+    instances = filter_on( instances, :state, opts )
     instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
Thu Jul  8 23:37:21 2010
@@ -190,6 +190,8 @@ class RHEVMDriver < Deltacloud::BaseDriv
     vms.each do |vm|
       instances << vm_to_instance(vm)
     end
+    instances = filter_on( instances, :id, opts )
+    instances = filter_on( instances, :state, opts )
     instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rimu/rimu_hosting_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rimu/rimu_hosting_driver.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rimu/rimu_hosting_driver.rb
(original)
+++ incubator/deltacloud/trunk/server/libexec/lib/deltacloud/drivers/rimu/rimu_hosting_driver.rb
Thu Jul  8 23:37:21 2010
@@ -68,6 +68,7 @@ class RimuHostingDriver < Deltacloud::Ba
       convert_srv_to_instance(inst)
     end
     instances = filter_on( instances, :id, opts)
+    instances = filter_on( instances, :state, opts )
     instances
   end
 

Modified: incubator/deltacloud/trunk/server/libexec/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/libexec/server.rb?rev=962217&r1=962216&r2=962217&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/libexec/server.rb (original)
+++ incubator/deltacloud/trunk/server/libexec/server.rb Thu Jul  8 23:37:21 2010
@@ -40,6 +40,7 @@ def filter_all(model)
     filter.merge!(:id => params[:id]) if params[:id]
     filter.merge!(:architecture => params[:architecture]) if params[:architecture]
     filter.merge!(:owner_id => params[:owner_id]) if params[:owner_id]
+    filter.merge!(:state => params[:state]) if params[:state]
     filter = nil if filter.keys.size.eql?(0)
     safely do
       singular = model.to_s.singularize.to_sym
@@ -201,7 +202,8 @@ collection :instances do
 
   operation :index do
     description "List all instances"
-    param :id,            :string
+    param :id,            :string,  :optional
+    param :state,         :string,  :optional
     control { filter_all(:instances) }
   end
 



Mime
View raw message