Method: OneviewSDK::API500::C7000::Volume#add

Defined in:
lib/oneview-sdk/resource/api500/c7000/volume.rb

#addOneviewSDK::Volume

Note:

Volumes can be added only on the storage system and storage pools managed by the appliance.

Initiates a process to import a volume (created external to OneView) for management by the appliance.

Returns:

  • The volume imported.

Raises:

  • if the client is not set or required attributes are missing



151
152
153
154
155
156
157
158
159
# File 'lib/oneview-sdk/resource/api500/c7000/volume.rb', line 151

def add
  ensure_client
  required_attributes = %w[deviceVolumeName isShareable storageSystemUri]
  required_attributes.each { |k| raise IncompleteResource, "Missing required attribute: '#{k}'" unless @data.key?(k) || @data.key?(k.to_sym) }
  @data['name'] ||= @data['deviceVolumeName']
  response = @client.rest_post("#{BASE_URI}/from-existing", { 'body' => @data }, @api_version)
  set_all(client.response_handler(response))
  self
end