Class: Dcmgr::NodeModules::InstanceHA
- Inherits:
-
Isono::NodeModules::Base
- Object
- Isono::NodeModules::Base
- Dcmgr::NodeModules::InstanceHA
- Includes:
- Logger
- Defined in:
- lib/dcmgr/node_modules/instance_ha.rb
Instance Method Summary collapse
Methods included from Logger
create, default_logdev, included
Instance Method Details
#restart_instance(inst) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dcmgr/node_modules/instance_ha.rb', line 27 def restart_instance(inst) # terminate and cleanup begin jobrpc.run("kvm-handle.#{inst.host_pool.node_id}", 'cleanup', inst.canonical_uuid) rescue => e # termination may fail end # TODO: pick a new host node Isono::NodeModules::DataStore. { inst.state = :failingover inst.save } # start a new backup instance case inst.image.boot_dev_type when Models::Image::BOOT_DEV_SAN boot_vol = inst.volume.find {|v| v.boot_dev == 1 } res = jobrpc.submit("kvm-handle.#{inst.host_pool.node_id}", 'run_vol_store', inst.canonical_uuid, boot_vol.canonical_uuid) when Models::Image::BOOT_DEV_LOCAL res = jobrpc.submit("kvm-handle.#{inst.host_pool.node_id}", 'run_local_store', inst.canonical_uuid) else raise "Unknown boot type" end logger.info("#{inst.canonical_uuid} has been restarted") end |