---
name: "Sys::Virt::DomainSnapshot"
section: "3pm"
platform: "linux"
package: "perl-sys-virt"
version: "12.7.0-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Sys::Virt::DomainSnapshot"
---

# Sys::Virt::DomainSnapshot(3pm)

Represent & manage a libvirt guest domain

## NAME

Sys::Virt::DomainSnapshot - Represent & manage a libvirt guest domain

## DESCRIPTION

The `"Sys::Virt::DomainSnapshot"` module represents a guest domain managed by the virtual machine monitor.

## METHODS

- my $str = $domss-\>**get\_name()**

  Return the name of the snapshot

- my $xml = $domss-\>get\_xml\_description($flags)

  Returns an XML document containing a complete description of the domain snapshot's configuration. The `$flags` parameter accepts the following constants

  - Sys::Virt::DomainSnapshot::XML\_SECURE

    Include security sensitive information in the XML dump, such as passwords.

- $domss-\>delete($flags)

  Deletes this snapshot object & its data. The optional `$flags` parameter controls what should be deleted via the `"Sys::Virt::DomainSnapshot::DELETE_*"` constants.

- $domss-\>revert\_to($flags)

  Revert the domain to the state associated with this snapshot. The optional `$flags` control the state of the VM after the revert via the `"Sys::Virt::DomainSnapshot::REVERT_*"` constants.

- $parentss = $domss-\>**get\_parent()**;

  Return the parent of the snapshot, if any

- $res = $domss-\>**is\_current()**

  Returns a true value if this is the current snapshot. False otherwise.

- $res = $domss-\>**has\_metadata()**

  Returns a true value if this snapshot has metadata associated with it.

- $count = $domss-\>**num\_of\_child\_snapshots()**

  Return the number of saved snapshots which are children of this snapshot

- @names = $domss-\>**list\_child\_snapshot\_names()**

  List the names of all saved snapshots which are children of this snapshot . The names can be used with the `"lookup_snapshot_by_name"`

- @snapshots = $domss-\>**list\_child\_snapshots()**

  Return a list of all snapshots that are children of this snapshot. The elements in the returned list are instances of the Sys::Virt::DomainSnapshot class. This method requires O(n) RPC calls, so the `"list_all_children"` method is recommended as a more efficient alternative.

- my @snapshots = $domss-\>list\_all\_children($flags)

  Return a list of all domain snapshots that are children of this snapshot. The elements in the returned list are instances of the Sys::Virt::DomainSnapshot class. The `$flags` parameter can be used to filter the list of return domain snapshots.

## CONSTANTS

### SNAPSHOT CREATION

The following constants are useful when creating snapshots

- Sys::Virt::DomainSnapshot::CREATE\_CURRENT

  Set the defined snapshot to be the current snapshot

- Sys::Virt::DomainSnapshot::CREATE\_DISK\_ONLY

  Only snapshot the disk, not the memory state

- Sys::Virt::DomainSnapshot::CREATE\_HALT

  Stop the guest after creating the snapshot

- Sys::Virt::DomainSnapshot::CREATE\_NO\_METADATA

  Do not save any metadata for the snapshot

- Sys::Virt::DomainSnapshot::CREATE\_REDEFINE

  Replace/set the metadata with the snapshot

- Sys::Virt::DomainSnapshot::CREATE\_QUIESCE

  Quiesce the guest disks while taking the snapshot

- Sys::Virt::DomainSnapshot::CREATE\_REUSE\_EXT

  Reuse the existing snapshot data files (if any)

- Sys::Virt::DomainSnapshot::CREATE\_ATOMIC

  Create multiple disk snapshots atomically

- Sys::Virt::DomainSnapshot::CREATE\_LIVE

  Create snapshot while the guest is running

- Sys::Virt::DomainSnapshot::CREATE\_VALIDATE

  Validate the XML document against the schema

### SNAPSHOT DELETION

The following constants are useful when deleting snapshots

- Sys::Virt::DomainSnapshot::DELETE\_CHILDREN

  Recursively delete any child snapshots

- Sys::Virt::DomainSnapshot::DELETE\_CHILDREN\_ONLY

  Only delete the child snapshots

- Sys::Virt::DomainSnapshot::DELETE\_METADATA\_ONLY

  Only delete the snapshot metadata

### SNAPSHOT LIST

The following constants are useful when listing snapshots

- Sys::Virt::DomainSnapshot::LIST\_METADATA

  Only list snapshots which have metadata

- Sys::Virt::DomainSnapshot::LIST\_ROOTS

  Only list snapshots which are root nodes in the tree

- Sys::Virt::DomainSnapshot::LIST\_DESCENDANTS

  Only list snapshots which are descendants of the current snapshot

- Sys::Virt::DomainSnapshot::LIST\_LEAVES

  Only list leaf nodes in the snapshot tree

- Sys::Virt::DomainSnapshot::LIST\_NO\_LEAVES

  Only list non-leaf nodes in the snapshot tree

- Sys::Virt::DomainSnapshot::LIST\_NO\_METADATA

  Only list snapshots without metadata

- Sys::Virt::DomainSnapshot::LIST\_ACTIVE

  Only list snapshots taken while the guest was running

- Sys::Virt::DomainSnapshot::LIST\_INACTIVE

  Only list snapshots taken while the guest was inactive

- Sys::Virt::DomainSnapshot::LIST\_EXTERNAL

  Only list snapshots stored in external disk images

- Sys::Virt::DomainSnapshot::LIST\_INTERNAL

  Only list snapshots stored in internal disk images

- Sys::Virt::DomainSnapshot::LIST\_DISK\_ONLY

  Only list snapshots taken while the guest was running, which did not include memory state.

- Sys::Virt::DomainSnapshot::LIST\_TOPOLOGICAL

  Sort list in topological order wrt to parent/child relationships.

### SNAPSHOT REVERT

The following constants are useful when reverting snapshots

- Sys::Virt::DomainSnapshot::REVERT\_PAUSED

  Leave the guest CPUs paused after reverting to the snapshot state

- Sys::Virt::DomainSnapshot::REVERT\_RUNNING

  Start the guest CPUs after reverting to the snapshot state

- Sys::Virt::DomainSnapshot::REVERT\_FORCE

  Force the snapshot to revert, even if it is risky to do so

- Sys::Virt::DomainSnapshot::REVERT\_RESET\_NVRAM

  Reset the firmware NVRAM state from its original template

## AUTHORS

Daniel P. Berrange \<berrange@redhat.com\>

## COPYRIGHT

Copyright (C) 2006 Red Hat Copyright (C) 2006-2007 Daniel P. Berrange

## LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file.

## SEE ALSO

Sys::Virt, Sys::Virt::Error, `"http://libvirt.org"`
