class OneviewSDK::API500::C7000::ServerProfileTemplate

Server Profile Template resource implementation on API500 C7000

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.

# 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

Public Instance Methods

add_connection(network, connection_options = {}) click to toggle source

Adds a connection entry to server profile template @param [OneviewSDK::EthernetNetwork, OneviewSDK::FCNetwork] network Network associated with the connection @param [Hash<String,String>] connection_options Hash containing the configuration of the connection @option connection_options [Boolean] 'boot' Indicates that the server will attempt to boot from this connection. @option connection_options [String] 'functionType' Type of function required for the connection. Values: Ethernet, FibreChannel, iSCSI. @option connection_options [Integer] 'id' A unique identifier for this connection. If 0, id is automatically assigned. @option connection_options [String] 'ipv4' The IP information for a connection. This is only used for iSCSI connections. @option connection_options [String] 'name' Name of the connection. @option connection_options [String] 'portId' Identifies the port (FlexNIC) used for this connection. @option connection_options [String] 'requestedMbps' The transmit throughput (mbps) that should be allocated to this connection. @option connection_options [String] 'requestedVFs' This value can be “Auto” or 0.

# 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 = {}) click to toggle source

Adds a volume attachment entry with new volume in Server profile template @param [OneviewSDK::storage_pool] storage_pool Storage Pool Resource to add an attachment @param [Hash] volume_options Options to create a new Volume. @option volume_options [String] 'volumeName' The name of the volume. @option volume_options [String] 'volumeDescription' The description of the storage volume. @option volume_options [String] 'volumeProvisionType' The provisioning type of the new volume: Thin“, ”Full“, or ”Thin Deduplication“. @option volume_options [Integer] 'volumeProvisionedCapacityBytes' The requested provisioned capacity of the storage volume in bytes. @param [Hash] attachment_options Options of the new attachment @option attachment_options [String] 'associatedTemplateAttachmentId' Uniquely identifying of a volume attachment in a template. @option attachment_options [String] 'dataProtectionLevel' Values specific to a StoreVirtual storage. @option attachment_options [Integer] 'id' The ID of the storage volume attachment. @option attachment_options [Boolean] 'isBootVolume' Identifies whether the volume will be used as a boot volume. @option attachment_options [String] 'lun' Logical Unit Number. @option attachment_options [String] 'lunType' Type of the LUN. Values: Manual or Auto. @option attachment_options [Array] 'storagePaths' A list of host-to-target path associations. @return Returns the connection hash if found, otherwise returns nil

# 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) click to toggle source

Removes a connection entry in server profile template @param [String] connection_name Name of the connection @return Returns the connection hash if found, otherwise returns nil

# 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