[libvirt] [PATCH] conf: Skip MAC checks when using an auto-generated one during detach-device

Michal Privoznik mprivozn at redhat.com
Mon May 30 14:11:01 UTC 2016

On 30.05.2016 14:09, Kothapally Madhu Pavan wrote:
> When we try to detach a network device without specifying the
> mac address, random mac address is generated. As the generated
> mac address will not be available in the running vm, detaching
> device will fail erroring out "error: operation failed: no
> device matching mac address xx:xx:xx:xx:xx:xx found".
> This patch allows to match DetachDeviec xml using PCI address
> when mac address is not specified.
> Signed-off-by: Kothapally Madhu Pavan <kmp at linux.vnet.ibm.com>
> ---
>  src/conf/domain_conf.c   |  116 +++++++++++++++++++++++++++++-----------------
>  src/conf/domain_conf.h   |    6 ++
>  src/libxl/libxl_driver.c |    4 +-
>  src/lxc/lxc_driver.c     |    6 +-
>  src/qemu/qemu_driver.c   |   40 ++++++++++++++--
>  src/qemu/qemu_hotplug.c  |   16 ++++--
>  src/qemu/qemu_hotplug.h  |    3 +
>  7 files changed, 132 insertions(+), 59 deletions(-)

I don't think this is a good idea. I mean, according to our
documentation, users are required to provide full device XML they want
to detach (see commit c6807b50). The reasoning behind is that even
though today we rely on MAC address, tomorrow we can change that to a
device alias or a combination of some other values and suddenly users
passing just MAC address would break. I wanted to do something similar
in ea7182c but it introduced a regression (fixed in c001eb5bbefd).


More information about the libvir-list mailing list