class OneviewSDK::API500::C7000::StoragePool

Storage pool resource implementation for API500 C7000

Constants

BASE_URI
UNIQUE_IDENTIFIERS

Public Class Methods

new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 26
def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['type'] ||= 'StoragePoolV3'
end
reachable(client, networks = []) click to toggle source

Gets the storage pools that are connected on the specified networks based on the storage system port's expected network connectivity. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Array<Resource>] networks The list of networks with URI to be used as a filter @return [Array<OneviewSDK::StoragePool>] the list of storage pools

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 78
def self.reachable(client, networks = [])
  uri = self::BASE_URI + '/reachable-storage-pools'
  unless networks.empty?
    network_uris = networks.map { |item| item['uri'] }
    uri += "?networks='#{network_uris.join(',')}'"
  end
  find_with_pagination(client, uri)
end

Public Instance Methods

create(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 34
def create(*)
  unavailable_method
end
create!(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 40
def create!(*)
  unavailable_method
end
delete(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 46
def delete(*)
  unavailable_method
end
exists?() click to toggle source

Check if a resource exists @note name or uri must be specified inside resource @return [Boolean] Whether or not resource exists

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 69
def exists?
  temp = self.class.new(@client, data)
  temp.retrieve!
end
manage(be_managed) click to toggle source

To manage/unmanage a storage pool @param [Boolean] be_managed Set true to manage or false to unmanage @note Storage Pool that belongs to Storage System with family StoreVirtual can't be changed to unmanaged

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 90
def manage(be_managed)
  if !be_managed && self['family'] == 'StoreVirtual'
    raise ArgumentError, 'Attempting to unmanage a StoreVirtual pool is not allowed'
  end
  self['isManaged'] = be_managed
  update
  refresh
end
request_refresh() click to toggle source

To request a refresh of a storage pool

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 100
def request_refresh
  self['requestingRefresh'] = true
  update
  refresh
end
retrieve!() click to toggle source

Retrieve resource details based on this resource's name or URI. @note Name or URI must be specified inside the resource @return [Boolean] Whether or not retrieve was successful

Calls superclass method OneviewSDK::Resource#retrieve!
# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 53
def retrieve!
  return super if @data['uri']
  unless @data['name'] && @data['storageSystemUri']
    raise IncompleteResource, 'Must set resource name and storageSystemUri, or uri, before trying to retrieve!'
  end
  results = self.class.find_by(@client, name: @data['name'], storageSystemUri: @data['storageSystemUri'])
  if results.size == 1
    set_all(results[0].data)
    return true
  end
  false
end
set_storage_system(storage_system) click to toggle source

Sets the storage system @param [OneviewSDK::StorageSystem] storage_system @raise [OneviewSDK::IncompleteResource] if Storage System not found

# File lib/oneview-sdk/resource/api500/c7000/storage_pool.rb, line 109
def set_storage_system(storage_system)
  raise 'Storage System could not be found!' unless storage_system.retrieve!
  set('storageSystemUri', storage_system['uri'])
end