XCP: Difference between revisions
Jump to navigation
Jump to search
| Line 53: | Line 53: | ||
</pre> | </pre> | ||
=VM Autostart= | |||
*http://support.citrix.com/article/CTX133910 | |||
Revision as of 13:19, 18 February 2014
SATA to VM Access
- add following lines to /etc/udev/rules.d/50-udev.rules and reboot (will not be persistent across reboots)
ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'" ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
XCP Backup Script
#!/usr/bin/env bash
#DST_PATH="${DST_PATH:-/tmp}"
DST_PATH="/media/drobo/XCPBACK"
backup() {
uuid="$1"
label_name=$( xe vm-list uuid="$uuid" | grep 'name-label' | cut -b 24- )
snapshot_uuid=$( xe vm-snapshot vm="$uuid" new-name-label=backup_vm )
xe template-param-set is-a-template=false ha-always-run=false uuid="$snapshot_uuid"
filename="$DST_PATH/$( date +%Y-%m-%d )-$uuid.xva"
echo "Filename:"
echo $filename
xe vm-export vm="$snapshot_uuid" filename="$filename"
xe vm-uninstall uuid="$snapshot_uuid" force=true
}
backup_all() {
options="vm-list is-control-domain=false is-a-template=false is-a-snapshot=false"
for uuid in $( xe $options | grep 'uuid' | awk -F': ' '{ print $2 }' ); do
backup "$uuid"
done
}
if [[ -z "$1" ]]; then
echo "Usage: $0 (<UUID>|all)"
echo "VMs Active:"
xe vm-list
exit 2
fi
if [[ "$1" = "all" ]]; then
backup_all
else
backup "$1"
fi