简体   繁体   中英

Pysphere get current snapshot name

Does anybody know how to get current snapshot name, using pyshpere api?
https://code.google.com/p/pysphere/wiki/GettingStarted#List_snapshots

    # 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()

It's always a good idea to refer to the basic libraries. Here is the link for pysphere. http://nullege.com/codes/show/src@p@y@pysphere-HEAD@pysphere@ init .py/173/pysphere.vi_mor.MORTypes

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM