From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v2 1/1] fix #5619: honor link_down setting when hot-plugging nic
Date: Tue, 23 Jul 2024 16:24:07 +0200 [thread overview]
Message-ID: <20240723142407.159280-1-s.hanreich@proxmox.com> (raw)
When detaching and attaching the network device on update, the
link_down setting is not considered and the network device always gets
attached to the guest - even if link_down is set.
Fixes: 3f14f206 ("nic online bridge/vlan change: link disconnect/reconnect")
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
---
Changes from v1 -> v2:
* Fixed trailers in commit message
* Re-added comment describing the reason for setting link_down on
changed bridge/tag
Thanks @Fiona for your suggestions!
PVE/QemuServer.pm | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 88c274d..39d729c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5339,20 +5339,18 @@ sub vmconfig_update_net {
PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks}, $newnet->{rate});
}
- #set link_up in guest if bridge or vlan change to notify guest (dhcp renew for example)
- if (safe_string_ne($oldnet->{bridge}, $newnet->{bridge}) ||
- safe_num_ne($oldnet->{tag}, $newnet->{tag})
- ) {
- qemu_set_link_status($vmid, $opt, 1);
- }
-
} elsif (safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
# Rate can be applied on its own but any change above needs to
# include the rate in tap_plug since OVS resets everything.
PVE::Network::tap_rate_limit($iface, $newnet->{rate});
}
- if (safe_string_ne($oldnet->{link_down}, $newnet->{link_down})) {
+ # set link_down on changed bridge/tag as well, because we detach the
+ # network device in the section above if the bridge or tag changed
+ if (safe_string_ne($oldnet->{link_down}, $newnet->{link_down})
+ || safe_string_ne($oldnet->{bridge}, $newnet->{bridge})
+ || safe_num_ne($oldnet->{tag}, $newnet->{tag})
+ ) {
qemu_set_link_status($vmid, $opt, !$newnet->{link_down});
}
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2024-07-23 14:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 14:24 Stefan Hanreich [this message]
2024-07-24 11:26 ` [pve-devel] applied: " Thomas Lamprecht
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=20240723142407.159280-1-s.hanreich@proxmox.com \
--to=s.hanreich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.