Class: VagrantPlugins::ProviderZone::Command::CreateSnapshots
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderZone::Command::CreateSnapshots
- Defined in:
- lib/vagrant-zones/command/create_snapshots.rb
Overview
This is used to create zfs snapshots the zone
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vagrant-zones/command/create_snapshots.rb', line 8 def execute = {} opts = OptionParser.new do |o| o. = 'Usage: vagrant zone zfssnapshot list [options]' o.on('--dataset SNAPSHOTPATH', 'Specify snapshot path') do |p| [:dataset] = p end o.on('--snapshot_name @SNAPSHOTNAME', 'Specify snapshot name') do |p| [:snapshot_name] = p end end argv = (opts) return unless argv unless argv.length <= 4 @env.ui.info(opts.help) return end [:dataset] = 'all' if [:dataset].nil? if [:snapshot_name].nil? t = Time.new dash = '-' colon = ':' datetime = t.year.to_s + dash + t.month.to_s + dash + t.day.to_s + dash + t.hour.to_s + colon + t.min.to_s + colon + t.sec.to_s [:snapshot_name] = datetime end with_target_vms(argv, provider: :zone) do |machine| driver = machine.provider.driver driver.zfs(@env.ui, 'create', ) end end |