Loading...

xenserver cli 列出所有的vm VPC端口

2013-04-02 19:59:30 发表于互联网事 本文链接: xenserver cli 列出所有的vm VPC端口

#!/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}”

标签:
发表于 2013-04-02 19:59:30 目录:互联网事 [RSS 2.0] 你可以发表评论, 或者从您的网站 trackback
  • 相关阅读
  • homezz 美国专业主机商
    板凳还空着的
    评论分页: 1
    (Required)
    (Required, not published)
    如果留言未显示无需重复留言,我将为你恢复!