Not being able to storage vMotion

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

Not being able to storage vMotion

Rearden
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 x.name == dsName:
        print x
        print x.name
        return x


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

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
vm.Relocate(relocate_spec)

Disconnect(si)

============


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?

Loading...