From nobody Fri May 3 13:26:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568300740; cv=none; d=zoho.com; s=zohoarc; b=AJNYXt7M2D2IJuVoqJLDYacjtxNbEr2G0lw5vRuiULwWNyftmwb/Evn27rd3pU34XixWjI4DhY3x4RTjavIpRP2bj5uwtCUjpj7dRQ3zE/t9yAASqfoemf/eRJ5GNHFqxdN5Yrh8252GsGgs++xSS9tr5sLxGJwFWcfGAKFXgok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568300740; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=fAqjMvKRdOaAsyuLvHz4N2xYAZEn17U5wgANrnInr70=; b=GqHZekL8ARUiPS72vloJ1USt550NpYpRYdG5gsnunqc5BvNQ22wPf5cFxnqU6AABVnyaS4QEDiLFbPFvTZCvTPh/nhQafjuDSCIUOl275IGz+CO0q7Y0+we3crG7TSrSJ1GolacDMs0FXCRccsguq5eVC/OH86TCXZ1kMN/KyRc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568300740914492.08207208925126; Thu, 12 Sep 2019 08:05:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7ADCA2CE972; Thu, 12 Sep 2019 15:05:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 172FD60C44; Thu, 12 Sep 2019 15:05:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3FDAB24FDF; Thu, 12 Sep 2019 15:05:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8CF5Z1m017673 for ; Thu, 12 Sep 2019 11:05:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id C74A51001944; Thu, 12 Sep 2019 15:05:35 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (dhcp-94.gsslab.fab.redhat.com [10.33.9.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 391C51001938; Thu, 12 Sep 2019 15:05:35 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 12 Sep 2019 16:05:32 +0100 Message-Id: <20190912150532.27568-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: correctly convert 'managed' attribute from network port X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 12 Sep 2019 15:05:39 +0000 (UTC) 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=C3=A9 Reviewed-by: Michal Privoznik --- 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(virDomainNetD= efPtr iface, actual->data.hostdev.def.parentnet =3D iface; actual->data.hostdev.def.info =3D &iface->info; actual->data.hostdev.def.mode =3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - actual->data.hostdev.def.managed =3D port->plug.hostdevpci.managed; + switch (port->plug.hostdevpci.managed) { + case VIR_TRISTATE_BOOL_YES: + actual->data.hostdev.def.managed =3D true; + break; + case VIR_TRISTATE_BOOL_ABSENT: + case VIR_TRISTATE_BOOL_NO: + actual->data.hostdev.def.managed =3D false; + break; + } actual->data.hostdev.def.source.subsys.type =3D VIR_DOMAIN_HOSTDEV= _SUBSYS_TYPE_PCI; actual->data.hostdev.def.source.subsys.u.pci.addr =3D port->plug.h= ostdevpci.addr; switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.dri= ver) { @@ -30820,7 +30828,10 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr= dom, iface->ifname); goto error; } - port->plug.hostdevpci.managed =3D actual->data.hostdev.def.managed; + if (actual->data.hostdev.def.managed) + port->plug.hostdevpci.managed =3D VIR_TRISTATE_BOOL_YES; + else + port->plug.hostdevpci.managed =3D VIR_TRISTATE_BOOL_NO; port->plug.hostdevpci.addr =3D actual->data.hostdev.def.source.sub= sys.u.pci.addr; switch ((virDomainHostdevSubsysPCIBackendType)actual->data.hostdev= .def.source.subsys.u.pci.backend) { case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list