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.

43 lines
1.3 KiB

  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_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. #TODO!
  23. }
  24. #Desc: export vm xml description
  25. #1 arg required: vm_name destination
  26. eurybox_export_vm_config ()
  27. {
  28. NAME=$1
  29. DESTINATION=$2
  30. sudo sh -c "virsh $EURYBOX_VIRSH_OPTIONS dumpxml $NAME > $DESTINATION"
  31. STATUS=$?
  32. if [[ !($STATUS -eq 0) ]]
  33. then
  34. eurybox_display_message error EXPORT "Error on vm $NAME configuration dump"
  35. else
  36. eurybox_display_message debug EXPORT "Successfully dumped vm $NAME configuration to $DESTINATION"
  37. fi
  38. }