Class: VagrantPlugins::Libvirt::Action::SuspendDomain
- Inherits:
-
Object
- Object
- VagrantPlugins::Libvirt::Action::SuspendDomain
- Defined in:
- lib/vagrant-libvirt/action/suspend_domain.rb
Overview
Suspend domain.
Instance Method Summary collapse
-
#call(env) ⇒ Object
make pause.
-
#initialize(app, env) ⇒ SuspendDomain
constructor
A new instance of SuspendDomain.
Constructor Details
#initialize(app, env) ⇒ SuspendDomain
Returns a new instance of SuspendDomain.
8 9 10 11 |
# File 'lib/vagrant-libvirt/action/suspend_domain.rb', line 8 def initialize(app, env) @logger = Log4r::Logger.new("vagrant_libvirt::action::suspend_domain") @app = app end |
Instance Method Details
#call(env) ⇒ Object
make pause
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vagrant-libvirt/action/suspend_domain.rb', line 14 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 |