Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CP-4319: Detect socket count in v6client.ml

Sending the socket count in the params list to V6client.apply_edition is
a bad idea, since this function also sends the current
Host.license_params, which may also contain the socket count, to v6d.

Instead, we update the license_params map with the socket count before
sending it to v6d.

This also means that the correct socket count is sent to v6d at xapi
startup.

Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information...
commit ebddedb3d26458ab7b7be20db91381e7957f7525 1 parent a00ba4d
@johnelse johnelse authored
Showing with 12 additions and 4 deletions.
  1. +11 −0 ocaml/license/v6client.ml
  2. +1 −4 ocaml/xapi/xapi_host.ml
View
11 ocaml/license/v6client.ml
@@ -15,6 +15,8 @@
module D=Debug.Debugger(struct let name="v6client" end)
open D
+open Listext
+
exception V6DaemonFailure
let retry = ref true
@@ -26,10 +28,19 @@ let v6rpc call =
XMLRPC_protocol.rpc ~srcstr:"xapi" ~dststr:"v6d" ~transport:(Unix socket) ~http:(xmlrpc ~version:"1.0" "/") call
let rec apply_edition ~__context edition additional =
+ (* Get localhost's current license state. *)
let host = Helpers.get_localhost ~__context in
let license_server = Db.Host.get_license_server ~__context ~self:host in
let current_edition = Db.Host.get_edition ~__context ~self:host in
let current_license_params = Db.Host.get_license_params ~__context ~self:host in
+ (* Make sure the socket count in license_params is correct.
+ * At first boot, the key won't exist, and it may be wrong if we've restored
+ * a database dump from a different host. *)
+ let cpu_info = Db.Host.get_cpu_info ~__context ~self:host in
+ let socket_count = List.assoc "socket_count" cpu_info in
+ let current_license_params =
+ List.replace_assoc "sockets" socket_count current_license_params in
+ (* Construct the RPC params to be sent to v6d *)
let additional = ("current_edition", current_edition) ::
license_server @ current_license_params @ additional in
let params = [ Rpc.rpc_of_string (Context.string_of_task __context)
View
5 ocaml/xapi/xapi_host.ml
@@ -1234,11 +1234,8 @@ let apply_edition ~__context ~host ~edition =
if Db.Pool.get_ha_enabled ~__context ~self:pool then
raise (Api_errors.Server_error (Api_errors.ha_is_enabled, []))
else begin
- let cpu_info = Db.Host.get_cpu_info ~__context ~self:host in
- let socket_count = List.assoc "socket_count" cpu_info in
let edition', features, additional =
- V6client.apply_edition ~__context edition
- ["sockets", socket_count]
+ V6client.apply_edition ~__context edition []
in
Db.Host.set_edition ~__context ~self:host ~value:edition';
copy_license_to_db ~__context ~host ~features ~additional
Please sign in to comment.
Something went wrong with that request. Please try again.