-
Notifications
You must be signed in to change notification settings - Fork 284
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
SDK fixes including CP-53003 #6210
Conversation
Signed-off-by: Konstantina Chremmou <[email protected]>
- Moved certificate methods to the Connect-XenServer cmdlet and refactored them to avoid multiple loads of the global variable KnownServerCertificatesFilePath. - Fixed accessibility of CommonCmdletFunctions members. Signed-off-by: Konstantina Chremmou <[email protected]>
… version is known. Signed-off-by: Konstantina Chremmou <[email protected]>
/// Return a positive number if the given session's API version is greater than the given | ||
/// API_version, negative if it is less, and 0 if they are equal. | ||
/// </summary> | ||
internal static int APIVersionCompare(Session session, API_Version v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove those functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods are not visible outside the library because they are internal. Inside the library they are not used, which means they are not needed.
Now, if someone has implemented the SDK in the way XenCenter has, the methods might be in use, however, XC's design is not ideal and should not be encouraged because it leads to complicated code.
|
||
if (JsonRpcClient != null) | ||
{ | ||
if (APIVersion == API_Version.API_2_6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the default value is already "JsonRpcVersion.v1", do we need re-setting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically someone could create the session object, change the JsonRpcVersion, and then call login_with_password
which calls this method. In reality it's highly unlikely someone would do that, but I put the code there to be defensive.
Continuing from #6208 The conflict resolution can be reviewed with: `git log --remerge-diff -1 8b8af63` ```diff diff --git a/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml b/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml remerge CONFLICT (content): Merge conflict in ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml index 7bace30dae..27cf306995 100644 --- a/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml +++ b/ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml @@ -33,49 +33,8 @@ let (queue : t Ipq.t) = Ipq.create 50 queue_default let lock = Mutex.create () -<<<<<<< 6589d9a (Xapi thread classification - part 2 (#6154)) let add_to_queue_span name ty start_span newfunc = let ( ++ ) = Mtime.Span.add in -||||||| 4f3f08f -module Clock = struct - let span s = Mtime.Span.of_uint64_ns (Int64.of_float (s *. 1e9)) - - let span_to_s span = - Mtime.Span.to_uint64_ns span |> Int64.to_float |> fun ns -> ns /. 1e9 - - let add_span clock secs = - (* return mix or max available value if the add overflows *) - match Mtime.add_span clock (span secs) with - | Some t -> - t - | None when secs > 0. -> - Mtime.max_stamp - | None -> - Mtime.min_stamp -end - -let add_to_queue name ty start newfunc = - let ( ++ ) = Clock.add_span in -======= -module Clock = struct - let span s = Mtime.Span.of_uint64_ns (Int64.of_float (s *. 1e9)) - - let span_to_s span = Mtime.Span.to_float_ns span |> fun ns -> ns /. 1e9 - - let add_span clock secs = - (* return mix or max available value if the add overflows *) - match Mtime.add_span clock (span secs) with - | Some t -> - t - | None when secs > 0. -> - Mtime.max_stamp - | None -> - Mtime.min_stamp -end - -let add_to_queue name ty start newfunc = - let ( ++ ) = Clock.add_span in ->>>>>>> 8c9b754 (SDK fixes including CP-53003 (#6210)) let item = { Ipq.ev= {func= newfunc; ty; name} ``` This code got deleted in `feature/perf` 6b02474, where `span_to_s` got replaced with `Clock.Timer.span_to_s`, and changed in master by e68cda7. Both achieve the same result: `span_to_s` uses `Mtime.Span.to_float_ns`, except the commit on feature/perf also removes code duplication by reusing the other clock module.
Commits best reviewed separately.