Permalink
Browse files

Merge "Generate private id for running instance"

  • Loading branch information...
anfernee authored and Gerrit Code Review committed Nov 5, 2012
2 parents 5a88816 + 6dc1608 commit 3179bec679a5097ba7e7c03e5385afd45d1e4a74
Showing with 13 additions and 2 deletions.
  1. +9 −0 lib/dea/instance.rb
  2. +2 −1 lib/dea/router_client.rb
  3. +2 −1 spec/dea/bootstrap/router_registration_spec.rb
View
@@ -217,6 +217,11 @@ def self.schema
optional("debug") => enum(nil, String),
optional("console") => enum(nil, bool),
+
+ # private_instance_id is internal id that represents the instance,
+ # which is generated by DEA itself. Currently, we broadcast it to
+ # all routers. Routers use that as sticky session of the instance.
+ "private_instance_id" => String,
}
end
end
@@ -269,6 +274,10 @@ def initialize(bootstrap, attributes)
# Generate unique ID
@attributes["instance_id"] ||= VCAP.secure_uuid
+
+ # Contatenate 2 UUIDs to genreate a 32 chars long private_instance_id
+ @attributes["private_instance_id"] ||= VCAP.secure_uuid + VCAP.secure_uuid
+
self.state = State::BORN
# Assume non-production app when not specified
View
@@ -41,7 +41,8 @@ def generate_instance_request(instance, opts = {})
"tags" => {
"framework" => instance.framework_name,
"runtime" => instance.runtime_name,
- }
+ },
+ "private_instance_id" => instance.private_instance_id,
}
end
@@ -50,7 +50,8 @@
"tags" => {
"framework" => instances[0].framework_name,
"runtime" => instances[0].runtime_name,
- }
+ },
+ "private_instance_id" => instances[0].private_instance_id,
}
expected_1 = {

0 comments on commit 3179bec

Please sign in to comment.