有人知道如何使用 pyshpere api 获取当前快照名称吗?
https://code.google.com/p/pysphere/wiki/GettingStarted#List_snapshots
问问题
586 次
1 回答
0
# This ignores the certificate warning
default_context = ssl._create_default_https_context
ssl._create_default_https_context = ssl._create_unverified_context
# Connect to the VMware instance
server_instance = pysphere.VIServer();
server_instance.connect(ipaddress,username,password)
# Create a VM object of which details are required
vm = server_instance.get_vm_by_name(vmname)
# This gets the status of the VM.
print vm.get_status()
# This gets the current snapshot name.
print vm.get_current_snapshot_name()
参考基本库总是一个好主意。这是 pysphere 的链接。http://nullege.com/codes/show/src@p@y@pysphere-HEAD@pysphere@init .py/173/ pysphere.vi_mor.MORTypes
祝你好运!
于 2016-08-03T15:59:29.703 回答