Class: OneviewSDK::API500::C7000::StorageSystem
- Inherits:
-
OneviewSDK::API300::C7000::StorageSystem
- Object
- Resource
- OneviewSDK::API200::Resource
- OneviewSDK::API200::StorageSystem
- OneviewSDK::API300::C7000::StorageSystem
- OneviewSDK::API500::C7000::StorageSystem
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/storage_system.rb
Overview
Storage System resource implementation for API500 C7000
Direct Known Subclasses
Synergy::StorageSystem, OneviewSDK::API600::C7000::StorageSystem
Constant Summary collapse
- UNIQUE_IDENTIFIERS =
deviceSpecificAttributes and deviceSpecificAttributes are supported too
%w[name uri hostname].freeze
Constants inherited from OneviewSDK::API200::StorageSystem
OneviewSDK::API200::StorageSystem::BASE_URI
Constants inherited from Resource
Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add ⇒ OneviewSDK::StorageSystem
Adds the resource to OneView using the current data.
-
#exists? ⇒ Boolean
Checks if the resource already exists.
-
#get_managed_ports ⇒ Object
Method is unavailable.
-
#get_reachable_ports(networks = []) ⇒ Array
Gets the storage ports that are connected on the specified networks based on the storage system port’s expected network connectivity.
-
#get_templates ⇒ Array
Gets a list of storage templates.
-
#initialize(client, params = {}, api_ver = nil) ⇒ StorageSystem
constructor
Create a resource object, associate it with a client, and set its properties.
-
#remove ⇒ true
Delete resource from OneView.
-
#request_refresh ⇒ Object
Refreshes a storage system.
-
#retrieve! ⇒ Boolean
Retrieves the resource details based on this resource’s unique identifiers.
-
#set_refresh_state ⇒ Object
Method is unavailable.
-
#update(attributes = {}) ⇒ Resource
Set data and save to OneView.
Methods inherited from OneviewSDK::API200::StorageSystem
#create, #create!, #delete, get_host_types, #get_storage_pools, #like?
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #schema, schema, #set, #set_all, #to_file
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ StorageSystem
Create a resource object, associate it with a client, and set its properties.
26 27 28 29 30 31 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 26 def initialize(client, params = {}, api_ver = nil) # Default values: @data ||= {} @data['type'] ||= 'StorageSystemV4' super end |
Instance Method Details
#add ⇒ OneviewSDK::StorageSystem
Calls the refresh method to set additional data
Adds the resource to OneView using the current data
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 48 def add ensure_client temp_old_data = JSON.parse(@data.to_json) credentials = temp_old_data['credentials'] || {} request_body = { 'family' => @data['family'], 'hostname' => @data['hostname'], 'username' => @data.delete('username') || credentials['username'], 'password' => @data.delete('password') || credentials['password'] } response = @client.rest_post(self.class::BASE_URI, { 'body' => request_body }, @api_version) response_body = @client.response_handler(response) set_all(response_body) managed_domain = temp_old_data['deviceSpecificAttributes']['managedDomain'] rescue nil if self['family'] == 'StoreServ' && managed_domain deep_merge!(temp_old_data) update end self end |
#exists? ⇒ Boolean
Checks if the resource already exists
95 96 97 98 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 95 def exists? temp_item = self.class.new(@client, @data.clone) temp_item.retrieve! end |
#get_managed_ports ⇒ Object
Method is unavailable
35 36 37 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 35 def get_managed_ports(*) unavailable_method end |
#get_reachable_ports(networks = []) ⇒ Array
Gets the storage ports that are connected on the specified networks based on the storage system port’s expected network connectivity
129 130 131 132 133 134 135 136 137 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 129 def get_reachable_ports(networks = []) ensure_client && ensure_uri uri = @data['uri'] + '/reachable-ports' unless networks.empty? network_uris = ensure_and_get_uris(networks) uri += "?networks='#{network_uris.join(',')}'" end self.class.find_with_pagination(@client, uri) end |
#get_templates ⇒ Array
Gets a list of storage templates.
141 142 143 144 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 141 def get_templates ensure_client && ensure_uri self.class.find_with_pagination(@client, @data['uri'] + '/templates') end |
#remove ⇒ true
Delete resource from OneView
85 86 87 88 89 90 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 85 def remove ensure_client && ensure_uri response = @client.rest_delete(@data['uri'], { 'If-Match' => @data['eTag'] }, @api_version) @client.response_handler(response) true end |
#request_refresh ⇒ Object
Refreshes a storage system
147 148 149 150 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 147 def request_refresh @data['requestingRefresh'] = true update end |
#retrieve! ⇒ Boolean
one of the UNIQUE_IDENTIFIERS, deviceSpecificAttributes or deviceSpecificAttributes must be specified in the resource
Retrieves the resource details based on this resource’s unique identifiers
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 105 def retrieve! data_temp = JSON.parse(@data.to_json) serial_number = data_temp['deviceSpecificAttributes']['serialNumber'] rescue nil wwn = data_temp['deviceSpecificAttributes']['wwn'] rescue nil proc_retrieve_temp = proc do |identifier| results = self.class.find_by(@client, identifier) if results.size == 1 set_all(results.first.data) return true end end proc_retrieve_temp.call('deviceSpecificAttributes' => { 'serialNumber' => serial_number }) if serial_number proc_retrieve_temp.call('deviceSpecificAttributes' => { 'wwn' => wwn }) if wwn super rescue IncompleteResource => e raise e unless serial_number || wwn false end |
#set_refresh_state ⇒ Object
Method is unavailable
41 42 43 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 41 def set_refresh_state(*) unavailable_method end |
#update(attributes = {}) ⇒ Resource
Set data and save to OneView
75 76 77 78 79 80 81 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 75 def update(attributes = {}) set_all(attributes) ensure_client && ensure_uri response = @client.rest_put(@data['uri'] + '/?force=true', { 'body' => @data }, @api_version) @client.response_handler(response) self end |