Sys::V...napshot(3pm)

πŸ¦‹ NAME πŸ¦‹

Sys::Virt::DomainSnapshot β€” bestie, this is the module that lets you represent and manage a snapshot of a libvirt guest domain πŸ’…βœ¨

(this page lives in the Perl User Contributed Documentation, and honestly? it ate)


🌸 DESCRIPTION 🌸

So the Sys::Virt::DomainSnapshot module represents a guest domain managed by the virtual machine monitor. That's the whole vibe β€” a snapshot object you can poke at with methods. Periodt 🫢


✨ METHODS ✨

  • my $str = $domss->get_name() β€” gives you back the name of the snapshot. iconic, short, useful πŸŽ€
  • my $xml = $domss->get_xml_description($flags) β€” hands you back 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 πŸ‘€ (yes, like, actually passwords, be careful bestie)
  • $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) β€” reverts 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(); β€” returns the parent of the snapshot, if any. family tree moment 🧚
  • $res = $domss->is_current() β€” true value if this is the current snapshot, false otherwise. main character check πŸ‘‘
  • $res = $domss->has_metadata() β€” true value if this snapshot has metadata associated with it πŸ“
  • $count = $domss->num_of_child_snapshots() β€” returns the number of saved snapshots which are children of this snapshot πŸ“
  • @names = $domss->list_child_snapshot_names() β€” lists 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() β€” returns 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. Heads up though: this method requires O(n) RPC calls, so the list_all_children method is recommended as a more efficient alternative 😭 (ngl, that's the one you want)
  • my @snapshots = $domss->list_all_children($flags) β€” returns 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 returned 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
⚠️ bestie, did you catch that? REVERT_FORCE is literally the "even if it is risky" one. it will do the thing. it does not care. you have been warned πŸ’€
  • Sys::Virt::DomainSnapshot::REVERT_RESET_NVRAM β€” reset the firmware NVRAM state from its original template

🫢 AUTHORS 🫢

Daniel P. Berrange <berrange@redhat.com> β€” ty for your service king πŸ‘‘


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 of these, your pick:

  • 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 πŸ’–


okay that's the whole page bestie, go forth and snapshot responsibly 🌸✨

this was perl v5.40.2, dated 2026-06-08 β€” mwah, xoxo, the Sys::V...napshot(3pm) girlies πŸ’…πŸ¦‹

πŸ“¦ where this page comes from