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

Important: This procedure is supported only in VMware Integrated OpenStack 5.1.0.1 and later.

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

Imported virtual machines become OpenStack instances but remain distinct.

  • If a virtual machine has multiple disks, the disks are imported as Cinder volumes.
  • After a virtual machine with a specific network backing is imported, the same network cannot be imported to a different project. If you want to use a network for multiple projects, configure it as a shared network.

You import VMs using the Data Center Command-Line Interface (DCLI) on the OpenStack Management Server.

Prerequisites

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

Procedure

  1. In vSphere, add the cluster containing the desired virtual machine as a compute cluster in your VMware Integrated OpenStack deployment. For instructions, see Add Compute Clusters to Your Deployment.
  2. Connect the virtual machine to a Neutron network.
    You can use a provider network or a tenant network for this procedure.
    1. In the vSphere Client, open the Hosts and Clusters view.
    2. Right-click each virtual machine that you want to import and select Edit Settings....
    3. From the drop-down list next to the network adapter, select the Neutron network that you want to use.
    4. Expand the network adapter settings and record its MAC address.
  3. Create a temporary opaque network for the virtual machine.
    1. In NSX Manager, select Switching > Switches and click Add.
    2. Enter a name for the switch and select the overlay transport zone.
    3. Click Add.
    4. In the Logical Switch column, click the name of the switch that you created.
    5. Record the ID of the switch as displayed in the Overview column.
  4. Log in to the OpenStack Management Server as viouser.
  5. If your deployment is not using a custom.yml file, copy the template custom.yml file to the /opt/vmware/vio/custom directory.
    sudo mkdir -p /opt/vmware/vio/custom
    sudo cp /var/lib/vio/ansible/custom/custom.yml.sample /opt/vmware/vio/custom/custom.yml
  6. Open the /opt/vmware/vio/custom/custom.yml file in a text editor.
  7. Uncomment the nova_import_net_id parameter and set its value to the ID of the switch that you created in Step 3.
  8. If you want to prevent imported virtual machines from being relocated or renamed, uncomment the nova_import_vm_relocate parameter and set its value to false.
  9. Deploy the updated configuration.
    sudo viocli deployment configure

    Deploying the configuration briefly interrupts OpenStack services.

  10. Switch to the root user and load the cloud administrator credentials file.
    sudo su -
    source ~/cloudadmin.rc
  11. Create a Neutron port that uses the MAC address of the virtual machine's network adapter.
    neutron port-create network --name port --tenant-id project-id --mac-address vm-mac [--fixed-ip ip_address=vm-ip]
    Option Description
    network

    Enter the name of the Neutron network to which you connected the virtual machine.

    --name

    Enter a name for the port.

    --tenant-id

    Specify the UUID of the project for which to create the port.

    --mac-address

    Enter the MAC address of the virtual machine's network adapter recorded in Step 2d.

    --fixed-ip

    Enter the IP address of the virtual machine.

    If the virtual machine does not have an IP address or you do not want to retain the existing IP address, you can omit this parameter.

  12. Connect to the VMware Integrated OpenStack vAPI endpoint.
    dcli +server https://mgmt-server-ip:9449/api +i

    If you cannot connect to the server, see DCLI Cannot Connect to Server.

  13. Import the virtual machine into VMware Integrated OpenStack.
    com vmware vio vm unmanaged importvm --vm vm-moid --nic-net-id network-uuid --nic-port-id port-uuid [--tenant project-name] [--root-disk root-disk-path]
    Option Description
    --vm

    Enter the managed object identifier (MOID) of the virtual machine that you want to import.

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

    --nic-net-id

    Enter the UUID of the Neutron network to which you connected the virtual machine.

    --nic-port-id

    Enter the UUID of the port that you created for the virtual machine.

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

    --root-disk

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

    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.