Class: Bosh::Director::VmRecreator

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/vm_recreator.rb

Instance Method Summary collapse

Constructor Details

#initialize(vm_creator, vm_deleter) ⇒ VmRecreator

Returns a new instance of VmRecreator.



4
5
6
7
# File 'lib/bosh/director/vm_recreator.rb', line 4

def initialize(vm_creator, vm_deleter)
  @vm_creator = vm_creator
  @vm_deleter = vm_deleter
end

Instance Method Details

#recreate_vm(instance_plan, disk_cid) ⇒ Object



9
10
11
12
13
14
# File 'lib/bosh/director/vm_recreator.rb', line 9

def recreate_vm(instance_plan, disk_cid)
  instance_model = instance_plan.instance.model
  @vm_deleter.delete_for_instance(instance_model)
  disks = [instance_model.persistent_disk_cid, disk_cid].compact
  @vm_creator.create_for_instance_plan(instance_plan, disks)
end