Class: VagrantPlugins::VMM::Action::SuspendVM

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vmm/action/suspend_vm.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SuspendVM



5
6
7
# File 'lib/vagrant-vmm/action/suspend_vm.rb', line 5

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-vmm/action/suspend_vm.rb', line 9

def call(env)
  vmm_server_address = env[:machine].provider_config.vmm_server_address
  # generate options
  options = {
    vmm_server_address: vmm_server_address,
    proxy_server_address: env[:machine].provider_config.proxy_server_address
  }
  env[:ui].info("Suspending the machine...")
  env[:machine].provider.driver.suspend(options)
  env[:machine].provider.reset_state

  @app.call(env)
end