Class: VagrantPlugins::OVirtProvider::Action::SnapshotSave

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-ovirt4/action/snapshot_save.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ SnapshotSave

Returns a new instance of SnapshotSave.



7
8
9
10
# File 'lib/vagrant-ovirt4/action/snapshot_save.rb', line 7

def initialize(app, env)
  @logger = Log4r::Logger.new("vagrant_ovirt4::action::snapshot_save")
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-ovirt4/action/snapshot_save.rb', line 12

def call(env)
  env[:ui].info(I18n.t("vagrant_ovirt4.snapshot_save"))
  
  snapshots_service = env[:vms_service].vm_service(env[:machine].id).snapshots_service
  
  snapshots_service.add(
    OvirtSDK4::Snapshot.new(
      description: env[:snapshot_name]
    )
  )

  @app.call(env)
end