You can import virtual machines from vSphere into your VMware Integrated OpenStack deployment and manage them as OpenStack instances.

This procedure applies to deployments with VDS or NSX Data Center for vSphere networking. For NSX-T Data Center deployments, see Import Virtual Machines into VMware Integrated OpenStack with NSX-T Data Center.

The following conditions apply to imported virtual machines:

  • If a virtual machine has multiple disks, the disks are imported as Cinder volumes.
  • Existing networks are imported as port group-based provider networks with access restricted to the specified project.
  • After a virtual machine with a specific network backing is imported, the same network cannot be imported to a different project.
  • Neutron subnets are automatically created with DHCP disabled.
  • Neutron ports are automatically created based on the IP and MAC address of the network interface card on the virtual machine.
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. To avoid this problem, use static DHCP bindings on existing DHCP servers and do not run new OpenStack instances on imported networks.

You import virtual machines using the Data Center Command-Line Interface (DCLI) in the Integrated OpenStack Manager toolbox.

Prerequisites

Verify that the virtual machines that you want to import are in the same vCenter Server instance.

Procedure

  1. Add the clusters containing the desired virtual machines as compute clusters in your VMware Integrated OpenStack deployment.
  2. Log in to the Integrated OpenStack Manager as the root user.
    ssh root@mgmt-server-ip
  3. If you want to prevent imported virtual machines from being relocated or renamed, update your deployment configuration.
    1. Modify the Nova compute configuration.
      viocli update nova-compute
    2. In the vmware section, add the import_vm_relocate parameter and set its value to false.

    If you do not perform this step, imported virtual machines are modified as follows:

    • The names of imported virtual machines are changed to the following format: original-name (instance-uuid)
    • Imported virtual machines are placed in the following folder in vSphere: datacenter > root-VM-folder > OpenStack > Project (project-uuid)
  4. Open the toolbox and connect to the VMware Integrated OpenStack vAPI endpoint.

    The endpoint is located at the private OpenStack endpoint of your deployment.

    toolbox
    dcli +server http://internal-vip:9449/api +i
  5. Import unmanaged virtual machines into VMware Integrated OpenStack.
    Note: When you execute a command, DCLI prompts you to enter the administrator credentials for your vCenter Server instance. You can save these credentials to avoid entering your username and password every time.
    • Run the following command to import all unmanaged virtual machines:
      com vmware vio vm unmanaged importall --cluster cluster-name [--tenant-mapping {FOLDER | RESOURCE_POOL} [--root-folder root-folder | --root-resource-pool root-resource-pool]]
      Option Description

      --cluster

      Enter the compute cluster that contains the virtual machines that you want to import.

      --tenant-mapping {FOLDER | RESOURCE_POOL}

      Specify whether to map imported virtual machines to OpenStack projects based on their location in folders or resource pools.

      If you do not include this parameter, all imported VMs will become instances in the import_service project by default.

      --root-folder

      If you specified FOLDER for the --tenant-mapping parameter, you can provide the name of the root folder containing the virtual machines to be imported.

      All virtual machines in the specified folder or any of its subfolders are imported as instances into an OpenStack project with the same name as the folder in which they are located.

      Note: If you specify --tenant-mapping FOLDER but do not specify --root-folder, the name of the top-level folder in the cluster is used by default.

      --root-resource-pool

      If you specified RESOURCE_POOL for the --tenant-mapping parameter, you can provide the name of the root resource pool containing the virtual machines to be imported.

      All virtual machines in the specified resource pool or any of its child resource pools are imported as instances into an OpenStack project with the same name as the resource pool in which they are located.

    • Run the following command to import a specified virtual machine:
      com vmware vio vm unmanaged importvm --vm vm-id [--tenant project-name] [--nic-mac-address nic-mac --nic-ipv4-address nic-ip] [--root-disk root-disk-path] [--nics specifications]
      Option Description

      --vm

      Enter the identifier of the virtual machine that you want to import.

      You can view the ID values of all unmanaged virtual machines by running the com vmware vio vm unmanaged list command.

      --tenant

      Specify the OpenStack project into which you want to import the virtual machine.

      If you do not include this parameter, the import_service project is used by default.

      --nic-mac-address

      Enter the MAC address of the network interface card on the virtual machine.

      If you do not include this parameter, the import process attempts to discover the MAC and IP addresses automatically.

      Note: If you include this parameter, you must also include the nic_ipv4_address parameter.

      --nic-ipv4-address

      Enter the IP address and prefix for the network interface card on the virtual machine. Enter the value in CIDR notation (for example, 10.10.1.1/24).

      This parameter must be used together with the --nic-mac-address parameter.

      --root-disk

      For a virtual machine with multiple disks, specify the root disk datastore path in the following format: --root-disk '[datastore1] dir/disk_1.vmdk'

      --nics

      For a virtual machine with multiple NICs, specify the MAC and IP addresses of each NIC in JSON format.

      Use the following key-value pairs:

      • mac_address: MAC address of the NIC in standard format
      • ipv4_address: IPv4 address in CIDR notation

      For example:

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

Results

The specified virtual machines are imported into your OpenStack deployment and can be managed as OpenStack instances.