Hi Seba,
Thanks for your reply - the information you gave below was enough for me to debug this problem. Here is what I found:
My hosts are set up as standalone hosts, and there is only the default (root) resource pool on each. If I call server.get_resource_pools(), I get two pools returned, one for each host. When I vMotion a VM using the vSphere client, I can see that it is passing the resource pool MOR as part of the MigrateVM_Task request. So it seems that even though VMware's own API documentation states that the resource pool may be left empty, this is not in fact always the case. If I call vm.migrate() with a valid resource pool for the target host, the operation is successful.
My remaining question is how best to get the root resource pool for a given host. It seems to be a property of the ComputeResource object, but I couldn't readily find a way to obtain the ComputeResource for a HostSystem. My current approach is to look at the value of
pool.owner.name which gives the name of the host containing that resource pool.
Regards,
Chris