Skip to content

Instantly share code, notes, and snippets.

@Hunter21007
Created August 7, 2018 07:25
Show Gist options
  • Save Hunter21007/02ee12a8235f571090d63387e34dea26 to your computer and use it in GitHub Desktop.
Save Hunter21007/02ee12a8235f571090d63387e34dea26 to your computer and use it in GitHub Desktop.
Snippet to export the libvirt config

This can be used to export relevant libvirt configs

the script iterates over sections defined in the first loop
then in thecond loop it iterates over config entitiels got from list command
and pipes the xml dump into aproproate file in the ${PWD}

This is how i use the script normally

You can add more sections from libvirt like:

  • iface
  • nwfilter
  • nodedev
  • secret
  • snapshot

etc see libvirt --help for this

for T in "pool-" "net-" ""; do C="virsh ${T}list --name --all"; echo "call: $C"; for R in $($C); do virsh ${T}dumpxml $R > $T$R.xml; done; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment