Skip to content

CA-432452: Mirror the leaf in its own slice when the VM has no domain - #7334

Open
LunfanZhang wants to merge 1 commit into
xapi-project:feature/sxm-v3from
LunfanZhang:private/luzhan/CA-432452-offline-v3-source
Open

LunfanZhang wants to merge 1 commit into
xapi-project:feature/sxm-v3from
LunfanZhang:private/luzhan/CA-432452-offline-v3-source

Conversation

@LunfanZhang

Copy link
Copy Markdown
Collaborator

A halted or suspended VM has domid -1, so the leaf mirror runs in qemu-dp slice "-1", which never starts but just report qemu-datapath@-1 took too long to become available.
Mirror in the mirror_vm slice instead - non-numeric when Guest is halted ( when live_vm = -1), so data-path resolves it to dom0 like SMAPIv1 does - attaching and activating the VDI on mirror_vm ensure offline Storage migration can work as well.

@changlei-li changlei-li left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread ocaml/xapi/storage_smapiv3_migrate.ml Outdated
Local.VDI.activate3 dbg dp sr vdi mirror_vm ;
mirror_vm
| _ ->
ignore (Local.VDI.attach3 dbg dp sr vdi (Vm.of_string "0") true) ;

@minglumlu minglumlu Oct 15, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why it needs to be attached to dom0 when the VM is running (hence the VDI must be attached and activated with the VM)?

@LunfanZhang LunfanZhang Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread ocaml/xapi/storage_smapiv3_migrate.ml Outdated
let live_vm =
match s_of_vm live_vm with
| "-1" ->
ignore (Local.VDI.attach3 dbg dp sr vdi mirror_vm true) ;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this case, the attach should not be ignored?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agree, updated.

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.

Signed-off-by: Lunfan Zhang[Lunfan.Zhang] <Lunfan.Zhang@cloud.com>
@LunfanZhang
LunfanZhang force-pushed the private/luzhan/CA-432452-offline-v3-source branch from d64b8d7 to 593216a Compare October 19, 2026 08:42
@LunfanZhang

Copy link
Copy Markdown
Collaborator Author

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.

Good catch, for a running VM, it is dom-id in source host and mirror_vm in the dest as the qemu slice id, should no conflict.
but for a halt VM, now it is mirror_vm in source and mirror_vm in dest as well which could be conflict.

adding a -src in source host for mirror_vm for avoiding this.

This branch has not been deployed

No deployments
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