You can import VMs from vSphere into your VMware Integrated OpenStack deployment and manage them like OpenStack instances.
About this task
You import VMs using the Datacenter Command Line Interface (DCLI), which is packaged with the VMware Integrated OpenStack management server, and is powered by the VMware Integrated OpenStack vAPI provider.
Though imported VMs become OpenStack instances, they remain distinct in several ways:
If the imported VM has multiple disks:
Existing networks are imported as provider network type port group, with subnets created with DHCP disabled. This prevents conflict between the DHCP node in OpenStack and the external DHCP server.
Note:
If the DHCP server cannot maintain the same IP address during lease renewal, the instance information in OpenStack will show the incorrect IP address. For this reason, it is recommended that you use static DHCP bindings on existing DHCP servers. Also, it is not recommended to launch new OpenStack instances on the imported networks since the DHCP address from the external server, if any, might conflict with OpenStack.
The flavor for the imported VM shows the correct CPU and memory but the root disk incorrectly displays as having 0 GB.
Prerequisites
Verify that you are running VMware Integrated OpenStack version 4.0.
Verify that VMware Integrated OpenStack is deployed and running.
Verify that the VMs to be imported are in the same vCenter.
Importing VMs is supported with NSX and the VDS plugin for Neutron.
Note:
If you are running VMware Integrated OpenStack 3.0, you cannot import VMs that are backed by a NSX logical switch. The network backing must be a regular distributed port group. This feature is supported in VMware Integrated OpenStack 3.1 and later.
Procedure
- Add the clusters containing the VMs to be imported to the VMware Integrated OpenStack deployment.
- In the vSphere Web Client, identify the cluster containing the VMs to be imported.
- Add the cluster to the VMware Integrated OpenStack deployment as a Nova compute cluster.
- Repeat for multiple clusters, if necessary.
After the cluster is added as a Nova compute cluster, you can import the VMs.
- Using SSH, log in to the VMware Integrated OpenStack manager.
- Connect to the VMware Integrated OpenStack vAPI endpoint.
The endpoint runs locally.
dcli +server http://localhost:9449/api +i
This command opens an interactive shell (dcli).
- List all namespaces in the VMware Integrated OpenStack vAPI provider.
dcli> com vmware vio
The vio namespace provides namespaces to manage components related to OpenStack and vSphere
Available Namespaces:
vm
- (Optional) List the commands related to importing unmanaged VMs.
Unmanaged VMs are VMs in VMware Integrated OpenStack that are not managed as OpenStack instances. In this case, the unmanaged VMs include the VMs in the cluster you added to the Compute node.
dcli> com vmware vio vm unmanaged
The Unmanaged namespace provides commands to manage virtual machine not under OpenStack
Available Commands:
importall Imports all unmanaged virtual machines into OpenStack
importvm Imports given virtual machine into OpenStack
list Enumerates the list of unmanaged virtual machines
- (Optional) List all unmanaged VMs in a specific target cluster that you added to the Nova Compute node.
com vmware vio vm unmanaged list --cluster <vcenter cluster mor-id>
- Import VMs into VMware Integrated OpenStack.
You can import all VMs or a specific VM.
- To import all VMs:
com vmware vio vm unmanaged importall [-h] --cluster CLUSTER [--tenant-mapping {FOLDER,RESOURCE_POOL}] [--root-folder ROOT_FOLDER]
[--root-resource-pool ROOT_RESOURCE_POOL]
Option |
Description |
--cluster CLUSTER |
Specify the Nova compute cluster where the VMs are located. |
--tenant-mapping {FOLDER,RESOURCE_POOL} |
Specify whether to map the vSphere VMs to OpenStack projects based on their location in folders or resource pools. This parameter is optional. If no tenant mapping is specified, imported VMs become instances in the import_service project in OpenStack. |
--root-folder ROOT_FOLDER |
Optionally, if you specified FOLDER for the tenant-mapping parameter, you can specify the name of the root folder containing the VMs to be imported.
All the VMs in the specified root folder are imported, including those contained in sub-folders.
The VMs will be imported as instances into an OpenStack project with the same name as the specified root folder.
If the root folder contains VMs in sub-folders, those VMs will be imported into OpenStack projects with the same names as the sub-folders.
Note:
If no root folder is specified, the name of the top level folder in the cluster is used by default.
|
--root-resource-pool ROOT_RESOURCE_POOL |
Optionally, if you specified RESOURCE_POOL for the tenant-mapping parameter, you can specify the name of the root resource pool containing the VMs to be imported.
All the VMs in the specified root resource pool are imported, including those contained in child resource pools.
The VMs will be imported as instances into an OpenStack project with the same name as the specified root resource pool.
If the root resource pool contains VMs in child resource pools, those VMs will be imported into OpenStack projects with the same names as the child resource pools.
|
- To import a specific VM:
com vmware vio vm unmanaged importvm [-h] \
--vm VM [--tenant TENANT] [--nic-mac-address NIC_MAC_ADDRESS] \
[--nic-ipv4-address NIC_IPV4_ADDRESS]
Option |
Description |
--vm VM |
Specify the vm-<id> of the specific VM to be imported. You can view the ID values of all VMs to be imported by running the com vmware vio vm unmanaged list command. |
--tenant TENANT |
Specify the OpenStack project where the imported VM will reside as an OpenStack instance. This parameter is optional. If unspecified, imported VMs become instances in the import_service project in OpenStack. |
--nic-mac-address NIC_MAC_ADDRESS |
Optionally, provide the MAC address for the VM's NIC. If the import process is unable to discover this value, the import will fail. This parameter enables you manually enter the NIC MAC address.
Note:
If specified, you must also provide the nic-ipv4-address parameter.
|
--nic-ipv4-address NIC_IPV4_ADDRESS |
Optionally, provide the IP address for the VM's NIC. If the import process is unable to discover this value, the import will fail. This parameter enables you manually enter the NIC IP address.
Note:
If specified, you must also provide the nic-mac-address parameter.
|
- (Optional) You can enable or disable the relocation and renaming of imported VMs by modifying the custom.yml file.
This option is enabled by default.
- If you have not already done so, implement the custom.yml file.
sudo mkdir -p /opt/vmware/vio/custom
sudo cp /var/lib/vio/ansible/custom/custom.yml.sample /opt/vmware/vio/custom/custom.yml
- To disable the relocation and renaming of imported VMs, uncomment the following parameter in the custom.yml file.
nova_import_vm_relocate: false
- Save the custom.yml file.