On 9/12/19 5:05 PM, Daniel P. Berrangé wrote:
The virNetworkPortDef config stores the 'managed' attribute as the virTristate type. The virDomainDef config stores the 'managed' attribute as the bool type. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/conf/domain_conf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3dc638f0de..ae196cac52 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30688,7 +30688,15 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDefPtr iface, actual->data.hostdev.def.parentnet = iface; actual->data.hostdev.def.info = &iface->info; actual->data.hostdev.def.mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - actual->data.hostdev.def.managed = port->plug.hostdevpci.managed; + switch (port->plug.hostdevpci.managed) { + case VIR_TRISTATE_BOOL_YES: + actual->data.hostdev.def.managed = true; + break; + case VIR_TRISTATE_BOOL_ABSENT: + case VIR_TRISTATE_BOOL_NO: + actual->data.hostdev.def.managed = false; + break; + } actual->data.hostdev.def.source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; actual->data.hostdev.def.source.subsys.u.pci.addr = port->plug.hostdevpci.addr; switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) { @@ -30820,7 +30828,10 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr dom, iface->ifname); goto error; } - port->plug.hostdevpci.managed = actual->data.hostdev.def.managed; + if (actual->data.hostdev.def.managed) + port->plug.hostdevpci.managed = VIR_TRISTATE_BOOL_YES; + else + port->plug.hostdevpci.managed = VIR_TRISTATE_BOOL_NO;
Or just use virTristateBoolFromBool(). Unfortunately, we don't have a counterpart to use in the first hunk.
Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx> Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list