network: Convert managed property of hostdev-pci ports correctly

virNetworkForwardDef.managed is a bool but
virNetworkPortDef.hostdevpci.managed is a virTristateBool, which
means that the current code performs the following incorrect
conversion:

  false -> BOOL_ABSENT
  true  -> BOOL_YES

Using the virTristateBoolFromBool() helper solves the issue.

Fixes: 6cb0ec48bd
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2022-03-24 19:32:13 +01:00
parent 06f5c092b8
commit 167ac6354c

View File

@ -3991,7 +3991,7 @@ networkAllocatePort(virNetworkObj *obj,
}
port->plug.hostdevpci.addr = dev->device.pci;
port->plug.hostdevpci.driver = netdef->forward.driverName;
port->plug.hostdevpci.managed = netdef->forward.managed;
port->plug.hostdevpci.managed = virTristateBoolFromBool(netdef->forward.managed);
if (port->virtPortProfile) {
/* make sure type is supported for hostdev connections */