xenserver 知识点记录

1. 问题一:如何判断一个VM已启动完成?有时候需要统计一台xenserver上所有的VM启动起来花了多长时间

参考链接:http://xapi-project.github.io/xen-api/usage.html

具体如果实现再研究。

 

 

2. 问题二:用命令行关闭一个虚拟机,如何判断虚拟机已经完全关闭了。

参考链接:http://xapi-project.github.io/xen-api/usage.html

# Check the power state of the vm
name=$(${XE} vm-list uuid=${vmuuid} params=name-label --minimal)
state=$(${XE} vm-list uuid=${vmuuid} params=power-state --minimal)
wasrunning=0

# If the VM state is running, we shutdown the vm first
if [ "${state}" = "running" ]; then
        ${XE} vm-shutdown uuid=${vmuuid}
        ${XE} event-wait class=vm power-state=halted uuid=${vmuuid}
        wasrunning=1
fi

 xe event-wait class 具体有多少,待研究。

3. 问题三,如何判断一个VM已启动完成

参考链接:https://discussions.citrix.com/topic/239735-event-wait-options/

xe event-wait class="vm" name-label=<VM NAME> power-state=running PV-drivers-up-to-date=true

通过监控这条命令完成的时间,也可大致判断启动一台VM所需要的时间。

posted @ 2017-12-12 18:19  hayden__wang  阅读(215)  评论(0编辑  收藏  举报