Skip to content

Move the update_snapshot_info_dest to storage mux #6433

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

Merged
merged 4 commits into from
Apr 24, 2025

Conversation

Vincent-lau
Copy link
Contributor

@Vincent-lau Vincent-lau commented Apr 17, 2025

Move the update_snapshot_info_dest to storage mux as this function just does db operations.

Also rescan the SR after updaing the content_id during SXM, so that the latest content_id can be reflected in the returned vdi_info, which gets used later on in update_snapshot_info

let update_snapshot_info_dest () ~dbg ~sr ~vdi ~src_vdi ~snapshot_pairs =
with_dbg ~name:"SR.update_snapshot_info_dest" ~dbg @@ fun di ->
with_dbg ~name:"SR.update_snapshot_info_dest" ~dbg @@ fun _di ->
let module C = StorageAPI (Idl.Exn.GenClient (struct
let rpc = of_sr sr
end)) in
Copy link
Contributor

Choose a reason for hiding this comment

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

I find module C is not used any more in this function after modification, please check.

@Vincent-lau Vincent-lau force-pushed the private/shul2/content-id branch 2 times, most recently from 2032fe6 to 3045e63 Compare April 22, 2025 10:31
exception No_VDI

(* Find a VDI given a storage-layer SR and VDI *)
let find_vdi ~__context sr vdi =
Copy link
Contributor

@changlei-li changlei-li Apr 23, 2025

Choose a reason for hiding this comment

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

There are two same find_vdi functions both here and storage_smapiv1.ml. Could you move it to storage_utils.ml or somewhere else to avoid two duplications. As well as the exception No_VDI.

This function updates the snapshot related db fields after the storage
migration. There is no need to leave this in the storage layer as
xapi-storage-script will not be able to access xapi db.

Signed-off-by: Vincent Liu <[email protected]>
(Storage_interface.Vdi.string_of vdi)
)
in
let local_vdi = find_vdi ~dbg ~sr ~vdi (module Local) in
Copy link
Member

Choose a reason for hiding this comment

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

We are now doing an extra Local.SR.scan in this function call. Is that cheap? Otherwise you could perhaps return all vdis from the scan from find_vdi as well.

@Vincent-lau Vincent-lau force-pushed the private/shul2/content-id branch 3 times, most recently from 1bd6483 to ad25956 Compare April 23, 2025 15:11
Move this to storage_utils.ml since it is used by storage_smapiv1.ml and
storage_mux.ml

Signed-off-by: Vincent Liu <[email protected]>
Signed-off-by: Vincent Liu <[email protected]>
Extract common logic on finding vdi_info given vdi, and also add a
parameter to specify where to find the VDI (locally or remotely).

Signed-off-by: Vincent Liu <[email protected]>
@Vincent-lau Vincent-lau added this pull request to the merge queue Apr 24, 2025
Merged via the queue into xapi-project:master with commit 8b5bdf7 Apr 24, 2025
17 checks passed
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.

3 participants