From patchwork Thu Oct 26 12:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Meng X-Patchwork-Id: 1855798 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=c+uRVAqQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4SGPlT2WZkz23jh for ; Thu, 26 Oct 2023 23:11:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BE3E680FB0; Thu, 26 Oct 2023 12:10:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BE3E680FB0 Authentication-Results: smtp1.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=c+uRVAqQ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PDre6-0B8T-W; Thu, 26 Oct 2023 12:10:56 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id D5A6A83C3B; Thu, 26 Oct 2023 12:10:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D5A6A83C3B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id AB712C0071; Thu, 26 Oct 2023 12:10:55 +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 56006C0032 for ; Thu, 26 Oct 2023 12:10:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2409A83C3D for ; Thu, 26 Oct 2023 12:10:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2409A83C3D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zjqHD8u_yDky for ; Thu, 26 Oct 2023 12:10:53 +0000 (UTC) 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 57A6C83C3B for ; Thu, 26 Oct 2023 12:10:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 57A6C83C3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698322252; 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; bh=QyQbNSnULdH+21R62tzMx2WBBcQbjP6v7Xpa6UXyAKc=; b=c+uRVAqQL2Y6Twt15Vyi7T6j80TsjL81ToQKGA+BPZcA9Ea2ENgZQKIwZ/J9hHcTjnEVX9 wAEARgw3dfYEj0bLBz3Cr0kglsIR5v/exaFNSSDKHAPY2rgDtMz61s7kj0+84fpQWnKTWh eeVXFy9Am6HOp2b671nzGtojZSYvelc= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-aHH3Z_VVNM-i97X_1efFrg-1; Thu, 26 Oct 2023 08:10:50 -0400 X-MC-Unique: aHH3Z_VVNM-i97X_1efFrg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40837aa4a58so5871975e9.0 for ; Thu, 26 Oct 2023 05:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698322249; x=1698927049; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QyQbNSnULdH+21R62tzMx2WBBcQbjP6v7Xpa6UXyAKc=; b=rjSYPszvnq7po3AWfZoA8kDcHEqm+7vfkb9boP97fRtnDxViL0fwRbpLEdb+As+7ZT u1AkvsgsoHNpJ+6sg9rQqyFpYNYnyShZFVr7dZzJUJx2NMiV83nbVCKsKXlLiJ5mLzUh n582Hk/LhL6GzjtuR7QpOK4Dwu0I8tbD4Ybxo663OZ3+J8yKGv9oHFbdOCIdp9lW6a29 JvaJmkKdPiRRTkuWIcwWkMznXXDrDv/6m8upED6SSH2VzdYfVHZMWBIRDbeKaRoC+lML +rQ7+zmKkcEtJbwp/lWZ8/6zN+QZQwZFNKSEpXoQIgi1LXfYh9v/3AzBFcp5fSPtmwpJ pwHQ== X-Gm-Message-State: AOJu0YztcMJmOHeOhKli0kdOy9BYtrJa4sGK1fCxSZheCwOTQzM1RRxR lQl0Pnq2PICTbiriGPhnP4bfq3usZHDZ47CYfZmKB8gJwmEkkjRfLZzg8o6oiZg/N13t8j/aiiI PwqPjPZ1HigbbvsjCEpvpvxqanUZe5NhIZp9htZAodWspVJhSq3hXobVsI9DFT412/ZU= X-Received: by 2002:a05:600c:488a:b0:408:369a:dad1 with SMTP id j10-20020a05600c488a00b00408369adad1mr2804798wmp.4.1698322249475; Thu, 26 Oct 2023 05:10:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENY8Jm67jruWovyrXdhA5PimQZn1axYtLyezqTOW/hGA1Kn31KPsVEb5RRhTsMkFIZ241KpQ== X-Received: by 2002:a05:600c:488a:b0:408:369a:dad1 with SMTP id j10-20020a05600c488a00b00408369adad1mr2804771wmp.4.1698322249045; Thu, 26 Oct 2023 05:10:49 -0700 (PDT) Received: from positronik4lide.redhat.com ([87.122.59.133]) by smtp.gmail.com with ESMTPSA id u18-20020a05600c19d200b00401b242e2e6sm2396105wmq.47.2023.10.26.05.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 05:10:48 -0700 (PDT) From: jmeng@redhat.com To: dev@openvswitch.org Date: Thu, 26 Oct 2023 14:10:44 +0200 Message-Id: <20231026121044.712645-1-jmeng@redhat.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] python: Remove duplicate UnixctlClient implementation. 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" From: Jakob Meng The unixctl implementation in Python has been split into three parts in the past. During this process the UnixctlClient was duplicated, in python/ovs/unixctl/client.py and python/ovs/unixctl/server.py. This patch removes the duplicate from the latter. Fixes: 53cf9963ccc6 ("python: Break unixctl implementation into re...") Signed-off-by: Jakob Meng Acked-by: Simon Horman Acked-by: Eelco Chaudron --- python/ovs/unixctl/server.py | 44 ------------------------------------ 1 file changed, 44 deletions(-) diff --git a/python/ovs/unixctl/server.py b/python/ovs/unixctl/server.py index 5f9b3e739..b9cb52fad 100644 --- a/python/ovs/unixctl/server.py +++ b/python/ovs/unixctl/server.py @@ -211,47 +211,3 @@ class UnixctlServer(object): version) return 0, UnixctlServer(listener) - - -class UnixctlClient(object): - def __init__(self, conn): - assert isinstance(conn, ovs.jsonrpc.Connection) - self._conn = conn - - def transact(self, command, argv): - assert isinstance(command, str) - assert isinstance(argv, list) - for arg in argv: - assert isinstance(arg, str) - - request = Message.create_request(command, argv) - error, reply = self._conn.transact_block(request) - - if error: - vlog.warn("error communicating with %s: %s" - % (self._conn.name, os.strerror(error))) - return error, None, None - - if reply.error is not None: - return 0, str(reply.error), None - else: - assert reply.result is not None - return 0, None, str(reply.result) - - def close(self): - self._conn.close() - self.conn = None - - @staticmethod - def create(path): - assert isinstance(path, str) - - unix = "unix:%s" % ovs.util.abs_file_name(ovs.dirs.RUNDIR, path) - error, stream = ovs.stream.Stream.open_block( - ovs.stream.Stream.open(unix)) - - if error: - vlog.warn("failed to connect to %s" % path) - return error, None - - return 0, UnixctlClient(ovs.jsonrpc.Connection(stream))