Skip to content

Snapshot management should be the same as Virtualbox #13694

@simono74

Description

@simono74

The snapshot management in the Vagrant VMWare plugin is different than the Virtualbox implementation.
In the Virtualbox implementation, doing "vagrant snapshot list" returns the list of snapshots as follows:

$ vagrant snapshot list
==> vm1:
snapshot1
snapshot2
snapshot3
==> vm2:
snapshot2
snapshot3

You can then restore the snapshots based on the unique name for the complete lab or per VM.
In the Vagrant VMWare plugin, the "vagrant snapshot list" returns a tree like list instead:

$ vagrant snapshot list
==> vm1:
snapshot1
snapshot1/snapshot2
snapshot1/snapshot2/snapshot3
==> vm2:
snapshot2
snapshot2/snapshot3

You must then pass the "path" in the vagrant snapshot restore command instead of only passing the snapshot name.
Trying to restore "snapshot2" for example would result in this error:

The snapshot name `snapshot2` was not found for the
virtual machine `vm1`.

To restore the snapshot, you need to pass the full path like "vagrant snapshot restore snapshot1/snapshot2".
However, this doesn't work in the example above since the path to "snapshot2" is different on both VMs. So it is not possible to restore this snapshot in one command.

The fix would be to handle the snapshots without the tree like structure like it is done in Virtualbox.

Expected behavior

Doing a 'vagrant snapshot list' should return the list of snapshots without the tree structure.

$ vagrant snapshot list
==> vm1:
snapshot1
snapshot2
snapshot3
==> vm2:
snapshot2
snapshot3

Restoring a snapshot should only take the snapshot name only even if we have nested snapshots.

Actual behavior

vagrant snapshot list returns a tree like output:

$ vagrant snapshot list
==> vm1:
snapshot1
snapshot1/snapshot2
snapshot1/snapshot2/snapshot3
==> vm2:
snapshot2
snapshot2/snapshot3

vagrant snapshot restore requires the full path to the snapshot instead of only the snapshot name:

vagrant snapshot restore snapshot1/snapshot2/snapshot3

Reproduction information

Vagrant version

2.4.7

Host operating system

Windows

Guest operating system

Oracle Linux 8

Steps to reproduce

See description above

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions