Class: OsCtld::Commands::Container::Move
- Defined in:
- lib/osctld/commands/container/move.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #client_handler, #id, #opts
Instance Method Summary collapse
Methods inherited from Logged
Methods inherited from Base
#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!
Constructor Details
This class inherits a constructor from OsCtld::Commands::Base
Instance Method Details
#config_opts(ct) ⇒ Object (protected)
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/osctld/commands/container/move.rb', line 41 def config_opts(ct) { id: ct.id, pool: ct.pool.name, target_pool: opts[:target_pool], target_id: opts[:target_id], target_user: opts[:target_user], target_group: opts[:target_group], target_dataset: opts[:target_dataset], network_interfaces: true } end |
#execute(ct) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/osctld/commands/container/move.rb', line 16 def execute(ct) manipulate(ct) do progress(type: :step, title: 'Preparing move') call_cmd!(Commands::Container::MoveConfig, **config_opts(ct)) progress(type: :step, title: 'Copying rootfs') call_cmd!(Commands::Container::MoveRootfs, id: ct.id, pool: ct.pool.name) progress(type: :step, title: 'Moving state') call_cmd!( Commands::Container::MoveState, id: ct.id, pool: ct.pool.name, start: opts.fetch(:start, true) ) progress(type: :step, title: 'Cleaning up') call_cmd!(Commands::Container::MoveCleanup, id: ct.id, pool: ct.pool.name) end ok end |
#find ⇒ Object
11 12 13 14 |
# File 'lib/osctld/commands/container/move.rb', line 11 def find ct = DB::Containers.find(opts[:id], opts[:pool]) ct || error!('container not found') end |