Skip to content

Commit

Permalink
CP-48676: Don't check resuable pool session validity by default
Browse files Browse the repository at this point in the history
Add a new flag validate-reusable-pool-session to xapi globs which skips
the reusable pool session validity check if it is false. This saves time
as we are no longer calling pool.get_all for each session.

Signed-off-by: Steven Woods <[email protected]>
  • Loading branch information
snwoods committed Jan 31, 2025
1 parent 4a942bd commit b94335a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ocaml/xapi/xapi_globs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,9 @@ let disable_webserver = ref false
let reuse_pool_sessions = ref true
(* Enables the reuse of pool sessions, speeding up intrapool communication *)

let validate_reusable_pool_session = ref false
(* Validate a reusable session before each use. This is slower and should not be required *)

let test_open = ref 0

let tgroups_enabled = ref false
Expand Down Expand Up @@ -1713,6 +1716,11 @@ let other_options =
, (fun () -> string_of_bool !reuse_pool_sessions)
, "Enable the reuse of pool sessions"
)
; ( "validate-reusable-pool-session"
, Arg.Set validate_reusable_pool_session
, (fun () -> string_of_bool !validate_reusable_pool_session)
, "Enable validation of reusable pool sessions before use"
)
]

(* The options can be set with the variable xapiflags in /etc/sysconfig/xapi.
Expand Down
5 changes: 4 additions & 1 deletion ocaml/xapi/xapi_session.ml
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,10 @@ let login_no_password_common ~__context ~uname ~originator ~host ~pool
debug "Invalid session: %s" err ;
false
in
session_id <> Ref.null || is_valid_session session_id
session_id <> Ref.null
&& ((not !Xapi_globs.validate_reusable_pool_session)
|| is_valid_session session_id
)
in
let create_session () =
let new_session_id =
Expand Down

0 comments on commit b94335a

Please sign in to comment.