2015-09-08 121 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

祝你好運!