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 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/dcmgr/node_modules/instance_ha.rb', line 27 def restart_instance(inst) # terminate and cleanup # set boot_vol before instance is cleaned up. case inst.image.boot_dev_type when Models::Image::BOOT_DEV_SAN boot_vol = inst.volume.find {|v| v.boot_dev == 1 } end begin jobrpc.run("hva-handle.#{inst.host_node.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 begin case inst.image.boot_dev_type when Models::Image::BOOT_DEV_SAN jobrpc.submit("scheduler", 'schedule_instance_ha', inst.canonical_uuid, boot_vol) when Models::Image::BOOT_DEV_LOCAL jobrpc.submit("scheduler", 'schedule_instance_ha', inst.canonical_uuid, nil) else raise "Unknown boot type" end rescue => e # termination may fail end logger.info("#{inst.canonical_uuid} has been restarted") end |