Repository navigation
CA-432452: Mirror the leaf in its own slice when the VM has no domain - #7334
Conversation
changlei-li
left a comment
There was a problem hiding this comment.
The fix is correct for cross-host halted SXM, but on a same-host v3→v3 migration it puts the source and the destination in the same qemu-dp slice, which brings back the CA-431809 data-loss bug.
| Local.VDI.activate3 dbg dp sr vdi mirror_vm ; | ||
| mirror_vm | ||
| | _ -> | ||
| ignore (Local.VDI.attach3 dbg dp sr vdi (Vm.of_string "0") true) ; |
There was a problem hiding this comment.
Why it needs to be attached to dom0 when the VM is running (hence the VDI must be attached and activated with the VM)?
There was a problem hiding this comment.
This is the original impl in master; I believe it was copied from SMAPIv1, where the datapath is attached to dom0. We can't do that for SMAPIv3, because qemu-dp doesn't support activating an already-activated datapath. So this line has no effect here — removed.
| let live_vm = | ||
| match s_of_vm live_vm with | ||
| | "-1" -> | ||
| ignore (Local.VDI.attach3 dbg dp sr vdi mirror_vm true) ; |
There was a problem hiding this comment.
In this case, the attach should not be ignored?
There was a problem hiding this comment.
Agree, updated.
d64b8d7 to
593216a
Compare
Good catch, for a running VM, it is adding a |
593216a to
525e861
Compare
| SMAPI.DP.destroy dbg dp false | ||
| SMAPI.DP.destroy dbg dp false ; | ||
| if not has_domain then | ||
| Storage_migrate.post_deactivate_hook |
There was a problem hiding this comment.
The calling to hook is correct. But it's better to be in DP.destroy in ocaml/xapi/storage_mux.ml although it's not ideal also. But I think it's the best choice we could make.
See ec612ae.
There was a problem hiding this comment.
This is my original thought as well :-) , updated now.
A halted or suspended VM has domid -1, and qemu-dp turns a numeric slice name straight into -xen-domid, so the mirror waits for a domain that will never appear. A non-numeric slice resolves to dom0, which is what the snapshot copies already use. With no domain there is no VBD deactivate to finalise the mirror either, so DP.destroy now runs the post-deactivate hook for SMAPIv3, as VDI.deactivate does. Signed-off-by: Lunfan Zhang[Lunfan.Zhang] <Lunfan.Zhang@cloud.com>
525e861 to
aeef7de
Compare
A halted or suspended VM has
domid -1, so the leaf mirror runs in qemu-dp slice "-1", which never starts but just reportqemu-datapath@-1 took too long to become available.Mirror in the
mirror_vmslice instead - non-numeric when Guest is halted ( whenlive_vm = -1), so data-path resolves it to dom0 like SMAPIv1 does - attaching and activating the VDI onmirror_vmensure offline Storage migration can work as well.