Class: Kitchen::Driver::Oci::Models::Iscsi

Inherits:
Blockstorage show all
Defined in:
lib/kitchen/driver/oci/models/iscsi.rb

Overview

iSCSI volume model.

Author:

  • Justin Steele <justin.steele@oracle.com>

Instance Attribute Summary collapse

Attributes inherited from Blockstorage

#api, #config, #logger, #oci, #state, #volume_attachment_state, #volume_state

Instance Method Summary collapse

Methods inherited from Blockstorage

#attach_volume, #create_clone_volume, #create_volume, #delete_volume, #detatch_volume, #final_state

Methods inherited from Kitchen::Driver::Oci

#create, #destroy, #finalize_config!, validation_error

Methods included from Kitchen::Driver::Oci::Mixin::Volumes

#create_and_attach_volumes, #create_volume, #detatch_and_delete_volumes, #process_volumes

Methods included from Kitchen::Driver::Oci::Mixin::Models

#instance_class, #volume_class

Methods included from Kitchen::Driver::Oci::Mixin::Actions

#are_legacy_imds_endpoints_disbled?, #auth, #execute_post_create_file, #execute_post_create_script, #execute_post_create_string, #instance_options, #instance_options?, #launch, #reboot, #terminate

Constructor Details

#initialize(opts = {}) ⇒ Iscsi

Returns a new instance of Iscsi.



28
29
30
31
# File 'lib/kitchen/driver/oci/models/iscsi.rb', line 28

def initialize(opts = {})
  super
  @attachment_type = "iscsi"
end

Instance Attribute Details

#attachment_typeString (readonly)

The type of attachment being created.

Returns:

  • (String)


36
37
38
# File 'lib/kitchen/driver/oci/models/iscsi.rb', line 36

def attachment_type
  @attachment_type
end

Instance Method Details

#attachment_details(volume_details, server_id, volume_config) ⇒ OCI::Core::Models::AttachIScsiVolumeDetails

Creates the attachment details for an iSCSI volume.

Parameters:

  • volume_details (OCI::Core::Models::Volume)
  • server_id (String)

    the ocid of the compute instance to which the volume will be attached.

  • volume_config (Hash)

    the state of the current volume being processed as specified in the kitchen.yml.

Returns:

  • (OCI::Core::Models::AttachIScsiVolumeDetails)


44
45
46
47
48
49
50
51
52
# File 'lib/kitchen/driver/oci/models/iscsi.rb', line 44

def attachment_details(volume_details, server_id, volume_config)
  device = volume_config[:device] unless server_os(server_id).downcase =~ /windows/
  OCI::Core::Models::AttachIScsiVolumeDetails.new(
    display_name: "#{attachment_type}-#{volume_details.display_name}",
    volume_id: volume_details.id,
    instance_id: server_id,
    device: device
  )
end

#final_volume_attachment_state(response) ⇒ Hash

Adds the volume attachment info into the state.

Parameters:

  • response (OCI::Core::Models::VolumeAttachment)

Returns:

  • (Hash)


58
59
60
61
62
63
64
65
# File 'lib/kitchen/driver/oci/models/iscsi.rb', line 58

def final_volume_attachment_state(response)
  volume_attachment_state.store(:id, response.id)
  volume_attachment_state.store(:display_name, response.display_name)
  volume_attachment_state.store(:iqn_ipv4, response.ipv4)
  volume_attachment_state.store(:iqn, response.iqn)
  volume_attachment_state.store(:port, response.port)
  volume_attachment_state
end