Skip to content

Feature request: Add new api method vm.revertLast for Jobs #6557

Open
@cocoon

Description

@cocoon

Is your feature request related to a problem? Please describe.

Currently I use revert.vm and have to specify the exact snapshot.
If I do changes / updates to the VMs I have to go though all those jobs again and have to point to the new snapshot.

Describe the solution you'd like

Would be a big time saver if there would be an job option to revert to the latest snapshot like in VMware.
Best would be if one could give one or even multiple vms as job parameter.

UPDATE: And in future if it will get ACL v2 + ObjectGroups an additional field instead of multiple VMs one could just give an ObjectGroup as parameter (https://xcp-ng.org/forum/topic/6644/acl-v2-allow-to-run-specific-job/4)

Describe alternatives you've considered

I have just found that it seems possible to sort by date (snapshot_time field) so it might be possible to add a new method like "revertLast" that takes a vm as parameter?

source: https://xcp-ng.org/forum/post/55374

  1. Take a look at a specific snapshot to see the available fields, note snapshot_time which is a [Unix timestamp](https://www.unixtimestamp.com/).
    
  2. Use a filter ([syntax documentation](https://xen-orchestra.com/docs/manage_infrastructure.html#filter-syntax)), example:
    
    /rest/v0/vm-snapshots?filter=snapshot_time%3A>1669044124

Original revert method:
https://github.com/vatesfr/xen-orchestra/blob/master/packages/xo-server/src/api/vm.mjs#L1060

export const revert = defer(async function ($defer, { snapshot }) {

could be added?

export const revertLast = defer(async function ($defer, { vm, objectgroup }) {
if(objectgroup is not empty, use all from objectgroup + every given vm)

Additional context

Original discussion started here: https://xcp-ng.org/forum/topic/5794/job-revert-vm-to-last-snapshot
ObjectGroups + ACL v2: objectgroup

Mockup:

vm_revertLast

vm_revertLast2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions