====== Virtualization ======
VMware OS Optimization Tool. -
===== pre installed virtualbox images =====
https://www.sysprobs.com/download-pre-installed-virtualbox-images-linux-windows#Windows-VMs \\
===== KVM =====
* https://kb.novaordis.com/index.php/Linux_Virtualization_Concepts https://kb.novaordis.com/index.php/KVM_Virtual_Machine_XML_Defintion https://kb.novaordis.com/index.php/KVM_Virtual_Networking_Concepts
* [[https://serveradmin.ru/kvm-backup/|KVM backup]] - https://bozza.ru/art-337.html
* qemu-img https://blog.programster.org/qemu-img-cheatsheet
* compress ''pigz -c ./MISOJ-auth.hdd > /home/vm/MISOJ-auth.hdd.gz''
* decompress ''pigz -d -c ./MISOJ-auth.hdd.gz > /home/vm/MISOJ-auth.hdd''
* for windows 7 virtio last version 0.1.173-4
* https://recoverhdd.com/blog/how-to-repair-boot-record-mbr-windows-guide.html#ch1 - fix boot
* centos 8 virtualization https://computingpost.medium.com/how-to-install-and-use-kvm-on-centos-stream-8-2816ca196ff6
* centos 7 configure with network manager https://www.server-world.info/en/note?os=CentOS_7&p=kvm
===== Qemu =====
* start qemu without libvirt, raw start
==== Virsh ====
* virsh cheatcode https://computingforgeeks.com/virsh-commands-cheatsheet/
==== Backup Snapshots ====
* commands and logic https://sysguides.com/create-and-manage-internal-snapshots-in-kvm
* old scripts https://b14esh.com/virtualization/kvm/backup-vm-qemu-kvm-libvirt.html
==== Nested virtualization - hyper-v ====
* https://www.redpill-linpro.com/techblog/2021/04/07/nested-virtualization-hyper-v-in-qemu-kvm.html
==== Qemu - checkpoints ====
Testing system updates using libvirts checkpoint feature - https://abbbi.github.io/changes/ \\
virtndbackup error - https://github.com/abbbi/virtnbdbackup/discussions/119 \\
working with bitmaps qmp https://kashyapc.fedorapeople.org/QEMU-Docs/_build/html/docs/interop/bitmaps.html#id1 \\
# bitmap
qemu-img bitmap --remove ./local_copy_1_154.hdd.qcow2 virtnbdbackup.1
#snapshot
qemu-img snapshot -l $DISK_IMAGE.qcow2 # List Snapshots
#Snapshots also appear in the output of the qemu-img info command.
qemu-img snapshot -c $SNAPSHOT_NAME $DISK_IMAGE #Create Snapshot
qemu-img snapshot -a $SNAPSHOT_NAME $DISK_IMAGE #Restore (Apply) Snapshot
qemu-img snapshot -d $SNAPSHOT_NAME $DISK_IMAGE #Delete Snapshot
++++ Checkpoints increment backup|
# Libvirt - checkpoints - dirtybitmap
article for incremental backup - https://abbbi.github.io/changes/
## Commands
virsh checkpoint-create
virsh qemu-monitor-command one-31 --pretty '{"execute": "query-block", "arguments": {}}'
qemu-img info --output json --force-share /var/lib/one/datastores/0/31/disk.0
## Manual
1.https://qemu-project.gitlab.io/qemu/interop/bitmaps.html#bitmap-status
1.https://qemu-project.gitlab.io/qemu/interop/dbus-vmstate.html
## Interesting manual with commands
1.https://github.com/OpenNebula/one/issues/6206 - in first message examples of commands
1.
Example of create chekpoints and use it
12:23:12.061 [CMD]: virsh --connect qemu:///system checkpoint-list --name 0f297c4b-001f-434d-9123-739342da23fb
12:23:12.079 [CMD]: DONE
12:23:12.080 [CMD]: virsh --connect qemu:///system domfsfreeze 0f297c4b-001f-434d-9123-739342da23fb
12:23:12.149 [CMD]: DONE
12:23:12.152 [CMD]: qemu-img create -f qcow2 /var/lib/one//datastores/0/36/tmp/scracth.0.qcow2 256M
12:23:12.211 [CMD]: DONE
12:23:12.211 [CMD]: virsh --connect qemu:///system backup-begin --reuse-external --backupxml /var/lib/one//datastores/0/36/tmp/backup.xml --checkpointxml /var/lib/one//datastores/0/36/tmp/checkpoint.xml 0f297c4b-001f-434d-9123-739342da23fb
12:23:12.641 [CMD]: DONE
12:23:12.641 [CMD]: virsh --connect qemu:///system domfsthaw 0f297c4b-001f-434d-9123-739342da23fb
12:23:12.716 [CMD]: DONE
12:23:12.719 [CMD]: nbdinfo --json --map=qemu:dirty-bitmap:backup-vda nbd+unix:///vda?socket=/var/lib/one//datastores/0/36/backup.socket
12:23:12.726 [CMD]: DONE
12:23:12.726 [CMD]: qemu-img create -f qcow2 -F raw -b nbd+unix:///vda?socket=/var/lib/one//datastores/0/36/backup.socket /var/lib/one//datastores/0/36/backup/disk.0.2
12:23:12.794 [CMD]: DONE
12:23:12.794 [CMD]: qemu-io
12:23:13.034 [CMD]: DONE
12:23:13.034 [BCK]: Incremental backup done in 0.955029454s
12:23:13.034 [CMD]: virsh --connect qemu:///system domjobabort 0f297c4b-001f-434d-9123-739342da23fb
12:23:13.054 [CMD]: DONE
12:23:13.055 [CMD]: virsh --connect qemu:///system checkpoint-list --name 0f297c4b-001f-434d-9123-739342da23fb
12:23:13.072 [CMD]: DONE
12:23:13.072 [CMD]: qemu-img info --output json --force-share /var/lib/datastores/local_mount/0/36/disk.0.snap/0
12:23:13.077 [CMD]: DONE
12:23:13.078 [CMD]: virsh --connect qemu:///system checkpoint-delete 0f297c4b-001f-434d-9123-739342da23fb one-36-0
12:23:13.399 [CMD]: DONE
````
++++
++++ Whole libvirt hierarchy of path|
# https://www.reddit.com/r/linuxquestions/comments/16kx0oi/how_do_i_change_libvirtqemuvirtmanager_s_xml/
# path of libvirt
/etc/libvirt/ Holds QEMU/Libvirt configurations files are.
/etc/libvirt/hooks/ Holds your own scripts that would starts when a specific VM does.
/etc/libvirt/nwfilter/ Looks like Libvirt has its own networking/firewall rules.
/etc/libvirt/qemu/ Holds VMs' XMLs are stored.
/etc/libvirt/qemu/networks/ Holds QEMU/Libvirt virtual networks' XMLs are.
/etc/libvirt/qemu/networks/autostart/ A QEMU/Libvirt virtual network XML symlinked there will make said virtual network starts when QEMU/Libvirt does.
/etc/libvirt/secrets/ ???
/etc/libvirt/storage/ Holds QEMU/Libvirt datastores/pool configurations files are.
/etc/libvirt/storage/autostart/ A QEMU/Libvirt datastore/pool configuration file symlinked there will make said datastore/pool starts when QEMU/Libvirt does.
/var/lib/libvirt/boot/ ???
/var/lib/libvirt/dnsmasq/ Holds further QEMU/Libvirt virtual networks' configuration files.
/var/lib/libvirt/images/ Default QEMU/Libvirt virtual disks' datastore/pool.
/var/lib/libvirt/qemu/ ???
/var/lib/libvirt/qemu/channel/ ???
/var/lib/libvirt/qemu/target/ ???
/var/lib/libvirt/qemu/checkpoint/ ???
/var/lib/libvirt/qemu/dump/ ???
/var/lib/libvirt/qemu/nvram/ Holds VMs' UEFI settings. Same goes for TPM and Secure Boot databases?
/var/lib/libvirt/qemu/ram/ ???
/var/lib/libvirt/qemu/ram/libvirt/ ???
/var/lib/libvirt/qemu/libvirt/qemu/ ???
/var/lib/libvirt/qemu/save/ Looks like it holds VMs' saved states.
/var/lib/libvirt/qemu/snapshot/ Looks like it's where VMs' snapshot are saved.
/var/lib/libvirt/sanlock/ ???
++++
==== Virsh from astra to redos ====
sed -i 's/pc-q35-7.2/pc-q35-6.1/g' ./vmconfig.virtnbdbackup.32.xml
sed -i 's//<\/seclabel-->/g' ./vmconfig.virtnbdbackup.32.xml
==== Virtualization CEPH ====
* https://insujang.github.io/2021-03-24/testing-ceph-rbd-performance-with-virtualization/