From 224d85565ab05f9972125f8daefe6c1e89168abb Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Mon, 14 Jan 2013 17:51:41 -0500 Subject: [PATCH 1/2] Updated the BlockStorage namespace to be Fog::HP::BlockStorage. --- lib/fog/bin/hp.rb | 9 ++++--- lib/fog/block_storage.rb | 24 ------------------- lib/fog/hp/block_storage.rb | 7 +++--- .../models/block_storage/bootable_volumes.rb | 8 +++---- lib/fog/hp/models/block_storage/snapshot.rb | 4 ++-- lib/fog/hp/models/block_storage/snapshots.rb | 8 +++---- lib/fog/hp/models/block_storage/volume.rb | 4 ++-- lib/fog/hp/models/block_storage/volumes.rb | 8 +++---- .../requests/block_storage/create_snapshot.rb | 6 ++--- .../requests/block_storage/create_volume.rb | 4 ++-- .../requests/block_storage/delete_snapshot.rb | 6 ++--- .../requests/block_storage/delete_volume.rb | 6 ++--- .../get_bootable_volume_details.rb | 6 ++--- .../block_storage/get_snapshot_details.rb | 6 ++--- .../block_storage/get_volume_details.rb | 6 ++--- .../block_storage/list_bootable_volumes.rb | 4 ++-- .../requests/block_storage/list_snapshots.rb | 4 ++-- .../hp/requests/block_storage/list_volumes.rb | 4 ++-- 18 files changed, 49 insertions(+), 75 deletions(-) delete mode 100644 lib/fog/block_storage.rb diff --git a/lib/fog/bin/hp.rb b/lib/fog/bin/hp.rb index 804f444b5..9708801dc 100644 --- a/lib/fog/bin/hp.rb +++ b/lib/fog/bin/hp.rb @@ -3,14 +3,14 @@ class HP < Fog::Bin def class_for(key) case key + when :block_storage + Fog::HP::BlockStorage when :cdn Fog::CDN::HP when :compute Fog::Compute::HP when :storage Fog::Storage::HP - when :block_storage - Fog::BlockStorage::HP else # @todo Replace most instances of ArgumentError with NotImplementedError # @todo For a list of widely supported Exceptions, see: @@ -22,6 +22,8 @@ class HP < Fog::Bin def [](service) @@connections ||= Hash.new do |hash, key| hash[key] = case key + when :block_storage + Fog::HP::BlockStorage.new when :cdn Fog::Logger.warning("HP[:cdn] is deprecated, use CDN[:hp] instead") Fog::CDN.new(:provider => 'HP') @@ -31,9 +33,6 @@ class HP < Fog::Bin when :storage Fog::Logger.warning("HP[:storage] is deprecated, use Storage[:hp] instead") Fog::Storage.new(:provider => 'HP') - when :block_storage - Fog::Logger.warning("HP[:block_storage] is deprecated, use BlockStorage[:hp] instead") - Fog::BlockStorage.new(:provider => 'HP') else raise ArgumentError, "Unrecognized service: #{key.inspect}" end diff --git a/lib/fog/block_storage.rb b/lib/fog/block_storage.rb deleted file mode 100644 index cc7c8c1a9..000000000 --- a/lib/fog/block_storage.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Fog - module BlockStorage - - def self.[](provider) - self.new(:provider => provider) - end - - def self.new(attributes) - attributes = attributes.dup # Prevent delete from having side effects - case provider = attributes.delete(:provider).to_s.downcase.to_sym - when :hp - require 'fog/hp/block_storage' - Fog::BlockStorage::HP.new(attributes) - else - raise ArgumentError.new("#{provider} is not a recognized block storage provider") - end - end - - def self.providers - Fog.services[:block_storage] - end - - end -end diff --git a/lib/fog/hp/block_storage.rb b/lib/fog/hp/block_storage.rb index 8b089177c..f870354da 100644 --- a/lib/fog/hp/block_storage.rb +++ b/lib/fog/hp/block_storage.rb @@ -1,9 +1,8 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'hp')) -require 'fog/block_storage' module Fog - module BlockStorage - class HP < Fog::Service + module HP + class BlockStorage < Fog::Service requires :hp_secret_key, :hp_account_id, :hp_tenant_id, :hp_avl_zone recognizes :hp_auth_uri, :persistent, :connection_options, :hp_use_upass_auth_style, :hp_auth_version, :user_agent @@ -133,7 +132,7 @@ module Fog rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound - Fog::BlockStorage::HP::NotFound.slurp(error) + Fog::HP::BlockStorage::NotFound.slurp(error) else error end diff --git a/lib/fog/hp/models/block_storage/bootable_volumes.rb b/lib/fog/hp/models/block_storage/bootable_volumes.rb index 3e9a7e770..cd0d16768 100644 --- a/lib/fog/hp/models/block_storage/bootable_volumes.rb +++ b/lib/fog/hp/models/block_storage/bootable_volumes.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/volume' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class BootableVolumes < Fog::Collection - model Fog::BlockStorage::HP::Volume + model Fog::HP::BlockStorage::Volume def all data = connection.list_bootable_volumes.body['volumes'] @@ -17,7 +17,7 @@ module Fog def get(volume_id) volume = connection.get_bootable_volume_details(volume_id).body['volume'] new(volume) - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/models/block_storage/snapshot.rb b/lib/fog/hp/models/block_storage/snapshot.rb index f421895d6..e8795681c 100644 --- a/lib/fog/hp/models/block_storage/snapshot.rb +++ b/lib/fog/hp/models/block_storage/snapshot.rb @@ -1,8 +1,8 @@ require 'fog/core/model' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Snapshot < Fog::Model diff --git a/lib/fog/hp/models/block_storage/snapshots.rb b/lib/fog/hp/models/block_storage/snapshots.rb index 64b81b0dc..c9a2aee43 100644 --- a/lib/fog/hp/models/block_storage/snapshots.rb +++ b/lib/fog/hp/models/block_storage/snapshots.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/snapshot' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Snapshots < Fog::Collection - model Fog::BlockStorage::HP::Snapshot + model Fog::HP::BlockStorage::Snapshot def all data = connection.list_snapshots.body['snapshots'] @@ -18,7 +18,7 @@ module Fog if snapshot = connection.get_snapshot_details(snapshot_id).body['snapshot'] new(snapshot) end - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/models/block_storage/volume.rb b/lib/fog/hp/models/block_storage/volume.rb index 07b7d2c26..142c75b31 100644 --- a/lib/fog/hp/models/block_storage/volume.rb +++ b/lib/fog/hp/models/block_storage/volume.rb @@ -1,8 +1,8 @@ require 'fog/core/model' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Volume < Fog::Model diff --git a/lib/fog/hp/models/block_storage/volumes.rb b/lib/fog/hp/models/block_storage/volumes.rb index 26685e031..ed378f247 100644 --- a/lib/fog/hp/models/block_storage/volumes.rb +++ b/lib/fog/hp/models/block_storage/volumes.rb @@ -2,12 +2,12 @@ require 'fog/core/collection' require 'fog/hp/models/block_storage/volume' module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Volumes < Fog::Collection - model Fog::BlockStorage::HP::Volume + model Fog::HP::BlockStorage::Volume def all data = connection.list_volumes.body['volumes'] @@ -17,7 +17,7 @@ module Fog def get(volume_id) volume = connection.get_volume_details(volume_id).body['volume'] new(volume) - rescue Fog::BlockStorage::HP::NotFound + rescue Fog::HP::BlockStorage::NotFound nil end diff --git a/lib/fog/hp/requests/block_storage/create_snapshot.rb b/lib/fog/hp/requests/block_storage/create_snapshot.rb index 54772d312..428d32ce0 100644 --- a/lib/fog/hp/requests/block_storage/create_snapshot.rb +++ b/lib/fog/hp/requests/block_storage/create_snapshot.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Create a new block storage snapshot @@ -65,7 +65,7 @@ module Fog self.data[:snapshots][data['id']] = data response.body = { 'snapshot' => data } else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/create_volume.rb b/lib/fog/hp/requests/block_storage/create_volume.rb index 00d2a4217..b1a370e13 100644 --- a/lib/fog/hp/requests/block_storage/create_volume.rb +++ b/lib/fog/hp/requests/block_storage/create_volume.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Create a new block storage volume diff --git a/lib/fog/hp/requests/block_storage/delete_snapshot.rb b/lib/fog/hp/requests/block_storage/delete_snapshot.rb index 84eed9c82..3ff2c3b84 100644 --- a/lib/fog/hp/requests/block_storage/delete_snapshot.rb +++ b/lib/fog/hp/requests/block_storage/delete_snapshot.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Delete an existing block storage snapshot @@ -27,7 +27,7 @@ module Fog self.data[:snapshots].delete(snapshot_id) response.status = 202 else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/delete_volume.rb b/lib/fog/hp/requests/block_storage/delete_volume.rb index 4be3e6d23..cfc6d1476 100644 --- a/lib/fog/hp/requests/block_storage/delete_volume.rb +++ b/lib/fog/hp/requests/block_storage/delete_volume.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Delete an existing block storage volume @@ -27,7 +27,7 @@ module Fog self.data[:volumes].delete(volume_id) response.status = 202 else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end response end diff --git a/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb b/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb index 86ae19ce1..42271c0f9 100644 --- a/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb +++ b/lib/fog/hp/requests/block_storage/get_bootable_volume_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage bootable volume @@ -48,7 +48,7 @@ module Fog response.body = { 'volume' => volume } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/get_snapshot_details.rb b/lib/fog/hp/requests/block_storage/get_snapshot_details.rb index 647a88767..3bd236792 100644 --- a/lib/fog/hp/requests/block_storage/get_snapshot_details.rb +++ b/lib/fog/hp/requests/block_storage/get_snapshot_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage snapshot @@ -43,7 +43,7 @@ module Fog response.body = { 'snapshot' => snapshot } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/get_volume_details.rb b/lib/fog/hp/requests/block_storage/get_volume_details.rb index 219eb688f..9049642e1 100644 --- a/lib/fog/hp/requests/block_storage/get_volume_details.rb +++ b/lib/fog/hp/requests/block_storage/get_volume_details.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # Get details for existing block storage volume @@ -47,7 +47,7 @@ module Fog response.body = { 'volume' => volume } response else - raise Fog::BlockStorage::HP::NotFound + raise Fog::HP::BlockStorage::NotFound end end diff --git a/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb b/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb index ab21a10bb..699209880 100644 --- a/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb +++ b/lib/fog/hp/requests/block_storage/list_bootable_volumes.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage bootbale volumes diff --git a/lib/fog/hp/requests/block_storage/list_snapshots.rb b/lib/fog/hp/requests/block_storage/list_snapshots.rb index e2c594264..743d9cc83 100644 --- a/lib/fog/hp/requests/block_storage/list_snapshots.rb +++ b/lib/fog/hp/requests/block_storage/list_snapshots.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage snapshots diff --git a/lib/fog/hp/requests/block_storage/list_volumes.rb b/lib/fog/hp/requests/block_storage/list_volumes.rb index e17c45e9e..3ce4ecd40 100644 --- a/lib/fog/hp/requests/block_storage/list_volumes.rb +++ b/lib/fog/hp/requests/block_storage/list_volumes.rb @@ -1,6 +1,6 @@ module Fog - module BlockStorage - class HP + module HP + class BlockStorage class Real # List existing block storage volumes From a1d9580f48f223c879426de96f56729fab499631 Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Mon, 14 Jan 2013 17:52:16 -0500 Subject: [PATCH 2/2] Updated the tests to reflect the BlockStorage namespace changes. --- .../block_storage/bootable_volume_tests.rb | 8 ++-- .../hp/models/block_storage/snapshot_tests.rb | 10 ++--- tests/hp/models/block_storage/volume_tests.rb | 8 ++-- .../block_storage/bootable_volume_tests.rb | 22 +++++----- .../requests/block_storage/snapshot_tests.rb | 20 +++++----- .../hp/requests/block_storage/volume_tests.rb | 40 +++++++++---------- .../compute/persistent_server_tests.rb | 4 +- .../requests/compute/server_volume_tests.rb | 12 +++--- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/tests/hp/models/block_storage/bootable_volume_tests.rb b/tests/hp/models/block_storage/bootable_volume_tests.rb index 8b5a6bc78..10a5cde24 100644 --- a/tests/hp/models/block_storage/bootable_volume_tests.rb +++ b/tests/hp/models/block_storage/bootable_volume_tests.rb @@ -1,15 +1,15 @@ -Shindo.tests("Fog::BlockStorage[:hp] | bootable volumes", ['hp', 'block_storage', 'volumes']) do +Shindo.tests("HP::BlockStorage | bootable volumes", ['hp', 'block_storage', 'volumes']) do @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 - model_tests(Fog::BlockStorage[:hp].bootable_volumes, {:name => "fogbvoltests", :description => "fogbvoltests-desc", :size => 10, :image_id => @base_image_id}, true) + model_tests(HP[:block_storage].bootable_volumes, {:name => "fogbvoltests", :description => "fogbvoltests-desc", :size => 10, :image_id => @base_image_id}, true) tests("new volume") do - @volume = Fog::BlockStorage[:hp].bootable_volumes.create(:name => "testbvol", :size => 10, :image_id => @base_image_id) + @volume = HP[:block_storage].bootable_volumes.create(:name => "testbvol", :size => 10, :image_id => @base_image_id) @volume.wait_for { ready? } unless Fog.mocking? test("get(#{@volume.id})") do - Fog::BlockStorage[:hp].bootable_volumes.get(@volume.id) != nil? + HP[:block_storage].bootable_volumes.get(@volume.id) != nil? end test("has_attachments?") do diff --git a/tests/hp/models/block_storage/snapshot_tests.rb b/tests/hp/models/block_storage/snapshot_tests.rb index 563f6efc7..4b5935fcb 100644 --- a/tests/hp/models/block_storage/snapshot_tests.rb +++ b/tests/hp/models/block_storage/snapshot_tests.rb @@ -1,16 +1,16 @@ -Shindo.tests("Fog::BlockStorage[:hp] | snapshots", ['hp', 'block_storage', 'snapshots']) do +Shindo.tests("HP::BlockStorage | snapshots", ['hp', 'block_storage', 'snapshots']) do - @volume = Fog::BlockStorage[:hp].volumes.create(:name => "testsnapvol", :size => 1) + @volume = HP[:block_storage].volumes.create(:name => "testsnapvol", :size => 1) @volume.wait_for { ready? } unless Fog.mocking? - model_tests(Fog::BlockStorage[:hp].snapshots, {:name => "fogsnaptests", :description => "fogsnaptests-desc", :volume_id => @volume.id}, true) + model_tests(HP[:block_storage].snapshots, {:name => "fogsnaptests", :description => "fogsnaptests-desc", :volume_id => @volume.id}, true) tests("new snapshot") do - @snapshot = Fog::BlockStorage[:hp].snapshots.create(:name => "testvol", :volume_id => @volume.id) + @snapshot = HP[:block_storage].snapshots.create(:name => "testvol", :volume_id => @volume.id) @snapshot.wait_for { ready? } unless Fog.mocking? test("get(#{@snapshot.id})") do - Fog::BlockStorage[:hp].snapshots.get(@snapshot.id) != nil? + HP[:block_storage].snapshots.get(@snapshot.id) != nil? end after do diff --git a/tests/hp/models/block_storage/volume_tests.rb b/tests/hp/models/block_storage/volume_tests.rb index e52c1141c..cf934707c 100644 --- a/tests/hp/models/block_storage/volume_tests.rb +++ b/tests/hp/models/block_storage/volume_tests.rb @@ -1,13 +1,13 @@ -Shindo.tests("Fog::BlockStorage[:hp] | volumes", ['hp', 'block_storage']) do +Shindo.tests("HP::BlockStorage | volumes", ['hp', 'block_storage', 'volumes']) do - model_tests(Fog::BlockStorage[:hp].volumes, {:name => "fogvoltests", :description => "fogvoltests-desc", :size => 1}, true) + model_tests(HP[:block_storage].volumes, {:name => "fogvoltests", :description => "fogvoltests-desc", :size => 1}, true) tests("new volume") do - @volume = Fog::BlockStorage[:hp].volumes.create(:name => "testvol", :size => 1) + @volume = HP[:block_storage].volumes.create(:name => "testvol", :size => 1) @volume.wait_for { ready? } unless Fog.mocking? test("get(#{@volume.id})") do - Fog::BlockStorage[:hp].volumes.get(@volume.id) != nil? + HP[:block_storage].volumes.get(@volume.id) != nil? end test("has_attachments?") do diff --git a/tests/hp/requests/block_storage/bootable_volume_tests.rb b/tests/hp/requests/block_storage/bootable_volume_tests.rb index 5f4279154..81df3e139 100644 --- a/tests/hp/requests/block_storage/bootable_volume_tests.rb +++ b/tests/hp/requests/block_storage/bootable_volume_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Fog::BlockStorage[:hp] | bootable volume requests', ['hp', 'block_storage', 'volumes']) do +Shindo.tests("HP::BlockStorage | bootable volume requests", ['hp', 'block_storage', 'volumes']) do @volume_format = { 'status' => String, @@ -42,35 +42,35 @@ Shindo.tests('Fog::BlockStorage[:hp] | bootable volume requests', ['hp', 'block_ @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 tests("#create_volume(#{@volume_name}, #{@volume_desc}, 10, {'imageRef' => '#{@base_image_id}'})").formats(@volume_format) do - data = Fog::BlockStorage[:hp].create_volume(@volume_name, @volume_desc, 10, {'imageRef' => "#{@base_image_id}"}).body['volume'] + data = HP[:block_storage].create_volume(@volume_name, @volume_desc, 10, {'imageRef' => "#{@base_image_id}"}).body['volume'] @volume_id = data['id'] data end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#get_bootable_volume_details(#{@volume_id})").formats(@boot_volume_format) do - Fog::BlockStorage[:hp].get_bootable_volume_details(@volume_id).body['volume'] + HP[:block_storage].get_bootable_volume_details(@volume_id).body['volume'] end tests("#list_bootable_volumes").formats({'volumes' => [@boot_volume_format]}) do - Fog::BlockStorage[:hp].list_bootable_volumes.body + HP[:block_storage].list_bootable_volumes.body end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#delete_volume(#{@volume_id})").succeeds do - Fog::BlockStorage[:hp].delete_volume(@volume_id) + HP[:block_storage].delete_volume(@volume_id) end end tests('failure') do - tests("#get_bootable_volume_details(0)").raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].get_bootable_volume_details(0) + tests("#get_bootable_volume_details(0)").raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].get_bootable_volume_details(0) end - tests("#delete_volume(0)").raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].delete_volume(0) + tests("#delete_volume(0)").raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].delete_volume(0) end end diff --git a/tests/hp/requests/block_storage/snapshot_tests.rb b/tests/hp/requests/block_storage/snapshot_tests.rb index 672035d3e..851faf9d9 100644 --- a/tests/hp/requests/block_storage/snapshot_tests.rb +++ b/tests/hp/requests/block_storage/snapshot_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Fog::BlockStorage[:hp] | snapshot requests', ['hp', 'block_storage', 'snapshots']) do +Shindo.tests('HP::BlockStorage | snapshot requests', ['hp', 'block_storage', 'snapshots']) do @snapshot_format = { 'status' => String, @@ -16,37 +16,37 @@ Shindo.tests('Fog::BlockStorage[:hp] | snapshot requests', ['hp', 'block_storage @snapshot_name = "fogsnapshottests" @snapshot_desc = @snapshot_name + " desc" - @volume = Fog::BlockStorage[:hp].volumes.create(:name => 'fogvolforsnap', :size => 1) + @volume = HP[:block_storage].volumes.create(:name => 'fogvolforsnap', :size => 1) @volume.wait_for { ready? } tests("#create_snapshot(#{@snapshot_name}, #{@snapshot_desc}, #{@volume.id})").formats(@snapshot_format) do - data = Fog::BlockStorage[:hp].create_snapshot(@snapshot_name, @snapshot_desc, @volume.id).body['snapshot'] + data = HP[:block_storage].create_snapshot(@snapshot_name, @snapshot_desc, @volume.id).body['snapshot'] @snapshot_id = data['id'] data end tests("#get_snapshot_details(#{@snapshot_id})").formats(@snapshot_format) do - Fog::BlockStorage[:hp].get_snapshot_details(@snapshot_id).body['snapshot'] + HP[:block_storage].get_snapshot_details(@snapshot_id).body['snapshot'] end tests('#list_snapshots').formats({'snapshots' => [@snapshot_format]}) do - Fog::BlockStorage[:hp].list_snapshots.body + HP[:block_storage].list_snapshots.body end tests("#delete_snapshot(#{@snapshot_id})").succeeds do - Fog::BlockStorage[:hp].delete_snapshot(@snapshot_id) + HP[:block_storage].delete_snapshot(@snapshot_id) end end tests('failure') do - tests('#get_snapshot_details(0)').raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].get_snapshot_details(0) + tests('#get_snapshot_details(0)').raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].get_snapshot_details(0) end - tests("#delete_snapshot(0)").raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].delete_snapshot(0) + tests("#delete_snapshot(0)").raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].delete_snapshot(0) end end diff --git a/tests/hp/requests/block_storage/volume_tests.rb b/tests/hp/requests/block_storage/volume_tests.rb index 7bd2b0d37..9b5bbba91 100644 --- a/tests/hp/requests/block_storage/volume_tests.rb +++ b/tests/hp/requests/block_storage/volume_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Fog::BlockStorage[:hp] | volume requests', ['hp', 'block_storage', 'volumes']) do +Shindo.tests("HP::BlockStorage | volume requests", ['hp', 'block_storage', 'volumes']) do @volume_format = { 'status' => String, @@ -26,65 +26,65 @@ Shindo.tests('Fog::BlockStorage[:hp] | volume requests', ['hp', 'block_storage', @volume_desc = @volume_name + " desc" @base_image_id = ENV["BASE_IMAGE_ID"] || 1242 - @server = Fog::BlockStorage[:hp].compute.servers.create(:name => 'fogvoltests', :flavor_id => 100, :image_id => @base_image_id) + @server = HP[:block_storage].compute.servers.create(:name => 'fogvoltests', :flavor_id => 100, :image_id => @base_image_id) @server.wait_for { ready? } tests("#create_volume(#{@volume_name}, #{@volume_desc}, 1)").formats(@volume_format) do - data = Fog::BlockStorage[:hp].create_volume(@volume_name, @volume_desc, 1).body['volume'] + data = HP[:block_storage].create_volume(@volume_name, @volume_desc, 1).body['volume'] @volume_id = data['id'] data end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#get_volume_details(#{@volume_id})").formats(@volume_format) do - Fog::BlockStorage[:hp].get_volume_details(@volume_id).body['volume'] + HP[:block_storage].get_volume_details(@volume_id).body['volume'] end tests('#list_volumes').formats({'volumes' => [@volume_format]}) do - Fog::BlockStorage[:hp].list_volumes.body + HP[:block_storage].list_volumes.body end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#attach_volume(#{@server.id}, #{@volume_id}, '/dev/sdg')").formats(@volume_attach_format) do - Fog::BlockStorage[:hp].compute.attach_volume(@server.id, @volume_id, "/dev/sdg").body['volumeAttachment'] + HP[:block_storage].compute.attach_volume(@server.id, @volume_id, "/dev/sdg").body['volumeAttachment'] end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? + HP[:block_storage].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? tests("#detach_volume(#{@server.id}, #{@volume_id})").succeeds do - Fog::BlockStorage[:hp].compute.detach_volume(@server.id, @volume_id) + HP[:block_storage].compute.detach_volume(@server.id, @volume_id) end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#delete_volume(#{@volume_id})").succeeds do - Fog::BlockStorage[:hp].delete_volume(@volume_id) + HP[:block_storage].delete_volume(@volume_id) end end tests('failure') do - tests('#get_volume_details(0)').raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].get_volume_details(0) + tests('#get_volume_details(0)').raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].get_volume_details(0) end tests("#attach_volume(0, 0, '/dev/sdg')").raises(Fog::Compute::HP::NotFound) do - Fog::BlockStorage[:hp].compute.attach_volume(0, 0, "/dev/sdg") + HP[:block_storage].compute.attach_volume(0, 0, "/dev/sdg") end tests("#attach_volume(#{@server.id}, 0, '/dev/sdg')").raises(Fog::Compute::HP::NotFound) do pending if Fog.mocking? - Fog::BlockStorage[:hp].compute.attach_volume(@server.id, 0, "/dev/sdg") + HP[:block_storage].compute.attach_volume(@server.id, 0, "/dev/sdg") end tests("#detach_volume(0, 0)").raises(Fog::Compute::HP::NotFound) do - Fog::BlockStorage[:hp].compute.detach_volume(0, 0) + HP[:block_storage].compute.detach_volume(0, 0) end tests("#detach_volume(#{@server.id}, 0)").raises(Fog::Compute::HP::NotFound) do pending if Fog.mocking? - Fog::BlockStorage[:hp].compute.detach_volume(@server.id, 0) + HP[:block_storage].compute.detach_volume(@server.id, 0) end - tests("#delete_volume(0)").raises(Fog::BlockStorage::HP::NotFound) do - Fog::BlockStorage[:hp].delete_volume(0) + tests("#delete_volume(0)").raises(Fog::HP::BlockStorage::NotFound) do + HP[:block_storage].delete_volume(0) end end diff --git a/tests/hp/requests/compute/persistent_server_tests.rb b/tests/hp/requests/compute/persistent_server_tests.rb index 701c83e7e..c3c6e69f5 100644 --- a/tests/hp/requests/compute/persistent_server_tests.rb +++ b/tests/hp/requests/compute/persistent_server_tests.rb @@ -22,7 +22,7 @@ Shindo.tests('Fog::Compute[:hp] | persistent server requests', ['hp', 'compute'] 'key_name' => Fog::Nullable::String } - @volume = Fog::BlockStorage[:hp].volumes.create(:name => 'fogvoltests', :description => 'fog vol test desc', :size => 1) + @volume = HP[:block_storage].volumes.create(:name => 'fogvoltests', :description => 'fog vol test desc', :size => 1) @volume.wait_for { ready? } tests('success') do @@ -61,6 +61,6 @@ Shindo.tests('Fog::Compute[:hp] | persistent server requests', ['hp', 'compute'] end - Fog::BlockStorage[:hp].delete_volume(@volume.id) + HP[:block_storage].delete_volume(@volume.id) end diff --git a/tests/hp/requests/compute/server_volume_tests.rb b/tests/hp/requests/compute/server_volume_tests.rb index 9656832ba..1ba2fec8e 100644 --- a/tests/hp/requests/compute/server_volume_tests.rb +++ b/tests/hp/requests/compute/server_volume_tests.rb @@ -1,4 +1,4 @@ -Shindo.tests('Fog::Compute[:hp] | volume requests', ['hp', 'compute', 'block_storage']) do +Shindo.tests('Fog::Compute[:hp] | volume requests', ['hp', 'compute', 'volumes']) do @list_volume_attachments_format = { 'volumeAttachments' => [{ @@ -22,21 +22,21 @@ Shindo.tests('Fog::Compute[:hp] | volume requests', ['hp', 'compute', 'block_sto @server.wait_for { ready? } tests('success') do - response = Fog::BlockStorage[:hp].create_volume('fogvoltest', 'fogvoltest desc', 1) + response = HP[:block_storage].create_volume('fogvoltest', 'fogvoltest desc', 1) @volume_id = response.body['volume']['id'] @device = "\/dev\/sdf" - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#attach_volume(#{@server.id}, #{@volume_id}, #{@device}").formats(@volume_attachment_format) do Fog::Compute[:hp].attach_volume(@server.id, @volume_id, @device).body end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? + HP[:block_storage].volumes.get(@volume_id).wait_for { in_use? } unless Fog.mocking? tests("#detach_volume(#{@server.id}, #{@volume_id}").succeeds do Fog::Compute[:hp].detach_volume(@server.id, @volume_id) end - Fog::BlockStorage[:hp].volumes.get(@volume_id).wait_for { ready? } + HP[:block_storage].volumes.get(@volume_id).wait_for { ready? } tests("#list_server_volumes(#{@server.id})").formats(@list_volume_attachments_format) do Fog::Compute[:hp].list_server_volumes(@server.id).body end @@ -70,7 +70,7 @@ Shindo.tests('Fog::Compute[:hp] | volume requests', ['hp', 'compute', 'block_sto end - Fog::BlockStorage[:hp].delete_volume(@volume_id) + HP[:block_storage].delete_volume(@volume_id) Fog::Compute[:hp].delete_server(@server.id) end