Sha256: ab943d839db918e24d278bef9b9586ea638eaef654a64a6444b7ab8049de7338

Contents?: true

Size: 828 Bytes

Versions: 3

Compression:

Stored size: 828 Bytes

Contents

module Uricp::Strategy
  class RbdCachedPut
    include Uricp::Strategy::Common
    include Uricp::Strategy::CacheCommon

    def appropriate?
      return proposal if to.scheme == 'rbd' &&
        rbd_snapshot_spec?(from) && 
        rbd_cache_name.nil? &&
        !rbd_sequence_complete?

      debug "#{self.class.name}: not appropriate"
      false
    end

    def command
      "rbd clone --id #{rbd_id} '#{rbd_image_spec(from)}' '#{rbd_image_spec(to)}';"
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options['from_uri'] = to
      if options['rbd_cache_target']
        @proposed_options['to_uri'] = options['rbd_cache_target']
        @proposed_options['rbd_cache_name'] = rbd_image_spec(to)
        @proposed_options.delete('rbd_cache_target')
      end
      self
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/strategy/rbd_cached_put.rb
uricp-0.0.23 lib/uricp/strategy/rbd_cached_put.rb
uricp-0.0.22 lib/uricp/strategy/rbd_cached_put.rb