Module: VpsAdminOS::Converter::Vz6::Migrator

Defined in:
lib/vpsadminos-converter/vz6/migrator.rb

Defined Under Namespace

Classes: Base, Ploop, Simfs, State, Zfs

Class Method Summary collapse

Class Method Details

.create(vz_ct, target_ct, opts) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vpsadminos-converter/vz6/migrator.rb', line 15

def self.create(vz_ct, target_ct, opts)
  begin
    Vz6::Migrator::State.load(vz_ct.ctid)

  rescue Errno::ENOENT
    # ok

  else
    fail "migration for CT #{vz_ct.ctid} has already been started"
  end

  state = Vz6::Migrator::State.create(vz_ct, target_ct, opts)
  self.for(vz_ct, opts[:zfs]).new(state)
end

.for(vz_ct, use_zfs) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/vpsadminos-converter/vz6/migrator.rb', line 3

def self.for(vz_ct, use_zfs)
  if use_zfs
    Vz6::Migrator::Zfs

  elsif vz_ct.ploop?
    Vz6::Migrator::Ploop

  else
    Vz6::Migrator::Simfs
  end
end

.load(ctid) ⇒ Object



30
31
32
33
# File 'lib/vpsadminos-converter/vz6/migrator.rb', line 30

def self.load(ctid)
  state = Vz6::Migrator::State.load(ctid)
  self.for(state.vz_ct, state.opts[:zfs]).new(state)
end