f-56: agent: MTU unique network.mtu_vm, underlay à 9000 contrôlé à la création, option DHCP 26 et host_mtu #56
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
d1b50d546c
commit
8cb5117cb2
37 changed files with 518 additions and 24 deletions
|
|
@ -102,9 +102,13 @@ func buildArgs(cfg Config) ([]string, error) {
|
|||
return nil, fmt.Errorf("vm %s has %d interfaces, the pci map holds %d", cfg.Name, len(cfg.NICs), maxNICs)
|
||||
}
|
||||
for i, n := range cfg.NICs {
|
||||
device := fmt.Sprintf("virtio-net-pci,netdev=net%d,mac=%s,bus=pci.0,addr=0x%02x", i, n.Mac, firstNICSlot+i)
|
||||
if n.MTU > 0 {
|
||||
device += fmt.Sprintf(",host_mtu=%d", n.MTU)
|
||||
}
|
||||
args = append(args,
|
||||
"-netdev", fmt.Sprintf("tap,id=net%d,ifname=tap%d,script=no,downscript=no", i, n.TapID),
|
||||
"-device", fmt.Sprintf("virtio-net-pci,netdev=net%d,mac=%s,bus=pci.0,addr=0x%02x", i, n.Mac, firstNICSlot+i),
|
||||
"-device", device,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ func devicesOf(args []string) []string {
|
|||
func TestBuildArgs_DiskSerialIsDeclaredDev(t *testing.T) {
|
||||
args, err := buildArgs(Config{
|
||||
Name: "vm1",
|
||||
NICs: []NICConfig{{TapID: 1, Mac: "52:54:00:00:00:01"}},
|
||||
NICs: []NICConfig{{TapID: 1, Mac: "52:54:00:00:00:01", MTU: 1450}, {TapID: 2, Mac: "52:54:00:00:00:02"}},
|
||||
Disks: []DiskConfig{
|
||||
{Path: "/v/b.qcow2", Dev: "xvdb"},
|
||||
{Path: "/v/root.qcow2", Dev: "vda"},
|
||||
|
|
@ -33,7 +33,8 @@ func TestBuildArgs_DiskSerialIsDeclaredDev(t *testing.T) {
|
|||
"virtio-blk-pci,drive=vda,bus=pci.0,addr=0x1f,bootindex=1,serial=vda",
|
||||
"scsi-hd,drive=xvda,bus=scsi0.0,scsi-id=0,bootindex=2,serial=xvda",
|
||||
"scsi-hd,drive=xvdb,bus=scsi0.0,scsi-id=1,bootindex=3,serial=xvdb",
|
||||
"virtio-net-pci,netdev=net0,mac=52:54:00:00:00:01,bus=pci.0,addr=0x03",
|
||||
"virtio-net-pci,netdev=net0,mac=52:54:00:00:00:01,bus=pci.0,addr=0x03,host_mtu=1450",
|
||||
"virtio-net-pci,netdev=net1,mac=52:54:00:00:00:02,bus=pci.0,addr=0x04",
|
||||
}
|
||||
got := devicesOf(args)
|
||||
if len(got) != len(want) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ type DiskConfig struct {
|
|||
type NICConfig struct {
|
||||
TapID int
|
||||
Mac string
|
||||
MTU int
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue