You can import VMs from vSphere into your VMware Integrated OpenStack deployment and manage them like OpenStack instances. If the imported VM has multiple disks, it is imported as Cinder volumes.

You import VMs using the data center 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. Existing networks are imported as provider network type portgroup with access restricted only to the given tenant.

The default tenant/project is import-service. Once a VM with specific network backing is imported, then the same network cannot be imported for a different tenant.

With DHCP disabled, Neutron subnets are automatically created and prevents conflict between the DHCP node in OpenStack and the external DHCP server. Neutron ports are automatically created based on either the IP and MAC address retrieved using VMware tools or set manually by admin during the import operation.

If the DHCP server cannot maintain the same IP address during lease renewal, the instance information in OpenStack shows the incorrect IP address. For this reason, you should use static DHCP bindings on existing DHCP servers. Also, you should not run new OpenStack instances on the imported networks since the DHCP address from the external server, if any, might conflict with OpenStack.

Prerequisites

  • Verify that you are running VMware Integrated OpenStack version 4.0 or later.

  • Verify that VMware Integrated OpenStack is deployed and running.

  • Verify that the VMs to be imported are in the same vCenter Server.

  • Importing VMs is only supported with NSX-V and the VDS plugin for Neutron.

    Note:

    If you are running VMware Integrated OpenStack 3.0, you cannot import VMs 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

  1. Add the clusters containing the VMs to be imported to the VMware Integrated OpenStack deployment.
    1. In the vSphere Web Client, identify the cluster containing the VMs to be imported.
    2. Add the cluster to the VMware Integrated OpenStack deployment as a Nova compute cluster.
    3. Repeat for multiple clusters, if necessary.

    After the cluster is added as a Nova compute cluster, you can import the VMs.

  2. Using SSH, log in to the VMware Integrated OpenStack manager.
  3. Connect to the VMware Integrated OpenStack vAPI endpoint.

    The endpoint runs on the OpenStack Management Server.

    dcli +server https://<oms-ip>:9449/api +i

    This command opens the DCLI interactive shell. If an error indicates a failure to connect to the server, see Troubleshoot Unable to Connect to Server.

  4. 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
  5. (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
  6. (Optional) List all unmanaged VMs in a specific target cluster that you added to the Nova Compute node.
    dcli> com vmware vio vm unmanaged list --cluster <vcenter cluster mor-id>

    The first time you execute a command, the DCLI prompts you for the user name and password used to log in to your vCenter Server. Then it asks if you want to save the credentials. If you accept the default answer y, the DCLI saves the credentials to /root/.dcli/dcli_credstore and does not ask the questions again.

  7. Import VMs into VMware Integrated OpenStack.

    You can import all VMs, a specific VM, or VMs with multiple disks.

    1. To import all VMs:
      dcli> 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 VMs contained in subfolders.

      • The VMs are imported as instances into an OpenStack project with the same name as the specified root folder.

      • If the root folder contains VMs in subfolders, those VMs will be imported into OpenStack projects with the same names as the subfolders.

      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 VMs contained in child resource pools.

      • The VMs are 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.

    2. To import a specific VM:
      dcli> com vmware vio vm unmanaged importvm [-h] \
           --vm VM [--tenant TENANT] 
           [--nic-mac-address NIC_MAC_ADDRESS] \
           [--nic-ipv4-address NIC_IPV4_ADDRESS/PREFIX]
           [--root-disk ROOT_DISK_PATH]
           [--nics]

      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 resides 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 fails. This parameter enables you manually enter the NIC MAC address.

      Note:

      If specified, you must also provide the nic_mac_address parameter.

      --nic-ipv4-address NIC_IPV4_ADDRESS/PREFIX

      Optionally, provide the IP address for the VM's NIC.

      If the import process is unable to discover this value, the import fails. This parameter enables you to manually enter the NIC IP address.

      Note:

      If specified, you must also provide the nic_ipv4_address parameter.

      --root-disk ROOT_DISK_PATH

      For a VM with multiple disks, specify the root disk datastore path such as, --root-disk '[datastore1] foo/foo_1.vmdk'

      --nics

      For a VM with multiple NICs, indicates the NIC information to be applied during import.

      The NIC information must be a JSON string representation of a list of dictionaries with the following keys:

      • mac: string representing the MAC address of the NIC

      • ipv4: string representing the IPv4 address in the format ip/prefix

      For example,

      --nics '[{"mac_address": "00:50:56:9a:f5:7b", "ipv4_address": "10.10.1.1/24"}, {"mac_address": "00:50:56:9a:ee:be", "ipv4_address": "10.10.2.1/24"}]'

  8. (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.

    1. 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
    2. To disable the relocation and renaming of imported VMs, uncomment the following parameter in the custom.yml file.
      nova_import_vm_relocate: false
    3. Save the custom.yml file.