-
Notifications
You must be signed in to change notification settings - Fork 292
CP-54207: Move VBD_attach outside of VM migrate downtime #6489
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,7 +187,7 @@ module VmExtra = struct | |
; pv_drivers_detected: bool [@default false] | ||
; xen_platform: (int * int) option (* (device_id, revision) for QEMU *) | ||
; platformdata: (string * string) list [@default []] | ||
; attached_vdis: (Vbd.id * attached_vdi) list [@default []] | ||
; attached_vdis: (string * attached_vdi) list [@default []] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we would need to do anything special when updating to this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I follow the explanation of the commit, this was an ID of a Virtual Block Device (VBD), not a VM ID. Are you sure this is the right thing to do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AIUI, a Vbd.id is actually a tuple (string * string). The first is the vm id and the second is the vbd id. We're using the vmextra DB (indexed by VM id) and store the (Vbd.id, vdi) in attached_vdis after VBD_attach and retrieve this value to use in VBD_activate. Temporary VM ids are used during migration but currently this doesn't matter as we do activate immediately after attach, so the VM ids are the same. In this PR, we are doing attach earlier, so the VM id it's using at this point is something like xxxx-00000001, so when we later try to retrieve this value for the VBD_attach, the VM id has changed to xxxx-xxxxxxxxx so we can't find it. In VM_rename, the VM id key xxxx-00000001 is correctly updated to xxxx-xxxxxxxxx. However, if we're using Vbd.id in attached_vdis, this isn't updated so we still fail to find it as the key is (xxxx-00000001, <vbd_id>) rather than (xxxx-xxxxxxxxx, <vbd_id>). As vmextra is already indexed by VM, using the full vbd.id is unnecessary, so we can avoid this whole issue by not using the VM id part of vbd.id. |
||
} | ||
[@@deriving rpcty] | ||
|
||
|
@@ -3682,9 +3682,13 @@ module VBD = struct | |
persistent= | ||
{ | ||
vm_t.VmExtra.persistent with | ||
(* Index by id_of vbd rather than vbd.id as VmExtra is | ||
already indexed by VM id, so the VM id part of | ||
vbd.id is unnecessary and causes issues finding the | ||
attached_vdi when the VM is renamed. *) | ||
attached_vdis= | ||
(vbd.Vbd.id, vdi) | ||
:: List.remove_assoc vbd.Vbd.id | ||
(id_of vbd, vdi) | ||
:: List.remove_assoc (id_of vbd) | ||
vm_t.persistent.attached_vdis | ||
} | ||
} | ||
|
@@ -3706,7 +3710,7 @@ module VBD = struct | |
|
||
let activate task vm vbd = | ||
let vmextra = DB.read_exn vm in | ||
match List.assoc_opt vbd.id vmextra.persistent.attached_vdis with | ||
match List.assoc_opt (id_of vbd) vmextra.persistent.attached_vdis with | ||
| None -> | ||
debug "No attached_vdi info, so not activating" | ||
| Some vdi -> | ||
|
@@ -3857,7 +3861,7 @@ module VBD = struct | |
) | ||
vm | ||
) | ||
(fun () -> cleanup_attached_vdis vm vbd.id) | ||
(fun () -> cleanup_attached_vdis vm (id_of vbd)) | ||
|
||
let deactivate task vm vbd force = | ||
with_xc_and_xs (fun xc xs -> | ||
|
@@ -4021,7 +4025,7 @@ module VBD = struct | |
| _ -> | ||
() | ||
) ; | ||
cleanup_attached_vdis vm vbd.id | ||
cleanup_attached_vdis vm (id_of vbd) | ||
|
||
let insert task vm vbd d = | ||
on_frontend | ||
|
Uh oh!
There was an error while loading. Please reload this page.