From nobody Tue Dec 16 03:22:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1675869613; cv=none; d=zohomail.com; s=zohoarc; b=WC5lRKJspz2N3NlOieQM53tg3JowyC4mYjh0F98nzylD11DczYMBncMazyJ+AE3Ejw/IJDMk+u29C6FUtuXMLKoE19cLBTi3uy0LcNX36BglT+pDeBQJKXMM+w+FyRQz2Vflh19W6y9a+QI7KrFj/Q2jhNLHXtqMIrZEZm4p6Hg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675869613; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tdEzMUw/DQALA67dkwrzuaDIsDb71ZrxD5D7fHQhy1g=; b=j8l4pzcT1Ry/Sj4wOPh0StvHGCgiRp1biQyRilNcwiXdjVOEijMnJMjJ2Xr5tCBK4MmGds+8cUcw0j/BMunWEmmlOdnBFTvpPD0SeHjuby1svaFg0je8FKhbDFXWXJPFga87Tc6pgjP/oc1uDUqZQKruk9pIJaaKPO4Oyh2RCNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1675869613450628.3259434944038; Wed, 8 Feb 2023 07:20:13 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-jiPIx99QNLuoqgBNwJiMRQ-1; Wed, 08 Feb 2023 10:19:33 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA39287B2A0; Wed, 8 Feb 2023 15:19:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6374140EBF4; Wed, 8 Feb 2023 15:19:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 701D01946597; Wed, 8 Feb 2023 15:19:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 307DC1946A42 for ; Wed, 8 Feb 2023 15:19:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 22E02492C3E; Wed, 8 Feb 2023 15:19:18 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.40.23.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB21E492B01 for ; Wed, 8 Feb 2023 15:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675869612; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tdEzMUw/DQALA67dkwrzuaDIsDb71ZrxD5D7fHQhy1g=; b=W1XONW55WYFo4OtNr4bChtRGW9PyJNRq9vO2I7nXXRepPGLAkI1WYZHhHsvw6FpefIAobt URIQwz3ez/3jj8MPG+k4vQCPDZIUrkYLGGSsrNLNRKagyOSP2sARqdzuf4MNE9aw6RzkdP Zx4YI3xflgPgB2V/gaUvqBZFQYx9uB4= X-MC-Unique: jiPIx99QNLuoqgBNwJiMRQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 4/8] virt-ssh-helper: Accept ?mode= in connection URI Date: Wed, 8 Feb 2023 16:19:10 +0100 Message-Id: <5d985e0f8ed40d8bcdf21df937d8aa9dda2a1e6d.1675869425.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1675869615434100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When split daemons were introduced, we also made connection URI accept new parameter: mode=3D{auto,legacy,direct} so that a client can force connecting to either old, monolithic daemon, or to split daemon (see v5.7.0-rc1~257 for more info). Now, the change was done to the remote driver, but not to virt-ssh-helper. True, our remote driver code still does not pass the 'mode' parameter, but that will be addressed in next commits. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/remote/remote_ssh_helper.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index b4735027be..8adc62acf2 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -354,6 +354,8 @@ int main(int argc, char **argv) g_autoptr(virURI) uri =3D NULL; g_autofree char *driver =3D NULL; remoteDriverTransport transport; + int mode =3D REMOTE_DRIVER_MODE_AUTO; + const char *mode_str =3D NULL; gboolean version =3D false; gboolean readonly =3D false; g_autofree char *sock_path =3D NULL; @@ -367,6 +369,7 @@ int main(int argc, char **argv) { NULL, '\0', 0, 0, NULL, NULL, NULL } }; unsigned int flags; + size_t i; =20 context =3D g_option_context_new("URI - libvirt socket proxy"); g_option_context_set_summary(context, @@ -429,8 +432,23 @@ int main(int argc, char **argv) if (readonly) flags |=3D REMOTE_DRIVER_OPEN_RO; =20 + for (i =3D 0; i < uri->paramsCount; i++) { + virURIParam *var =3D &uri->params[i]; + + if (STRCASEEQ(var->name, "mode")) { + mode_str =3D var->value; + continue; + } + } + + if (mode_str && + (mode =3D remoteDriverModeTypeFromString(mode_str)) < 0) { + g_printerr(_("%s: unknown remote mode '%s'"), argv[0], mode_str); + exit(EXIT_FAILURE); + } + sock_path =3D remoteGetUNIXSocket(transport, - REMOTE_DRIVER_MODE_AUTO, + mode, driver, flags, &daemon_path); --=20 2.39.1