From 319d2cc563cf0d29e3539b4105d01032b471318f Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Thu, 17 Dec 2020 18:46:10 +0800 Subject: [PATCH] feat(host): startvm: set vpc nic mtu Windows DHCP client does not respect DHCP MTU option --- pkg/hostman/guestman/qemu-kvmhelper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/hostman/guestman/qemu-kvmhelper.go b/pkg/hostman/guestman/qemu-kvmhelper.go index 23232d3981..8f2a75d613 100644 --- a/pkg/hostman/guestman/qemu-kvmhelper.go +++ b/pkg/hostman/guestman/qemu-kvmhelper.go @@ -277,6 +277,7 @@ func (s *SKVMGuestInstance) getNicAddr(index int) int { } func (s *SKVMGuestInstance) getVnicDesc(nic jsonutils.JSONObject) string { + bridge, _ := nic.GetString("bridge") ifname, _ := nic.GetString("ifname") driver, _ := nic.GetString("driver") mac, _ := nic.GetString("mac") @@ -295,6 +296,9 @@ func (s *SKVMGuestInstance) getVnicDesc(nic jsonutils.JSONObject) string { cmd += fmt.Sprintf(",vectors=%d", vectors) } cmd += fmt.Sprintf("$(nic_speed %d)", bw) + if bridge == options.HostOptions.OvnIntegrationBridge { + cmd += fmt.Sprintf("$(nic_mtu %q)", bridge) + } } return cmd }