Highly Available and Scalable Information System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

eurybox.functions.export 1.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. #EuryBOX export functions file
  3. #Desc: export hv xml description
  4. #No arg required
  5. eurybox_export_hv_config ()
  6. {
  7. #Dumping network configuration
  8. for (( NET_NUM=0;NET_NUM<${EURYBOX_DETECTED_NETWORKS[NUM]};NET_NUM++ ))
  9. do
  10. DESTINATION=$EURYBOX_BACKUP_TMP_FOLDER/${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]}.libvirt.xml
  11. sudo sh -c "virsh $EURYBOX_VIRSH_OPTIONS net-dumpxml ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} > $DESTINATION"
  12. STATUS=$?
  13. if [[ !($STATUS -eq 0) ]]
  14. then
  15. eurybox_display_message error EXPORT "Error on net ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} configuration dump"
  16. else
  17. eurybox_display_message debug EXPORT "Successfully dumped net ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} configuration to $DESTINATION"
  18. EURYBOX_BACKUP_TARGETS[$((${#EURYBOX_BACKUP_TARGETS[@]}+1))]=$DESTINATION
  19. fi
  20. done
  21. #Dumping storage configuration
  22. }
  23. #Desc: export vm xml description
  24. #1 arg required: vm_name
  25. eurybox_export_vm_config ()
  26. {
  27. NAME=$1
  28. DESTINATION=$EURYBOX_BACKUP_TMP_FOLDER/$NAME.libvirt.xml
  29. sudo sh -c "virsh $EURYBOX_VIRSH_OPTIONS dumpxml $NAME > $DESTINATION"
  30. STATUS=$?
  31. if [[ !($STATUS -eq 0) ]]
  32. then
  33. eurybox_display_message error EXPORT "Error on vm $NAME configuration dump"
  34. else
  35. eurybox_display_message debug EXPORT "Successfully dumped vm $NAME configuration to $DESTINATION"
  36. EURYBOX_BACKUP_TARGETS[$((${#EURYBOX_BACKUP_TARGETS[@]}+1))]=$DESTINATION
  37. fi
  38. }