From nobody Sat Nov 23 18:13:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1723160733; cv=none; d=zohomail.com; s=zohoarc; b=OCcsP41p7sasFd6vmHUmj9Wqi9XgQJQCwsnCRDp88ng+32DZKAHW1MlBtYcgBC1ExL9N8iKBAA9ENPZ7Qt3OpXAvgTB96uAloO+3qo3uLF2vhTZ6olHs9jTsh2CeAVM7hm/P2xABSJqrKgStLrZ01c3tBMTy4WhL+9WKlSDH8kY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723160733; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=XWHneypQnGC9g1mKY75XLjNJcCaF2qK+b5/fATNhqZo=; b=hFRcbcUn8xFlstWLqDwftlU8b2+Rci4ud13fn510YuNFCuVppV+kopWs0iVWg7nOJ28C9TbEy7QQa8+BaOUw+BUcOoY7IVFI2c7/CJjM6xTNsQZs2IUtx6rA4uv0TSh/qoGzTWfW1WtavdGNhPnGLkkd+GQGeYwMf48cGu6SvJo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1723160733077811.8489099500172; Thu, 8 Aug 2024 16:45:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E7F97A36; Thu, 8 Aug 2024 19:45:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 330F31479; Thu, 8 Aug 2024 19:39:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7618214CE; Thu, 8 Aug 2024 19:39:07 -0400 (EDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E29531499 for ; Thu, 8 Aug 2024 19:38:42 -0400 (EDT) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4281d812d3eso14524945e9.3 for ; Thu, 08 Aug 2024 16:38:42 -0700 (PDT) Received: from localhost ([69.51.98.127]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39b33853f12sm47409795ab.75.2024.08.08.16.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 16:38:41 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1723160322; x=1723765122; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6nCvd+qhiUX7j8rP/8ke8aEFVJ3Xf9sfodiXPG7nIB0=; b=MlWhiaD5QFWQfBwHd+NnLWxFYRuR1FhZ7ph1sl2dX+q3lO/TkA5dLXbVf26mshMN8I Z/zWGZPqlEsqQm4lpJ+cPmTaFZhDM5xTJRzuwYFD+/I77HHmgjAZmu2mEUdE9LhCkhyn bwNoqPFtw8AqmDbiz7CzlCUJCe1wgNsUMstRt8ea3EheaH1+TPkSuM4eGPyyuhoCPh7e DgfWbGFEp8iRFoAeEm4CCZW9zLh7IESWMuQ/9U9u47iP4tyh6BcBPHaGKuHZswDHv/Z8 FJtfcO8Zcig0ZIwqo4fhQW8jvmAcTc9ht7s0UgMTdw8OpfnIBVt7sl1eaKw8QtAHUc4E dLwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723160322; x=1723765122; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6nCvd+qhiUX7j8rP/8ke8aEFVJ3Xf9sfodiXPG7nIB0=; b=RuY/CTbjZqij2OVL9HBbaB48+SW8Nmue76jnKzjkXQPq+MbqF1V305b2ByjQKMFznW yrOk055ZXZk6DmiwV+iwc5X17F7eJTfxp0AcbRhsn8nNqeaG2hHh5Q/ztLVJNchJJXPn W+IvqAAF2pw5BCt3UNABxyaqyNiyNm6eJaQlCvhxAN5LuLcvWL3QbVP2Nb1N6fewEg05 A6cjMnI0SuDMXizh1t2B1r4ZZTn/yECLmoh0oUn39vfq2VLfIUKYUBDprrr4CpUVSHXu UNz67nBfIpIFzS6T5zQZIO/0UusAGFaKhG/35xjpJZJzxBZlCTZ9ujlMhEfoILbqvx0e hMVQ== X-Gm-Message-State: AOJu0Yw6AypUQPUe8qTqwMIAYGYBCk5sRFOWYVhxNzRkxovae5pKFSzY G/3CIpTjuJdBK06YU5/dWzuOMVzaSNjwIQcfaCUKuemJ9C0VFfQKv1vU4spZn1wfOxJFAP3JWeB d X-Google-Smtp-Source: AGHT+IFRQ3bvlb30VG5y2UyYwLYEhbZbuH9cvt+a7+3ftVwQv7aaYjvWQZpXJBosbkzBQoFSDGU3yA== X-Received: by 2002:a5d:4b07:0:b0:368:6337:4221 with SMTP id ffacd0b85a97d-36d27592be2mr2428221f8f.54.1723160321602; Thu, 08 Aug 2024 16:38:41 -0700 (PDT) To: devel@lists.libvirt.org Subject: [PATCH 12/20] qemu: Move creation of qemuProcessIncomingDef struct Date: Thu, 8 Aug 2024 17:38:05 -0600 Message-Id: <20240808233813.22905-13-jfehlig@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240808233813.22905-1-jfehlig@suse.com> References: <20240808233813.22905-1-jfehlig@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: N7JCNP2ENY4V5W7VZEPOMQYSGE6YYPJZ X-Message-ID-Hash: N7JCNP2ENY4V5W7VZEPOMQYSGE6YYPJZ X-MailFrom: jfehlig@suse.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: farosas@suse.de X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Jim Fehlig via Devel Reply-To: Jim Fehlig X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1723160733892116600 Content-Type: text/plain; charset="utf-8" qemuProcessStartWithMemoryState() is the only caller of qemuProcessStart() that uses the qemuProcessIncomingDef struct. Move creation of the struct to qemuProcessStartWithMemoryState(). Signed-off-by: Jim Fehlig --- src/qemu/qemu_process.c | 44 ++++++++++++++++++++--------------------- src/qemu/qemu_process.h | 2 +- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index cec739c984..7eeb85062c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8191,7 +8191,7 @@ qemuProcessStart(virConnectPtr conn, virDomainObj *vm, virCPUDef *updatedCPU, virDomainAsyncJob asyncJob, - const char *migrateFrom, + qemuProcessIncomingDef *incoming, int migrateFd, const char *migratePath, virDomainMomentObj *snapshot, @@ -8199,7 +8199,6 @@ qemuProcessStart(virConnectPtr conn, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; - qemuProcessIncomingDef *incoming =3D NULL; unsigned int stopFlags; bool relabel =3D false; bool relabelSavedState =3D false; @@ -8207,11 +8206,11 @@ qemuProcessStart(virConnectPtr conn, int rv; =20 VIR_DEBUG("conn=3D%p driver=3D%p vm=3D%p name=3D%s id=3D%d asyncJob=3D= %s " - "migrateFrom=3D%s migrateFd=3D%d migratePath=3D%s " + "incoming=3D%p migrateFd=3D%d migratePath=3D%s " "snapshot=3D%p vmop=3D%d flags=3D0x%x", conn, driver, vm, vm->def->name, vm->def->id, virDomainAsyncJobTypeToString(asyncJob), - NULLSTR(migrateFrom), migrateFd, NULLSTR(migratePath), + incoming, migrateFd, NULLSTR(migratePath), snapshot, vmop, flags); =20 virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | @@ -8220,20 +8219,13 @@ qemuProcessStart(virConnectPtr conn, VIR_QEMU_PROCESS_START_GEN_VMID | VIR_QEMU_PROCESS_START_RESET_NVRAM, cleanup); =20 - if (!migrateFrom && !snapshot) + if (!incoming && !snapshot) flags |=3D VIR_QEMU_PROCESS_START_NEW; =20 if (qemuProcessInit(driver, vm, updatedCPU, - asyncJob, !!migrateFrom, flags) < 0) + asyncJob, !!incoming, flags) < 0) goto cleanup; =20 - if (migrateFrom) { - incoming =3D qemuProcessIncomingDefNew(priv->qemuCaps, NULL, migra= teFrom, - migrateFd, migratePath); - if (!incoming) - goto stop; - } - if (qemuProcessPrepareDomain(driver, vm, flags) < 0) goto stop; =20 @@ -8286,14 +8278,13 @@ qemuProcessStart(virConnectPtr conn, qemuSecurityRestoreSavedStateLabel(driver->securityManager, vm->def, migratePath) < 0) VIR_WARN("failed to restore save state label on %s", migratePath); - qemuProcessIncomingDefFree(incoming); return ret; =20 stop: stopFlags =3D 0; if (!relabel) stopFlags |=3D VIR_QEMU_PROCESS_STOP_NO_RELABEL; - if (migrateFrom) + if (incoming) stopFlags |=3D VIR_QEMU_PROCESS_STOP_MIGRATED; if (priv->mon) qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); @@ -8347,20 +8338,24 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, VIR_AUTOCLOSE intermediatefd =3D -1; g_autoptr(virCommand) cmd =3D NULL; g_autofree char *errbuf =3D NULL; - const char *migrateFrom =3D NULL; + qemuProcessIncomingDef *incoming =3D NULL; int rc =3D 0; + int ret =3D -1; + + incoming =3D qemuProcessIncomingDefNew(priv->qemuCaps, NULL, "stdio", + *fd, path); + if (!incoming) + return -1; =20 if (data) { if (virSaveCookieParseString(data->cookie, (virObject **)&cookie, virDomainXMLOptionGetSaveCookie(drive= r->xmlopt)) < 0) - return -1; + goto cleanup; =20 if (qemuSaveImageDecompressionStart(data, fd, &intermediatefd, &errbuf, &cmd) < 0) { - return -1; + goto cleanup; } - - migrateFrom =3D "stdio"; } =20 /* No cookie means libvirt which saved the domain was too old to mess = up @@ -8373,7 +8368,7 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, priv->disableSlirp =3D true; =20 if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, - asyncJob, migrateFrom, *fd, path, snapshot, + asyncJob, incoming, *fd, path, snapshot, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, start_flags) =3D=3D 0) *started =3D true; @@ -8385,14 +8380,17 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, =20 virDomainAuditStart(vm, reason, *started); if (!*started || rc < 0) - return -1; + goto cleanup; =20 /* qemuProcessStart doesn't unset the qemu error reporting infrastruct= ure * in case of migration (which is used in this case) so we need to res= et it * so that the handle to virtlogd is not held open unnecessarily */ qemuMonitorSetDomainLog(qemuDomainGetMonitor(vm), NULL, NULL, NULL); + ret =3D 0; =20 - return 0; + cleanup: + qemuProcessIncomingDefFree(incoming); + return ret; } =20 =20 diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 2324aeb7bd..e48d53dc46 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -84,7 +84,7 @@ int qemuProcessStart(virConnectPtr conn, virDomainObj *vm, virCPUDef *updatedCPU, virDomainAsyncJob asyncJob, - const char *migrateFrom, + qemuProcessIncomingDef *incoming, int stdin_fd, const char *stdin_path, virDomainMomentObj *snapshot, --=20 2.35.3