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$flagsparameter 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$flagsparameter controls what should be deleted via theSys::Virt::DomainSnapshot::DELETE_*constants ποΈ$domss->revert_to($flags)β reverts the domain to the state associated with this snapshot. The optional$flagscontrol the state of the VM after the revert via theSys::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 thelookup_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 theSys::Virt::DomainSnapshotclass. Heads up though: this method requires O(n) RPC calls, so thelist_all_childrenmethod 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 theSys::Virt::DomainSnapshotclass. The$flagsparameter 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 snapshotSys::Virt::DomainSnapshot::CREATE_DISK_ONLYβ only snapshot the disk, not the memory stateSys::Virt::DomainSnapshot::CREATE_HALTβ stop the guest after creating the snapshotSys::Virt::DomainSnapshot::CREATE_NO_METADATAβ do not save any metadata for the snapshotSys::Virt::DomainSnapshot::CREATE_REDEFINEβ replace/set the metadata with the snapshotSys::Virt::DomainSnapshot::CREATE_QUIESCEβ quiesce the guest disks while taking the snapshotSys::Virt::DomainSnapshot::CREATE_REUSE_EXTβ reuse the existing snapshot data files (if any)Sys::Virt::DomainSnapshot::CREATE_ATOMICβ create multiple disk snapshots atomicallySys::Virt::DomainSnapshot::CREATE_LIVEβ create snapshot while the guest is runningSys::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 snapshotsSys::Virt::DomainSnapshot::DELETE_CHILDREN_ONLYβ only delete the child snapshotsSys::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 metadataSys::Virt::DomainSnapshot::LIST_ROOTSβ only list snapshots which are root nodes in the treeSys::Virt::DomainSnapshot::LIST_DESCENDANTSβ only list snapshots which are descendants of the current snapshotSys::Virt::DomainSnapshot::LIST_LEAVESβ only list leaf nodes in the snapshot treeSys::Virt::DomainSnapshot::LIST_NO_LEAVESβ only list non-leaf nodes in the snapshot treeSys::Virt::DomainSnapshot::LIST_NO_METADATAβ only list snapshots without metadataSys::Virt::DomainSnapshot::LIST_ACTIVEβ only list snapshots taken while the guest was runningSys::Virt::DomainSnapshot::LIST_INACTIVEβ only list snapshots taken while the guest was inactiveSys::Virt::DomainSnapshot::LIST_EXTERNALβ only list snapshots stored in external disk imagesSys::Virt::DomainSnapshot::LIST_INTERNALβ only list snapshots stored in internal disk imagesSys::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 stateSys::Virt::DomainSnapshot::REVERT_RUNNINGβ start the guest CPUs after reverting to the snapshot stateSys::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 π
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
- epel 10: perl-Sys-Virt 12.4.0-1.el10_3 Β· GPL-2.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms