Skip to content

Commit

Permalink
CP-4318: Fall back to free edition if v6d is not running at startup
Browse files Browse the repository at this point in the history
Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information
johnelse committed Apr 3, 2013
1 parent 9f9d2c8 commit a00ba4d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ocaml/license/license_init.ml
Expand Up @@ -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
Expand Down

0 comments on commit a00ba4d

Please sign in to comment.