From patchwork Wed Mar 11 17:20:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11432361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D670414E5 for ; Wed, 11 Mar 2020 17:22:28 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E82B20746 for ; Wed, 11 Mar 2020 17:22:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="JkthFbGC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E82B20746 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jC529-0002zR-Cm; Wed, 11 Mar 2020 17:20:41 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jC528-0002zI-8g for xen-devel@lists.xenproject.org; Wed, 11 Mar 2020 17:20:40 +0000 X-Inumbo-ID: 9e768ca2-63bc-11ea-b027-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9e768ca2-63bc-11ea-b027-12813bfff9fa; Wed, 11 Mar 2020 17:20:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1583947235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=30rIw5MKw1vPYrrF3I7Ibt5BjmFr9isaYP68YPRd2m8=; b=JkthFbGC1xlJ+9BHw7MnxEiR7DCUeZ0DwW9AAiLsub0dAwacCirk6RJD bLAKbX8F/Ap6rh+un0+uS+myTA5HJH08SDNVB/sBJwEylzXviMrxakb6L QYFHqO34MKOGoNd3o9zhIhF56Hf8SLL+ovGkkIVc8FHt1cBnSDs3vd2Pg o=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: nWdRPX177Z7ZMLeLMMpzQXzCeV9M3IJinb9+/bqG+yaJthKbJWVXx0DsTLZ9N8tyegww08p04v p3DxfxDD9wAueWsApw3czzGgDuqI8IQZdg28Plsmtdwv91sHR2jpblyD6H1wj1w/kW498+2czm ezfoNViGpPW+GX0pxxWNdX1PjgAwVuIVkXeZlbjZrEFlkdEumZRB8ZDTahFXlbGgyFxP5cdxUy Y1bems4tXjMowgfOB0gObHJWiHpEsauBA6sOEhzLAsQlrnG7voYouVzmzzB/o2E9NInPtx3el0 9NQ= X-SBRS: 2.7 X-MesageID: 13794324 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,541,1574139600"; d="scan'208";a="13794324" From: Roger Pau Monne To: Date: Wed, 11 Mar 2020 18:20:06 +0100 Message-ID: <20200311172010.7777-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200311172010.7777-1-roger.pau@citrix.com> References: <20200311172010.7777-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH OSSTEST v5 2/5] host: introduce a helper to modify hostflags X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: ian.jackson@eu.citrix.com, Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add a generic function to perform database changes related to a host flag and add a wrapper to TestSupport. Signed-off-by: Roger Pau Monné Reviewed-by: Ian Jackson --- Changes since v4: - Move addition of hostflag_putative_record to a different patch. - Introduce a single helper in TestSupport: modify_host_flag. Changes since v3: - Introduce modify_flag instead of {set/remove}_flag. - Introduce a generic modify_host helper. - Split from patch 1. --- Requested on IRC: 17:08:58 Diziet royger: I think your ts-examine-hostprops-save hunk in 2/ belongs in 1/ ? (Or in a separate 1.5/ along with hostflag_putative_record.) --- Osstest/HostDB/Executive.pm | 17 +++++++++++++++++ Osstest/HostDB/Static.pm | 7 +++++++ Osstest/TestSupport.pm | 8 +++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Osstest/HostDB/Executive.pm b/Osstest/HostDB/Executive.pm index d402bcac..a6dc4462 100644 --- a/Osstest/HostDB/Executive.pm +++ b/Osstest/HostDB/Executive.pm @@ -96,6 +96,23 @@ END return $flags; } +sub modify_flag ($$$$) { + my ($hd, $ho, $flag, $set) = @_; + my $rmq = $dbh_tests->prepare(<prepare(<execute($ho->{Name}, $flag); + if ($set) { + $addq->execute($ho->{Name}, $flag); + } + }); +} + sub get_arch_platforms ($$$) { my ($hd, $blessing, $arch, $suite) = @_; diff --git a/Osstest/HostDB/Static.pm b/Osstest/HostDB/Static.pm index 0c6be3ee..d0669fb2 100644 --- a/Osstest/HostDB/Static.pm +++ b/Osstest/HostDB/Static.pm @@ -72,6 +72,13 @@ sub get_flags ($$) { #method return $flags; } +sub modify_flag ($$$$) { + my ($hd, $ho, $flag, $set) = @_; + + die + "Cannot modify flags in standalone mode for $ho->{Name} $flag set: $set\n"; +} + sub get_arch_platforms ($$$) { my ($hd, $blessing, $arch, $suite) = @_; diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index f49ed529..ceb6bb7b 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -84,7 +84,7 @@ BEGIN { get_target_property get_host_native_linux_console hostnamepath hostnamepath_list set_runtime_hostflag power_state power_cycle power_reboot_attempts - serial_fetch_logs set_host_property + serial_fetch_logs set_host_property modify_host_flag propname_massage propname_check hostprop_putative_record @@ -1411,6 +1411,12 @@ sub hostprop_putative_record ($$$) { store_runvar("hostprop/$ho->{Ident}/$prop", $val); } +sub modify_host_flag ($$$) { + my ($ho, $flag, $set) = @_; + + $mhostdb->modify_flag($ho, $flag, $set); +} + sub get_target_property ($$;$); sub get_target_property ($$;$) { my ($ho, $prop, $defval) = @_;