Not being able to storage vMotion

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Not being able to storage vMotion

I am attempting to do a simple storage vMotion using pyvmomi but coming into some issues. Here is the code I am using (mostly stolen from the interwebz):

si = None
vcenter = "vc"
username = "user"
password = "pass"
targetDS = "destination"
vm_name = "myVM"

#Finds the datastore we want by name
def getDS(dsList, dsName):
  for x in dsList:
    if == dsName:
        print x
        return x

    si = SmartConnect(host=vcenter, user=username, pwd=password, port=443)
except IOError, e:

dsList = vmutils.get_datastores(si)
moveDS = getDS(dsList, targetDS)
# Finding source VM
vm = vmutils.get_vm_by_name(si, vm_name)

# relocate spec to migrate
relocate_spec = vim.vm.RelocateSpec(datastore=moveDS)

# does the actual migration to host



Output suggest that the datastore is found since it is returned the datastore name and ID however when the task is sent to vCenter an error is returned: "Unable to access the VM configuration: Unable to access file [datastore name]"

The error suggests it is trying to move files from the destination datastore instead of the source. Am I missing something basic here?