You can import virtual machines to a non-default domain from vSphere into your VMware Integrated OpenStack deployment and manage them like OpenStack instances.

This procedure applies to deployments with a non-default domain. 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.
  • After importing a virtual machine with a specific network backing, you cannot use the same network to import a different project. If you want to use a network for multiple projects, configure the provider VLAN (Virtual LAN) network as the shared network.

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. Connect the virtual machine to a Neutron network.
    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.
    • 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, cllick 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.
  4. Log in to the Integrated OpenStack Manager as the root user.
    ssh root@mgmt-server-ip
  5. Edit the Nova compute configuration.
    viocli update nova-compute
  6. In the vmware section, add the import_net_id parameter and set its value to the recorded switch ID or the segment name.
  7. If you want to prevent imported virtual machines from being relocated or renamed, add the import_vm_relocate parameter and set its value to false.
  8. To import virtual machines to a non-default domain, you must create a user and project in this domain and set the default_tenant_domain_name parameter in the vioshim pod.
    domain name: import-domain
    admin user in import-domain: import-domain
    a new project in import-domain: import-proj2
    viocli update vioshim
    conf:
      vioshim:
        DEFAULT:
          default_tenant_domain_name: import-domain
    To verify, you can login to the following pod.
    osctl exec -it vioadmin1-vioshim-6855dd94b4-s5vzk -c vioshim bash
    To check the content of /etc/viocli/viocli.conf, you can use the following line of code:
    default_tenant_domain_name = import-domain
  9. Set the password for the admin account.
    export OS_PASSWORD=admin-account-password
  10. Export variables in the toolbox.

    The password given in the following code is for reference. For exporting variables in the toolbox, you must specify your password.

    [root@vioadmin1-vioshim-6855dd94b4-s5vzk /]# export OS_PROJECT_NAME=import-proj2 
    [root@vioadmin1-vioshim-6855dd94b4-s5vzk /]# export OS_PROJECT_DOMAIN_NAME=import-domain
    [root@vioadmin1-vioshim-6855dd94b4-s5vzk /]# export OS_USER_DOMAIN_NAME=import-domain
    [root@vioadmin1-vioshim-6855dd94b4-s5vzk /]# export OS_PASSWORD=*****
    [root@vioadmin1-vioshim-6855dd94b4-s5vzk /]# export OS_USERNAME=import-admin

    You can also import virtual machines using a default project import-service and export variables in the toolbox.

    [root@vioadmin1-vioshim-56f9ddc779-wc4lc /]#
    [root@vioadmin1-vioshim-56f9ddc779-wc4lc /]# export OS_PASSWORD=*****
    [root@vioadmin1-vioshim-56f9ddc779-wc4lc /]#  env | grep -i project
    OS_PROJECT_NAME=import-service
    OS_PROJECT_DOMAIN_NAME=default
    [root@vioadmin1-vioshim-56f9ddc779-wc4lc /]# export OS_PROJECT_NAME=admin
    
  11. Create a Neutron port in the specified project.

    You can create a Neutron port in the specified project. The project import-proj2 uses the shared provider network, and you must specify the --tenant-id for the port to avoid the PortNotUsable issue.

    neutron port-create network --name port --tenant-id <project id of import-proj2> --mac-address vm-mac --fixed-ip ip_address=vm-ip
    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.

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

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

    dcli +server http://internal-vip:9449/api +i
  13. Import the virtual machine, specifying the tenant name.

    To import virtual machines, you must specify the --tenant name. However, if no --tenant name is specified, VMware Integrated OpenStack will use a default --tenant name import-service.

    com vmware vio vm unmanaged importvm --vm vm-moid --nic-net-id network-uuid --nic-port-id port-uuid --tenant import-proj2
    com vmware vio vm unmanaged importvm --vm vm-moid --nic-net-id network-uuid --nic-port-id port-uuid --tenant import-service
    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.

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

    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.

Results

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