vSphere source locators point to a virtual machine or vApp within the virtual infrastructure. The vSphere target locator provides all required information for importing an OVF package or virtual machine into a cluster, host or resource pool. Both source and target locator use the same syntax:
vi://<username>:<password>@<host>:<port>/<search-term>
The server name and port can designate either a vCenter server or an ESXi host. If you omit credentials, OVF Tool prompts you for them. Default installations of vCenter Server and ESXi use port 443. If you are using the default port, you do not need to specify it. When using OVF Tool with VMware Server, you had to specify port 8333, the default port for this discontinued product.
The search term has the following format:
<path>[?<query>=<value>]
If a query is not given, a VC inventory path lookup is performed using the specified path. Otherwise, the object matching the query is used. The meaning of the query depends on the object type. Source and Target Values for All Query Types shows the different values that you can use in the query field.
Name | Query | Source | Target |
---|---|---|---|
BIOS | bios | BIOS ID of a virtual machine | BIOS ID of a host |
Datastore | ds | Datastore path to a virtual machine | N/A |
IP Address | ip | IP address of a virtual machine | IP address of a host |
DNS | dns | DNS name of a virtual machine | DNS name of a host |
Mo-Ref | moref | Managed object reference (vSphere specific identifier) of a virtual machine or vApp | Managed object reference (vSphere specific identifier) of a host, cluster, or resource pool |
Examples of Query Values shows example values for each query type.
Name | Query | Example Value |
---|---|---|
BIOS | bios | vi://localhost?bios=234290984 |
Datastore | ds | vi://localhost/TestDatacenter?ds=[foo]/myvm/myvm.vmx |
IP Address | ip | vi://localhost?ip=123.231.232.232 |
DNS | dns | vi://localhost?dns=production-vm3.example.com |
Mo-Ref | moref | vi://localhost?moref=vim.VirtualMachine:vm-23423 |
Note: For the same VM, the Managed Object Reference (MoRef) will be different for vCenter Server than it is for the ESXi host. For instance, the same VM can have a MoRef of ‘vm-92’ in vCenter Server and ‘118’ in the ESXi host. Also note that the syntax contains ‘vm-’ for a vCenter Server MoRef. When the Motif is defined by vCenter Server, you can see it in the browser address and use it directly. The OVF Tool script doesn't define and parse the format of a MoRef. |
You can enter a partial source locator if you do not know the entire inventory path. In this case, the tool fails but suggests possible inventory path completions.
Specifying the Inventory Path to a Virtual Machine or vApp
To specify an inventory path for a virtual machine or vApp, use the following syntax:
<datacenter name>/vm/<folders>/<vm or vApp name>
or
<datacenter name>/host/<resource pool path>/<vm or vApp name>
The use of the vm tag after the datacenter name specifies that you are locating a virtual machine or vApp in the VM and Template view. Use the host tag after the datacenter name if you are locating a virtual machine or vApp in the Host and Clusters view.
The following example shows an inventory path without any folders:
MyDatacenter/vm/MyVM
The following example shows an inventory path with two nested folders:
MyDatacenter/vm/Folder 1/Sub Folder/MyVM
Specifying the Inventory Path for a Cluster, Host, or Resource Pool
You can specify an inventory path for a host or a resource pool. You can nest resource pools similar to folders. To specify an inventory path for a host or a resource pool as part of target locators, use the following syntax:
<datacenter name>/host/<host name>/Resources/<resource pool>
- host and Resources. Fixed parts of the path.
- Resources. Specify only when a resource pool is specified.
- <resource pool>. Can take the value of one or more nested resource pools. If no resource pools are specified, the default resource pool for the host is used.
The following example is of an inventory path without a specified resource pool:
vi://username:pass@localhost/my_datacenter/host/esx01.example.com
The following example is of an inventory path with a specified resource pool:
vi://username:pass@localhost/my_datacenter/host/esx01.example.com/Resources/my_resourcepool