title: Relocate VMX file with pyvmomi or REST API
body: <p>I was able to make this request to relocate a specific vdisk for a VM via REST call in python by running this code :</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import requests
  import json
  
  url = "https://myvcenter.local/rest/vcenter/vm/vm-12016?action=relocate"
  
  payload = json.dumps({
    "spec": {
      "disks": [
        {
          "value": {
            "datastore": "datastore-11"
          },
          "key": "2000"
        }
      ]
    }
  })
  headers = {
    'Content-Type': 'application/json',
    'vmware-api-session-id': 'myToken',
  }
  
  response = requests.request("POST", url, headers=headers, data=payload)</code></pre>
  </div>
  </div>
  </p>
  <p>This works , the vDisk was moved but not the VMX file that is on the same datastore.</p>
  <p>I tried also to do something with pyvmomi example to relocate VM , but I was not able to find out how to move the VMX file : <a href="https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/relocate_vm.py" rel="nofollow noreferrer">https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/relocate_vm.py</a></p>
  <p>The VMX file seems not to be a vim.vm.device.VirtualDisk object.</p>
  <p>Do you guys have any pointers for me to achieve a VMX file migration ? pyvmomi or REST call.</p>
  <p>Thanks</p>