mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
qemu_interface: Fix managed='no' case when creating an ethernet interface
In a recent commit of v9.0.0-rc1~192 I've tried to forbid case
where a TAP device already exists, but at the same time it's
managed by Libvirt (<interface type='ethernet'> <target
dev='tap0' managed='yes'/> </interface>). NB, if @managed
attribute is missing then it's assumed to be managed by Libvirt.
Anyway, I've mistakenly put setting of
VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING flag into managed='yes'
branch instead of managed='no' branch in
qemuInterfaceEthernetConnect().
Move the setting of the flag into the correct branch.
Fixes: a2ae3d299c
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
af99d60dc8
commit
d6a8b9eef7
@ -443,6 +443,9 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
|
|||||||
_("target managed='no' but specified dev doesn't exist"));
|
_("target managed='no' but specified dev doesn't exist"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
|
||||||
|
|
||||||
if (virNetDevMacVLanIsMacvtap(net->ifname)) {
|
if (virNetDevMacVLanIsMacvtap(net->ifname)) {
|
||||||
auditdev = net->ifname;
|
auditdev = net->ifname;
|
||||||
if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0)
|
if (virNetDevMacVLanTapOpen(net->ifname, tapfd, tapfdSize) < 0)
|
||||||
@ -461,8 +464,6 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
|
|||||||
if (!net->ifname)
|
if (!net->ifname)
|
||||||
template_ifname = true;
|
template_ifname = true;
|
||||||
|
|
||||||
tap_create_flags |= VIR_NETDEV_TAP_CREATE_ALLOW_EXISTING;
|
|
||||||
|
|
||||||
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
|
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
|
||||||
tap_create_flags) < 0) {
|
tap_create_flags) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user