deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH] Updates openstack driver to use the 'new' openstack gem Also updates the gemspec accordingly
Date Tue, 05 Jun 2012 14:25:29 GMT
On 05/06/12 17:20, Michal Fojtik wrote:
> On 06/05/12, marios@redhat.com wrote:
> 
> ACK.
> 
> For some reason I can't see the commit message, but I guess is my mutt
> configuration problem.
> 

yes strange - i applied the email patch to new branch and could see
commit message - no idea - also just pushed and commit message looks
fine in 'git log'

> Also note this change require 'old' vcr (<2.0) to run, otherwise you get a
> lot for VCR failures... Otherwise it works fine under VCR 1.0.
> 
yes that's right. the main point of running the tests here was to ensure
that this 'new' driver (basically just changed the way the openstack
client is instantiated through the 'new' gem and the way we grab vars
from that client) works in the same way as the 'old' driver. On my list
is to update these tests to new minitest/spec format so this vcr 1 vs 2
issue will go away.

thanks!

marios


>   -- Michal
> 
>> From: marios <marios@redhat.com>
>>
>>
>> Signed-off-by: marios <marios@redhat.com>
>> ---
>>  server/deltacloud-core.gemspec                     |    4 +-
>>  .../drivers/openstack/openstack_driver.rb          |   24 ++++++++++----------
>>  server/tests/drivers/openstack/images_test.rb      |    2 +-
>>  3 files changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/server/deltacloud-core.gemspec b/server/deltacloud-core.gemspec
>> index 1df10cc..8a2ba35 100644
>> --- a/server/deltacloud-core.gemspec
>> +++ b/server/deltacloud-core.gemspec
>> @@ -100,7 +100,7 @@ Gem::Specification.new do |s|
>>  # Condor Cloud
>>    s.add_dependency('uuidtools', '>= 2.1.1')
>>  
>> -# Openstack Compute
>> -  s.add_dependency('openstack-compute')
>> +# Openstack Compute and Object-Storage
>> +  s.add_dependency('openstack')
>>  
>>  end
>> diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
>> index df8e823..7c5125c 100644
>> --- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
>> +++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
>> @@ -14,7 +14,7 @@
>>  # under the License.
>>  #
>>  
>> -require 'openstack/compute'
>> +require 'openstack'
>>  require 'tempfile'
>>  
>>  module Deltacloud
>> @@ -61,10 +61,10 @@ module Deltacloud
>>            safely do
>>              if(opts[:id])
>>                img = os.get_image(opts[:id])
>> -              results << convert_from_image(img, os.authuser)
>> +              results << convert_from_image(img, os.connection.authuser)
>>              else
>>                results = os.list_images.collect do |img|
>> -                convert_from_image(img, os.authuser)
>> +                convert_from_image(img, os.connection.authuser)
>>                end
>>              end
>>            end
>> @@ -80,7 +80,7 @@ module Deltacloud
>>              server = os.get_server(opts[:id])
>>              image_name = opts[:name] || "#{server.name}_#{Time.now}"
>>              img = server.create_image(:name=>image_name)
>> -            convert_from_image(img, os.authuser)
>> +            convert_from_image(img, os.connection.authuser)
>>            end
>>          end
>>  
>> @@ -118,10 +118,10 @@ module Deltacloud
>>            safely do
>>              if opts[:id]
>>                server = os.get_server(opts[:id].to_i)
>> -              insts << convert_from_server(server, os.authuser)
>> +              insts << convert_from_server(server, os.connection.authuser)
>>              else
>>                insts = os.list_servers_detail.collect do |server|
>> -                convert_from_server(server, os.authuser)
>> +                convert_from_server(server, os.connection.authuser)
>>                end
>>              end
>>            end
>> @@ -144,7 +144,7 @@ module Deltacloud
>>            end
>>            safely do
>>              server = os.create_server(params)
>> -            result = convert_from_server(server, os.authuser)
>> +            result = convert_from_server(server, os.connection.authuser)
>>            end
>>            result
>>          end
>> @@ -154,7 +154,7 @@ module Deltacloud
>>            safely do
>>              server = os.get_server(instance_id.to_i)
>>              server.reboot! # sends a hard reboot (power cycle) - could instead server.reboot("SOFT")
>> -            convert_from_server(server, os.authuser)
>> +            convert_from_server(server, os.connection.authuser)
>>            end
>>          end
>>  
>> @@ -163,7 +163,7 @@ module Deltacloud
>>            safely do
>>              server = os.get_server(instance_id.to_i)
>>              server.delete!
>> -            convert_from_server(server, os.authuser)
>> +            convert_from_server(server, os.connection.authuser)
>>            end
>>          end
>>  
>> @@ -229,7 +229,7 @@ private
>>              user_name, tenant_name = tokens.first, tokens.last
>>            end
>>            safely do
>> -              OpenStack::Compute::Connection.new(:username => user_name, :api_key
=> credentials.password, :authtenant => tenant_name, :auth_url => api_provider)
>> +              OpenStack::Connection.create(:username => user_name, :api_key =>
credentials.password, :authtenant => tenant_name, :auth_url => api_provider)
>>            end
>>          end
>>  
>> @@ -353,11 +353,11 @@ private
>>              status 400
>>            end
>>  
>> -          on /Exception::Authentication/ do
>> +          on /OpenStack::Exception::Authentication/ do
>>              status 401
>>            end
>>  
>> -          on /Exception::ItemNotFound/ do
>> +          on /OpenStack::Exception::ItemNotFound/ do
>>              status 404
>>            end
>>  
>> diff --git a/server/tests/drivers/openstack/images_test.rb b/server/tests/drivers/openstack/images_test.rb
>> index bec7b27..3b79093 100644
>> --- a/server/tests/drivers/openstack/images_test.rb
>> +++ b/server/tests/drivers/openstack/images_test.rb
>> @@ -31,7 +31,7 @@ module OpenstackTest
>>          (image/'architecture').should_not == ''
>>          (image/'state').text.should == 'ACTIVE'
>>          ENV['API_USER'].include?((image/'owner_id').text).should == true
>> -        (image/'actions/link').length.should == 1
>> +        (image/'actions/link').length.should == 2
>>          (image/'actions/link').first[:rel].should == 'create_instance'
>>        end
>>        @@image_id = ((last_xml_response/'images/image').first)[:id]
>> -- 
>> 1.7.6.5
>>
> 


Mime
View raw message