From patchwork Wed Feb 12 10:42:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 24539 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D5F020341 for ; Wed, 12 Feb 2014 10:45:13 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id ar20sf30651253iec.5 for ; Wed, 12 Feb 2014 02:45:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=b40TB3eoBjC666BR9QYY9s7wCYD8sDjSvnR1xHjm+48=; b=aka76IUbnyZD9tA9CC5tirBl9Sfu99K3Hf6zf6RHaUQTwawycFiY76c387taGx0THJ Y+iKK2T6XWBU3UhJ7Ym824ASCEAFmf+zDaeChHtwSKgKCLmGNZVMjjXi8tX1DLMueSNh 1oZQjtsZv+U7D8xubBAxd4vPUmvOJLV2uy68y7jRwh8q4qPjxxIwqgTDGzcqA5zqkglC D+X9zSxVcngrZdYXIpJ5JF/t/LDaphM5G99KzpCOWEbqz0/HHP49Zuy+tv6evWZyRudg hiRkhZMOtOh/BDCTMYdoD+hK32AiAXpnIQmx6vnWOi5LtuqibHwzERxhf3nNEkYcmTI5 4jrw== X-Gm-Message-State: ALoCoQnynrRZWJdVT7GjuEYvJ3bDemWyJ5dhAEAd51NSaBkH+vo/mSK2KW9yAF1RGCA4SABKaNO5 X-Received: by 10.182.66.193 with SMTP id h1mr1401354obt.47.1392201912537; Wed, 12 Feb 2014 02:45:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.8 with SMTP id c8ls2891792qgc.56.gmail; Wed, 12 Feb 2014 02:45:12 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr15476753ved.20.1392201912429; Wed, 12 Feb 2014 02:45:12 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id yv5si7153935veb.64.2014.02.12.02.45.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 02:45:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ks9so6779901vcb.39 for ; Wed, 12 Feb 2014 02:45:12 -0800 (PST) X-Received: by 10.220.99.7 with SMTP id s7mr32032530vcn.19.1392201912283; Wed, 12 Feb 2014 02:45:12 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp26883vcz; Wed, 12 Feb 2014 02:45:11 -0800 (PST) X-Received: by 10.224.125.4 with SMTP id w4mr7544423qar.68.1392201911743; Wed, 12 Feb 2014 02:45:11 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id j10si14910744qas.11.2014.02.12.02.45.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Feb 2014 02:45:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WDXHN-0008RU-Cm; Wed, 12 Feb 2014 10:42:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WDXHL-0008RP-7Q for xen-devel@lists.xen.org; Wed, 12 Feb 2014 10:42:55 +0000 Received: from [85.158.139.211:7224] by server-11.bemta-5.messagelabs.com id C6/1D-23886-E205BF25; Wed, 12 Feb 2014 10:42:54 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1392201772!3398894!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14624 invoked from network); 12 Feb 2014 10:42:53 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 12 Feb 2014 10:42:53 -0000 X-IronPort-AV: E=Sophos;i="4.95,832,1384300800"; d="scan'208";a="101870181" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 12 Feb 2014 10:42:51 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Wed, 12 Feb 2014 05:42:51 -0500 Received: from spare.cam.xci-test.com ([10.80.2.80] helo=kazak.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WDXHG-0006gI-VX; Wed, 12 Feb 2014 10:42:51 +0000 From: Ian Campbell To: Date: Wed, 12 Feb 2014 10:42:50 +0000 Message-ID: <1392201770-14927-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH OSSTEST] Configure the Calxeda fabric on host boot X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: The fabric on the Calxeda midway boxes (marilith-* in osstest) does not learn mac address (at least not with the firmware we have, and with Calxeda folding this seems unlikely to get fixed). This means that guests do not get network connectivity unless their mac addresses explicitly registered with the fabric. Registrations can be done with the bridge(8) tool from the iproute2 package which unfortunately is only present in Jessie+ and not in Wheezy. So I have done my own backport and placed it in $images/wheezy-iproute2 and arranged for it to be installed along with the transitional iproute package (from the same source) which is needed to satisfy various dependencies. The registrations are ephemeral and need to be renewed on each reboot, so add the necessary commands to rc.local during ts-xen-install. This required leaking a certain amount of the implementation of select_ether. Unless we want to do the bodge on every ts-guest-satart, reboot, migrate etc then this seems to be the best way. In my testing I've set NRCXFabricMACs to 8. test-armhf-armhf-xl now gets past ts-guest-start and as far as the migration tests. Signed-off-by: Ian Campbell --- Osstest/CXFabric.pm | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ Osstest/TestSupport.pm | 21 ++++++++---- ts-xen-install | 3 ++ 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 Osstest/CXFabric.pm diff --git a/Osstest/CXFabric.pm b/Osstest/CXFabric.pm new file mode 100644 index 0000000..690afba --- /dev/null +++ b/Osstest/CXFabric.pm @@ -0,0 +1,86 @@ +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2014 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +package Osstest::CXFabric; + +use strict; +use warnings; + +use Osstest; +use Osstest::TestSupport; + +BEGIN { + use Exporter (); + our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); + $VERSION = 1.00; + @ISA = qw(Exporter); + @EXPORT = qw( + setup_cxfabric + ); + %EXPORT_TAGS = ( ); + + @EXPORT_OK = qw(); +} + +sub setup_cxfabric($) +{ + my ($ho) = @_; + + my $nr = get_host_property($ho, 'NRCXFabricMACs', 0); + return unless $nr; + + die unless $nr < 2**16; + + my $prefix = ether_prefix($ho); + logm("Registering $nr MAC addresses with CX fabric using prefix $prefix"); + + if ( $ho->{Suite} =~ m/wheezy/ ) + { + # iproute2 is not in Wheezy nor wheezy-backports. Use our own backport. + my $images = "$c{Images}/wheezy-iproute2"; + my $ver = '3.12.0-1~xen70+1'; + + target_putfile_root($ho, 10, "$images/iproute_${ver}_all.deb", "iproute_${ver}_all.deb"); + target_putfile_root($ho, 10, "$images/iproute2_${ver}_armhf.deb", "iproute2_${ver}_armhf.deb"); + + target_cmd_root($ho, <> 8, $i & 0xff); + } + + target_editfile_root($ho, '/etc/rc.local', sub { + my $had_banner = 0; + while (<::EI>) { + $had_banner = 1 if m/^$banner$/; + print ::EO $rclocal if m/^exit 0$/ && !$had_banner; + print ::EO; + } + }); + +} + +1; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index a513540..98eb172 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -97,6 +97,8 @@ BEGIN { await_webspace_fetch_byleaf create_webfile file_link_contents get_timeout setup_pxeboot setup_pxeboot_local host_pxefile + + ether_prefix ); %EXPORT_TAGS = ( ); @@ -1245,6 +1247,17 @@ sub target_choose_vg ($$) { return $bestvg; } +sub ether_prefix($) { + my ($ho) = @_; + my $prefix = get_host_property($ho, 'gen-ether-prefix-base'); + $prefix =~ m/^(\w+:\w+):(\w+):(\w+)$/ or die "$prefix ?"; + my $lhs = $1; + my $pv = (hex($2)<<8) | (hex($3)); + $pv ^= $mjobdb->gen_ether_offset($ho,$flight); + $prefix = sprintf "%s:%02x:%02x", $lhs, ($pv>>8)&0xff, $pv&0xff; + return $prefix; +} + sub select_ether ($$) { my ($ho,$vn) = @_; # must be run outside transaction @@ -1252,13 +1265,7 @@ sub select_ether ($$) { return $ether if defined $ether; db_retry($flight,'running', $dbh_tests,[qw(flights)], sub { - my $prefix = get_host_property($ho, 'gen-ether-prefix-base'); - $prefix =~ m/^(\w+:\w+):(\w+):(\w+)$/ or die "$prefix ?"; - my $lhs = $1; - my $pv = (hex($2)<<8) | (hex($3)); - $pv ^= $mjobdb->gen_ether_offset($ho,$flight); - $prefix = sprintf "%s:%02x:%02x", $lhs, ($pv>>8)&0xff, $pv&0xff; - + my $prefix = ether_prefix($ho); my $glob_ether = $mjobdb->jobdb_db_glob('*_ether'); my $previous= $dbh_tests->selectrow_array(<