Created
April 12, 2017 08:22
-
-
Save mb00g/d4837d91c912b18380ec73a2527bdae9 to your computer and use it in GitHub Desktop.
Export VM Metadata XenServer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=$(date +%d%B%y) | |
XSNAME=`echo $HOSTNAME` | |
BACKUPPATH=/opt/$XSNAME | |
mkdir -p $BACKUPPATH | |
xe vm-list is-control-domain=false is-a-snapshot=false | grep uuid | cut -d":" -f2 > /$BACKUPPATH/list-uuids.txt | |
while read line | |
do | |
VMNAME=`xe vm-list uuid=$line | grep name-label | cut -d":" -f2 | sed 's/^ *//g'` | |
xe vm-export filename="$BACKUPPATH/$VMNAME-$DATE.vmmeta" uuid=$line metadata=true | |
done < /$BACKUPPATH/list-uuids.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment