Permalink
Browse files

CP-4318: Fall back to free edition if v6d is not running at startup

Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information...
1 parent 9f9d2c8 commit a00ba4decf847f08259d7fd3887272c5a7fb6899 @johnelse committed Mar 27, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 ocaml/license/license_init.ml
View
10 ocaml/license/license_init.ml
@@ -15,12 +15,20 @@
module D = Debug.Debugger(struct let name="license" end)
open D
+let v6_initialise ~__context ~edition ~params =
+ try
+ V6client.apply_edition ~__context edition params
+ with Api_errors.Server_error (code, []) when code = Api_errors.v6d_failure ->
+ (* Couldn't communicate with v6d, so fall back to running in free mode,
+ * with all standard features enabled and no additional features advertised. *)
+ "free", Features.all_features, []
+
(* xapi calls this function upon startup *)
let initialise ~__context ~host =
try
let edition = Db.Host.get_edition ~__context ~self:host in
let edition', features, additional =
- V6client.apply_edition ~__context edition ["startup", "true"] in
+ v6_initialise ~__context ~edition ~params:["startup", "true"] in
Db.Host.set_edition ~__context ~self:host ~value:edition';
(* Copy resulting license to the database *)
Xapi_host.copy_license_to_db ~__context ~host ~features ~additional

0 comments on commit a00ba4d

Please sign in to comment.