# get list of virtual machines function get_system_virtual_guests { [ "`is_disabled $FUNCNAME`" == "1" ] && return CMDS="virsh xm xe" for CMD in ${CMDS} ; do CMDNAME=`echo ${CMD} | awk '{print toupper($1) }' | sed -e s@"-"@""@g` export $(eval "echo ${CMDNAME}")=`which ${CMD} 2>/dev/null` if [ -z "${!CMDNAME}" ] ; then debug "Command: ${CMD} not found!" else debug "Found command $(echo $CMDNAME) in ${!CMDNAME}" fi done case `get_system_type` in xen-dom0|baremetal) if [ -n "${VIRSH}" ] ; then VMS=`${VIRSH} -q list | ${GREP} -v Domain-0 | ${AWK} '{print $2}' | ${SORT} -u` elif [ -n "${XM}" ] ; then VMS=`${XM} list | ${GREP} -v -E '(^Name|^Domain-0)' | ${AWK} '{print $1}' | ${SORT} -u` elif [ -n "${XE}" ] ; then VMS=`${XE} vm-list is-control-domain=false params=name-label | ${AWK} '{print $NF}'| ${GREP} -v ^$ | ${SORT} -u` else VMS="" fi ;; *) VMS="" ;; esac debug "GET-SYSTEM-VIRTUAL-GUESTS: ${VMS}" echo "${VMS}" }