Deploy VM and Manage the VM Lifecycle

VM lifecycle management covers creating, importing, registering, cloning, and deleting virtual machines. Different deployment methods apply to VM files from different sources and to different operational scenarios.

Create a VM when you want to start from an image, a template, or a custom configuration. Import a VM to bring in an existing VM through an OVF file. Register a VM to bring existing VM configuration and data files under platform management. Clone a VM to quickly copy an existing VM environment.

Create a Virtual Machine

A new virtual machine that you'll be able to customize CPU, memory, storage, and network settings for the workload.

Before you begin

  • The platform provides VM-related system parameters that control default platform behavior. Before creating a VM, you can customize VM-related system parameters to control default VM characteristics.
  • The platform provides default capacity and feature settings for VMs, such as CPU, Memory, Disk 1, NIC 1, Other Hardware, and Advanced Settings. You can quickly create a VM by using the default platform settings.
  • You can create a VM without an OS image. You can add the disk 1 by creating a new disk. A CD/DVD drive is optional.
  • You can create a VM without a NIC and configure NICs and their features later.
  • To enable VM or disk encryption, make sure that an available default key provider is configured. If you use the Native Key Provider, back it up first. For more information, see Encryption Keys and How Encryption Works.

Procedure

  1. In the navigation pane, right-click the target cluster, host, or image, and then click New Virtual Machine.
  2. In the Select VM Creation Type dialog, select New VM, and then click Next.
  3. In the New Virtual Machine dialog, configure the basic information as needed:
    Option Description
    Name VM name.
    Quantity Number of VMs to create.
    Group VM group. If not specified, the default group is used.
    Location Host or cluster where the VM runs.
    OS VM operating system. Mainstream operating systems are supported, including Linux and Windows.
    HA Automatic restart mechanism after an abnormal VM shutdown.
    VM Encryption Encrypts runtime data written to disk, such as memory and GPU state, by using a key from the default key provider. Enabling this option automatically enables Disk Encryption for all disks. Enable encryption during VM creation when possible to avoid the additional time required to convert existing data later. For more information, see VM Encryption.
    Power Status Whether to automatically power on the VM after it is created. By default, the VM is powered on automatically.
  4. Configure the VM hardware settings as needed:
    1. CPU: Customize the VM CPU cores and features.
      Option Description
      Cores Number of CPU cores in the VM.
      Cores per Socket Number of CPU cores allocated per socket in the VM.
      CPU Mode Whether to match the VM CPU model with the host CPU model so that the VM can inherit some or all host CPU features for different workloads. The default value is None. For more information, see Configure VM CPU Features.
      CPU Resource Priority For critical VMs, set this option to High to give the VM higher CPU contention capability than VMs with Normal priority when the host is overloaded. For more information, see Configure VM Resource Contention.
      CPU Clock Speed Limit Controls the upper limit of host CPU resources that the VM can use. The valid range is 1% to 100%. Setting the value to 100% or leaving it blank means no limit.
      CPU NUMA Binding Binds VM CPUs (vCPUs) to host CPUs (pCPUs) and assigns specific pCPUs to the VM to improve VM performance. For more information, see Configure VM Resource Contention.
      CPU Hot Plug Whether the VM supports online CPU modification. This option is enabled by default. CPU hot plug and memory hot plug must be enabled or disabled together.
      Note: Only some operating systems support hot plug. Click View to view the list of operating systems that support hot plug.
      CPU Hypervisor Tag Whether to enable the virtualization (hypervisor) flag for the VM. If disabled, applications skip VM virtualization environment detection. This option is enabled by default.
    2. Memory: Customize the VM memory capacity and features.
      Option Description
      Memory VM memory capacity.
      Memory Resource Priority For critical VMs, set this option to High to give the VM higher memory contention capability than VMs with Normal priority when the host is overloaded. For more information, see Configure VM Resource Contention.
      Memory Hot Plug Whether the VM supports online memory modification. This option is enabled by default. CPU hot plug and memory hot plug must be enabled or disabled together.
      Note: Only some operating systems support hot plug. Click View to view the list of operating systems that support hot plug.
    3. Disk 1: Customize the storage location, capacity, and features of the VM system disk. You can create a new disk or select an existing system image.
      Option Description
      Disk Encryption Encrypts all data stored on the disk by using a key from the default key provider. You can encrypt an individual disk even when VM encryption is disabled. Disk encryption and shared-disk mode are mutually exclusive.
      Storage Location Data storage location of the VM disk. If not specified, the system allocates a data storage automatically.
      Capacity System disk capacity when creating a new disk.
      System Image When using a system image, select an image that contains the VM operating system. raw and qcow2 formats are supported.
      Bus Type Bus type of the VM disk device. Options include Virtio, IDE, Virtio SCSI, and SCSI. By default, Disk 1 uses Virtio on Linux and IDE on Windows and Other operating systems.
      Provision Method When SAN storage is selected as the storage location, select how disk storage space is allocated. The default value is Thin Provisioning.
      • Thin Provisioning: Allocates storage space based on actual usage for higher storage utilization.
      • Thick Provisioning: Pre-allocates the required storage space when the disk is created to provide sufficient storage capacity and ensure storage performance.
      Caching Mode Whether to use the host page cache for VM write operations and, if used, whether to return success only after data is written to the storage device. The default value is none, which means the host page cache is not used.
      AIO Acceleration Whether to enable asynchronous I/O (AIO) acceleration in the VM kernel. This option is disabled by default.
      Note: AIO acceleration can be enabled only when the caching mode is none.
      QoS Whether to set read/write bandwidth and IOPS limits for the disk. By default, no limit is set. For more information, see Configure VM QoS.
      Disks other than Disk 1 are data disks, such as Disk 2. Click Add Hardware > Disk to add a data disk. A single VM supports up to 24 disks, including Disk 1.
      • Supported data disk addition methods include creating a new disk, using a disk image, selecting an existing disk, and adding an RDM disk.
      • When you create a disk or add one from a disk image, Disk Encryption follows the VM encryption state by default and can be changed as needed.
      • When you select an existing disk, it retains its encryption state, which cannot be changed during attachment. The VM encryption state does not change the encryption state of the existing disk.
      • RDM disks do not support disk encryption and are not automatically encrypted when VM encryption is enabled.
      • By default, data disks use Virtio on Linux and Windows. For Other operating systems, data disks support only IDE.
      • When the storage location is ZHPS distributed storage, only Virtio is supported as the bus type.
      • When the disk storage location is ZCE distributed storage and the bus type is Virtio SCSI, the data disk can be set as a shared disk. This is not set by default.
      • When the disk storage location is SAN storage, the bus type is Virtio SCSI, and the provision method is Thick Provisioning, the data disk can be set as a shared disk. This is not set by default.
      • A shared disk cannot be encrypted. If Disk Encryption is enabled, disable it before configuring the disk as shared.
      • When a disk is a shared disk, you cannot modify its bus type or QoS limit.
    4. NIC 1: Customize the VM NIC address and features.
      Option Description
      State Whether to automatically enable the NIC when the VM powers on.
      NIC Model Set the NIC model. e1000, rtl8139, virtio, and SR-IOV are supported.
      Port Group Port group that contains the distributed switch port connected to the VM NIC.
      NIC Queue Number Uses multiple queues for the VM NIC to send and receive network packets, improving network PPS and bandwidth performance.
      MAC Address Specify a VM MAC address. By default, the system assigns a MAC address automatically.
      Specify IP Address Specify a VM IP address. By default, the system assigns an IP address automatically.

      If DHCP is disabled for the distributed port group where the VM NIC resides, you can use VMTools to specify an IPv4 address and automatically apply it to the VM. For more information, see Install and Use VMTools.

      Assign DNS Specify how DNS addresses are assigned. By default, the system assigns DNS addresses automatically.
      Security Group Associate security groups with the VM NIC to control east-west traffic. The smaller the value on the left of an associated security group, the higher its priority.
      Note: Configure security groups carefully to avoid rule conflicts between them.
      QoS Whether to set bandwidth limits for packets sent and received by the VM NIC. By default, no limit is set. For more information, see Configure VM QoS.

      Click Add Hardware > NIC to add multiple NICs.

    5. CD/DVD Drive 1: Mount an ISO system image file to boot the VM from a CD/DVD drive.
      Click Add Hardware > CD/DVD Drive to add a CD/DVD drive. A single VM supports up to 3 CD/DVD drives.
    6. GPU Device 1: Attach a GPU device to the VM.
      Physical GPU devices and vGPU devices are supported. Click Add Hardware > GPU Device to add a GPU device.
    7. USB Device 1: Attach a USB device to the VM.
      Direct connection and forwarding are supported. Click Add Hardware > USB Device to add a USB device. A single VM supports up to 1 USB device.
    8. PCIe Device 1: Attach a PCIe device to the VM.
      PCIe devices on the host that have been switched to passthrough are supported. Click Add Hardware > PCIe Device to add a PCIe device.
    9. TPM: Attach a virtual Trusted Platform Module (vTPM) to provide enhanced security for the VM operating system.
      Before adding a TPM device, add an available key provider and set the VM boot mode to UEFI. Click Add Hardware > TPM to add a TPM device. A single VM supports up to 1 TPM device.
    10. Other Hardware: Configure the graphics card and audio card types for the VM.
      Option Description
      Graphics Card Type Default graphics card type used when the VM starts. vga, virtio, qxl, and cirrus are supported and provide basic, high-definition, or high-performance video capabilities. The default value is vga for x86 VMs. ARM VMs support only virtio.
      Total Graphics Memory For vga and cirrus graphics card types, graphics memory is fixed at 16 MB. For qxl, graphics memory can be customized.
      Audio Card Type Default audio card type used when the VM starts. HDA (ICH6), HDA (ICH9), and AC97 are supported. The default value is HDA (ICH6).
      Motherboard Type Default motherboard type used when the VM starts. i440fx and q35 are supported. The default value is i440fx.
  5. Configure the VM advanced settings as needed:
    1. Configure general options.
      Option Description
      Tag Attach tags to identify VMs.
      Hostname VM hostname.
      VM Scheduling Group Join a VM scheduling group and allocate hosts according to the scheduling policy associated with the group.
      Sync with Host BIOS Whether to synchronize the Windows VM BIOS clock with the host BIOS clock. This option is disabled by default. For more information, see VM Time Synchronization.
      User Data User-defined data. Upload custom parameters or scripts to customize the VM or complete specific tasks. For more information, see Import User Data to a Linux VM and Import User Data to a Windows VM.
    2. Configure remote access settings.
      Option Description
      Console Mode VM console mode. Options include VNC, SPICE, and VNC+SPICE. The default value is VNC.
      Console Password VM console password. You can enter a password manually or generate one randomly. Only letters, numbers, and the following special characters are supported: -`=[];',./~!@#$%^&*()_+|{}:"<>?

      In security settings, you can use the VNC Console Password switch to specify whether a console password is required and customize password strength. If enabled, the console password must meet the specified strength requirements.

      USB Redirection Redirect USB devices from the VDI client to the VM. This option is disabled by default.
    3. Configure login authentication settings.
      Option Description
      None Do not set a login password or SSH key.
      Password System login password for the root user of a Linux VM or the Administrator user of a Windows VM. You can enter a password manually or generate one randomly. Only letters, numbers, and the following special characters are supported: -`=[];',./~!@#$%^&*()_+|{}:"<>?
      Note: Before setting the password, make sure the VM image has cloud-init.
      SSH Key Select an SSH key to inject for password-free VM login.
      Note: Before injecting the SSH key, make sure the VM image has cloud-init.
    4. Configure VMTools.
      Option Description
      Failure Response Policy Set the automatic response action after a VM failure, such as a Windows blue screen or Linux guest hang. Options include No Action, Reboot, and Shut Down.
      Time Synchronization Whether to automatically synchronize the VM base time with the host system time. This option is enabled by default.
    5. Configure boot options.
      Option Description
      Boot Order Priority sequence for loading the operating system during VM boot. Hard disk, CD/DVD drive, and network boot are supported. By default, BIOS boots from the hard disk. If no boot device is found, the system cannot be loaded.
      BIOS Mode BIOS boot mode. Legacy and UEFI are supported. The default value is Legacy for x86 clusters and UEFI for ARM clusters.
      Secure Boot This option can be enabled only when BIOS Mode is UEFI. When enabled, the system validates the digital signatures of all boot components, such as the boot loader and operating system kernel, during VM startup. Only trusted software with valid signatures is loaded.
      BIOS Post Delay Duration for which the BIOS screen stays open. The default value is 10 seconds.
    6. Configure other options.
      Option Description
      Hide KVM Virtualization Flag Controls whether the VM CPU virtualization flag is hidden. When enabled, <hidden state="on"> is inserted into the <kvm> element in the VM definition XML. This option is disabled by default.
      VMware I/O Port Simulation Whether to allow a KVM VM to emulate I/O ports in a VMware virtualization environment so that the KVM VM can use VMware I/O port standards. This option is disabled by default.
      The main purposes of this option are:
      • Migration and compatibility: Allows VMs to be migrated from a VMware environment to a KVM environment, or allows VMware and KVM VMs to run in a mixed environment without large-scale configuration changes.
      • Testing and development: Developers and testers can use KVM VMs to simulate a VMware environment and test application or configuration behavior without actual VMware licenses.
      Anti-Spoofing Mode Whether to enable anti-IP/MAC spoofing and ARP spoofing protection. When enabled, the VM can communicate with external networks only by using the IP/MAC address assigned by the platform. This option is disabled by default.
      Cross-Cluster HA Policy Whether automatic VM HA migration supports cross-cluster migration.
      Note: This policy affects only automatic VM migration in shared storage scenarios, such as distributed storage, NFS storage, and SAN storage. Examples include starting a VM on another host for VM HA or migrating a VM when a host enters maintenance mode. Other operations, such as manual hot migration of a VM to another host, starting a VM on a specified host, or changing hosts based on a dynamic resource scheduling (DRS) policy, are not affected.
      Hyper-V Whether to enable Hyper-V emulation for the VM. This option is mainly used for nested virtualization scenarios on Windows VMs. It is disabled by default.
      EmulatorPin Whether to bind VM threads other than vCPU and I/O threads to host pCPUs. Binding by NUMA node is supported. By default, no binding is configured, and VM-related threads run on pCPUs according to system scheduling.
      Auto-Converge Whether to enable auto-convergence mode for KVM VM hot migration. This option is disabled by default.

      If the VM remains under high workload for a long time and the application is moderately sensitive to performance, enable auto-convergence mode to improve the migration success rate.

      PCI Hot Plug Whether to allow hot plugging of PCI devices from the VM. This option is enabled by default.
      Note: If a hardware compatibility error occurs during hot plug, or if the hardware device is not supported, disable this option.
      CPU Vendor ID If the host where the VM runs uses a Hygon CPU, set the VM CPU vendor ID to AuthenticAMD to improve operating system compatibility and ensure that the VM runs properly. If the value is None, some VM operating systems might be incompatible.
      Note: This parameter is hidden when the VM location is a cluster or automatically allocated.
  6. Review the configuration and click OK.

What to do next

Some VM settings depend on VMTools. After the VM is created, install VMTools so that these settings can take effect. For more information about VMTools, see Install and Use VMTools.

Import a Virtual Machine

Upload an OVF file to quickly import a VM and support migration from third-party virtualization platforms.

Before you begin

  • The platform provides VM-related system parameters that control default platform behavior. Before creating a VM, you can customize VM-related system parameters to control default VM characteristics.
  • To enable VM or disk encryption, make sure that an available default key provider is configured. If you use the Native Key Provider, back it up first. For more information, see Encryption Keys and How Encryption Works.

Procedure

  1. In the navigation pane, right-click the target cluster, host, or image, and then click New Virtual Machine.
  2. In the Select VM Creation Type dialog, select Import VM, and then click Next.
  3. In the Import VM dialog, configure the following options:
    Upload Information
    Option Description
    Image Storage Temporary storage for the uploaded template file. Standalone image storage and distributed image storage are supported. The template file is automatically deleted after the VM is generated.
    Template Type OVF template files are supported.
    OVF File Upload an OVF file. Only one file can be uploaded.
    VMDK File Upload VMDK files from the OVF template. The files must be consistent with the file configuration defined in the OVF file, including the number of files and the configuration content.
    MF File Upload the MF file from the OVF template. Only one file can be uploaded.
    Basic Information
    Option Description
    Name VM name.
    Group VM group. If not specified, the default group is used.
    Location Host or cluster where the VM runs.
    Storage Location Data storage location of the VM disk. Local storage, NFS storage, SAN storage, and distributed storage are supported. If not specified, automatic allocation is used.
    HA Automatic restart mechanism after an abnormal VM shutdown. This option is enabled by default.
    VM Encryption Encrypts runtime data written to disk, such as memory and GPU state, by using a key from the default key provider. Enabling this option automatically enables Disk Encryption. For more information, see VM Encryption.
    Disk Encryption Encrypts all data stored on the imported VM disks by using a key from the default key provider. You can encrypt the disks even when VM encryption is disabled.
    Power Status Whether to automatically power on the VM after it is created. By default, the VM is powered on automatically.
  4. Review the configuration and click OK.

What to do next

Some VM settings depend on VMTools. After the VM is created, install VMTools so that these settings can take effect. For more information about VMTools, see Install and Use VMTools.

Register a Virtual Machine

Register VM configuration and data files to create a corresponding virtual machine record on the platform. After registration, the virtual machine can be managed by the platform.

Before you begin

  • Make sure an Advanced Edition license is installed on the platform and is valid.
  • Only SAN storage, local storage, and NFS storage support VM registration. Before registration, the data storage must be attached to the corresponding cluster, and the cluster must contain hosts.
  • The same VM configuration file cannot be registered multiple times on the same host.
  • For a VM with TPM, make sure the corresponding key provider is configured on the platform before registration.

Procedure

  1. In the navigation pane, click Inventory > Data Storage.
  2. Select the target data storage, and then click Actions > Register VM.
  3. In the Register VM dialog, configure the following options:
    Option Description
    Configuration File Select the configuration file of the VM to register.
    VM Name Set the VM name.
    Group Select the VM group.
    Location Specify where the VM runs.
  4. Click OK.

Clone a Virtual Machine

To reuse the configuration of an existing virtual machine, clone the VM. ZSphere provides full-VM cloning and supports Full Clone and Instant Full Clone.

Before you begin

  • The source VM must be running, paused, or shut down.
    Note: When cloning a running VM, only data that has been written to disk when the clone task starts is cloned. Real-time cached data is not included.
  • To ensure data integrity, pause or shut down high-I/O VMs before cloning them.
  • Detach shared disks from the source VM. VMs with shared disks cannot be cloned.
  • The cluster where the VM resides has sufficient compute, storage, and network resources.
  • If the source VM is encrypted or you plan to encrypt the cloned VM, make sure that the default key provider is available.

Procedure

  1. On the target VM page, click Actions > Clone > Clone Virtual Machine.
  2. In the Clone Configuration section of the Clone Virtual Machine dialog, select a clone method.
    Option Description
    Source VM Displays the source VM. This value cannot be changed.
    Clone Method Select a clone method:
    • Full Clone: Copies all data from the source VM. The cloned VM is always independent of the source VM. This method takes more time and storage space, but lets you specify the storage location for each disk.
    • Instant Full Clone: Quickly creates a cloned VM from the source VM, and then merges snapshots in the background so that the cloned VM becomes independent. This method takes less time and storage space. Disk storage locations are assigned automatically.
      Note: During the snapshot merge, other VM or disk operations are performed after the merge is complete.
  3. In the Basic Info section, configure the cloned VM.
    Option Description
    Name Specify a name for the cloned VM.
    Quantity Specify the number of VMs to clone. For a batch clone, the system appends sequential suffixes such as "-1", "-2", and "-3" to the VM names.
    VM Encryption Controls whether VM encryption is enabled for the cloned VM. If VM encryption is enabled for the source VM, it remains enabled for the cloned VM. Otherwise, enable this option as needed. Enabling VM encryption enables disk encryption for all disks by default. You can still adjust the encryption state of disks that were not encrypted in the source VM.
    Power Status Select Power on after clone to automatically start the VMs after cloning.
  4. On the Hardware Info tab, configure the hardware for the cloned VM.
    Hardware Description
    Disk

    For a Full Clone, you can specify the Storage Location for each disk. For an Instant Full Clone, storage locations are assigned automatically.

    Disk encryption is handled as follows:

    • A disk encrypted in the source VM remains encrypted.
    • A disk not encrypted in the source VM remains unencrypted by default. Enable Disk Encryption as needed.
    • When VM Encryption is enabled, Disk Encryption is enabled by default for disks that were not encrypted.
    Note:
    • If Disk 1 of the source VM uses local storage and the other disks use different data storage, the clone fails when the local storage is unavailable.
    • For SAN storage, you can specify a provisioning method for the disk.
    • For ZCE distributed storage, you can select a storage pool for the disk.
    NIC The NIC configuration of the source VM is used by default. You can add or remove NICs and configure the state, NIC model, port group, number of NIC queues, MAC address, IP address, DNS, security groups, and NIC QoS. For more information about NIC options, see Create a Virtual Machine.
    Note: Make sure that the MAC and IP addresses of cloned VMs do not conflict with existing resources. For a batch clone, you cannot apply the same network values that must remain unique to every cloned VM.
    vTPM Displayed only if a vTPM is attached to the source VM. For TPM Configuration, select one of the following options:
    • Retain: Retains the TPM information of the source VM for the cloned VM.
    • Reset: Uses the default key provider to create a new TPM for the cloned VM.
  5. On the Advanced Settings tab, select General Options and configure the following settings.
    Option Description
    Hostname Specify the hostname for the cloned VM. VMTools must be installed on the source VM for this setting to take effect. For a batch clone, the system appends a sequential numeric suffix to each hostname.
    VM Scheduling Group Add the cloned VM to a VM scheduling group so that a host is assigned according to the scheduling policy associated with the group. A VM can belong to only one VM scheduling group.
  6. Review the configuration and click OK.

What to do next

The clone operation copies the VM configuration, installed applications, credentials, and similar data to the cloned VM. It does not automatically copy all associated settings. Configure additional settings for the cloned VM as needed. For example, you can manually assign the same tags as the source VM.

If the source VM has a console password configured, restart the cloned VM to make the password take effect.

Delete a Virtual Machine

Before you begin

  • VMs in the running, paused, crashed, or unknown state cannot be moved to the recycle bin or deleted. Shut down the VM before this operation.
  • (Optional) The platform provides deletion protection for VMs and disks. You can control deletion behavior by adjusting deletion policies in system parameters. By default, the VM deletion policy is delayed deletion with a 7-day retention period, and the disk deletion policy is delayed deletion with a 3-day retention period. Deleted resources are first moved to the recycle bin and are permanently deleted after the corresponding retention period.

Procedure

  1. In the navigation pane, choose Inventory > VM and Host.
  2. Select the target VM.
  3. On the VM details page, click Actions > Move to Recycle Bin.
    To delete multiple VMs, go to the Virtual Machine tab of a parent resource, such as a host, cluster, or data center. For example, on the Virtual Machine tab of a host, select the VMs to delete, and then click Actions > Move to Recycle Bin.
    The delete button name changes based on VM Deletion Policy. When the deletion policy is Immediate Deletion, the button is named "Delete". When the deletion policy is Delayed Deletion or Never Delete, the button is named "Move to Recycle Bin".
  4. In the confirmation dialog, select whether to delete disks attached to the VM at the same time, excluding shared disks.
    If selected, disks are handled according to the behavior defined in the disk deletion policy.
  5. After acknowledging the risk, click OK.

Results

After deletion, CPU, memory, IP addresses, and other resources occupied by the original VM are released immediately.