Class: VagrantPlugins::VCloud::Action::Suspend

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vcloud/action/suspend.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Suspend

Returns a new instance of Suspend.



5
6
7
8
# File 'lib/vagrant-vcloud/action/suspend.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant_vcloud::action::suspend')
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  cfg = env[:machine].provider_config
  cnx = cfg.vcloud_cnx.driver

  vm_id = env[:machine].id

  env[:ui].info('Suspending VM...')
  task_id = cnx.suspend_vm(vm_id)
  cnx.wait_task_completion(task_id)

  @app.call env
end