Create VM Instance

ZStack allows you to create one or more VM instances at a time.

In the navigation pane of the ZStack Private Cloud UI, choose Resource Pool > VM Instance. On the VM Instance page, click Create VM Instance. On the displayed Create VM Instance page, set the following parameters:
  • Add Type: Select an add type to determine whether to create multiple VM instances at a time. Options: Single | Multiple. If you select Multiple, specify the number of VM instances to be created.
  • Name: Enter a name for the VM instance.
  • Description: Optional. Enter a description for the VM instance.
  • Instance Offering: Select an instance offering for creating a VM instance.
  • Image: Select an image for creating a VM instance. The image BIOS mode includes Legacy and UEFI.
    Note:
    • A VM instance inherits the BIOS mode of the image added to the VM instance.
    • You need to get the corresponding image ready, and select a proper BIOS mode. For more information, see Add Image.
    • You can change the BIOS mode on the VM details page. Exercise caution when you make any changes. The VM instance may fail to work properly if the BIOS mode does not match the VM instance. After you change the BIOS mode, restart the VM instance for the changes to take effect.
    • The Legacy mode is recommended when you create a VM instance. If you want to use the UEFI mode, we recommend that you select the corresponding image from the following list of operating system versions.
      Operating System BIOS Mode Supported Version
      Windows UEFI
      • Windows 8 or later versions
      UEFI (compatibility module)
      • Windows 7
      • Windows Server 2008 R2
      Linux UEFI
      • CentOS 7.2
      • CentOS 7.3
      • CentOS 7.4 or later versions
    • When you create a VM instance, a virtual drive (vDrive) will also be created by default. The relationship between different image formats and the default vDrive is as follows:
      • If you select a qcow2 image or raw image, the system will create an empty vDrive by default. To delete the vDrive, go to the Create VM Instance page and choose Advanced > vDrive.
      • If you select an ISO image, the system will create a vDrive by default and attach the ISO image to the vDrive. Note that this vDrive cannot be deleted on the Create VM Instance page by choosing Advanced > vDrive.
  • Root Disk Offering: Select a root disk size for the VM instance. This option displays only when you select an ISO image.
  • Network: Select a network for the VM instance. The required parameters are as follows:
    • L3 Network: Select a network for the VM instance, including private network, public network, and VPC network.
      Note: When you select an L3 network, note the following:
      • Each VM instance lets you add multiple networks, while each L3 network corresponds to one NIC.
      • If you choose an L3 network with the IPv4+IPv6 type, the VM instance will have the double stack NIC. That is, the same NIC can have two types of IP address: IPv4 and IPv6.
      • If you want to create VM instances by using a network with the IPv6 type or IPv4+IPv6 type, run the dhclient -6 NIC_NAME command to manually obtain an IP address.
      • We recommend that you use only one IPv6 IP address for a VM instance to avoid potential risks.
    • Set Default Network: If you add more than one L3 network, you can set the default network by selecting the radio button in front of the network name.
    • VM NIC Setting: Optional. Configure the IP address and MAC address for the VM instance.
      • By default, this checkbox is not configured. The system will automatically assign an IP address and an MAC address for the VM instance.
      • The NIC of the VM instance can be customized. That is, you can manually configure the IP address and MAC address. At this time, to ensure that your configurations are successful, avoid the IP conflicts.
        Note: If you create VM instances in bulk and specify an IP address, the start IP address will be started from the specified IP address by default. Then, IP addresses will be assigned to multiple VM instances continuously. When a specified IP address is occupied within the continuously assigned IP range, the corresponding VM instance will fail to be created.
    • Enable SR-IOV: Choose whether to enable SR-IOV.
      • By default, this checkbox is not selected, indicating that SR-IOV is not enabled. In this case, the VM instance that you created will have a vNIC attached.
      • If selected, SR-IOV is enabled. In this case, the VM instance that you created will have a VF NIC attached.
      Note: When you enable SR-IOV, note the following:
      • Only IPv4 networks support SR-IOV, but IPv6 or IPv4+IPv6 networks do not.
      • Verify that SR-IOV must be enabled for the L2 network that corresponds to the L3 network. Otherwise, SR-IOV might fail to be enabled.
      • After SR-IOV is enabled, make sure that the physical NIC corresponded by the L3 network has an available VF NIC. Otherwise, the VM instance might fail to be created.
      • If SR-IOV is enabled, NICs of the VM instances that were created by using a public network or a flat network do not support the network services such as security group and EIP. If the VM instances that were created by using the vRouter network or VPC network, their NICs do not support the security group network services.
So far, the basic settings for creating a VM instance are completed. The following is an example of creating a VM instance by selecting an IPv4 network, as shown in Figure 1. Then, click OK to finish creating the VM instance.
Figure 1. Create VM Instance


When you create a VM instance in ZStack, you can configure the advanced settings by clicking Advanced on the Create VM Instance page, as shown in Figure 2.
Figure 2. Advanced Setting






To configure the advanced settings, set the following parameters:
  • Data Disk Offering: Select a data disk offering.
    • After you select a data disk offering, the system will directly create a data volume and attach the data volume to the VM instance.
    • If no disk offering is available, create a disk offering by referring to Create Disk Offering.
  • Storage Allocation Policy: Select a storage allocation policy.
    • System allocation: The system allocates primary storages according to the preconfigured allocation policy.
    • Manual allocation: You can manually select a primary storage as needed.
  • Affinity Group: Select an affinity group that you created before. The system allocates VM instances on hosts according to the rules of the chosen affinity group.
  • CPU Pinning: Specify the association between the physical CPU (pCPU) of hosts and the virtual CPU (vCPU) of VM instances. Then, the system allocates pCPUs to VM instances accordingly. This helps to improve the VM performance.
    • To specify more CPU pinning policies, click Add more.
    • Enter the vCPU range in the left text box and the pCPU range in the right text box. Note that the - symbol indicates the value range, while the ^ symbol indicates that a value is not included. If you specify multiple rules in a policy, separate each rule by using a comma (,). The following are some examples:
      • 0-2 indicates CPU 0, CPU 1, and CPU 2.
      • ^2 indicates that CPU 2 is not included.
      • 0-2,^2 indicates CPU 0 and CPU 1.
      • 1-7,^2,^3,^4,10 indicates CPU 1, CPU 5, CPU 6, CPU 7, and CPU 10.
      Note:
      • The vCPU range depends on the instance offering of the chosen VM instance, while the pCPU range depends on the chosen cluster or the number of pCPUs of the chosen host.
      • If a vCPU has multiple CPU pinning policies, the union of the policies will be used.
      • ZStack supports CPU overprovisioning. Therefore, the number of vCPUs can be greater than those of pCPUs. However, if the number of vCPUs specified in the CPU pinning policy is greater than those of pCPUs, the VM performance will be affected. This setting is not recommended.
      • You can modify the CPU pinning policy on the Basic Attributes tab page of a VM instance. The modification takes effect after you restart the VM instance.
      • Cloning or migrating a VM instance will also copy the CPU binding policy, while creating a VM image or performing VM backup cannot copy the CPU pinning policy.
      • When you create a VM instance, the system firstly checks the affinity group and host allocation strategies, and then checks the CPU pinning policy.
      • When you power off a VM instance to modify its instance offering and reduce its CPU, the invalid CPU pinning policy will not take effect. In this case, we recommend that you modify or delete this policy.
  • Cluster: Specify the cluster on which the host of the VM instance to be started.
  • Data Volume Primary Storage: Specify a primary storage for the data volume of the VM instance.
    • If the primary storage type of your data volume is Shared Block, you need to select a provisioning method, including thin provisioning and thick provisioning.
      • Thin provisioning: Allocate storage space to data volumes based on the actual usage to achieve higher storage utilization.
      • Thick provisioning: Allocate required storage space in advance to provide sufficient storage capacity to data volumes, ensuring the storage performance.
    • If the primary storage type of your data volume is Ceph, you need to specify the Data Volume Pool.
      • The Data Volume Pool parameter is optional. If not specified, the system uses the initial Ceph data volume pool to create data volumes.
      • You can add multiple data volume pools on the Storage Pool tab page of the Ceph primary storage details page.
      • A Ceph pool can be a data volume pool or a root volume pool.
    • ZStack allows you to attach more than one primary storage to a cluster. For more information, see Cluster | Primary Storage in Cluster.
    Note: When you create a VM instance, the policy for allocating multiple primary storages is as follows:
    • If a cluster has multiple LocalStorage primary storages attached:
      • You can specify any LocalStorage primary storage when you create a VM instance.
      • If you do not specify a primary storage, the system will automatically select the local primary storage that has the most available capacity.
    • If a cluster has multiple shared primary storages attached (currently, multiple NFS primary storages or Shared Block primary storages are supported):
      • You can specify any NFS or Shared Block primary storage when you create a VM instance.
      • If you do not specify a primary storage, the system will automatically allocate an NFS or a Shared Block primary storage that is available.
    • If a cluster has a combination of primary storages attached (currently, the supported combinations include: 1 LocalStorage + 1 NFS, 1 LocalStorage + 1 SMP, 1 LocalStorage + 1 Shared Block):
      • You can specify any primary storage when you create a VM instance.
      • When you create a VM instance, if you create a data volume and attach it to the VM instance at the same time, you need to specify a primary storage for the data volume.
      • If you do not specify a primary storage, the system will automatically use a local primary storage to create a VM instance.
  • Root Volume Primary Storage: Specify a primary storage for the root volume of the VM instance.
    • If the primary storage type of your root volume is Shared Block, you need to select a provisioning method, including thin provisioning and thick provisioning.
      • Thin provisioning: Allocates storage space to data volumes based on the actual usage to achieve higher storage utilization.
      • Thick provisioning: Allocates required storage space in advance to provide sufficient storage capacity to data volumes, ensuring the storage performance.
    • If the primary storage type of your data volume is Ceph, you need to specify the Root Volume Pool.
      • The Root Volume Pool parameter is optional. If not specified, the system uses the initial Ceph root volume pool to create VM instances.
      • You can add multiple root volume pools on the Storage Pool tab page of the Ceph primary storage details page.
      • A Ceph pool can be a data volume pool or a root volume pool.
      • Currently, root volume pools cannot be deleted.
  • Host: Select the host on which the VM instance is to be started. If you selected a cluster, select a host from the cluster.
  • vDrive: Create more vDrives for the VM instance.
    To create more vDrives, click Create More vDrive. To attach an ISO to a vDrive, click Attach ISO.
      • If you select a qcow2 image or raw image, the system will create an empty vDrive by default. To delete the vDrive, go to the Create VM Instance page and choose Advanced > vDrive.
      • If you select an ISO image, the system will create a vDrive by default and attach the ISO image to the vDrive. Note that this vDrive cannot be deleted on the Create VM Instance page by choosing Advanced > vDrive.
    • You can set the maximum number of vDrives for a VM instance after stopping the VM instance. The method is as follows:

      Go to Settings > Global Settings > Advanced, locate maximumCdRomNum, and click the Edit icon. Options: 1 | 2 | 3. Default value: 3.

  • GPU Add Methods: Add a GPU device (pGPU or vGPU) for the VM instance by specifying a GPU specification or GPU device.
    • GPU specifications: Allocates a GPU device according to the chosen GPU specification, as shown in Figure 3.
      Figure 3. GPU Specifications


      Auto uninstall GPU device when VM stopped: Determine whether to retain a GPU device when the corresponding VM instance is stopped.
      • By default, this checkbox is not selected if you use a pGPU. If you use a vGPU, this checkbox is selected.
      • If selected, the GPU device will be automatically uninstalled after the corresponding VM instance is stopped. When the VM instance is restarted, a new GPU device will be allocated to the VM instance according to the GPU specification.
      • If not selected, the GPU device will be retained after the corresponding VM instance is stopped. When the VM instance is restarted, the existing GPU device will be used.
    • GPU device: Attaches the chosen GPU device when you create a VM instance.
    Note:
    • One VM instance can have multiple pGPU devices or only one vGPU device attached at the same time.
    • One VM instance cannot have both pGPU devices and vGPU devices attached at the same time.
    • You can attach GPU devices to a VM instance from the host where the VM instance is located. Currently, you cannot attach GPU devices to a VM instance across hosts.
  • HA Level: Select an HA level. Options: NeverStop | None. Default level: None.
    • None: Indicates that the high availability feature is disabled for the VM instance.
    • NeverStop: Indicates that the high availability feature is enabled for the VM instance.
    Note:
    • To enable or disable the HA feature, go to Settings > Global Settings > Basic Settings, locate Enable next to HA, and click the Edit icon. Default value: true.
    • If disabled, you cannot set high availability for VM instances. The VM instance details page will not display the high availability information.
    • If disabled, the high availability feature will be disabled globally. Please exercise caution.
  • Resource Priority: Set the resource priority for the VM instance. Options: Normal | High. Default priority: Normal. When resource competition occurs due to high host loads, priority is given to ensuring the resource usage of VM instances with the High resource priority.
    Note: We recommend that you set high resource priority only for important VM instances.
  • Console Password: Set a password (VNC password) for the VM console. The password must be 6 to 18 characters long.
  • SSH Login Method: If your VM image was installed with Cloud-init, you can log in to your VM instance by using an SSH key or a password.
    • If you use an SSH key, set the following parameter:
      • SSH Key: After an SSH key is injected to a VM instance, you can SSH in to the VM instance without entering a password when the VM instance is running.
    • If you use a password, set the following parameters:
      • User Name: By default, the user name is root.
      • Password: After a root password is injected to a VM instance, you can SSH in to the VM instance by entering a password when the VM instance is running.
      Note:
      • The root password setting method only applies to Linux VM instances. For Windows VM instances, you can set passwords by using User Data.
      • Before you set the password, make sure that the VM image has the Cloud-init installed. Recommended versions for Cloud-init: 0.7.9, 17.1, 19.4, and the later versions.
      • After you set a password, do not set the password again in User Data to avoid conflicts.
      • After you set a root password, a clear text password will be displayed in the User Data on the details page of the created VM instance. Keep your password confidential.
    Note: Different types of images support different SSH login methods.
    • Images of different operating systems:
      • Linux image: Fixed user name: root. Supported SSH login methods: SSH key | password.
      • Windows image: Fixed user name: administrator. Supported SSH login method: setting password by using User Data.
    • Images of different formats:
      • Image of the ISO type: Supported SSH login method: SSH key.
      • Image of the Image type: Supported SSH login methods: SSH key | password.
  • Hostname: Set a hostname for the VM instance.
    • The rules for setting Linux hostname and Windows hostname are different.
      • Linux hostname: The hostname must be 2 to 60 characters long, and can be uppercase, lowercase, numbers, and hyphens (-). Note that a hostname cannot contain consecutive hyphens (-) and cannot start or end with hyphens (-).
      • Windows hostname: The hostname must be 2 to 15 characters long, and can be uppercase, lowercase, numbers, and hyphens (-). Note that a hostname cannot contain consecutive hyphens (-), cannot start or end with hyphens (-), and cannot contain only numbers.
    • Before you set a hostname, make sure that the DHCP service of the L3 network corresponding to the VM instance is enabled.
    • For Linux images, the hostname must be set to localhost.localdomain.
    • After you set a hostname, do not set it again in User Data to avoid conflicts.
  • User Data: You can import User Data. That is, you can customize VM configurations or operations by uploading custom parameters or scripts so that the VM instance can complete some specific tasks.
    • Before you import User Data, make sure that both the User Data network service and DHCP network service are available.
    • By default, the User Data network service and DHCP network service in the three network environments of flat network, vRouter network, and VPC network are enabled.
    • If you set a hostname and password by using the User Data, do not set them again in SSH Login Method to avoid conflicts.
    • After you set a root password by using the User Data, a clear text password will be displayed in the User Data field on the details page of the created VM instance. Very that you keep your password confidential.
    • When you import the User Data to a Linux VM instance, note the following:
      • Cloud-init must be installed for the VM image. Recommended versions: 0.7.9, 17.1, 19.4, and the later versions.
      • If you create a Linux VM instance by using a VM image that has Cloud-init installed, you must import the User Data. Otherwise, the Cloud-init task will wait until the task times out.
      • The following is an example of importing the User Data to a Linux VM instance:
        #cloud-config
        users:
         - name: test
           shell: /bin/bash
           groups: users
           sudo: ['ALL=(ALL) NOPASSWD:ALL']
           ssh-authorized-keys:
               - ssh-rsa AAAAB3NzaC1LXCJfjroD1lT root@10-0-0-18
        bootcmd:
         - mkdir /tmp/temp 
        write_files:
         - path: /tmp/ZStack_config
           content: |
               Hello,world!
           permissions: '0755'
        hostname: Perf-test
        disable_root: false
        ssh_pwauth: yes
        chpasswd:
          list: |
              root:word
          expire: False
        runcmd:
         - echo ls -l / >/root/list.sh
        The preceding script can be realized by following the steps below:
        1. Create a user named test and use ssh-key when a VM instance is created.
        2. Write the /etc/hosts file when the VM instance is started, create a directory named /tmp/temp, create a file, and write content to the file.
        3. Set the hostname, enable the root user, allow the SSH login with passwords, and change the root password.
        4. Run the echo ls -l / command.
    • When you import the User Data to a Windows VM instance, note the following:
      • Cloudbase-Init must be installed for the VM image. The version of the Cloudbase-Init is not enforced. For information about how to install Cloudbase-Init, see Cloudbase Documentation.
      • If you create a Windows VM instance by using a VM image that has Cloudbase-Init installed, you must import the User Data. Otherwise, the Cloudbase-Init task will wait until the task times out.
      • The following is an example of importing User Data to a Windows VM instance:
        #cloud-config
        write_files:
           -   encoding: b64
               content: NDI=
               path: C:\b64
               permissions: '0644'
           -   encoding: base64
               content: NDI=
               path: C:\b64_1
               permissions: '0644'
           -   encoding: gzip
               content: !!binary |
                   H4sIAGUfoFQC/zMxAgCIsCQyAgAAAA==
               path: C:\gzip
               permissions: '0644'

        The script above creates b64, b64_1, and gzip files under C drive when the VM instance is started.

      Note: When the User Data is used, one L2 network can only let you configure one L3 network.
  • VirtioSCSI: If selected, the VirtioSCSI bus will be used, and a data volume of the SCSI type will be created.
  • USB redirection: ZStack is compatible with multiple USB devices for redirection. You must select this checkbox if you want to use the VDI feature. Then, the USB device on the VDI client will be redirected to the VDI VM instance.
  • Anti-spoofing: ZStack provides anti-IP/MAC forgery and ARP spoofing features. If selected, the VM instance can only use the IP or MAC address allocated by the cloud to communicate with external networks.
    • By default, this setting is consistent with the Network Anti-Spoofing switch in Global Settings.
      • If the Network Anti-Spoofing switch in global settings is set to true, this checkbox is selected by default.
      • If the Network Anti-Spoofing switch in global settings is set to false, this checkbox is not selected by default.
    • By default, the anti-spoofing setting of existing VM instances is consistent with the Network Anti-Spoofing switch in the global settings. You can manually set this switch on the Basic Attributes tab page of the VM details page.
  • Console Mode: Set the mode for opening the VM console. Options: vnc | spice | vnc+spice. Default mode: vnc.
  • Bind Tag: Bind one or more tags to the VM instance.
    Note:
    • One resource can bind 50 tags at most, while a single tag can bind the unlimited number of resources.
    • Many-to-many bindings between tags and resources are supported. That is, you can bind multiple tags to multiple resources.
    • Tags that were created by a tenant can only be bound to resources owned by the tenant, while admin tags can be bound to all resources.
    • An administrator can unbind or delete tenant tags.
    • Resource tags can be sorted in order according to the creation time or tag names (priority: characters > numbers > Chinese characters > English characters). To change the sort order, choose Settings > Global Settings > Advanced, locate Tag sorting field, and click the Edit icon. By default, the tags are sorted in order by the tag name.