Sha256: 1c8f235ae1fd3f2000f5a1a827184dce5969e5f29dee669b2d0cd77168c932bc

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

#
# Author:: Justin Steele (<justin.steele@oracle.com>)
#
# Copyright (C) 2024, Stephen Pearson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Kitchen
  module Driver
    class Oci
      module Models
        # iscsi volume attachment model
        class Iscsi < Blockstorage
          def initialize(config, state, oci, api)
            super
            @attachment_type = "iscsi"
          end

          #
          # The type of attachment being created
          #
          # @return [String]
          #
          attr_reader :attachment_type

          def attachment_details(volume_details, server_id)
            OCI::Core::Models::AttachIScsiVolumeDetails.new(
              display_name: "#{attachment_type}-#{volume_details.display_name}",
              volume_id: volume_details.id,
              instance_id: server_id
            )
          end

          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
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kitchen-oci-1.21.0 lib/kitchen/driver/oci/models/iscsi.rb
kitchen-oci-1.20.0 lib/kitchen/driver/oci/models/iscsi.rb
kitchen-oci-1.19.0 lib/kitchen/driver/oci/models/iscsi.rb
kitchen-oci-1.18.1 lib/kitchen/driver/oci/models/iscsi.rb
kitchen-oci-1.18.0 lib/kitchen/driver/oci/models/iscsi.rb
kitchen-oci-1.17.0 lib/kitchen/driver/oci/models/iscsi.rb