Class: OneviewSDK::API500::C7000::ServerProfileTemplate

Inherits:
OneviewSDK::API300::C7000::ServerProfileTemplate show all
Defined in:
lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb

Overview

Server Profile Template resource implementation on API500 C7000

Constant Summary

Constants inherited from OneviewSDK::API200::ServerProfileTemplate

OneviewSDK::API200::ServerProfileTemplate::BASE_URI

Constants inherited from Resource

Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

Methods inherited from OneviewSDK::API300::C7000::ServerProfileTemplate

#get_transformation

Methods inherited from OneviewSDK::API200::ServerProfileTemplate

#add_volume_attachment, #get_available_hardware, #new_profile, #remove_volume_attachment, #set_enclosure_group, #set_firmware_driver, #set_server_hardware_type

Methods inherited from Resource

#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update

Constructor Details

#initialize(client, params = {}, api_ver = nil) ⇒ ServerProfileTemplate

Create a resource object, associate it with a client, and set its properties.

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • params (Hash) (defaults to: {})

    The options for this resource (key-value pairs)

  • api_ver (Integer) (defaults to: nil)

    The api version to use when interracting with this resource.



24
25
26
27
28
29
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 24

def initialize(client, params = {}, api_ver = nil)
  @data ||= {}
  # Default values
  @data['type'] ||= 'ServerProfileTemplateV3'
  super
end

Instance Method Details

#add_connection(network, connection_options = {}) ⇒ Object

Adds a connection entry to server profile template

Parameters:

  • network (OneviewSDK::EthernetNetwork, OneviewSDK::FCNetwork)

    Network associated with the connection

  • connection_options (Hash<String,String>) (defaults to: {})

    Hash containing the configuration of the connection

Options Hash (connection_options):

  • 'boot' (Boolean)

    Indicates that the server will attempt to boot from this connection.

  • 'functionType' (String)

    Type of function required for the connection. Values: Ethernet, FibreChannel, iSCSI.

  • 'id' (Integer)

    A unique identifier for this connection. If 0, id is automatically assigned.

  • 'ipv4' (String)

    The IP information for a connection. This is only used for iSCSI connections.

  • 'name' (String)

    Name of the connection.

  • 'portId' (String)

    Identifies the port (FlexNIC) used for this connection.

  • 'requestedMbps' (String)

    The transmit throughput (mbps) that should be allocated to this connection.

  • 'requestedVFs' (String)

    This value can be “Auto” or 0.



42
43
44
45
46
47
48
49
50
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 42

def add_connection(network, connection_options = {})
  connection_options = Hash[connection_options.map { |k, v| [k.to_s, v] }]
  self['connectionSettings'] = {} unless self['connectionSettings']
  self['connectionSettings']['connections'] = [] unless self['connectionSettings']['connections']
  self['connectionSettings']['manageConnections'] = true
  connection_options['id'] ||= 0
  connection_options['networkUri'] = network['uri'] if network['uri'] || network.retrieve!
  self['connectionSettings']['connections'] << connection_options
end

#create_volume_with_attachment(storage_pool, volume_options, attachment_options = {}) ⇒ Object

Adds a volume attachment entry with new volume in Server profile template

Parameters:

  • storage_pool (OneviewSDK::storage_pool)

    Storage Pool Resource to add an attachment

  • volume_options (Hash)

    Options to create a new Volume.

  • attachment_options (Hash) (defaults to: {})

    Options of the new attachment

Options Hash (volume_options):

  • 'volumeName' (String)

    The name of the volume.

  • 'volumeDescription' (String)

    The description of the storage volume.

  • 'volumeProvisionType' (String)

    The provisioning type of the new volume: Thin“, ”Full“, or ”Thin Deduplication“.

  • 'volumeProvisionedCapacityBytes' (Integer)

    The requested provisioned capacity of the storage volume in bytes.

Options Hash (attachment_options):

  • 'associatedTemplateAttachmentId' (String)

    Uniquely identifying of a volume attachment in a template.

  • 'dataProtectionLevel' (String)

    Values specific to a StoreVirtual storage.

  • 'id' (Integer)

    The ID of the storage volume attachment.

  • 'isBootVolume' (Boolean)

    Identifies whether the volume will be used as a boot volume.

  • 'lun' (String)

    Logical Unit Number.

  • 'lunType' (String)

    Type of the LUN. Values: Manual or Auto.

  • 'storagePaths' (Array)

    A list of host-to-target path associations.

Returns:

  • Returns the connection hash if found, otherwise returns nil

Raises:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 80

def create_volume_with_attachment(storage_pool, volume_options, attachment_options = {})
  raise IncompleteResource, 'Storage Pool not found!' unless storage_pool.retrieve!
  # Convert symbols keys to string in volume_options and attachment_options
  volume_options = Hash[volume_options.map { |k, v| [k.to_s, v] }]
  attachment_options = Hash[attachment_options.map { |k, v| [k.to_s, v] }]

  self['sanStorage'] ||= {}
  self['sanStorage']['volumeAttachments'] ||= []

  attachment_options['id'] ||= 0
  attachment_options['volumeStoragePoolUri'] = storage_pool['uri']
  attachment_options['volumeStorageSystemUri'] = storage_pool['storageSystemUri']
  attachment_options['volumeName'] = volume_options['name']
  attachment_options['volumeDescription'] = volume_options['description']
  attachment_options['volumeProvisionType'] = volume_options['provisioningType']
  attachment_options['volumeProvisionedCapacityBytes'] = volume_options['size']

  # Defaults
  attachment_options['volumeUri'] = nil
  attachment_options['permanent'] ||= true
  attachment_options['volumeShareable'] = false
  self['sanStorage']['manageSanStorage'] ||= true

  self['sanStorage']['volumeAttachments'] << attachment_options
end

#remove_connection(connection_name) ⇒ Object

Removes a connection entry in server profile template

Parameters:

  • connection_name (String)

    Name of the connection

Returns:

  • Returns the connection hash if found, otherwise returns nil



55
56
57
58
59
60
61
62
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 55

def remove_connection(connection_name)
  desired_connection = nil
  return desired_connection unless self['connectionSettings']['connections']
  self['connectionSettings']['connections'].each do |con|
    desired_connection = self['connectionSettings']['connections'].delete(con) if con['name'] == connection_name
  end
  desired_connection
end