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, the non-root disks would be imported as Cinder volumes.
  • The import VM action can only setup link between the Nova instance and flavor. It will not resize the instance according to the flavor configuration during the import.

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

Procedure

  1. Add the clusters containing the desired virtual machines as compute clusters in your VMware Integrated OpenStack deployment.
  2. Record each network adapter’s MAC address
    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. Expand the network adapter settings and record its MAC address.
  3. Create a temporary opaque network for the virtual machine.
    • 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.
  4. 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
    conf:
      nova_compute:
        vmware:
          import_net_id: name or id
    
    Note:
    For NSX-T 3.0, set its value to the name
    For NSX-T 3.2 or later, set its value to the id
  5. Create multiple Neutron ports that uses the MAC address of the virtual machine vNICs.
    You can create a new Neutron network or use the existed one.
    neutron net-create NAME --tenant-id project-id 
    neutron port-create network --name port --tenant-id project-id --mac-address vm-mac [--fixed-ip ip_address=vm-ip]
    Note: The network and port tenant ID must be the same with the import VM’s tenant ID.
    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 the virtual machine will connect to.

    --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 (optional)

    Enter the IP address of the virtual machine.

  6. Open the toolbox and 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
    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.
  7. Import the virtual machine into VMware Integrated OpenStack.
    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 for multi-vCenter.

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

    • Single vCenter Deployment
    1. To import virtual machine into VIO using single vNIC and 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] [--root-disk root-disk-path]
    2. To import virtual machine into VIO using multiple vNICs and single disk, 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-disks configured, use the following command:
      com vmware vio vm unmanaged importvm --vm vm-moid --root-disk 'root-disk-path' --nics '[{"port_id":"port1_uuid"}]'  --default-volume-type 'volumetye_uuid'
      Note: The volume type can be created by openstack volume type create <name>, each disk can specify different or same volume type.
      For example:
      com vmware vio vm unmanaged importvm --vm vm-33574 --root-disk '[vsanDatastore (1)] ab61b663-a6ac-249f-6c81-bc97e1d51910/imp-002_2.vmdk' --nics '[{"port_id":"dae27a0d-b9b7-4801-ae1c-12333fe21241"}]'  --default-volume-type 'e35d1605-4808-48e2-a940-f5f66eb55b8c' --flavor 9a0248cd-3b51-4626-8f9a-0090fa4a146e --tenant admin --image bc16f0f8-518d-4fc8-a7fe-1314f55dd3cc
    • Multi-vCenter Deployment
    1. To import virtual machine into VIO with multi-vCenter, 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.
    2. To import virtual machine into VIO with multi disks configured, you must configure cinder cluster in different vCenter with the different availability zone name, and specify the --cinder-az option.
      com vmware vio vm unmanaged importvm --vm vm-60 --tenant admin --nics '[{"port_id": "cc1bba10-1e9b-4818-baa9-6b416738bfb1"}]' --vcent
      er vcenter2 --flavor da10460e-7174-457b-86dd-f8b2b10a578a --root-disk '[vdnetSharedStorage] test-import7/test-import7_2.vmdk' --volume-type
       '[{"disk_path": "[vdnetSharedStorage] test-import7/test-import7.vmdk", "type_id": "3eaeee82-aae5-4803-a3a9-de6cd84e30db"}]' --cinder-aznova1
      
  8. For the flavor part, record the ID of the existing flavor type.
  9. 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.