最新消息:

xenserver cli 列出所有的vm VPC端口

未分类 admin 3024浏览 0评论
#!/bin/bash
for UUID in $(/opt/xensource/bin/xe vm-list power-state=running --minimal | tr ,  ); do
NAME=$(/opt/xensource/bin/xe vm-list uuid="${UUID}" params=name-label,dom-id | sed 's/.*: //' | sed -n -e '1p')
DOMID=$(/opt/xensource/bin/xe vm-list uuid="${UUID}" params=name-label,dom-id | sed 's/.*: //' | sed -n -e '2p')
VNCPORT=$(/usr/bin/xenstore-ls /local/domain/"${DOMID}"/console | grep ^vnc-port | awk '{print $3}' | tr -d ")
TCPORT=$(/usr/bin/xenstore-ls /local/domain/"${DOMID}"/console | grep ^vnc-port | awk '{print $3}' | tr -d ")
echo "${UUID} (${NAME}) is running on port ${VNCPORT} tcport:${TCPORT}"
done

列出指定的vm name

list vnmane

#!/bin/bash
DOMID=$(/opt/xensource/bin/xe vm-list name-label="${1}" params=name-label,dom-id | sed 's/.*: //' | sed -n -e '2p')
VNCPORT=$(/usr/bin/xenstore-ls /local/domain/"${DOMID}"/console | grep ^vnc-port | awk '{print $3}' | tr -d ")
TCPORT=$(/usr/bin/xenstore-ls /local/domain/"${DOMID}"/console | grep ^vnc-port | awk '{print $3}' | tr -d ")
echo "${UUID} (${1}) is running on port ${VNCPORT} tcport:${TCPORT}"

转载请注明:爱开源 » xenserver cli 列出所有的vm VPC端口

您必须 登录 才能发表评论!