From patchwork Sat May 14 20:00:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67807 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp850813qge; Sat, 14 May 2016 13:04:57 -0700 (PDT) X-Received: by 10.140.220.137 with SMTP id q131mr22704199qhb.60.1463256296934; Sat, 14 May 2016 13:04:56 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id s201si16910576qke.3.2016.05.14.13.04.56 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 14 May 2016 13:04:56 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u4EK0GvV016935; Sat, 14 May 2016 16:00:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u4EK0Elg010426 for ; Sat, 14 May 2016 16:00:14 -0400 Received: from colepc.redhat.com (ovpn-116-31.phx2.redhat.com [10.3.116.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4EK0C1G004370; Sat, 14 May 2016 16:00:13 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sat, 14 May 2016 16:00:07 -0400 Message-Id: <870fb8f388bd01b1d1b61f29867d6e4b070c253c.1463255562.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 1/4] domain: Add virDomainDefAssignAddressesCallback 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com This will be called at the end of virDomainDefPostParse to fill allow hypervisor drivers to fill in device addresses. --- src/conf/domain_conf.c | 7 +++++++ src/conf/domain_conf.h | 8 ++++++++ 2 files changed, 15 insertions(+) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ed0c471..1c8d326 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4448,6 +4448,13 @@ virDomainDefPostParse(virDomainDefPtr def, if ((ret = virDomainDefPostParseInternal(def, &data)) < 0) return ret; + if (xmlopt->config.assignAddressesCallback) { + ret = xmlopt->config.assignAddressesCallback(def, caps, parseFlags, + xmlopt->config.priv); + if (ret < 0) + return ret; + } + if (virDomainDefPostParseCheckFeatures(def, xmlopt) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b9e696d..02594fe 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2475,6 +2475,13 @@ typedef int (*virDomainDeviceDefPostParseCallback)(virDomainDeviceDefPtr dev, virCapsPtr caps, unsigned int parseFlags, void *opaque); +/* Drive callback for assigning device addresses, called at the end + of parsing, after all defaults and implicit devices have been added */ +typedef int (*virDomainDefAssignAddressesCallback)(virDomainDef *def, + virCapsPtr caps, + unsigned int parseFlags, + void *opaque); + typedef struct _virDomainDefParserConfig virDomainDefParserConfig; typedef virDomainDefParserConfig *virDomainDefParserConfigPtr; @@ -2482,6 +2489,7 @@ struct _virDomainDefParserConfig { /* driver domain definition callbacks */ virDomainDefPostParseCallback domainPostParseCallback; virDomainDeviceDefPostParseCallback devicesPostParseCallback; + virDomainDefAssignAddressesCallback assignAddressesCallback; /* private data for the callbacks */ void *priv;