Pysphere get current snapshot name

722 Views Asked by At

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

1

There are 1 best solutions below

0
On
    # 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!