mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 11:00:25 +00:00
Merge pull request #2501 from ijc/qemu-reinstate-persistent-mac
qemu: restore persistent mac address support
This commit is contained in:
commit
95a1c51d0d
@ -571,13 +571,12 @@ func buildQemuCmdline(config QemuConfig) (QemuConfig, []string) {
|
||||
if config.NetdevConfig == "" {
|
||||
qemuArgs = append(qemuArgs, "-net", "none")
|
||||
} else {
|
||||
// provide a network device first for the QEMU VM if '-networking' is specified,
|
||||
qemuArgs = append(qemuArgs, "-device", "virtio-net-pci,netdev=t0")
|
||||
mac := retrieveMAC(config.StatePath)
|
||||
qemuArgs = append(qemuArgs, "-device", "virtio-net-pci,netdev=t0,mac="+mac.String())
|
||||
forwardings, err := buildQemuForwardings(config.PublishedPorts, config.Containerized)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
// we perfer "-netdev" to the "-net" which is an old way to initialize a host nic
|
||||
qemuArgs = append(qemuArgs, "-netdev", config.NetdevConfig+forwardings)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user