Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
:
tools
>
inventory-system
> vm-functions.sh
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File vm-functions.sh of Package inventory-system (Revision 120)
Currently displaying revision
120
,
show latest
# 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}" }