Updated on 2024-07-19 GMT+08:00

Launching a QingTian Enclave Instance

Resource Isolation

Before launching a QingTian Enclave instance, you need to isolate resources in the parent instance for QingTian Enclave instances first. Isolated resources include vCPUs and memory. You can specify the isolated resources by modifying the */etc/qingtian/enclave/qt-enclave-env.conf* configuration file in the instance.

1 GiB hugepage:
hugepage_size:1024  
Memory: 1 GiB
memory_mib:1024  
vCPUs
cpu_count:2  
# vCPU list
# cpu_list:2,3

Do not repeatedly enable resource isolation, or the hugepage memory may become insufficient and the launch of QingTian Enclave instances or resource isolation may fail. In this example, retain the default settings of 1 GiB hugepage, 2 vCPUs, and 1 GiB of memory. After confirming the parameters in the configuration file, run the following command:

systemctl restart qt-enclave-env.service

There are constraints between configuration items in the */etc/qingtian/enclave/qt-enclave-env.conf* configuration file. For details, see Introduction to the qt-enclave-env.

Launching a QingTian Enclave Instance

On the parent instance, run the *qt enclave start* command with the QingTian Enclave instance image file specified to create a QingTian Enclave instance. After the QingTian Enclave instance is launched, the QingTian Enclave application and its dependencies will be booted from the QingTian Enclave image file to the QingTian Enclave instance. For example, if you want to create a QingTian Enclave instance with 2 vCPUs, 1 GiB of memory, and an EnclaveCID of 4, run the following command:

[root@localhost ~]# qt enclave start --cpus 2 --mem 1024 --eif /home/docker/ubuntu.eif --cid 4
Started enclave with EnclaveID : 0, EnclaveCID : 4, NumberOfCPUs : 2, MemoryMiB : 1024
{
    "EnclaveID":    0,
    "EnclaveCID":   4,
    "NumberOfCPUs": 2,
    "MemoryMiB":    1024,
    "LaunchMode":   "debug"
}

In this instance, the CMD statement in the original Ubuntu image is /bin/bash, so the QingTian Enclave instance executes the statement after being launched. After the statement is executed, the QingTian Enclave application exits, and the QingTian enclave instance is closed.