-
Notifications
You must be signed in to change notification settings - Fork 291
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
Move the update_snapshot_info_dest
to storage mux
#6433
Conversation
ocaml/xapi/storage_mux.ml
Outdated
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 |
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.
I find module C is not used any more in this function after modification, please check.
2032fe6
to
3045e63
Compare
ocaml/xapi/storage_mux.ml
Outdated
exception No_VDI | ||
|
||
(* Find a VDI given a storage-layer SR and VDI *) | ||
let find_vdi ~__context sr vdi = |
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.
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 |
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.
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.
1bd6483
to
ad25956
Compare
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]>
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