715
edits
Changes
no edit summary
else:
sys.exit("Invalid choice, your VM options are centos1, centos2, centos3")
</pre>
=== Else, we are doing a full backup (all 3 VMs) ===
Use the below sample to back up centos1. Modify it for centos2 and centos3.
<pre>
print("Backing up centos1")
os.system("virsh dumpxml centos1 > /home/jmcarman/backups/centos1.xml")
os.system("gzip < /var/lib/libvirt/images/centos1.qcow2 > /home/jmcarman/backups/centos1.qcow2.gz")
</pre>
=== Exit with success ===
Finally, we should exit successfully. This isn't technically necessary, but is a good practice.
<pre>
sys.exit()
</pre>