mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #15 from SDK-CLI-Docs/feature/230_fix_block_namespace
Feature/230 fix block namespace
This commit is contained in:
commit
c978d4c60d
26 changed files with 111 additions and 137 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Snapshot < Fog::Model
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'fog/core/model'
|
||||
|
||||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
|
||||
class Volume < Fog::Model
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# Create a new block storage volume
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage bootbale volumes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage snapshots
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module BlockStorage
|
||||
class HP
|
||||
module HP
|
||||
class BlockStorage
|
||||
class Real
|
||||
|
||||
# List existing block storage volumes
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue