[elbe-devel] [PATCH] elbepack: drop option --nesting

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Apr 24 17:15:47 CEST 2024


The --nesting option enables running the initvm within another vm.
This is achieved by telling libvirt to pass through the full host CPU to
the initvm.
Otherwise libvirt would refuse to start the VM as the virtual CPU would
not fulfill the requirements of its generic guest CPU.

Using a generic guest CPU is useful when migrating VMs between different
hosts. But in the context of an elbe initvm this is an edge case that
requires manual steps anyway.

More users are confused by the failure to start an initvm inside an
existing VM.

So just completely remove the option.

If we want to properly support both behaviours, the --nesting one should
be the default.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/commands/init.py      | 8 --------
 elbepack/commands/initvm.py    | 8 --------
 elbepack/init/Makefile.mako    | 4 ----
 elbepack/init/libvirt.xml.mako | 2 --
 elbepack/initvmaction.py       | 2 --
 5 files changed, 24 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 19bb888a1443..52c657246f79 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -52,14 +52,6 @@ def run_command(argv):
         default=False,
         help='start qemu in graphical mode to enable console switch')
 
-    oparser.add_option(
-        '--nesting',
-        dest='nesting',
-        action='store_true',
-        default=False,
-        help='allow initvm to support nested kvm. '
-             'This makes /proc/cpuinfo inside initvm differ per host.')
-
     oparser.add_option(
         '--skip-build-bin',
         action='store_false',
diff --git a/elbepack/commands/initvm.py b/elbepack/commands/initvm.py
index 93fcf2378c4a..531b48d29c5d 100644
--- a/elbepack/commands/initvm.py
+++ b/elbepack/commands/initvm.py
@@ -47,14 +47,6 @@ def run_command(argv):
     oparser.add_option('--writeproject', dest='writeproject', default=None,
                        help='write project name to file')
 
-    oparser.add_option(
-        '--nesting',
-        dest='nesting',
-        action='store_true',
-        default=False,
-        help='allow initvm to support nested kvm. '
-             'This makes /proc/cpuinfo inside initvm differ per host.')
-
     oparser.add_option(
         '--build-sdk',
         dest='build_sdk',
diff --git a/elbepack/init/Makefile.mako b/elbepack/init/Makefile.mako
index f2db159be12a..a05edbffbb5d 100644
--- a/elbepack/init/Makefile.mako
+++ b/elbepack/init/Makefile.mako
@@ -111,9 +111,7 @@ run:
 		-drive file=$(INITVM),if=$(HD_TYPE),bus=1,unit=0 \
 		-no-reboot \
 		-netdev user,ipv4,id=user.0${fwd} \
-% if opt.nesting:
 		-cpu host \
-% endif
 		-m $(MEMSIZE) \
 		-usb \
 		-smp $(SMP)
@@ -126,9 +124,7 @@ run-con:
 		-drive file=$(INITVM),if=$(HD_TYPE),bus=1,unit=0 \
 		-no-reboot \
 		-netdev user,ipv4,id=user.0${fwd} \
-% if opt.nesting:
 		-cpu host \
-% endif
 		-m $(MEMSIZE) \
 		-usb \
 		-nographic \
diff --git a/elbepack/init/libvirt.xml.mako b/elbepack/init/libvirt.xml.mako
index 8ca767691f2c..abeb81017fb3 100644
--- a/elbepack/init/libvirt.xml.mako
+++ b/elbepack/init/libvirt.xml.mako
@@ -43,11 +43,9 @@ xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
   <memory unit='KiB'>${memory}</memory>
   <currentMemory unit='KiB'>${memory}</currentMemory>
   <vcpu placement='static'>${cpus}</vcpu>
-% if opt.nesting:
   <cpu mode='host-model' check='partial'>
     <model fallback='allow'/>
   </cpu>
-% endif
   <os>
     <type arch='x86_64' machine='pc'>hvm</type>
   </os>
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index a5caa8fec853..bda045fd5022 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -746,8 +746,6 @@ class CreateAction(InitVMAction):
 
         try:
             init_opts = []
-            if opt.nesting:
-                init_opts.append('--nesting')
 
             if not opt.build_bin:
                 init_opts.append('--skip-build-bin')

---
base-commit: 9d8411747148c0bc88935c39f13387fcae5238fb
change-id: 20240424-nesting-aabc5ad92227

Best regards,
-- 
Thomas Weißschuh <thomas.weissschuh at linutronix.de>



More information about the elbe-devel mailing list