Skip to content

Conversation

psafont
Copy link
Member

@psafont psafont commented Oct 2, 2025

This proposal is 11 years old and the architecture of xapi has changed
enough that the proposal needs changing.

In particular, SMAPIv3 has been introduced which means that there's an
xapi storage interface shared between the two SMAPI backend, and that
the fallback the logic that was done at SMAPI level now must be done at the
level of xapi.

I've also elected to further restrict the fallback behaviour to VM
reverts, VDI revert will require backend support: it reduces the chances of
failures during revert resulting in wrong fields in the database.

I'm still unsure about exposing VDI.revert, I would avoid it if at all possible, maybe as an internal or hidden API? It might be useful to exposed to use it in quicktests, like it was done in the initial prototype.

@psafont psafont force-pushed the dev/pau/vdi-revert-doc branch from d15451a to 753944c Compare October 2, 2025 09:55
- in: `sr_uuid`: the UUID of the SR containing both the VDI and the snapshot
- in: `vdi_uuid`: the UUID of the snapshot whose contents should be duplicated
- in: `target_uuid`: the UUID of the target whose contents should be replaced
- in: `vdi_uuid`: the UUID of the snapshot whose contents must be duplicated
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe worth calling this snapshot_uuid? otherwise v1 and v3 arguments are not consistent (vdi/snapshot, target/vdi)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll see if I can change it, it might be a bit inflexible, and not up to me whether it can be changed or not

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately this piece of code is common for all the calls to sm, so it ends up with these names, even if the function in sm.ml has reasonable arguments:

let vdi_revert ~dbg dconf driver sr vdi snapshot =
  debug "vdi_revert" driver
  (sprintf "sr=%s vdi=%s snapshot=%s" (Ref.string_of sr) (Ref.string_of vdi)
     (Ref.string_of snapshot)
  ) ;
  (* NB the SM backends treat the snapshot as the 'target', hence first argument
   *)
  let call =
    Sm_exec.make_call ~sr_ref:sr ~vdi_ref:snapshot dconf "vdi_revert"
      [Ref.string_of vdi]
  in
  Sm_exec.parse_unit (Sm_exec.exec_xmlrpc ~dbg (driver_filename driver) call)

- defining a new storage operation `VDI.revert` in storage_interface and
calling this from `VM.revert`
- proxying the storage operation to SMAPIv3 and SMAPv1 backends accordingly
- changing the Xapi implementation of `VM.revert` to first try the
Copy link
Contributor

@MarkSymsCtx MarkSymsCtx Oct 3, 2025

Choose a reason for hiding this comment

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

This should be exposed as a feature that the SM layer can expose when supported and then there is no need to try with failback.

@psafont psafont force-pushed the dev/pau/vdi-revert-doc branch from f028d09 to 753944c Compare October 7, 2025 09:38
Copy link
Contributor

@snwoods snwoods left a comment

Choose a reason for hiding this comment

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

Minor typos as Mark mentioned but otherwise approved.

@lindig
Copy link
Contributor

lindig commented Oct 14, 2025

Can we het the DCO problems fixed, @psafont?

This proposal is 11 years old and the architecture of xapi ahs changed
enough that the proposal needs changing.

In particular, SMAPIv3 has been introduced which means that there's an
xapi storage interface shared between the two SMAPI backend, and that
the fallback the logic that was done at SMAPI level now must be done at the
level of xapi.

I've also elected to further restrict the fallback behaviour to VM
reverts, VDI revert will require backend support: it reduces the chances of
failures during revert resulting in wrong fields in the database.

Signed-off-by: Pau Ruiz Safont <[email protected]>
@psafont psafont force-pushed the dev/pau/vdi-revert-doc branch from a80e9e0 to aa04042 Compare October 14, 2025 16:14
@psafont
Copy link
Member Author

psafont commented Oct 14, 2025

With the PoC, I'm not seeing any issues regarding the design, although all the ad-hoc code in VM.revert is making implementing this more complex than I would like

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.

5 participants