Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-52115: Add v6d interface error License_server_certificate_error #6195

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ocaml/idl/datamodel_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ let _ =
() ;
error Api_errors.license_checkout_error ["reason"]
~doc:"The license for the edition you requested is not available." () ;
error Api_errors.license_server_certificate_error ["reason"]
~doc:"The license server certificate check error." () ;
error Api_errors.license_file_deprecated []
~doc:
"This type of license file is for previous versions of the server. \
Expand Down
7 changes: 5 additions & 2 deletions ocaml/xapi-cli-server/cli_operations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5249,9 +5249,12 @@ let with_license_server_changes printer rpc session_id params hosts f =
hosts
) ;
let now = Unix.gettimeofday () in
let need_roll_back errname =
errname = Api_errors.license_checkout_error
|| errname = Api_errors.license_server_certificate_error
in
try f rpc session_id with
| Api_errors.Server_error (name, _) as e
when name = Api_errors.license_checkout_error ->
| Api_errors.Server_error (name, _) as e when need_roll_back name ->
(* Put back original license_server_details *)
List.iter
(fun (host, license_server) ->
Expand Down
3 changes: 3 additions & 0 deletions ocaml/xapi-consts/api_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ let missing_connection_details = add_error "MISSING_CONNECTION_DETAILS"

let license_checkout_error = add_error "LICENSE_CHECKOUT_ERROR"

let license_server_certificate_error =
add_error "LICENSE_SERVER_CERTIFICATE_ERROR"

let license_file_deprecated = add_error "LICENSE_FILE_DEPRECATED"

let activation_while_not_free = add_error "ACTIVATION_WHILE_NOT_FREE"
Expand Down
2 changes: 2 additions & 0 deletions ocaml/xapi-idl/v6/v6_interface.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ type errors =
date *)
| License_processing_error (** License could not be processed *)
| License_checkout_error of string (** License could not be checked out *)
| License_server_certificate_error of string
(** License server certificate error *)
| Missing_connection_details
(** Thrown if connection port or address parameter not supplied to
check_license *)
Expand Down
2 changes: 2 additions & 0 deletions ocaml/xapi/xapi_host.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,8 @@ let apply_edition_internal ~__context ~host ~edition ~additional =
raise Api_errors.(Server_error (missing_connection_details, []))
| V6_interface.(V6_error (License_checkout_error s)) ->
raise Api_errors.(Server_error (license_checkout_error, [s]))
| V6_interface.(V6_error (License_server_certificate_error s)) ->
raise Api_errors.(Server_error (license_server_certificate_error, [s]))
| V6_interface.(V6_error (Internal_error e)) ->
raise Api_errors.(Server_error (internal_error, [e]))
in
Expand Down
Loading