Class: Bosh::Director::Jobs::CreateSnapshot

Inherits:
BaseJob show all
Defined in:
lib/bosh/director/jobs/create_snapshot.rb

Instance Attribute Summary

Attributes inherited from BaseJob

#task_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseJob

#begin_stage, #dns_manager, #event_manager, #logger, perform, #result_file, schedule_message, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log, #username

Constructor Details

#initialize(instance_id, options) ⇒ CreateSnapshot

Returns a new instance of CreateSnapshot.



11
12
13
14
# File 'lib/bosh/director/jobs/create_snapshot.rb', line 11

def initialize(instance_id, options)
  @instance = Bosh::Director::Api::InstanceManager.new.find_instance(instance_id)
  @options = options
end

Class Method Details

.job_typeObject



7
8
9
# File 'lib/bosh/director/jobs/create_snapshot.rb', line 7

def self.job_type
  :create_snapshot
end

Instance Method Details

#performObject



16
17
18
19
20
# File 'lib/bosh/director/jobs/create_snapshot.rb', line 16

def perform
  logger.info("taking snapshot of: #{@instance.job}/#{@instance.index} (#{@instance.vm_cid})")
  snapshot_cids = Bosh::Director::Api::SnapshotManager.take_snapshot(@instance, @options)
  "snapshot(s) #{snapshot_cids.join(', ')} created"
end