From nobody Sun Feb 8 12:19:58 2026 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547852765785190.47390919913937; Fri, 18 Jan 2019 15:06:05 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03BC596E9; Fri, 18 Jan 2019 23:06:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ABC0761D1A; Fri, 18 Jan 2019 23:06:03 +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 240CB18033CA; Fri, 18 Jan 2019 23:06:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0IN5anc008658 for ; Fri, 18 Jan 2019 18:05:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 46BE1600D6; Fri, 18 Jan 2019 23:05:36 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-125-139.rdu2.redhat.com [10.10.125.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF3F5600C2; Fri, 18 Jan 2019 23:05:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 18 Jan 2019 18:05:23 -0500 Message-Id: <8f79ddeb607669441bc0d93325ddf1b27ded8b2d.1547851897.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] vz: convert to net model enum 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-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 18 Jan 2019 23:06:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The vz driver only handles three models: virtio, e1000, and rtl8139. Add enum values for those models, and convert the vz driver to handling net->model natively Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 5 ++++- src/conf/domain_conf.h | 3 +++ src/vz/vz_driver.c | 7 +++---- src/vz/vz_sdk.c | 17 +++++++---------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 129e16bd0b..9b651d06b6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -438,7 +438,10 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, =20 VIR_ENUM_IMPL(virDomainNetModel, VIR_DOMAIN_NET_MODEL_LAST, "unknown", - "netfront") + "netfront", + "rtl8139", + "virtio", + "e1000") =20 VIR_ENUM_IMPL(virDomainNetBackend, VIR_DOMAIN_NET_BACKEND_TYPE_LAST, "default", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e26b885508..2e1235a993 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -964,6 +964,9 @@ typedef enum { typedef enum { VIR_DOMAIN_NET_MODEL_UNKNOWN, VIR_DOMAIN_NET_MODEL_NETFRONT, + VIR_DOMAIN_NET_MODEL_RTL8139, + VIR_DOMAIN_NET_MODEL_VIRTIO, + VIR_DOMAIN_NET_MODEL_E1000, =20 VIR_DOMAIN_NET_MODEL_LAST } virDomainNetModelType; diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index eab2953759..10fba0efb7 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -269,10 +269,9 @@ vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, if (dev->type =3D=3D VIR_DOMAIN_DEVICE_NET && (dev->data.net->type =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK || dev->data.net->type =3D=3D VIR_DOMAIN_NET_TYPE_BRIDGE) && - !virDomainNetGetModelString(dev->data.net) && - def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && - virDomainNetSetModelString(dev->data.net, "e1000") < 0) - return -1; + dev->data.net->model =3D=3D VIR_DOMAIN_NET_MODEL_UNKNOWN && + def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM) + dev->data.net->model =3D VIR_DOMAIN_NET_MODEL_E1000; =20 return 0; } diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 60681591c6..13f18cbc19 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1105,16 +1105,13 @@ prlsdkGetNetInfo(PRL_HANDLE netAdapter, virDomainNe= tDefPtr net, bool isCt) =20 switch ((int)type) { case PNT_RTL: - if (virDomainNetSetModelString(net, "rtl8139") < 0) - goto cleanup; + net->model =3D VIR_DOMAIN_NET_MODEL_RTL8139; break; case PNT_E1000: - if (virDomainNetSetModelString(net, "e1000") < 0) - goto cleanup; + net->model =3D VIR_DOMAIN_NET_MODEL_E1000; break; case PNT_VIRTIO: - if (virDomainNetSetModelString(net, "virtio") < 0) - goto cleanup; + net->model =3D VIR_DOMAIN_NET_MODEL_VIRTIO; break; default: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3378,15 +3375,15 @@ static int prlsdkConfigureNet(vzDriverPtr driver AT= TRIBUTE_UNUSED, goto cleanup; =20 if (isCt) { - if (virDomainNetGetModelString(net)) + if (net->model !=3D VIR_DOMAIN_NET_MODEL_UNKNOWN) VIR_WARN("Setting network adapter for containers is not " "supported by vz driver."); } else { - if (virDomainNetStreqModelString(net, "rtl8139")) { + if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_RTL8139) { pret =3D PrlVmDevNet_SetAdapterType(sdknet, PNT_RTL); - } else if (virDomainNetStreqModelString(net, "e1000")) { + } else if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_E1000) { pret =3D PrlVmDevNet_SetAdapterType(sdknet, PNT_E1000); - } else if (virDomainNetStreqModelString(net, "virtio")) { + } else if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_VIRTIO) { pret =3D PrlVmDevNet_SetAdapterType(sdknet, PNT_VIRTIO); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list