From patchwork Wed Apr 10 21:38:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Terry Wilson X-Patchwork-Id: 1922237 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cDIH7a91; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFGRR3tL6z1yYB for ; Thu, 11 Apr 2024 07:38:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EB20D605E4; Wed, 10 Apr 2024 21:38:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gdqZx5jFzzAg; Wed, 10 Apr 2024 21:38:39 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EDF18605AF Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cDIH7a91 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id EDF18605AF; Wed, 10 Apr 2024 21:38:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BDDB2C0077; Wed, 10 Apr 2024 21:38:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5DF95C0037 for ; Wed, 10 Apr 2024 21:38:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 38D6D402D4 for ; Wed, 10 Apr 2024 21:38:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Kb_Bzv2IGpfp for ; Wed, 10 Apr 2024 21:38:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=twilson@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 4490A4012E Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4490A4012E Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cDIH7a91 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4490A4012E for ; Wed, 10 Apr 2024 21:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712785114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pwh5SjI7iNTBk1yX7cEJoC6rvbPgBRUCZcVnt/EpBio=; b=cDIH7a91W/rPKoub5inieq60eTJBDvX13sh/ZT2sCYGd98oVZrjv84AXmL/xF9PhreS/+o Pfjiq0LI77Sapk1cH4bhKFvPgimTzgQHhuU3zBGON8Sr2n1it2uPVLtR5elyBI2Dxhd22f 86UY/7uJVzlOzy3BsAN70NOpStVSzOc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-I7TChaDDOcCgLGWg5j_d3g-1; Wed, 10 Apr 2024 17:38:33 -0400 X-MC-Unique: I7TChaDDOcCgLGWg5j_d3g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4D1A802A6F for ; Wed, 10 Apr 2024 21:38:32 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.33.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98DD3492BC6; Wed, 10 Apr 2024 21:38:32 +0000 (UTC) From: Terry Wilson To: dev@openvswitch.org Date: Wed, 10 Apr 2024 16:38:24 -0500 Message-Id: <20240410213826.3126397-1-twilson@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH 1/3] ovsdb-idl: Add python keyword to persistent UUID test. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The Python persistent UUID tests should have the keyword "python" added so that TESTSUITEFLAGS="-k python" will not miss testing them. Fixes: 55b9507e6824 ("ovsdb-idl: Add the support to specify the uuid for row insert.") Signed-off-by: Terry Wilson Acked-by: Simon Horman Tested-by: Simon Horman --- tests/ovsdb-idl.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index fb568dd82..c9e36d678 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -2713,7 +2713,7 @@ m4_define([OVSDB_CHECK_IDL_PERS_UUID_INSERT_C], m4_define([OVSDB_CHECK_IDL_PERS_UUID_INSERT_PY], [AT_SETUP([$1 - Python3]) - AT_KEYWORDS([idl persistent uuid insert]) + AT_KEYWORDS([idl python persistent uuid insert]) OVSDB_START_IDLTEST([], ["$abs_srcdir/idltest.ovsschema"]) AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2], [0], [stdout], [stderr]) From patchwork Wed Apr 10 21:38:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Terry Wilson X-Patchwork-Id: 1922238 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ANJlxEwF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFGSD2w2nz1yYB for ; Thu, 11 Apr 2024 07:39:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C479D60E8D; Wed, 10 Apr 2024 21:39:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qyWfg0gaQJSy; Wed, 10 Apr 2024 21:39:21 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C999860630 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ANJlxEwF Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id C999860630; Wed, 10 Apr 2024 21:39:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AEFA1C0077; Wed, 10 Apr 2024 21:39:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D7C7C0037 for ; Wed, 10 Apr 2024 21:39:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4F76480E70 for ; Wed, 10 Apr 2024 21:39:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Ehmx86MMqaZV for ; Wed, 10 Apr 2024 21:39:19 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=twilson@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 8E3C480DF9 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8E3C480DF9 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ANJlxEwF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 8E3C480DF9 for ; Wed, 10 Apr 2024 21:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712785158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/duKtbJGciTOfHBoOqe9OXLamdTk1iFKAEpVNpcEIQ0=; b=ANJlxEwFfTmfHATr+I8Br//+37poA6UTmi6gHFhOYGjqWe8iwFqSMHtlVOD/CSNZCYYb06 Aka+E5dTZnujJihgkXD0LMEzWTNIViBXiVHiVlLla13CWL+wyMSbTYCojwgmLXdgR2maBd 4nZg/DHHUWj4QqwmGoDuTwGvq7rY6RY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-137-QDNN2y9fORybF8LGWuPwFw-1; Wed, 10 Apr 2024 17:39:17 -0400 X-MC-Unique: QDNN2y9fORybF8LGWuPwFw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CDA131887314 for ; Wed, 10 Apr 2024 21:39:16 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.33.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id A18F0492BC7; Wed, 10 Apr 2024 21:39:16 +0000 (UTC) From: Terry Wilson To: dev@openvswitch.org Date: Wed, 10 Apr 2024 16:38:25 -0500 Message-Id: <20240410213826.3126397-2-twilson@redhat.com> In-Reply-To: <20240410213826.3126397-1-twilson@redhat.com> References: <20240410213826.3126397-1-twilson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH 2/3] python: ovsdb-idl: Make IndexedRows mirror hmap. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The Python IDL code very closely mirrors the C IDL code, which uses an hmap to store table rows. hmap code allows duplicate keys, while IndexedRows, which is derived from DictBase does not. The persistent UUID code can attempt to temporarily add a Row with a duplicate UUID to table.rows, so IndexedRows is modified to behave similarly to the C IDL's hmap implementation. Fixes: 55b9507e6824 ("ovsdb-idl: Add the support to specify the uuid for row insert.") Signed-off-by: Terry Wilson --- python/ovs/db/custom_index.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/python/ovs/db/custom_index.py b/python/ovs/db/custom_index.py index 587caf5e3..3fa03d3c9 100644 --- a/python/ovs/db/custom_index.py +++ b/python/ovs/db/custom_index.py @@ -90,14 +90,21 @@ class IndexedRows(DictBase, object): index = self.indexes[name] = MultiColumnIndex(name) return index + def __getitem__(self, key): + return self.data[key][-1] + def __setitem__(self, key, item): - self.data[key] = item + try: + self.data[key].append(item) + except KeyError: + self.data[key] = [item] for index in self.indexes.values(): index.add(item) def __delitem__(self, key): - val = self.data[key] - del self.data[key] + val = self.data[key].pop() + if len(self.data[key]) == 0: + del self.data[key] for index in self.indexes.values(): index.remove(val) From patchwork Wed Apr 10 21:38:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Terry Wilson X-Patchwork-Id: 1922239 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I6vJuoto; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFGSG6xKrz1yYB for ; Thu, 11 Apr 2024 07:39:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CE9C84027A; Wed, 10 Apr 2024 21:39:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wy74yYOhwK0J; Wed, 10 Apr 2024 21:39:23 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B8CE441506 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I6vJuoto Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id B8CE441506; Wed, 10 Apr 2024 21:39:23 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8F480C0077; Wed, 10 Apr 2024 21:39:23 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id C71DCC0DD2 for ; Wed, 10 Apr 2024 21:39:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B5A6440917 for ; Wed, 10 Apr 2024 21:39:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id rfAYXV7qwprX for ; Wed, 10 Apr 2024 21:39:22 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=twilson@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B565C40491 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B565C40491 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I6vJuoto Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id B565C40491 for ; Wed, 10 Apr 2024 21:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712785160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0bBJGGLEF6W/TcPEI6/rP9TbE1JkN9KMr1YVBYDSMu8=; b=I6vJuotoYIvqHfUP2n02GeG7icokL3luhMQa7PchtGxlLKKKEP3q8wPciJn4Op7jYqy+6m YCgf3KPstzcvJV7kDlBIrvW410ATqBf6/bVzCx1K+MfoVWblGoUIei/gy1xR4RV+zKk/ZO +o2oC1FSscsqGb77lF3OisBHIXo/LgU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-Or1zzO0gNWSPIbkJgYwywg-1; Wed, 10 Apr 2024 17:39:19 -0400 X-MC-Unique: Or1zzO0gNWSPIbkJgYwywg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A6B9800198 for ; Wed, 10 Apr 2024 21:39:19 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.33.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id E303A492BC6; Wed, 10 Apr 2024 21:39:18 +0000 (UTC) From: Terry Wilson To: dev@openvswitch.org Date: Wed, 10 Apr 2024 16:38:26 -0500 Message-Id: <20240410213826.3126397-3-twilson@redhat.com> In-Reply-To: <20240410213826.3126397-1-twilson@redhat.com> References: <20240410213826.3126397-1-twilson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH 3/3] python: ovsdb-idl: Convert new_uuid insert() arg to UUID. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The argument to insert() should be a uuid.UUID object. If it isn't then a Row is created with a string uuid attribute and that row is added to table.rows with a string key instead of a UUID key. Fixes: 55b9507e6824 ("ovsdb-idl: Add the support to specify the uuid for row insert.") Signed-off-by: Terry Wilson --- python/ovs/db/idl.py | 2 +- tests/test-ovsdb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index a80da84e7..0e201366b 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -1854,7 +1854,7 @@ class Transaction(object): if row._data is None: op["op"] = "insert" if row._persist_uuid: - op["uuid"] = row.uuid + op["uuid"] = str(row.uuid) else: op["uuid-name"] = _uuid_name_from_uuid(row.uuid) diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index 48f8ee2d7..6307aa2bd 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -434,7 +434,7 @@ def idl_set(idl, commands, step): sys.stderr.write('"set" command requires 2 argument\n') sys.exit(1) - s = txn.insert(idl.tables["simple"], new_uuid=args[0], + s = txn.insert(idl.tables["simple"], new_uuid=uuid.UUID(args[0]), persist_uuid=True) s.i = int(args[1]) elif name == "delete":