2015-09-08 119 views
0

有谁知道如何获得当前快照名称,使用pyshpere API?
https://code.google.com/p/pysphere/wiki/GettingStarted#List_snapshotsPysphere获取当前快照名称

+0

我没有找到这样的选项只拿到所有快照,删除当前快照或恢复到它 – JavaSa

+0

请[编辑]你的问题澄清你的具体问题或添加额外的细节,突显正是你需要的。正如目前所写,很难确切地说出你在问什么。请参阅[问]页面以获得澄清此问题的帮助。 – JosefZ

回答

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/[email protected]@[email protected]@[email protected]init.py/173/pysphere.vi_mor.MORTypes

祝你好运!