From patchwork Mon Jul 15 00:03:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 168975 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3688844ilk; Sun, 14 Jul 2019 17:04:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvOriqibk0QW3AUSj1fiCQUUDDUCSu5PkTdo/+QvPjmd4fe4HjolfEx57/Bx0jdPP/ugUy X-Received: by 2002:a37:3c4:: with SMTP id 187mr13445010qkd.406.1563149082282; Sun, 14 Jul 2019 17:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563149082; cv=none; d=google.com; s=arc-20160816; b=twWFcRCfBh5Wj9r3PSRliQlMve39LJFLn6VokzJYLYexQ687H7ylfT1PDFbiUqhF4o 1urBiCZWJbW6mbIeRSiz8kIARUC5YdQxA7A6lbpxxlVFu7NQpfhlAF4UI6thF5BJIXaw Kz29GPrBZqp1q320XfMe5TFQ5Xxzt6grTFIj12++OMxGPN9WFvk1Q4cgHQ2Yqnm0y3AW 9QYJi8aQaExNxti4NNIRbk/7lN7F/uDi24tv8tLiHA1cqWj6sn2+gM+yRvHDjV0Xsd/g 9jlUEG6URHCiXJiemZd9xpZnri4pJfb5FHXAPVk3elB/d/y1KZuv+kbW/VjUxSriyE2s q3ZA== 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:references:in-reply-to:message-id:date:to:from :delivered-to; bh=LexyZl8G5jscvi6TcJ7mWNIYeZtolXxzwCDm1fJaQy0=; b=fIsIuAuFmUfLljZwRIxkl9el10p8Rkx5iqen+Oe61LN3vegayPU89sdBNRc/zqbkf0 u0SbuqioCefAGOn5eDTuLS3z6mCk2l3LDUFIPFnndbvxlUnW9/SmRtmkx7nzAZtLVsqE LgVkLr5YnFEjnicR49UWld1ZF7ufT33dOC1DaZwX6xoMG1Y/0OmtOiwBbjnkzwWMQqEl 9aHDWxxUwQiSfoEwWrzIScqIFByWAtMdKUasX2e8M1w5YiXlzyAhSwDErGaNI3UhAFWc YUmnpeRf8iP3HQwCdM2pgvlyRQJhGKcP9ciA1Tlt3JuXHyc+rLuHo7Q0fHT6neadPUT/ ZIgQ== 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 k18si10705657qvg.102.2019.07.14.17.04.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jul 2019 17:04:42 -0700 (PDT) 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-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 118F9C04959E; Mon, 15 Jul 2019 00:04:41 +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 DC62E60C70; Mon, 15 Jul 2019 00:04:40 +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 9DC2C3FAEC; Mon, 15 Jul 2019 00:04:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6F04HCY030294 for ; Sun, 14 Jul 2019 20:04:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 208E860C44; Mon, 15 Jul 2019 00:04:17 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-121-2.rdu2.redhat.com [10.10.121.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F87A60BFB; Mon, 15 Jul 2019 00:04:16 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 14 Jul 2019 20:03:57 -0400 Message-Id: <4117347a5d84d7b410b95ce8630d3cf3088bfc35.1563148979.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] conf: Add virNetworkXMLOption 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.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.31]); Mon, 15 Jul 2019 00:04:41 +0000 (UTC) Just a stub for now that is unused. Add init+cleanup plumbing and demostrate it in bridge_driver.c Signed-off-by: Cole Robinson --- src/conf/network_conf.c | 33 ++++++++++++++++++++++++++++ src/conf/network_conf.h | 11 ++++++++++ src/libvirt_private.syms | 1 + src/network/bridge_driver.c | 10 +++++++++ src/network/bridge_driver_platform.h | 2 ++ 5 files changed, 57 insertions(+) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 09e379ae9a..ca4b9986ad 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -73,6 +73,39 @@ VIR_ENUM_IMPL(virNetworkTaint, "hook-script", ); +static virClassPtr virNetworkXMLOptionClass; + +static void +virNetworkXMLOptionDispose(void *obj ATTRIBUTE_UNUSED) +{ + return; +} + +static int +virNetworkXMLOnceInit(void) +{ + if (!VIR_CLASS_NEW(virNetworkXMLOption, virClassForObject())) + return -1; + + return 0; +} + +VIR_ONCE_GLOBAL_INIT(virNetworkXML); + +virNetworkXMLOptionPtr +virNetworkXMLOptionNew(void) +{ + virNetworkXMLOptionPtr xmlopt; + + if (virNetworkXMLInitialize() < 0) + return NULL; + + if (!(xmlopt = virObjectNew(virNetworkXMLOptionClass))) + return NULL; + + return xmlopt; +} + static void virPortGroupDefClear(virPortGroupDefPtr def) { diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 424c4b0913..edd9f51f44 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -41,6 +41,14 @@ #include "virmacmap.h" #include "virenum.h" + +struct _virNetworkXMLOption { + virObject parent; +}; +typedef struct _virNetworkXMLOption virNetworkXMLOption; +typedef virNetworkXMLOption *virNetworkXMLOptionPtr; + + typedef enum { VIR_NETWORK_FORWARD_NONE = 0, VIR_NETWORK_FORWARD_NAT, @@ -289,6 +297,9 @@ enum { VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE = (1 << 1), }; +virNetworkXMLOptionPtr +virNetworkXMLOptionNew(void); + virNetworkDefPtr virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7dfa5af3b3..5aec33cf52 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -730,6 +730,7 @@ virNetworkSaveConfig; virNetworkSetBridgeMacAddr; virNetworkTaintTypeFromString; virNetworkTaintTypeToString; +virNetworkXMLOptionNew; virPortGroupFindByName; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 6292e3b90a..5be6f1ba45 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -136,6 +136,12 @@ networkDnsmasqCapsRefresh(virNetworkDriverStatePtr driver) return 0; } +static virNetworkXMLOptionPtr +networkDnsmasqCreateXMLConf(void) +{ + return virNetworkXMLOptionNew(); +} + static int networkStateCleanup(void); @@ -605,6 +611,9 @@ networkStateInitialize(bool privileged, network_driver->privileged = privileged; + if (!(network_driver->xmlopt = networkDnsmasqCreateXMLConf())) + goto error; + /* configuration/state paths are one of * ~/.config/libvirt/... (session/unprivileged) * /etc/libvirt/... && /var/(run|lib)/libvirt/... (system/privileged). @@ -766,6 +775,7 @@ networkStateCleanup(void) return -1; virObjectUnref(network_driver->networkEventState); + virObjectUnref(network_driver->xmlopt); /* free inactive networks */ virObjectUnref(network_driver->networks); diff --git a/src/network/bridge_driver_platform.h b/src/network/bridge_driver_platform.h index 95993c5e31..169417a6c0 100644 --- a/src/network/bridge_driver_platform.h +++ b/src/network/bridge_driver_platform.h @@ -55,6 +55,8 @@ struct _virNetworkDriverState { /* Immutable pointer, self-locking APIs */ virObjectEventStatePtr networkEventState; + + virNetworkXMLOptionPtr xmlopt; }; typedef struct _virNetworkDriverState virNetworkDriverState;