Permalink
Browse files

provide job, index, and release state as soon as possible in instance…

… updater.

this allows us to recover much more easily and is inline with ResourcePoolUpdater

Change-Id: I37d1b40d1acda35c4b2c4b97fa27a86ec6670033
  • Loading branch information...
1 parent 7034269 commit 98da8b24ae9d001554f8f9a283eea0eef8064854 Vadim Spivak committed Jun 4, 2012
Showing with 14 additions and 2 deletions.
  1. +3 −0 director/lib/director/instance_updater.rb
  2. +11 −2 director/spec/unit/instance_updater_spec.rb
View
3 director/lib/director/instance_updater.rb
@@ -285,6 +285,9 @@ def update_resource_pool(new_disk_cid = nil)
"deployment" => @deployment_plan.name,
"networks" => @instance_spec.network_settings,
"resource_pool" => @job_spec.resource_pool.spec,
+ "job" => @job_spec.spec,
+ "index" => @instance_spec.index,
+ "release" => @deployment_plan.release.spec
}
if @instance_spec.disk_size > 0
View
13 director/spec/unit/instance_updater_spec.rb
@@ -48,6 +48,15 @@
}
IDLE_PLAN = {
"deployment" => "test_deployment",
+ "job" => {
+ "name" => "test_job",
+ "blobstore_id" => "job_blob"
+ },
+ "release"=> {
+ "name" => "test_release",
+ "version" => 99
+ },
+ "index" => 5,
"resource_pool" => {
"stemcell" => {
"name" => "ubuntu",
@@ -87,7 +96,7 @@ def make_updater(spec)
before(:each) do
@deployment = Bosh::Director::Models::Deployment.make
@vm = Bosh::Director::Models::Vm.make(:deployment => @deployment, :agent_id => "agent-1", :cid => "vm-id")
- @instance = Bosh::Director::Models::Instance.make(:deployment => @deployment, :vm => @vm, :index => "0")
+ @instance = Bosh::Director::Models::Instance.make(:deployment => @deployment, :vm => @vm, :index => "5")
@stemcell = Bosh::Director::Models::Stemcell.make(:cid => "stemcell-id")
@cloud = mock("cloud")
@@ -187,7 +196,7 @@ def make_updater(spec)
instance_updater.update
}.should raise_error(
BD::AgentJobNotStopped,
- "`test_job/0' is still running despite the stop command")
+ "`test_job/5' is still running despite the stop command")
end
it "should do a basic canary update" do

0 comments on commit 98da8b2

Please sign in to comment.