You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: how-to/virtualisation/enable-nested-virtualisation.md
+31-29Lines changed: 31 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
1
(enable-nested-virtualisation)=
2
2
# How to enable nested virtualisation
3
3
4
-
> **Disclaimer**:
5
-
> Nested virtualisation is enabled by default on Ubuntu. If you are using Ubuntu, it's unlikely that you will need to manually enable the feature. If you check (using the steps below) and discover that nested virtualisation is enabled, then you will not need to do anything further.
4
+
```{important}
5
+
Nested virtualisation is enabled by default on Ubuntu. If you are using Ubuntu, it's unlikely that you will need to manually enable the feature. If you check (using the steps below) and discover that nested virtualisation is enabled, then you will not need to do anything further.
6
+
```
6
7
7
8
There may be use cases where you need to enable nested virtualisation so that you can deploy instances inside other instances. The sections below explain how to check if nested virtualisation is enabled/available and how to enable it if that is not the case. Bear in mind that currently nested virtualisation is only supported in Ubuntu on `x86` machine architecture.
8
9
@@ -35,7 +36,7 @@ If the output is either `1` or `Y` then nested virtualisation is enabled and you
35
36
36
37
### If the module is not loaded
37
38
38
-
If the module your host requires is not loaded you can load it using `modprobe`and add the property `nested=1` to enable nested virtualisation as shown below for Intel hosts:
39
+
If the module your host requires is not loaded, you can load it using `modprobe`in combination with the property `nested=1` to enable nested virtualisation, as shown below for Intel hosts:
39
40
40
41
```bash
41
42
modprobe kvm-intel nested=1
@@ -47,36 +48,35 @@ Or as follows for AMD hosts:
47
48
modprobe kvm-amd nested=1
48
49
```
49
50
50
-
51
51
## Enable nested virtualisation
52
52
53
53
If the above checks indicate that nested virtualisation is not enabled, you can follow the below steps to enable it.
54
54
55
-
* Create a file in `/etc/modprobe.d` -e.g., `/etc/modprobe.d/kvm.conf`- and add the line `options kvm-intel nested=1` to that file (replace `kvm-intel` with `kvm-amd` for AMD hosts).
55
+
* Create a file in `/etc/modprobe.d` -e.g., `/etc/modprobe.d/kvm.conf`- and add the line `options kvm-intel nested=1` to that file (replace `kvm-intel` with `kvm-amd` for AMD hosts).
56
56
57
-
* Reload the kernel module to apply the changes:
57
+
* Reload the kernel module to apply the changes:
58
58
59
-
```bash
60
-
sudo modprobe -r <module>
61
-
```
59
+
```bash
60
+
sudo modprobe -r <module>
61
+
```
62
62
63
-
Example for Intel hosts:
63
+
Example for Intel hosts:
64
64
65
-
```bash
66
-
sudo modprobe -r kvm-intel
67
-
```
65
+
```bash
66
+
sudo modprobe -r kvm-intel
67
+
```
68
68
69
-
* You should now be able to see nested virtualisation enabled:
69
+
* You should now be able to see nested virtualisation enabled:
70
70
71
-
Example for Intel hosts:
72
-
```bash
73
-
$ cat /sys/module/kvm_intel/parameters/nested
74
-
Y
75
-
```
71
+
Example for Intel hosts:
72
+
```bash
73
+
$ cat /sys/module/kvm_intel/parameters/nested
74
+
Y
75
+
```
76
76
77
77
## Check and enable nested virtualisation inside an instance
78
78
79
-
Once the host is ready to use nested virtualisation it is time to check if the guest instance where the other instance(s) are going to run is able to host these nested VMs.
79
+
Once the host is ready to use nested virtualisation, it is time to check if the guest instance can run additional nested VMs inside it.
80
80
81
81
To determine if an instance can host another instance on top, run the below command within the instance:
82
82
@@ -86,16 +86,18 @@ egrep "svm|vmx" /proc/cpuinfo
86
86
87
87
If any of these are present in the output (depending on whether the host is AMD or Intel respectively), then virtualisation is available in that instance. If this is not the case you will need to edit the instance CPU settings:
88
88
89
-
* Shut down the instance
90
-
* Edit the instance XML definition file executing: `virsh edit <instance>`
91
-
* Search the `cpu mode` parameter in and set its value to either `host-model` or `host-passthrough` (details about these modes can be found [here](https://wiki.openstack.org/wiki/LibvirtXMLCPUModel)).
89
+
* Shut down the instance
90
+
* Edit the instance XML definition file executing: `virsh edit <instance>`
91
+
* Search the `cpu mode` parameter in and set its value to either `host-model` or `host-passthrough` (details about these modes can be found [here](https://wiki.openstack.org/wiki/LibvirtXMLCPUModel)).
92
92
93
-
Sample `cpu mode` parameter in XML with nested virtualisation:
94
-
```xml
95
-
<cpumode='host-model'check='partial'/>
96
-
```
97
-
* Save the modifications and start the instance
93
+
Sample `cpu mode` parameter in XML with nested virtualisation:
94
+
95
+
```xml
96
+
<cpumode='host-model'check='partial'/>
97
+
```
98
+
99
+
* Save the modifications and start the instance
98
100
99
101
## Limitations of nested virtualisation
100
102
101
-
Nested virtualisation has some key limitations you'd need to consider. Namely, not all KVM features will be available for instances running nested VMs and actions such as migrating or saving the parent instance will not be possible until the nested instance is stopped.
103
+
Nested virtualisation has some key limitations you'd need to consider, namely that not all KVM features will be available for instances running nested VMs, and actions such as migrating or saving the parent instance will not be possible until the nested instance is stopped.
0 commit comments