Sha256: 1ffa4e4c9dfb95ddacfabf1a67fde0d8b9fdd682f4b7160e984369b91744b86b

Contents?: true

Size: 676 Bytes

Versions: 5

Compression:

Stored size: 676 Bytes

Contents

require 'log4r'

module VagrantPlugins
  module Libvirt
    module Action
      # Suspend domain.
      class SuspendDomain
        def initialize(app, env)
          @logger = Log4r::Logger.new("vagrant_libvirt::action::suspend_domain")
          @app = app
        end

        # make pause
        def call(env)
          env[:ui].info(I18n.t("vagrant_libvirt.suspending_domain"))

          domain = env[:libvirt_compute].servers.get(env[:machine].id.to_s)
          raise Errors::NoDomainError if domain == nil

          domain.suspend
          @logger.info("Machine #{env[:machine].id} is suspended ")

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-libvirt-0.0.6 lib/vagrant-libvirt/action/suspend_domain.rb
vagrant-libvirt-0.0.5 lib/vagrant-libvirt/action/suspend_domain.rb
vagrant-libvirt-0.0.4 lib/vagrant-libvirt/action/suspend_domain.rb
vagrant-libvirt-0.0.3 lib/vagrant-libvirt/action/suspend_domain.rb
vagrant-libvirt-0.0.2 lib/vagrant-libvirt/action/suspend_domain.rb