Class: OneviewSDK::API500::C7000::StoragePool
- Inherits:
-
Resource
- Object
- Resource
- OneviewSDK::API300::C7000::Resource
- Resource
- OneviewSDK::API500::C7000::StoragePool
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/storage_pool.rb
Overview
Storage pool resource implementation for API500 C7000
Direct Known Subclasses
Synergy::StoragePool, OneviewSDK::API600::C7000::StoragePool
Constant Summary collapse
- BASE_URI =
'/rest/storage-pools'.freeze
- UNIQUE_IDENTIFIERS =
%w[uri].freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.reachable(client, networks = []) ⇒ Array<OneviewSDK::StoragePool>
Gets the storage pools that are connected on the specified networks based on the storage system port’s expected network connectivity.
Instance Method Summary collapse
-
#create ⇒ Object
Method is not available.
-
#create! ⇒ Object
Method is not available.
-
#delete ⇒ Object
Method is not available.
-
#exists? ⇒ Boolean
Check if a resource exists.
-
#initialize(client, params = {}, api_ver = nil) ⇒ StoragePool
constructor
Create a resource object, associate it with a client, and set its properties.
-
#manage(be_managed) ⇒ Object
To manage/unmanage a storage pool.
-
#request_refresh ⇒ Object
To request a refresh of a storage pool.
-
#retrieve! ⇒ Boolean
Retrieve resource details based on this resource’s name or URI.
-
#set_storage_system(storage_system) ⇒ Object
Sets the storage system.
Methods inherited from Resource
#==, #[], #[]=, build_query, #deep_merge!, #each, #eql?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ StoragePool
Create a resource object, associate it with a client, and set its properties.
26 27 28 29 30 |
# 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 |
Class Method Details
.reachable(client, networks = []) ⇒ Array<OneviewSDK::StoragePool>
Gets the storage pools that are connected on the specified networks based on the storage system port’s expected network connectivity.
78 79 80 81 82 83 84 85 |
# 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 |
Instance Method Details
#create ⇒ Object
Method is not available
34 35 36 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_pool.rb', line 34 def create(*) unavailable_method end |
#create! ⇒ Object
Method is not available
40 41 42 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_pool.rb', line 40 def create!(*) unavailable_method end |
#delete ⇒ Object
Method is not available
46 47 48 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_pool.rb', line 46 def delete(*) unavailable_method end |
#exists? ⇒ Boolean
name or uri must be specified inside resource
Check if a resource exists
69 70 71 72 |
# 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) ⇒ Object
Storage Pool that belongs to Storage System with family StoreVirtual can’t be changed to unmanaged
To manage/unmanage a storage pool
90 91 92 93 94 95 96 97 |
# 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 ⇒ Object
To request a refresh of a storage pool
100 101 102 103 104 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_pool.rb', line 100 def request_refresh self['requestingRefresh'] = true update refresh end |
#retrieve! ⇒ Boolean
Name or URI must be specified inside the resource
Retrieve resource details based on this resource’s name or URI.
53 54 55 56 57 58 59 60 61 62 63 64 |
# 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) ⇒ Object
Sets the storage system
109 110 111 112 |
# 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 |