From patchwork Fri Jan 18 23:05:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156099 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3797030jaa; Fri, 18 Jan 2019 15:05:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN5SzjU/oQ45/yEbkH0AqYDSOQulNtA8yXfFDLgWae8mRNyC3RMgFcqW6uYtJZCIbgBhwGZ1 X-Received: by 2002:ac8:3f5c:: with SMTP id w28mr17850122qtk.151.1547852747124; Fri, 18 Jan 2019 15:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547852747; cv=none; d=google.com; s=arc-20160816; b=QsP1RFpdwazGGpR37LQ4ajnspXjMnlO1tTV6LlaHs9K3GJjLDN1oKGuwIQQnB8y43Z HhbggNbcaMMcYopr1QC3XAQ14NrDM2HQT5HkOhSA9PZERk3gjQSTaxrU17rVTs1+wgGi Le9QN8ozuNcYv1VBvVxANq9U430Jph8pJY5la5I3yO9WcGcw7CLQnVqlQpeC1lXKAyu1 O9Kg1J0FVFm2uMZbUi60n60wD+vrlxK8OpbGYUMHX50Xl1w1pEc8VJyMpRDZN9vzL0Ar W99iaBqQoy4zCaxU2Ok5pL8nldnhCxQQZ0sew4iDM9KoXbSb/NkmbtkxS+zQOhHVgXNT YxqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:delivered-to; bh=+OLLC7Hf7PCtXWPh3oZF3dSuG/wFn21tdP2u3Z7b8Rs=; b=el2fa6CRP26LC3TzLJ1P+2YNUE7g9xu26DL+JzqYtpuo4ndRku4Zi38sTfT6JRMEoR bE1nJ1uTPKMjec+pGWay0EQ9sIEydPq+u2BCJn8FB3DKndEK9pf4g4mVWNqR+4YV4pkk GQCgxBxncOlu1nTioAZ1j2LXUdE3e8HzcbngldrIjLlsM3Ic8c3jpsxFdB9WNRjQV0X/ tSamlT+hzOZr5bUusoyPSBzZAxFeYiNPmDd6NrkIWRv6DJ273FQ/Dr65kL8xN41FMoBD jqAbYIlUkosRS84nAFeeC4MWx8+aIkCSyBarri/p5Sql1eydgnjz0TgTP20av2KYTqrL it/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id p17si6096915qvi.74.2019.01.18.15.05.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 15:05:47 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41DBE5D605; Fri, 18 Jan 2019 23:05:40 +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 AC3B91A926; Fri, 18 Jan 2019 23:05:39 +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 3F38A3F7CD; Fri, 18 Jan 2019 23:05:35 +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 x0IN5Wa5008622 for ; Fri, 18 Jan 2019 18:05:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id D83B6600D6; Fri, 18 Jan 2019 23:05:32 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-125-139.rdu2.redhat.com [10.10.125.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id 658BD600C2; Fri, 18 Jan 2019 23:05:30 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 18 Jan 2019 18:05:18 -0500 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 00/10] RFC: conf: partially net model enum conversion 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 18 Jan 2019 23:05:46 +0000 (UTC) This series is base on my virtio-transitional work, since it touches a lot of the same code: https://www.redhat.com/archives/libvir-list/2019-January/msg00593.html This series partially converts the net->model value from a string to an enum. We wrap the existing ->model string in accessor functions, rename it to ->modelstr, add a ->model enum, and convert internal driver usage bit by bit. At the end, all driver code that is acting on specific network model values is comparing against an enum, not a string. This is only partial because of xen/libxl/xm and qemu drivers, which if they don't know anything particular about the model string will just place it on the qemu command line/xen config and see what happens. So basically if I were to pass in qemu would turn that into -device idontexist,... That behavior is untouched by this series. Unwinding it will take some thought. For starters would be populating the enum with any qemu/xen network model that a user could realistically have a working config with. Then maybe tainting the VM if modelstr is used. Then after some time the final round could be causing domains to fail to start, but not fail to parse, so they don't disappear on upgrade but still break in an obvious way that will generate complaints/bugreports. But we should agree on a plan for it. Other caveats: * vz and bhyve drivers are not compile tested * vmx and virtualbox drivers previously would do a case insensitive compare on the model value passed in via the user XML. Current patches don't preserve that. I don't know how much it matters for these drivers for reading fresh XML vs roundtrip XML from converted native formats (which _will_ correct the case issue). If we want to fix this we will need to tolower() the modelstr value in the XML parser. I think there's a gnulib function for it but I haven't explored it deeply Cole Robinson (10): tests: Add several net model passthrough tests conf: net: Add wrapper functions for value conf: net: Rename 'model' to 'modelstr' conf: net: Add model enum, and netfront value vz: convert to net model enum bhyve: convert to net model enum qemu: Partially convert to net model enum vmx: convert to net model enum vbox: Convert to net enum model conf: Add VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING src/bhyve/bhyve_command.c | 15 +-- src/bhyve/bhyve_parse_command.c | 10 +- src/conf/domain_conf.c | 105 ++++++++++++++---- src/conf/domain_conf.h | 35 +++++- src/libvirt_private.syms | 4 + src/libxl/libxl_conf.c | 8 +- src/libxl/libxl_domain.c | 1 + src/qemu/qemu_command.c | 33 +++--- src/qemu/qemu_domain.c | 32 +++--- src/qemu/qemu_domain_address.c | 14 +-- src/qemu/qemu_driver.c | 14 ++- src/qemu/qemu_hotplug.c | 15 ++- src/qemu/qemu_parse_command.c | 5 +- src/security/virt-aa-helper.c | 3 +- src/vbox/vbox_common.c | 29 +++-- src/vmx/vmx.c | 55 ++++----- src/vz/vz_driver.c | 7 +- src/vz/vz_sdk.c | 17 ++- src/xenconfig/xen_common.c | 31 +++--- src/xenconfig/xen_sxpr.c | 30 ++--- tests/qemuxml2argvdata/net-many-models.args | 39 +++++++ tests/qemuxml2argvdata/net-many-models.xml | 37 ++++++ tests/qemuxml2argvtest.c | 1 + tests/xlconfigdata/test-net-fakemodel.cfg | 24 ++++ tests/xlconfigdata/test-net-fakemodel.xml | 39 +++++++ tests/xlconfigtest.c | 1 + .../test-paravirt-net-fakemodel.cfg | 13 +++ .../test-paravirt-net-fakemodel.xml | 40 +++++++ .../test-paravirt-net-modelstr.cfg | 13 +++ tests/xmconfigtest.c | 1 + .../xml2sexpr-fv-net-many-models.sexpr | 1 + .../xml2sexpr-fv-net-many-models.xml | 43 +++++++ tests/xml2sexprtest.c | 1 + 33 files changed, 534 insertions(+), 182 deletions(-) create mode 100644 tests/qemuxml2argvdata/net-many-models.args create mode 100644 tests/qemuxml2argvdata/net-many-models.xml create mode 100644 tests/xlconfigdata/test-net-fakemodel.cfg create mode 100644 tests/xlconfigdata/test-net-fakemodel.xml create mode 100644 tests/xmconfigdata/test-paravirt-net-fakemodel.cfg create mode 100644 tests/xmconfigdata/test-paravirt-net-fakemodel.xml create mode 100644 tests/xmconfigdata/test-paravirt-net-modelstr.cfg create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-net-many-models.sexpr create mode 100644 tests/xml2sexprdata/xml2sexpr-fv-net-many-models.xml -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list