Class: VpsAdminOS::Converter::Vz6::Migrator::Ploop

Inherits:
Simfs
  • Object
show all
Defined in:
lib/vpsadminos-converter/vz6/migrator/ploop.rb

Instance Attribute Summary

Attributes inherited from Base

#progress_handler, #state

Instance Method Summary collapse

Methods inherited from Simfs

#cancel, #cleanup, #do_sync, #dst_rootfs, #root_sshcmd, #rsync, #src_rootfs

Methods inherited from Base

#cancel, #cancel_remote, #cleanup, #export_skel, #initialize, #progress, #stage, #transfer_container

Constructor Details

This class inherits a constructor from VpsAdminOS::Converter::Vz6::Migrator::Base

Instance Method Details

#syncObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vpsadminos-converter/vz6/migrator/ploop.rb', line 5

def sync
  mounted = false

  unless vz_ct.status[:mounted]
    mounted = true
    syscmd("vzctl mount #{vz_ct.ctid}")
  end

  super

  syscmd("vzctl umount #{vz_ct.ctid}") if mounted
end

#transfer(&block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vpsadminos-converter/vz6/migrator/ploop.rb', line 18

def transfer(&block)
  self.progress_handler = block

  # Stop the container
  running = vz_ct.running?
  syscmd("vzctl stop #{vz_ct.ctid}")
  syscmd("vzctl mount #{vz_ct.ctid}")

  # Second sync
  do_sync

  # Transfer to dst
  transfer_container(running)
  syscmd("vzctl umount #{vz_ct.ctid}")
end