public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/1] fix #5779: vm start: pass storage hints when activating guest volumes
Date: Fri, 31 Oct 2025 11:36:13 +0100	[thread overview]
Message-ID: <20251031103709.60233-7-f.weber@proxmox.com> (raw)
In-Reply-To: <20251031103709.60233-1-f.weber@proxmox.com>

Currently supported hints are

- 'guest-is-windows' to denote a Windows guest,
- 'plugin-may-deactivate-volume' which denotes that the plugin may
  deactivate and re-activate a volume to apply a hint.

Currently the only consumer of hints is the RBD plugin. In case a
Windows VM guest volume is mapped using KRBD, certain VM workloads may
cause degraded performance and e.g. "libceph: [...] bad crc/signature"
messages in the host journal. A workaround is to pass the rxbounce
option when mapping the volume [1]. If 'guest-is-windows' is set to 1,
the RBD plugin will map the guest volume with the rxbounce option.

[1] https://docs.ceph.com/en/squid/man/8/rbd/#kernel-rbd-krbd-options

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
 src/PVE/QemuServer.pm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index cf195ccc..17ddd39b 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -5363,6 +5363,21 @@ my sub remove_left_over_vmstate_opts {
     PVE::QemuConfig->write_config($vmid, $conf) if $found;
 }
 
+sub generate_storage_hints {
+    my ($conf, $plugin_may_deactivate_volume) = @_;
+
+    my $hints = {};
+
+    if (PVE::Storage::Plugin::is_hint_supported('guest-is-windows')) {
+        $hints->{'guest-is-windows'} = int(!!windows_version($conf->{ostype}));
+    }
+    if (PVE::Storage::Plugin::is_hint_supported('plugin-may-deactivate-volume')) {
+        $hints->{'plugin-may-deactivate-volume'} = $plugin_may_deactivate_volume || 0;
+    }
+
+    return $hints;
+}
+
 # see vm_start_nolock for parameters, additionally:
 # migrate_opts:
 #   storagemap = parsed storage map for allocating NBD disks
@@ -5530,7 +5545,9 @@ sub vm_start_nolock {
     my $pci_reserve_list = [];
     eval {
         # With -blockdev, it is necessary to activate the volumes before generating the command line
-        PVE::Storage::activate_volumes($storecfg, $vollist);
+        # Plugins can safely deactivate already-active volumes here if needed
+        my $storage_hints = generate_storage_hints($conf, 1);
+        PVE::Storage::activate_volumes($storecfg, $vollist, undef, $storage_hints);
 
         # Note that for certain cases like templates, the configuration is minimized, so need to ensure
         # the rest of the function here uses the same configuration that was used to build the command
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      parent reply	other threads:[~2025-10-31 10:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 10:36 [pve-devel] [PATCH qemu-server/storage 0/6] fix #5779: introduce guest hints to pass rxbounce flag to KRBD Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 1/5] plugin: introduce hints for activating and mapping volumes Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 2/5] plugin api: bump api version and age Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 3/5] storage: activate/map volumes: verify and pass hints to plugin Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 4/5] plugin: rbd: factor out subroutine to obtain RBD ID Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 5/5] plugin: rbd: pass rxbounce when mapping Windows VM guest volumes Friedrich Weber
2025-10-31 10:36 ` Friedrich Weber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251031103709.60233-7-f.weber@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal