Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

tools/cvm-image-rewriter/README.md: guide for nested VM #228

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions tools/cvm-image-rewriter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ framework, and the whole flow was divided into three stages:
1. This tool has been tested on `Ubuntu 22.04` and `Debian 10`. It is recommend to use
`Ubuntu 22.04`.

2. This tool can run on bare metal or virtual machine (with nest VM like `Intel VT-x`)
2. This tool can run on bare metal or virtual machine (with nest VM like `Intel VT-x`, detailed in [Section 2.4](#2.4-Run-in-Nested-VM-(Optional)))

3. Please install following packages on Ubuntu/Debian:

Expand Down Expand Up @@ -90,7 +90,7 @@ steps:
```


### 2.1 Customize
### 2.2 Customize

```
$ ./run.sh -h
Expand All @@ -115,7 +115,7 @@ a file named as `NOT_RUN` at the plugin directory. For example:
```


### 2.2 Run Test
### 2.3 Run Test

```
$ ./qemu-test.sh -h
Expand All @@ -124,6 +124,42 @@ Required
-i <guest image> Specify initial guest image file
```

### 2.4 Run in Nested VM (Optional)

This tool can be run in a guest VM on the host, in case that users need to prepare a clean host environment.

1. Enable Nested Virtualization

Given that some plugins will consume more time in a low-performance guest VM, it is recommended to enable nested virtualization feature on the host.

Firstly, check if the nested virtualization is enabled. If the file `/sys/module/kvm_intel/parameters/nested` show `Y` or `1`, it indicates that the feature is enabled.

```
cat /sys/module/kvm_intel/parameters/nested
```

If the feature is not enabled, create the file ` /etc/modprobe.d/kvm.conf`, appending `options kvm_intel nested=1` to it and reboot the host.

```
echo "options kvm_intel nested=1" > /etc/modprobe.d/kvm.conf
```

2. Launch the guest VM

When we launch the guest VM, it is recommended to allocate more than `8G` memory for the guest VM, because this tool will occupy at least `4G` memory. And more CPU cores will improve the guest VM performance, typically the number of CPU cores is at least `4`.

3. Install dependencies

At last, install dependencies in the guest VM before running this tools.

It is an example for a basic Ubuntu 22.04 guest VM.

```
sudo apt install qemu-utils libguestfs-tools virtinst genisoimage cloud-init qemu-kvm libvirt-daemon-system
```



## 3. Plugin

### 3.1 Existing Plugins
Expand Down