Hi!

Thanks Sascha for the pointer. I have tested it on bullseye and it really
works, great.

I don't know if we could add this patch for the next .release or something.

All I did was patch all the nodes, a ganeti force-reload and I was migrating
without problems (no need to reboot the guests or anything).

I'm attaching the patch as github's web seems to put it difficult (or even
imposible, at least I didn't find it) to download the raw patch.

Regards.
-- 
Manty/BestiaTester -> http://manty.net
--- a/usr/share/ganeti/3.0/ganeti/hypervisor/hv_kvm/__init__.py	2021-03-02 14:13:17.000000000 +0100
+++ b/usr/share/ganeti/3.0/ganeti/hypervisor/hv_kvm/__init__.py	2021-09-09 12:15:30.634811616 +0200
@@ -629,6 +629,10 @@
   # different than -drive is starting)
   _BOOT_RE = re.compile(r"^-drive\s([^-]|(?<!^)-)*,boot=on\|off", re.M | re.S)
   _UUID_RE = re.compile(r"^-uuid\s", re.M)
+  # The auto-read-only option is on the -blockdev, Ganeti uses this at -drive
+  _AUTO_RO_RE = \
+    re.compile(r"^-blockdev\s([^-]|(?<!^)-)*,auto-read-only=on\|off",
+               re.M | re.S)
 
   _INFO_VERSION_RE = \
     re.compile(r'^QEMU (\d+)\.(\d+)(\.(\d+))?.*monitor.*', re.M)
@@ -1246,6 +1250,14 @@
         dev_val += ",drive=%s" % kvm_devid
         dev_opts.extend(["-device", dev_val])
 
+      # QEMU 4.0 introduced dynamic auto-read-only for file-backed drives. This
+      # is unhandled in Ganeti and breaks live migration with
+      # security_model=user|pool, disable it here. See also
+      # HotAddDevice/drive_add_fn which solves a similar problem for hotpluged
+      # disks
+      if self._AUTO_RO_RE.search(kvmhelp):
+        drive_val += ",auto-read-only=off"
+
       dev_opts.extend(["-drive", drive_val])
 
     return dev_opts

Reply via email to