Hi Mabroor,
You can access to all the vSphere sdk API from pysphere (so virtually, you should be able to do everything you can do from the vSphere Client or CLI).
On the other hand I try to provide some simplified interfaces for some methods (in particular virtual machines related methods) so users do not need to deal with the complexity of the vSphere SDK.
Regarding vmotion, I've just implemented a "migrate" method in virtual machine objects (if that is what you need), so you might want to try the current trunk version.
If you want to use the last stable version (pysphere 0.1.5), you might still want to check the svn trunk to see how I wrote the "migrate" method and implement something similar yourself.
Here there's an example on how to migrate a vm with the current trunk version of pysphere:
>>> from pysphere import *
>>> s = VIServer()
>>> s.connect("vcenter", "user", "password")
>>>
>>> s.get_hosts()
...
>>> vm = s.get_vm_by_path("[datastore1] path/to/config/file.vmx")
>>>
>>> vm.migrate(host='host-1029')
>>> vm.properties._flush_cache()
>>> s.disconnect()
There are other parameters you can provide to the migrate method. For example to migrate from resource pool as well, or to run the task asynchronously. I'm copying here the method signature and its doc string.
def migrate(self, sync_run=True, priority='default', resource_pool=None,
host=None, state=None):
"""
Cold or Hot migrates this VM to a new host or resource pool.
@sync_run: If True (default) waits for the task to finish, and returns
(raises an exception if the task didn't succeed). If False the task
is started an a VITask instance is returned.
@priority: either 'default', 'high', or 'low': priority of the task that
moves the vm. Note this priority can affect both the source and
target hosts.
@resource_pool: The target resource pool for the virtual machine. If the
pool parameter is left unset, the virtual machine's current pool is
used as the target pool.
@host: The target host to which the virtual machine is intended to
migrate. The host parameter may be left unset if the compute
resource associated with the target pool represents a stand-alone
host or a DRS-enabled cluster. In the former case the stand-alone
host is used as the target host. In the latter case, the DRS system
selects an appropriate target host from the cluster.
@state: If specified, the virtual machine migrates only if its state
matches the specified state.
"""
Is that what you needed? Hope it helps,
Regards,
Sebastian.