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

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

The following conditions apply to imported virtual machines:

  • If a virtual machine has multiple disks, you can import the disks as Cinder volumes.
  • After importing a virtual machine with a specific network backing, you cannot import the same network to a different project. To use a network for multiple projects, configure it as a shared network.
  • The import VM action can only setup link between the Nova instance and flavor. It cannot resize the instance according to the flavor configuration.

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

Prerequisites

For importing the virtual machines, verify that they 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. 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. To import virtual machines, right-click each virtual machine and select Edit Settings....
    3. Select the Neutron network from the drop-down menu next to the network adapter.
    4. Expand the network adapter settings and record its MAC address.
  3. After importing VMs, to connect VMs multiple vNICs to different Neutron networks, you must create the corresponding Neutron networks from VMware Integrated OpenStack.
  4. Connect the unimported VMs vNICs to the corresponding Neutron networks (NSXT segments) from the vCenter Server.
    Note: You can connect multiple vNICs to the same Neutron network and also to the different Neutron networks.
  5. Create a temporary opaque network for the virtual machine.
    • For NSX-T 2.5, you create a Logical Switch. See Create a Logical Switch to add a switch, then perform the following steps to obtain the logical switch ID.
      1. In the Logical Switch column, click the name of the switch that you created.
      2. Record the ID of the switch as displayed in the Overview column.
    • For NSX-T 3.0, you create a segment. See Add a Segment and record the name of the segment you added.
    • For NSX-T 3.2, you create a segment. See Add a Segment and record the ID of the segment you added.
      Note: You can identify the segment ID from the NSX-T 3.2 Manager > Logical Switches view.
  6. Edit the Nova compute configuration by viocli update nova-compute, add the import_net_id parameter and set its value to the name or ID of the segment created in Step 5.
    viocli update nova-compute
  7. Create multiple Neutron ports that uses the MAC address of the virtual machine vNICs.
    neutron port-create network --name port --tenant-id project-id --mac-address vm-mac [--fixed-ip ip_address=vm-ip]
    Note: You must repeat the Neutron port create command for creating multiple ports. You can create them on the same Neutron network and also on different Neutron networks. This scenario depends on the VMs vNICs connection requirement.
    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

    For creating the port, specify the UUID of the project.

    --mac-address

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

    --fixed-ip

    Enter the IP address of the virtual machine.

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

  8. Connect to the VMware Integrated OpenStack vAPI endpoint.

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

    dcli +server https://internal-vip:9449/api +i
  9. Import the virtual machine into VMware Integrated OpenStack.
    1. To import virtual machine into VIO using single vNIC, use the following command:
      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]
    2. To import virtual machine into VIO using multiple vNICs, use the following command:
      com vmware vio vm unmanaged importvm --vm vm-moid --nics '[{"port_id": "port1_uuid"}, {"port_id": "port2_uuid"}]' " 
      For example:
      com vmware vio vm unmanaged importvm --vm vm-88 --tenant admin --nics '[{"port_id": "41fa621e-89d6-493f-876c-ed052905042d"}, {"port_id": "e97c74e9-e930-4837-a6d2-33bd065d8e32"}]'
      Note: During the import process, the port can auto-bind to the vNIC with the corresponding MAC address.
    3. To import virtual machine into VIO with multi-vCenter configured, use the following command:
      com vmware vio vm unmanaged importvm --vm vm-moid --nics '[{"port_id": "port1_uuid"}, {"port_id": "port2_uuid"}]' --vcenter vcenter_obj
      For example:
      com vmware vio vm unmanaged importvm --vm vm-88 --tenant admin --nics '[{"port_id": "41fa621e-89d6-493f-876c-ed052905042d"}, {"port_id": "e97c74e9-e930-4837-a6d2-33bd065d8e32"}]' --vcenter vcenter2
      Note:
      • The vcenter_obj list in VIO environment can be acquired by executing command kubectl -n openstack get vioshim vioadmin1 -o json | jq .status.processedSpec.conf.vioshim.DEFAULT.enabled_backends
      • If not add the --vcenter option, the default vcenter is the mgmt vcenter.
    Option Description

    --vm

    Enter the managed object identifier (MOID) of the virtual machine.

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

    --nics

    Enter the array of key-value pairs for the VMs vNIC in JSON format.

    --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] dir/disk_1.vmdk'

    --vcenter

    Enter the vcenter obj name in VIO environment

    --cinder-az

    Cinder availability zone for importing disk

    --default-volume-type

    Default volume type id for imported volumes

    --flavor

    Flavor ID stored in NOVA instance metadata

    --volume-type

    Disk Path and Volume Type mapping information

    Note: When you execute a command, DCLI prompts you to enter the administrator credentials for your vCenter Server instance. To avoid entering your user name and password every time, you can save these credentials.
  10. For volume types, create required multiple volume types from the VMware Integrated OpenStack, and record IDs for the volume types.
    openstack volume type create vol-type-ssd
  11. Import the virtual machine into VIO for volume types.
    1. Import virtual machine using the default volume type.

      For example, you can use the following command:

      "com vmware vio vm unmanaged importvm --vm vm-183 --root-disk '[vdnetSharedStorage] 2nic-001/2nic-001.vmdk' --nics '[{"port_id":"5b8f18e7-f77b-457f-9618-4dcb5fccb833"}, {"port_id": "96a26fe8-1458-4a25-ba85-9a7dcaac88fe"}]' --default-volume-type '059c97ce-f5ef-47fa-8552-1c7eeeac058b' --flavor 0a3cf2a0-754c-4a64-9ce5-a9eb2ef34e0c --tenant admin"
    2. To import virtual machine specifying volume-type for each disk, use the following command:
      com vmware vio vm unmanaged importvm --vm vm-moid --nic -net-id network-uuid --nic -port-id port-uuid  --tenant project-name --volume-type 
      '[{"disk_path":"[datastore1] dir/disk_1.vmdk", "type_id": "volume-type1-uuid"}, {"disk_path":"[datastore1] dir/disk_2.vmdk", "type_id": "volume-type2-uuid"}]'  "
      For example:
      com vmware vio vm unmanaged importvm --vm vm-109 --nic -net-id e10b0037-6705-46d8-a8c5-20fbfdc1598d --nic -port-id be9bb062-d7b3-47f7-8566-f7b1f1c6ce2d  --volume-type 
      [{"disk_path":"[datastore1] dir/disk_1.vmdk", "type_id": "096ef8ea-85ca-40f4-ba7f-9637f5fe95d2"}, {"disk_path":"[datastore1] dir/disk_2.vmdk", "type_id": "9969dd48-23dc-4010-a852-716f173fd59b"}]' --tenant admin
  12. For the flavor part, record the ID of the existing flavor type.
  13. Import the virtual machine into VIO for the flavor type.
    com vmware vio vm unmanaged importvm --vm vm-moid --nic -net-id network-uuid --nic -port-id port-uuid --flavor flavor-uuid --tenant project-name
    For example:
    com vmware vio vm unmanaged importvm --vm vm-109 --nic -net-id e10b0037-6705-46d8-a8c5-20fbfdc1598d --nic -port-id be9bb062-d7b3-47f7-8566-f7b1f1c6ce2d --flavor 256ac8d6-6fb1-4434-a007-bb6db6837e5a --tenant admin

Results

After importing, the specified virtual machine is in your OpenStack deployment, you can manage it as an OpenStack instance.