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.

42 lines
1.3 KiB

#!/bin/bash
#EuryBOX export functions file
#Desc: export hv xml description
#No arg required
eurybox_export_hv_config ()
{
#Dumping network configuration
for (( NET_NUM=0;NET_NUM<${EURYBOX_DETECTED_NETWORKS[NUM]};NET_NUM++ ))
do
DESTINATION=$EURYBOX_TMP_FOLDER/${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]}.libvirt.xml
sudo sh -c "virsh $EURYBOX_VIRSH_OPTIONS net-dumpxml ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} > $DESTINATION"
STATUS=$?
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message error EXPORT "Error on net ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} configuration dump"
else
eurybox_display_message debug EXPORT "Successfully dumped net ${EURYBOX_DETECTED_NETWORKS[NAME,$NET_NUM]} configuration to $DESTINATION"
EURYBOX_BACKUP_TARGETS[$((${#EURYBOX_BACKUP_TARGETS[@]}+1))]=$DESTINATION
fi
done
#Dumping storage configuration
#TODO!
}
#Desc: export vm xml description
#1 arg required: vm_name destination
eurybox_export_vm_config ()
{
NAME=$1
DESTINATION=$2
sudo sh -c "virsh $EURYBOX_VIRSH_OPTIONS dumpxml $NAME > $DESTINATION"
STATUS=$?
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message error EXPORT "Error on vm $NAME configuration dump"
else
eurybox_display_message debug EXPORT "Successfully dumped vm $NAME configuration to $DESTINATION"
fi
}