Module: Kitchen::Driver::Oci::Volumes
- Included in:
- Kitchen::Driver::Oci
- Defined in:
- lib/kitchen/driver/oci/volumes.rb
Overview
mixin for working with volumes and attachments
Instance Method Summary collapse
- #create_and_attach_volumes(config, state, oci, api) ⇒ Object
- #create_volume(vol, volume) ⇒ Object
- #process_volumes(config, state, oci, api) ⇒ Object
Instance Method Details
#create_and_attach_volumes(config, state, oci, api) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/kitchen/driver/oci/volumes.rb', line 25 def create_and_attach_volumes(config, state, oci, api) return if config[:volumes].empty? volume_state = process_volumes(config, state, oci, api) state.merge!(volume_state) end |
#create_volume(vol, volume) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/kitchen/driver/oci/volumes.rb', line 44 def create_volume(vol, volume) if volume.key?(:volume_id) vol.create_clone_volume(volume) else vol.create_volume(volume) end end |
#process_volumes(config, state, oci, api) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kitchen/driver/oci/volumes.rb', line 32 def process_volumes(config, state, oci, api) volume_state = { volumes: [], volume_attachments: [] } config[:volumes].each do |volume| vol = volume_class(volume[:type], config, state, oci, api) volume_details, vol_state = create_volume(vol, volume) attach_state = vol.attach_volume(volume_details, state[:server_id], volume) volume_state[:volumes] << vol_state volume_state[:volume_attachments] << attach_state end volume_state end |