One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
perl-Sys-Virt
/
examples
/
View File Name :
save-restore.pl
#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $xml = <<EOF; <domain type='kvm'> <name>perl-demo</name> <memory>219200</memory> <currentMemory>219136</currentMemory> <vcpu>1</vcpu> <os> <type arch='i686'>hvm</type> <boot dev='network'/> </os> <features> <acpi/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <serial type='pty'> <target port='0'/> </serial> </devices> </domain> EOF my $conn = Sys::Virt->new(uri => "qemu:///session"); print "Starting a transient guest\n"; my $dom = $conn->create_domain($xml); print "Saving the guest\n"; my $curxml = $dom->get_xml_description(); $dom->save("perl-demo.img", $curxml, Sys::Virt::Domain::SAVE_BYPASS_CACHE); my $newxml = $conn->get_save_image_xml_description("perl-demo.img"); print $newxml; print "Restoring the guest\n"; $conn->restore_domain("perl-demo.img", $newxml, Sys::Virt::Domain::SAVE_BYPASS_CACHE); print "Destroying the guest\n"; $dom = $conn->get_domain_by_name("perl-demo"); $dom->destroy; unlink "perl-demo.img";