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

CA-400860: rrdp-netdev - drop xenctrl, use xenstore to get UUIDs from domids instead #6068

Merged

Conversation

last-genius
Copy link
Contributor

Follow-up to the fix we had to rush, dropping xenctrl entirely.

Tested with a Windows VM, the domain creation is picked up and network metrics are present for it, with correct UUIDs determined.

(Printf.sprintf "Failed to find uuid corresponding to domid: %d" domid)
in
uuid
let uuid_of_domid domid =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other plugins that use this pattern? They could share code in the plugin library that you added

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xenops_helpers has the same function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's where i stole the function from. but xenops_helpers also converts strings to UUIDs, which I don't need.

xs.Xenstore.Xs.read (vm_dir ^ "/uuid")
)
with _ ->
failwith
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let fail = Printf.ksprintf failwith (* somewhere at the top of the file *)

..
fail "Something %s" "a string"

Might want to log the exception to understand why this fails. I would use Filename.concat to construct the paths but it's a aesthetic choice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Xenstore.Path.concat or similar, since they are not filenames

@last-genius last-genius force-pushed the private/asultanov/rrdd-xenctrl-fix branch from 537904f to 1bdb22a Compare October 22, 2024 10:11
@robhoes robhoes added this pull request to the merge queue Oct 29, 2024
Merged via the queue into xapi-project:master with commit 58b9acc Oct 29, 2024
15 checks passed
Comment on lines +140 to +143
Xenstore.with_xs (fun xs ->
let vm = xs.Xenstore.Xs.getdomainpath domid ^ "/vm" in
let vm_dir = xs.Xenstore.Xs.read vm in
xs.Xenstore.Xs.read (vm_dir ^ "/uuid")
Copy link
Collaborator

@andyhhp andyhhp Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I'm late to the party here, but this is very expensive. You've got 3 xenstore accesses to do what was previously a single hypercall (would be faster than a single xenstore access), and xenstore is a known bottleneck.

First, getdomainpath $x is universally /local/domain/$x. Some original plans for xenstore involved having /remote/$host/domain/$domid as shared-virtual-memory across the pool. Luckily, this plan never even got started, and you can reasonably hard-code it.

Second, /vm/$uuid/uuid is always self-referential, so you could just split the answer from /local/domain/$domid/vm at / and take the final component.

Or, if you want something less dodgy, just have Xapi/Xenops/whatever fill in a new top-level dir with /uuid-by-domid/$domid = $uuid so logic like this can issue a single read for /uuid-by-domid/$domid and get the precise data you want.

last-genius added a commit to last-genius/xen-api that referenced this pull request Nov 20, 2024
Bake in assumptions that have been constant ever since xenstore was created:
getdomainpath always returns "/local/domain/<domid>", /local/domain/domid/vm
returns "/vm/<uuid>", so there's no need to look up that path to get the uuid
again

This reduces the number of xenstore accesses from 3 to 1 with no functional
change.

As suggested in: xapi-project#6068 (review)

Signed-off-by: Andrii Sultanov <[email protected]>
last-genius added a commit to last-genius/xen-api that referenced this pull request Nov 20, 2024
Bake in assumptions that have been constant ever since xenstore was created:
getdomainpath always returns "/local/domain/<domid>", /local/domain/domid/vm
returns "/vm/<uuid>", so there's no need to look up that path to get the uuid
again

This reduces the number of xenstore accesses from 3 to 1 with no functional
change.

As suggested in: xapi-project#6068 (review)

Signed-off-by: Andrii Sultanov <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 26, 2024
Bake in assumptions that have been constant ever since xenstore was
created: getdomainpath always returns "/local/domain/domid",
/local/domain/domid/vm returns "/vm/uuid", so there's no need to look up
that path to get the uuid again

This reduces the number of xenstore accesses from 3 to 1 with no
functional change.

As suggested in:
#6068 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants