abbbi / virtnbdbackup

Backup utility for Libvirt / qemu / kvm supporting incremental and differential backups + instant recovery (agentless).
http://libvirtbackup.grinser.de/
GNU General Public License v3.0
345 stars 46 forks source link

Feature to backup xmls of guest networks configs #96

Closed damiankaczkowski closed 1 year ago

damiankaczkowski commented 1 year ago

Hi. Please consider enhancing virtnbdbackup with feature to backup xmls of networks configs used by guest alongside "vmconfig.copy.xml". I am talking about configs in "/etc/libvirt/qemu/networks". They can be listed by "virsh net-list" and dumped by "virsh net-dumpxml". Networks configs are required to restore guest to different location/hypervisor. For more advanced networks it is a must to have a backup of those configs. Good starting point would be to just allow virtnbdbackup to backup a copy of networks xmls used by guest. Reinstalling networks configs during recovery would be nice but not required. Greets.

abbbi commented 1 year ago

why not backup these files with a regular file backup solution like restic? First and foremost virtnbdbackup is about backing up the virtual machine disk data in a consistent way, not about backing up the complete libvirt configuration stack. If i would add features like backing up the relevant virtual machine network configuration, where to start and where to end? What if the virtual machine uses OVN or other networking backends where the configuration would need to be backed up too? What about the libvirt volume layout or other specific confiurations relevant to get the virtual machine up and running?

There would be tons of features to add, but none of them are relevant to me at the moment. Each feature added means i have to support the code in the future even if i dont use it. If you would like to create a full disaster recovery valid backup of your libvirt host i would recommend:

damiankaczkowski commented 1 year ago

Seems reasonable. But I still have a feeling that I miss something. You just can't restore (in a sense of reachability) machine with multiple interfaces and tagged vlans without this information. You need at least vlan info to at least know where you should connect which interface. Otherwise quest will not be reachable. Without this info in xmls, you will have to login to machine to check its configuration, which will be troublesome, moreover in case a guests that needs SSO and working network to login, this will be even more troublesome.

Also there is an inconsistency. For example, you can have a vlan information inside guest xml. But you can leverage just "portgoup" (openvsiwtch) element instead of direct vlan config which holds vlan information in network xml file. So in one case when you backup you store vlan info in other case you do not. It should be failry easy to just query network backend for source network then query portgroup and then export only that part of xml so we can just have necessary guest config for future usage.

I think such network config is more a guest config not libvirt config in general. Not sure about other backends.

abbbi commented 1 year ago

like said, implementing this is currently not in my use scope, you could introduce a script in your backup workflow that dumps specific network config xml via virsh to the same backup folder before or after the backup.

Im happy to merge a pull request that enhances virtnbdbackup, given the fact that it comes with proper test cases in the testsuite so its assured things dont break in the future.

Like you already mention, there can be many libvirt specific type of network configurations, and if implemented, virtnbdbackup should be able to handle them all (direct bridge, attached libvirt network, libvirt network controlled via openvswitch) and not just a specific one.

damiankaczkowski commented 1 year ago

Understood. Thank you for your time and advice. I am not able to provide a patch so I will close that. Greets.