From nobody Tue Feb 10 10:54:17 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=suse.de 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 1650655965166897.4228201811775; Fri, 22 Apr 2022 12:32:45 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-J5GKVRbMPauupF_GZdOGFw-1; Fri, 22 Apr 2022 15:32:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22147281180C; Fri, 22 Apr 2022 19:32:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C0B040EC01D; Fri, 22 Apr 2022 19:32:35 +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 663E0194036A; Fri, 22 Apr 2022 19:32:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0334B194036D for ; Fri, 22 Apr 2022 19:32:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C4055565DD9; Fri, 22 Apr 2022 19:32:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF909565DD4 for ; Fri, 22 Apr 2022 19:32:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A9A4B833942 for ; Fri, 22 Apr 2022 19:32:28 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-kaDWv7cKPG2jXqeuDs2ZzQ-1; Fri, 22 Apr 2022 15:32:27 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 946E61F749; Fri, 22 Apr 2022 19:32:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4D0CE13AE1; Fri, 22 Apr 2022 19:32:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kJWSEMkCY2L8bAAAMHmgww (envelope-from ); Fri, 22 Apr 2022 19:32:25 +0000 X-MC-Unique: J5GKVRbMPauupF_GZdOGFw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: kaDWv7cKPG2jXqeuDs2ZzQ-1 From: Claudio Fontana To: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [libvirt RFC v2 08/11] qemu: wire up saveimage code with the multifd helper Date: Fri, 22 Apr 2022 21:32:14 +0200 Message-Id: <20220422193217.22513-9-cfontana@suse.de> In-Reply-To: <20220422193217.22513-1-cfontana@suse.de> References: <20220422193217.22513-1-cfontana@suse.de> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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: , Cc: libvir-list@redhat.com, "Dr . David Alan Gilbert" , Claudio Fontana Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1650655965771100011 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Claudio Fontana --- src/qemu/qemu_saveimage.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 6a65d72fb3..bb23788a5e 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -17,6 +17,7 @@ */ =20 #include +#include =20 #include "qemu_saveimage.h" #include "qemu_domain.h" @@ -412,7 +413,8 @@ static int qemuSaveImageCloseMultiFd(virQEMUSaveFd *mul= tiFd, int nconn, virDomai =20 static virQEMUSaveFd * qemuSaveImageCreateMultiFd(virQEMUDriver *driver, virDomainObj *vm, - const char *path, uid_t user, gid_t group, + virCommand *cmd, const char *path, + uid_t user, gid_t group, int nconn, unsigned int flags) { virQEMUSaveFd *multiFd =3D g_new0(virQEMUSaveFd, nconn); @@ -426,6 +428,8 @@ qemuSaveImageCreateMultiFd(virQEMUDriver *driver, virDo= mainObj *vm, virQEMUSaveFdFini(m, vm, -1); goto error; } + virCommandAddArgFormat(cmd, "%d", m->fd); + virCommandPassFD(cmd, m->fd, 0); } return multiFd; =20 @@ -463,8 +467,30 @@ qemuSaveImageCreate(virQEMUDriver *driver, goto cleanup; =20 if (flags & VIR_DOMAIN_SAVE_PARALLEL) { + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *helper_path =3D NULL; + qemuDomainObjPrivate *priv =3D vm->privateData; + g_autofree char *sun_path =3D g_strdup_printf("%s/save-multifd.soc= k", priv->libDir); + char buf[1]; + int helper_out =3D -1; + if (!(helper_path =3D virFileFindResource("libvirt_multifd_helper", + abs_top_builddir "/src", + LIBEXECDIR))) + goto cleanup; + cmd =3D virCommandNewArgList(helper_path, sun_path, NULL); + virCommandAddArgFormat(cmd, "%d", nconn); + virCommandAddArgFormat(cmd, "%d", saveFd.fd); + virCommandPassFD(cmd, saveFd.fd, 0); + virCommandSetOutputFD(cmd, &helper_out); /* should create pipe aut= omagically */ + /* Perform parallel multifd migration to files (main fd + channels= ) */ - if (!(multiFd =3D qemuSaveImageCreateMultiFd(driver, vm, saveFd.pa= th, cfg->user, cfg->group, nconn, flags))) + if (!(multiFd =3D qemuSaveImageCreateMultiFd(driver, vm, cmd, save= Fd.path, cfg->user, cfg->group, nconn, flags))) + goto cleanup; + if (virCommandRunAsync(cmd, NULL) < 0) + goto cleanup; + if (saferead(helper_out, &buf, 1) !=3D 1 || buf[0] !=3D 'R') + goto cleanup; + if (chown(sun_path, cfg->user, cfg->group) < 0) goto cleanup; /* still using single fd migration for now */ if (qemuMigrationSrcToFile(driver, vm, saveFd.fd, compressor, asyn= cJob) < 0) --=20 2.34.1