A Windows template is a VM image where a Windows VM instance with
installed necessary software such as drives and QGA removes and then regenerates its
security identifier (SID, a unique identifier of a user, user group, or computer
account). This template can be mainly used to create VM instances in bulk in a custom
manner. This Tutorial supports the following versions:
Windows version: Windows Server 2008 R2, Windows Server 2012 R2, Windows 7,
Windows 10, Windows Server 2016, and Windows Server 2019.
ZStack Cloud version: 3.7.1 or later.
Environment Preparation
To encapsulate a template, prepare the following software or tools:
Make sure that you obtain a Windows image from the
Microsoft official website as needed, and ensure your compliance of relevant
authorizations and permissions. This Tutorial
referencescn_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_x64_dvd_617598.iso.
Optional. USB 3.0 driver:
USB 2.0 driver is native to Windows Server
2008 R2. Install USB 3.0 driver as needed. The driver
path (64-bit) references
http://cdn.zstack.io/tools/renesas_usb30_21390.exe
.
Template
This Tutorial includes two types of encapsulation method: Windows and Windows VirtIO.
Encapsulation procedures for each method are different. Make sure that you perform
relevant operations according to the corresponding method as follows:
Windows: Add an image by using Windows platform type. Note that the
template with the Windows method has two types of drive: IDE and VirtIO. For
more information about how to encapsulate a template with the Windows method,
see Windows Template.
Windows VirtIO: Add an image by using Windows platform type and enable
Virtio. Note that the template with the Windows VirtIO method has only one type
of drive: VirtIO. For more information about how to encapsulate a template with
the Windows VirtIO method, see Windows VirtIO Template.
Windows Template
To encapsulate a Windows template, follow these steps:
Add an image.
Install an operating system.
Install GuestTools and other software.
Prepare the operating system.
Create a system template.
The following details the whole process of how to encapsulate a Windows Server 2008 R2
template.
Add an Image
Add a Windows Server 2008 R2 image to ZStack Cloud. This image is used to install the operating system.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Compute Configuration > Image. On the Image page, click Add
Image. Then, the Add Image page is displayed. On
the Add Image page, set the following parameters:
Name: Enter a name for the image.
Description: Optional. Enter a description for the
image.
Image Type: Select an image type. Here, select system
template.
Image Format: Select an image format. Here, select
iso.
CPU Architecture: Select a CPU architecture for the
image. VM instances created from the image use this CPU architecture.
Note: If
you select aarch64 or mips64, set the BIOS mode to UEFI.
Platform: Select an image platform. Here, select
Windows.
OS: Select an operating system that is consistent with
the image.
VirtIO: Disable Virtio.
Image Storage: Select an image storage.
Image Path: Specify an image URL or upload a local file.
Note:
The URL can be either in the HTTP/HTTPS/FTP/SFTP format
or the file:/// format. Currently, the
file:/// format supports only
ImageStorage backup
storages.
To upload a local file, make sure that this file can be accessed
by your browser. ImageStore image storage are supported.
BIOS Mode: Select a BIOS mode,
including Legacy or UEFI. Default mode: Legacy.
Legacy: This mode supports all operating systems.
UEFI: This mode supports Windows 7, Windows Server 2008 R2, Windows 8,
and their later versions.
Note:
For a Windows-based VM instance (such as
Windows Server 2012 R2, Windows Server 2016, and Windows 10)
booted by UEFI, the following page will be displayed after
the VM instance starts. Press any key to continue the
installation of the VM operating system. Otherwise, the VM
instance will enter the UEFI Shell.Figure 1. Press Any Key to Continue If the VM instance already entered the UEFI Shell, you
must run the following commands before you boot the
operating
system.
Shell> fs0:
FS0:\> dir
FS0:\> cd EFI
FS0:\EFI\> cd BOOT
FS0:\EFI\BOOT\> BOOTX64.EFI
After
you perform the preceding operations, press any key to
continue the VM operating system installation. Otherwise,
the VM instance will enter the UEFI Shell again.
Figure 2. Add Windows Image
Install an Operating System
Create a VM instance and install the operating system by using the
Windows Server 2008 R2 image you added in the previous step.
Create a VM Instance
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. On the displayed, click on
Standard Creation. Then, follow these steps to create a
VM instance.
Complete the basic configurations.
Set the following parameters:
Name: Enter a name for the VM
instance.
Description: Optional. Enter a
description for the VM instance.
Quantity: Enter the number of VM
instances to be created. You can create VM instances in
bulk.
Tag: Optional. Bind one or more tags to
the VM instance.
Group:Choose a group for the VM instance.
If not selected, the VM instance will go to the default
group.
Set the VM offering by using one of the following methods:
Basic Offering: Set the VM
offering by selecting an existing instance offering and
disk offering.
Instance Offering: Select
an existing instance offering.
Image: Select an existing
image.
BIOS Mode: Select an BIOS
mode for the VM instance. By default, the VM BIOS
mode is consistent with the image.
Data Volume: Optional.
Choose whether to create a data volume and attach
it to the VM instance. Here, you do not need to
create a data volume.
Custom Offering: Set the VM
offering by customizing the following VM
configurations:
CPU: Set the number of
CPU cores of the VM instance.
Memory: Set the memory
size of the VM instance.
Image: Select an existing
image.
BIOS Mode: Select an BIOS
mode for the VM instance. By default, the VM BIOS
mode is consistent with the image.
Data Volume: Optional.
Choose whether to create a data volume and attach
it to the VM instance. Here, you do not need to
create a data volume.
Complete the resource configurations.
Set the following parameters:
Network Configurations: Select an L3
network used by the VM instance and complete the network
configurations.
Network: Select an L3 network
used by the VM instance. Supported network types: public
network, flat network, and VPC network.
Make Default: If you add multiple
network configurations, set one of the networks as the
default network.
Enable
SR-IOV: Optional. Choose whether to use
SR-IOV to generate a VF NIC and pass it through to the
VM instance.
Assign IP:
Optional. Choose whether to assign an IP address to the
VM NIC.
MAC Address: Optional. Choose
whether to configure a MAC address for the VM
instance.
Security Group: Optional.
Associate a security group with the VM instance.
Cluster: Optional. Specify a cluster for
the host on which the VM instance is to be started.
Storage Allocation Policy: Specify how
the Cloud allocates a primary storage.
Host: Optional. Select the host on which the VM
instance is to be started. If you specified a cluster, select a
host from the cluster.
vDrive:
Optional. Add a virtual drive (vDrive) for the VM instance.
GPU: Add a GPU
device for the VM instance by specifying a GPU specification or
device. The GPU device can be either a physical GPU (pGPU) or a
virtual GPU (vGPU).
CPU Pinning:
Specify the association between the pCPU of the host and the
vCPU of the VM instance. Then, the Cloud allocates a pCPU to the
VM instance accordingly. This helps to improve the VM
performance.
Complete the system configurations.
Set the following parameters:
SSH Login Mode: Optional. Set the SSH
login mode.
Hostname: Set
a hostname for the VM instance.
User Data:
Optional. Inject user-defined parameters or scripts to customize
configurations for the VM instance or to accomplish specific
tasks.
Console
Password: Set a console password for the VM
instance.
Console Mode:
Set the console mode. Options: VNC, SPICE, and VNC+SPICE.
Default: VNC.
Confirm the information.
View the information about the
VM instance. You can edit the information by clicking the Edit
icon.
On the Preview page, click
OK. Then, the Windows Server 2008 VM instance is created.
The operating system will automatically enter the BIOS mode.
Figure 3. Create VM Instance
Install the Operating System
On the VM Instance page, select the VM
instance you created before, and launch the VM console. Then, the installation page
appears.
Figure 4. Install Operating System
Complete the configurations by referencing to the common
installation process of Windows Server 2008 R2. During the installation, the
operating system will be automatically rebooted, due to which the console might be
disconnected. In that case, launch the console again. After you complete installing
the operating system, set the admin password and log in to the operating system. So
far, the Windows operating system is installed.
Figure 5. Complete Installing Operating System
Prevent Disk from Being Offline
If the server is abnormally shut down, disks on the VM instance
might be offline after the VM instance reboots. To prevent this, after you complete
installing the Windows operating system, go to Command Prompt
as an Administrator, and run the following commands
successively.
C:\Users\Administrator> diskpart ::Enter diskpart.
DISKPART> san ::View the SAN policy.
DISKPART> san policy=onlineall ::Change the SAN policy by using diskpart.
DISKPART> exit
Install GuestTools and other Software
GuestTools is a performance optimization tool used by ZStack Cloud to improve the performance of Windows VM instances. The
following table lists the tools and drivers contained in GuestTools.
Type
Name
Functionality
VirtIO driver
SCSI controller
Storage controllers of the VirtIO type can
effectively improve the disk performance of a VM instance in a
virtualization environment.
PCI simple communications controller
After you install a PCI simple communications
controller, a Windows VM instance can communicate with the
underlying KVM virtualization.
PCI device
After you install a PCI device and enable its
internal monitoring, Windows will support the balloon memory
scaling.
Ethernet adapter
A VirtIO Ethernet adapter can effectively improve the network
performance of a VM instance in a virtualization
environment.
Commonly-used tools
QEMU Guest Agent (QGA)
QGA is an application where mutual interactions between a host
and a VM instance can be achieved. These interactions do not
rely on networks, thereby greatly improving the VM performance
and functionality.
QGA helps check the state of GuestTools and VirtIO drivers in a
VM instance.
After QGA is installed, the VM instance enables you to change its
password online.
Cloudbase-Init
The VM instance that has Cloudbase-Init installed
enables you to import User Data and achieve other custom
functionalities.
Agent internal monitoring
After an agent is installed, you can check the internal
monitoring data of a VM instance.
Install GuestTools
Install GuestTools ISO.
After you complete installing the operating
system, enter the VM details page, and click install
GuestTools to attach the GuestTools ISO to the VM
instance.
Load the GuestTools image.
Enter the console page of the VM instance,
and click Install GuestTools in the GuestTools
installation prompt. Then, the operating system automatically loads the
GuestTools image to the virtual CD Drive. To check this operation, go to the
Computer page.Figure 6. Load GuestTools Image
Install GuestTools and VirtIO driver.
Right-click the GuestTools CD
Drive, select Install or run program from your media
or double-click the GuestTools installation program. By following the
displayed setup installation wizard, install GuestTools, commonly-used
tools, and VirtIO drivers, successively.
Figure 7. Install GuestTools
Confirm the installation and reboot your computer.
After you complete
installing GuestTools, click Finish in the displayed
dialog box. Make sure that you complete the installation and reboot the
computer to make all configurations take effect.
Figure 8. Complete the Installation and Reboot Your Computer
After the operating system reboots, the platform of the VM instance is
automatically changed to WindowsVirtio.
(Optional) Install other Software
You can install other software as needed in addition to the tools
or drivers included in GuestTools.
For example, USB 2.0 driver is native to Windows Server 2008 R2.
You can install the USB 3.0 driver as needed. Then, you can use the USB passthrough
functionality.
You can obtain the driver file from
https://cdn.zstack.io/tools/renesas_usb30_21390.exe , and double click
the file to install the USB 3.0 driver.
Figure 9. Install USB 3.0 Driver
Prepare the Operating System
Operating system preparation is designed for generalizing and removing
system-specific information such as hardware of a computer via Windows-native System
Preparation Tool (Sysprep). To prepare the operating system, follow these steps:
Open the CMD command line by using the administrator permission.
Go to the C:\Windows\System32\sysprep directory and run the
Sysprep tool.
Configure preparation policies and perform relevant operations. You can complete
this step by setting the following parameters:
System Cleanup Action: Select Enter System
Out-of-Box Experience (OOBE).
Generalize: Select this checkbox. Then, the VM
operating system created from the template has a unique security
identity (SID).
Shutdown Options: Select Shutdown.
Click OK. Then, the system
preparation begins.Figure 10. System Preparation
Allow Execution of Third-Party Scripts:
In the VM instance, run the
command Set-ExecutionPolicy RemoteSigned -Force to allow
the execution of third-party scripts, ensuring that platform functions such
as network configuration delivery, reading, and script execution can work
properly.
Create a System Template
After you create the operating system template successfully, you can
create VM instances in bulk in a custom manner by using this image. Also, you can export
this image to create VM instances in other cloud platforms.
Create a VM Image
On the VM Instance page, select the target VM
instance and create an image for the VM instance.
On the Create Image page, set the following parameters:
Name: Enter a name for the image.
Description: Optional. Enter a description for the
image.
Image Type: Select system image.
Image Storage: Select an existing image storage.
Click OK. Then, the image is created.Figure 11. Create Image
Note: If your image storage is ImageStore or Ceph, you can create an image for
a VM instance when it is in the running state. For other types of image storage,
you need to stop the VM instance before you can create an image.
Export the Image
Exported images can be used directly by other cloud platforms to
create VM instances. The export method varies based on the image storage type.
ImageStore image storage
On the Image page,
click Actions > Export Image. Then, an image is exported.
After the image is
generated, you can download the exported image by copying the image URL
on the Overview tab page of the image details
page.
Ceph image storage
On the Overview tab page of
the created image, copying Image Storage Path
will prompt you for the corresponding information such as pool and image
in the Ceph image storage. After you copy this image path, you can
export the Ceph image by running rbd on the Ceph
image storage. Assume that the storage path of the Ceph image storage is
ceph://bak-t-c9923f982/61ece0adc72, run the
following
command:
[root@ceph-node1 ~]#rbd export bak-t-c9923f982/61ece0adc72 /root/export-test.image
#bak-t-c9923f982 is the pool name where the image belongs.
#61ece0adc72 is the image name.
#/root/export-test.image is the name of the exported target file .
Windows VirtIO Template
To encapsulate a Windows VirtIO template, follow these steps:
Add an image.
Install an operating system.
Install GuestTools and other software.
Prepare the operating system.
Create a system template.
The following details the whole process of how to encapsulate a Windows Server 2008 R2
template.
Add an Image
Add a Windows Server 2008 R2 image and a VirtIO drive image to
ZStack Cloud. These two images are used to install the
operating system.
Add a Windows Image
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Compute Configuration > Image. On the Image page, click Add
Image. Then, the Add Image page is
displayed.
On the Add Image page, set the following
parameters:
Name: Enter a name for the image.
Description: Optional. Enter a description for the
image.
Image Type: Select an image type. Here, select system
template.
Image Format: Select an image format. Here, select
iso.
CPU Architecture: Select a CPU architecture. Here,
select x86_64.
Platform: Select the platform for the image. Here,
select Windows.
OS: Select Windows.
VirtIO: Enable VirtIO.
Image Storage: Select an existing image storage.
Image Path: Specify an image URL or upload a local file.
Note:
The URL can be either in the HTTP/HTTPS/FTP/SFTP
format or the file:/// format. Currently, the
file:/// format supports only
ImageStorage backup
storages.
To upload a local file, make sure that this file can be
accessed by your browser. ImageStore image storage are
supported.
BIOS Mode: Select a BIOS mode,
including Legacy or UEFI. Default mode: Legacy.
Legacy: This mode supports all operating systems.
UEFI: This mode supports Windows 7, Windows Server 2008 R2, Windows 8,
and their later versions.
Note:
For a Windows-based VM instance (such as
Windows Server 2012 R2, Windows Server 2016, and Windows 10)
booted by UEFI, the following page will be displayed after
the VM instance starts. Press any key to continue the
installation of the VM operating system. Otherwise, the VM
instance will enter the UEFI Shell.Figure 12. Press Any Key to Continue If the VM instance already entered the UEFI Shell, you
must run the following commands before you boot the
operating
system.
Shell> fs0:
FS0:\> dir
FS0:\> cd EFI
FS0:\EFI\> cd BOOT
FS0:\EFI\BOOT\> BOOTX64.EFI
After
you perform the preceding operations, press any key to
continue the VM operating system installation. Otherwise,
the VM instance will enter the UEFI Shell again.
QEMU Guest Agent: Choose whether the current image
has installed QEMU Guest Agent (QGA). Here, leave this option alone.
Support Elastic Baremetal Instance: Choose whether to
support elastic baremetal instance. Here, leave this option alone.
Figure 13. Add Windows Image
Install an Operating System
Create a VM instance and install an operating system by using the Windows Server 2008 R2
image you added before.
Create a VM Instance
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. On the displayed, click on
Standard Creation. Then, follow these steps to create a
VM instance.
On the main menu of ZStack Cloud, choose Resource Center > Resource Pool > Virtual Resource > VM Instance. On the VM Instance page, click
Create VM Instance. On the displayed, click on
Standard Creation. Then, follow these steps to create a
VM instance.
Complete the basic configurations.
Set the following parameters:
Name: Enter a name for the VM
instance.
Description: Optional. Enter a
description for the VM instance.
Quantity: Enter the number of VM
instances to be created. You can create VM instances in
bulk.
Tag: Optional. Bind one or more tags to
the VM instance.
Group:Choose a group for the VM instance.
If not selected, the VM instance will go to the default
group.
Set the VM offering by using one of the following methods:
Basic Offering: Set the VM
offering by selecting an existing instance offering and
disk offering.
Instance Offering: Select
an existing instance offering.
Image: Select the
WindowsVirtio image you added before.
Data Volume: Optional.
Choose whether to create a data volume and attach
it to the VM instance. Here, you do not need to
create a data volume.
Custom Offering: Set the VM
offering by customizing the following VM
configurations:
CPU: Set the number of
CPU cores of the VM instance.
Memory: Set the memory
size of the VM instance.
Image: Select an existing
image.
Data Volume: Optional.
Choose whether to create a data volume and attach
it to the VM instance. Here, you do not need to
create a data volume.
Complete the resource configurations.
Set the following parameters:
Network Configurations: Select an L3
network used by the VM instance and complete the network
configurations.
Network: Select an L3 network
used by the VM instance. Supported network types: public
network, flat network, and VPC network.
Make Default: If you add multiple
network configurations, set one of the networks as the
default network.
Enable
SR-IOV: Optional. Choose whether to use
SR-IOV to generate a VF NIC and pass it through to the
VM instance.
Assign IP:
Optional. Choose whether to assign an IP address to the
VM NIC.
MAC Address: Optional. Choose
whether to configure a MAC address for the VM
instance.
Security Group: Optional.
Associate a security group with the VM instance.
Cluster: Optional. Specify a cluster for
the host on which the VM instance is to be started.
Storage Allocation Policy: Specify how
the Cloud allocates a primary storage.
Host: Optional. Select the host on which the VM
instance is to be started. If you specified a cluster, select a
host from the cluster.
vDrive:
Optional. Add a virtual drive (vDrive) for the VM instance.
GPU: Add a GPU
device for the VM instance by specifying a GPU specification or
device. The GPU device can be either a physical GPU (pGPU) or a
virtual GPU (vGPU).
CPU Pinning:
Specify the association between the pCPU of the host and the
vCPU of the VM instance. Then, the Cloud allocates a pCPU to the
VM instance accordingly. This helps to improve the VM
performance.
Complete the system configurations.
Set the following parameters:
SSH Login Mode: Optional. Set the SSH
login mode.
Hostname: Set
a hostname for the VM instance.
User Data:
Optional. Inject user-defined parameters or scripts to customize
configurations for the VM instance or to accomplish specific
tasks.
Console
Password: Set a console password for the VM
instance.
Console Mode:
Set the console mode. Options: VNC, SPICE, and VNC+SPICE.
Default: VNC.
Confirm the information.
View the information about the
VM instance. You can edit the information by clicking the Edit
icon.
On the Preview page, click OK. Then,
the Windows Server 2008 VM instance is created. The operating system will
automatically enter the BIOS mode.Figure 14. Create VM Instance
Install the Operating System
On the VM Instance page, select the VM
instance you created before, and launch the VM console. Then, the installation page
appears.
Figure 15. Install Operating System
To configure your own operating system, reference to the normal Windows Server 2008
R2. When you select the installation path during installation, you will prompt for
No drives were found., as shown in No
Drives Were Found.Figure 16. No Drives Were Found
At this time, to continue the installation, install a disk drive. Choose Load Driver > Browse. According to the operating system, select the disk drive in the
VirtIO driver image, and click OK > Next to complete loading the disk drive.
For the 64-bit operating system, the path of the disk drive is
viostor\*\amd64.
For the 32-bit operating system, the path of the disk drive is
viostor\*\x86.
Figure 17. Load Disk Drive
After you load the disk drive, select a system installation path and click
Next to continue the preceding installation process.
During installation, the operating system will automatically reboot, which may lead
to disconnection of the console. In that case, re-enter the operating system. After
you complete installing the operating system, customize the admin password and log
in to the operating system. So far, the Windows operating system is installed.
Figure 18. Complete Installing Operating System
Prevent Disk from Being Offline
If the server is abnormally shut down, disks on the VM instance
might be offline after the VM instance reboots. To prevent this, after you complete
installing the Windows operating system, go to Command Prompt
as an Administrator, and run the following commands
successively.
C:\Users\Administrator> diskpart ::Enter diskpart.
DISKPART> san ::View the SAN policy.
DISKPART> san policy=onlineall ::Change the SAN policy by using diskpart.
DISKPART> exit
Install GuestTools and other Software
GuestTools is a performance optimization tool used by ZStack Cloud to improve the performance of Windows VM instances. The
following table lists the tools and drivers contained in GuestTools.
Type
Name
Functionality
VirtIO driver
SCSI controller
Storage controllers of the VirtIO type can
effectively improve the disk performance of a VM instance in a
virtualization environment.
PCI simple communications controller
After you install a PCI simple communications
controller, a Windows VM instance can communicate with the
underlying KVM virtualization.
PCI device
After you install a PCI device and enable its
internal monitoring, Windows will support the balloon memory
scaling.
Ethernet adapter
A VirtIO Ethernet adapter can effectively improve the network
performance of a VM instance in a virtualization
environment.
Commonly-used tools
QEMU Guest Agent (QGA)
QGA is an application where mutual interactions between a host
and a VM instance can be achieved. These interactions do not
rely on networks, thereby greatly improving the VM performance
and functionality.
QGA helps check the state of GuestTools and VirtIO drivers in a
VM instance.
After QGA is installed, the VM instance enables you to change its
password online.
Cloudbase-Init
The VM instance that has Cloudbase-Init installed
enables you to import User Data and achieve other custom
functionalities.
Agent internal monitoring
After an agent is installed, you can check the internal
monitoring data of a VM instance.
Install GuestTools
Install GuestTools ISO.
After you complete installing the operating
system, enter the VM details page, and click install
GuestTools to attach the GuestTools ISO to the VM
instance.
Load the GuestTools image.
Enter the console page of the VM instance,
and click Install GuestTools in the GuestTools
installation prompt. Then, the operating system automatically loads the
GuestTools image to the virtual CD Drive. To check this operation, go to the
Computer page.Figure 19. Load GuestTools Image
Install GuestTools and VirtIO driver.
Right-click the GuestTools CD
Drive, select Install or run program from your media
or double-click the GuestTools installation program. By following the
displayed setup installation wizard, install GuestTools, commonly-used
tools, and VirtIO drivers, successively.
Figure 20. Install GuestTools
Confirm the installation and reboot your computer.
After you complete
installing GuestTools, click Finish in the displayed
dialog box. Make sure that you complete the installation and reboot the
computer to make all configurations take effect.
Figure 21. Complete the Installation and Reboot Your Computer
After the operating system reboots, the platform of the VM instance is
automatically changed to WindowsVirtio.
(Optional) Install other Software
You can install other software as needed in addition to the tools
or drivers included in GuestTools.
For example, USB 2.0 driver is native to Windows Server 2008 R2.
You can install the USB 3.0 driver as needed. Then, you can use the USB passthrough
functionality.
You can obtain the driver file from
https://cdn.zstack.io/tools/renesas_usb30_21390.exe , and double click
the file to install the USB 3.0 driver.
Figure 22. Install USB 3.0 Driver
Prepare the Operating System
Operating system preparation is designed for generalizing and removing
system-specific information such as hardware of a computer via Windows-native System
Preparation Tool (Sysprep). To prepare the operating system, follow these steps:
Open the CMD command line by using the administrator permission.
Go to the C:\Windows\System32\sysprep directory and run the
Sysprep tool.
Configure preparation policies and perform relevant operations. You can complete
this step by setting the following parameters:
System Cleanup Action: Select Enter System
Out-of-Box Experience (OOBE).
Generalize: Select this checkbox. Then, the VM
operating system created from the template has a unique security
identity (SID).
Shutdown Options: Select Shutdown.
Click OK. Then, the system
preparation begins.Figure 23. System Preparation
Allow Execution of Third-Party Scripts:
In the VM instance, run the
command Set-ExecutionPolicy RemoteSigned -Force to allow
the execution of third-party scripts, ensuring that platform functions such
as network configuration delivery, reading, and script execution can work
properly.
Create a System Template
After you create the operating system template successfully, you can
create VM instances in bulk in a custom manner by using this image. Also, you can export
this image to create VM instances in other cloud platforms.
Create a VM Image
On the VM Instance page, select the target VM
instance and create an image for the VM instance.
On the Create Image page, set the following parameters:
Name: Enter a name for the image.
Description: Optional. Enter a description for the
image.
Image Type: Select system image.
Image Storage: Select an existing image storage.
Click OK. Then, the image is created.Figure 24. Create Image
Note: If your image storage is ImageStore or Ceph, you can create an image for
a VM instance when it is in the running state. For other types of image storage,
you need to stop the VM instance before you can create an image.
Export the Image
Exported images can be used directly by other cloud platforms to
create VM instances. The export method varies based on the image storage type.
ImageStore image storage
On the Image page,
click Actions > Export Image. Then, an image is exported.
After the image is
generated, you can download the exported image by copying the image URL
on the Overview tab page of the image details
page.
Ceph image storage
On the Overview tab page of
the created image, copying Image Storage Path
will prompt you for the corresponding information such as pool and image
in the Ceph image storage. After you copy this image path, you can
export the Ceph image by running rbd on the Ceph
image storage. Assume that the storage path of the Ceph image storage is
ceph://bak-t-c9923f982/61ece0adc72, run the
following
command:
[root@ceph-node1 ~]#rbd export bak-t-c9923f982/61ece0adc72 /root/export-test.image
#bak-t-c9923f982 is the pool name where the image belongs.
#61ece0adc72 is the image name.
#/root/export-test.image is the name of the exported target file .