On Fri, Oct 18, 2013 at 11:44 AM, mike <qiud...@linux.vnet.ibm.com> wrote: > On 10/18/2013 05:00 PM, Stefan Hajnoczi wrote: > > On Fri, Oct 18, 2013 at 10:54:13AM +0800, mike wrote: > > NACK > > I'm not going to merge this patch: > > If you terminate QEMU and launch it again the NIC gets a different MAC > address. Some guest operating systems are sensitive to this - under > > For these users must use -device <nic-model>,mac=XX:XX:XX:XX:XX:XX. > I think no body will boot up the guest, which sensitive to this, > without mac address. > > Actually, people use the command line without mac address, mean they mainly > don't care about mac address, so give them random mac address is reasonable > I think. > > In my opinion, if we fix this, for qemu side no any issue, we both support > mac address set or unset correctly. > > What am I confuse is, *qemu supports mac address unset, why we force > users must set the address when more than one guests*? > This is unreasonable. > > many Linux distros the network interfaces names change due to the MAC > address change. As a result firewall configuration will break and other > services may fail to start because they cannot find the interface. > > Agree, so this mac address should set in qemu command line as > libvirt does :) > > If you have multiple guests or want control over the MAC address, set it > explicitly using -device <nic-model>,mac=XX:XX:XX:XX:XX:XX. > > Currently, especially for developers, people mainly use qemu > command line directly, and as qemu supports mac address > unset, they may try the simplest command line to boot up > lots of guests, they will confuse about why all this guest use > the same mac address. > > Your argument is weak: *you* want to avoid specifying the MAC address so > in exchange you want to *break* existing configurations and force other > people to start specifying a MAC address. > > OK, I do not want to break the existing configurations. > > I'm fine if you do not want to merge this patch. > > But I think this should be an issue of qemu, and need to > do something on it, so I make this patch. > > Can we try other solutions to solve this issue? > (if you agree this should be an issue)
Options: 1. Set mac= on the command-line 2. Save the QEMU command-line in a script so the guest can be launched without remembering the details 3. Use -writeconfig/-readconfig to save the command-line to file and restore it Option 2 or 3 are more convenient than Option 1. Does that help? Finally, if random MACs are desirable for your particular use case, create a wrapper script that does something like: #!/bin/bash exec qemu-system-x86_64 "$@" -set device.mynic.mac=04:ab:cd:$((RANDOM % 256)):$((RANDOM % 256)):$((RANDOM % 256)) > Also this potential issue can happens if the user set the same mac address > with more than one guest on one host. > > Can we avoid this ? The same situation is possible on a physical LAN. MAC or IP collisions are configuration issues. I don't see collisions as a QEMU issue. Stefan