From patchwork Tue Feb 23 21:53:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 8396931 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DBEE2C0553 for ; Tue, 23 Feb 2016 21:57:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCDF3202BE for ; Tue, 23 Feb 2016 21:57:07 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E3DE2024D for ; Tue, 23 Feb 2016 21:57:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYKuM-0004jP-Ri; Tue, 23 Feb 2016 21:54:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aYKuL-0004jK-Ch for xen-devel@lists.xen.org; Tue, 23 Feb 2016 21:54:13 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id F5/A2-04050-405DCC65; Tue, 23 Feb 2016 21:54:12 +0000 X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1456264450!24545207!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5642 invoked from network); 23 Feb 2016 21:54:11 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-3.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Feb 2016 21:54:11 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1NLs89G014294 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Feb 2016 21:54:09 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u1NLs8he027180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 23 Feb 2016 21:54:08 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u1NLs0hL019068; Tue, 23 Feb 2016 21:54:06 GMT Received: from [192.168.0.104] (/89.181.88.39) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Feb 2016 13:53:55 -0800 To: Jim Fehlig References: <1449506541-9856-1-git-send-email-jfehlig@suse.com> <20151207185212.GO848@redhat.com> <566671C4.1080706@suse.com> <20151208103834.GE2999@redhat.com> <56670006.40108@suse.com> <56CB967D.6040509@oracle.com> From: Joao Martins Message-ID: <56CCD4E9.1070607@oracle.com> Date: Tue, 23 Feb 2016 21:53:45 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.4.0 MIME-Version: 1.0 In-Reply-To: <56CB967D.6040509@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: libvir-list@redhat.com, "Daniel P. Berrange" , xen-devel@lists.xen.org Subject: Re: [Xen-devel] [libvirt] [FOR 1.3.0 PATCH] conf: add net device prefix for Xen X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 02/22/2016 11:15 PM, Joao Martins wrote: > > > On 12/08/2015 04:06 PM, Jim Fehlig wrote: >> Daniel P. Berrange wrote: >>> On Mon, Dec 07, 2015 at 10:59:32PM -0700, Jim Fehlig wrote: >>>> On 12/07/2015 11:52 AM, Daniel P. Berrange wrote: >>>>> On Mon, Dec 07, 2015 at 09:42:21AM -0700, Jim Fehlig wrote: >>>>>> In commit d2e5538b1, the libxl driver was changed to copy interface >>>>>> names autogenerated by libxl to the corresponding network def in the >>>>>> domain's virDomainDef object. The copied name is freed when the domain >>>>>> transitions to the shutoff state. But when migrating a domain, the >>>>>> autogenerated name is included in the XML sent to the destination host. >>>>>> It is possible an interface with the same name already exists on the >>>>>> destination host, causing migration to fail. Indeed the Xen project's >>>>>> OSSTEST CI already encountered such a failure. >>>>>> >>>>>> This patch defines another VIR_NET_GENERATED_PREFIX for Xen, allowing >>>>>> the autogenerated names to be excluded when parsing and formatting >>>>>> inactive config. >>>>>> >>>>>> Signed-off-by: Jim Fehlig >>>>>> --- >>>>>> >>>>>> This is an alternative approach to Joao's fix for this regression >>>>>> >>>>>> https://www.redhat.com/archives/libvir-list/2015-December/msg00197.html >>>>>> >>>>>> I think it is the same approach used by the qemu driver. My only >>>>>> reservation is that it expands the potential for clashes with >>>>>> user-defined names. I.e. with this change both 'vnet' and 'vif' are >>>>>> reserved prefixes. >>>>> Hmm, yes, tricky one. >>>>> >>>>> If we only care about XML parsing, then you could register a post >>>>> parse callback instead to do this. >>>> AFAIK, XML parsing is all that's in play here. >>>> >>>>> I'm not clear why we also have it in the virDomainNetDefFormat >>>>> method - and we can't solve that with a post-parse callback. >>>>> >>>>> >>>>> The other option would be to make the reserved prefix be a >>>>> capability that the parser/formatter could read. >>>> This seems like the best option, since a post-parse callback doesn't solve the >>>> problem in virDomainNetDefFormat. It also has the upshot of making the prefix >>>> visible and known to users. But I doubt such a change is suitable during 1.3.0 >>>> freeze. With the freeze in mind, seems the best solution to the libxl migration >>>> regression is revert d2e5538b1. It can be added again post-1.3.0 release, after >>>> adding the prefix to capabilities. >>>> >>>> DV, since you may be making the release soon, feel free to revert d2e5538b1 if >>>> you agree. >>> >>> Yeah, just go ahead & revert it Jim, DV isn't doing the releae until >>> tomorrow morning >> >> I've pushed the revert. >> >> Joao, sorry for yanking this for 1.3.0. We can get it in 1.3.1, after exposing >> the prefix in capabilities. >> > Hey Jim, > > I had the impression we had pushed this back in (i.e. cherry-picking d2e5538) > but I was double checking and that's doesn't seem to be case. In adding support > for the prefix in capabilities I found out one issue on the migration failure > path leading to dereferencing a NULL pointer on the destination. If you agree > could we squash the following chunk in addition to the cherry-pick of d2e5538: > > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c > index 63c5b24..f73bfb3 100644 > --- a/src/libxl/libxl_domain.c > +++ b/src/libxl/libxl_domain.c > @@ -768,7 +768,7 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver, > for (i = 0; i < vm->def->nnets; i++) { > virDomainNetDefPtr net = vm->def->nets[i]; > > - if (STRPREFIX(net->ifname, "vif")) > + if (net->ifname && STRPREFIX(net->ifname, "vif")) > VIR_FREE(net->ifname); > } > } > diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c > index 3f4457f..5479441 100644 > --- a/src/libxl/libxl_driver.c > +++ b/src/libxl/libxl_driver.c > @@ -5590,7 +5590,7 @@ static virHypervisorDriver libxlHypervisorDriver = { > .domainGetJobStats = libxlDomainGetJobStats, /* 1.3.1 */ > .domainMemoryStats = libxlDomainMemoryStats, /* 1.3.0 */ > .domainGetCPUStats = libxlDomainGetCPUStats, /* 1.3.0 */ > - .domainInterfaceStats = libxlDomainInterfaceStats, /* 1.3.0 */ > + .domainInterfaceStats = libxlDomainInterfaceStats, /* 1.3.2 */ > .connectDomainEventRegister = libxlConnectDomainEventRegister, /* 0.9.0 */ > .connectDomainEventDeregister = libxlConnectDomainEventDeregister, /* 0.9.0 */ > .domainManagedSave = libxlDomainManagedSave, /* 0.9.2 */ > > > Or do you think it should be deferred to 1.3.3 ? In case this is considered, please ignore the above chunk in my previous message. The one below should be better since I introduced LIBXL_GENERATED_PREFIX_XEN on a040ba9 which means no need to hardcode "vif". Regards, Joao >> Regards, >> Jim >> >> -- >> libvir-list mailing list >> libvir-list@redhat.com >> https://www.redhat.com/mailman/listinfo/libvir-list >> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 63c5b24..8313c6e 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -768,7 +768,8 @@ libxlDomainCleanup(libxlDriverPrivatePtr driver, for (i = 0; i < vm->def->nnets; i++) { virDomainNetDefPtr net = vm->def->nets[i]; - if (STRPREFIX(net->ifname, "vif")) + if (net->ifname && + STRPREFIX(net->ifname, LIBXL_GENERATED_PREFIX_XEN)) VIR_FREE(net->ifname); } } @@ -960,7 +961,8 @@ libxlDomainCreateIfaceNames(virDomainDefPtr def, libxl_domain_config *d_config) if (net->ifname) continue; - ignore_value(virAsprintf(&net->ifname, "vif%d.%d%s", + ignore_value(virAsprintf(&net->ifname, + LIBXL_GENERATED_PREFIX_XEN "%d.%d%s", def->id, x_nic->devid, suffix)); } } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 3f4457f..5479441 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5590,7 +5590,7 @@ static virHypervisorDriver libxlHypervisorDriver = { .domainGetJobStats = libxlDomainGetJobStats, /* 1.3.1 */ .domainMemoryStats = libxlDomainMemoryStats, /* 1.3.0 */ .domainGetCPUStats = libxlDomainGetCPUStats, /* 1.3.0 */ - .domainInterfaceStats = libxlDomainInterfaceStats, /* 1.3.0 */ + .domainInterfaceStats = libxlDomainInterfaceStats, /* 1.3.2 */ .connectDomainEventRegister = libxlConnectDomainEventRegister, /* 0.9.0 */ .connectDomainEventDeregister = libxlConnectDomainEventDeregister, /* 0.9.0 */ .domainManagedSave = libxlDomainManagedSave, /* 0.9.2 */