From nobody Thu Dec 18 17:56:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1695043802; cv=none; d=zohomail.com; s=zohoarc; b=hMYEkkvSErt3kJK7K+JKytk+e+Yj/8rqrA5u+dPH9QthJBk5ypZrIGl57DdW1ANBIC6ZxxNoV8MWjKMGVw2SY31WrHMYi0dPhIGXXs/nNEWTBEWuESSsRq0Yb7wLjxAWUCtjrJzMOQ21bBPNeZQRh6uanNJ6hOVLazJwQTc4TLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695043802; 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=jfHdAbCfdqnuNQTBFA47Y7QJ6m29Bs20nGl5PYZZdjM=; b=Y6izLVDzTqo4gkc+BbmmKaCibPVhK+xxzaHnPWeyuejGG4d1mTjNk5iJSBmujFwmyPJjuhmd2UMkWFPGOQojPsjSWc4b0oWJaXQWnvhujaxqubj9VogD9ZocavuCB/p3gDFrh4auDlh7jnjrkIQ83eaEtw9nqJxoHkOAg3EEXdQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1695043802682974.7095546298643; Mon, 18 Sep 2023 06:30:02 -0700 (PDT) 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-307-fMsX6pcwMVuS3fnOT4H7GQ-1; Mon, 18 Sep 2023 09:29:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 20E798002B2; Mon, 18 Sep 2023 13:29:57 +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 0CB9F215670B; Mon, 18 Sep 2023 13:29:57 +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 199C91946A4D; Mon, 18 Sep 2023 13:29:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 42EC019465B7 for ; Mon, 18 Sep 2023 13:29:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 365E61C554; Mon, 18 Sep 2023 13:29:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD33F170EC for ; Mon, 18 Sep 2023 13:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695043801; 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=jfHdAbCfdqnuNQTBFA47Y7QJ6m29Bs20nGl5PYZZdjM=; b=fph6txGbdRNpZpim+63cnozr9wUWztRpYH2RZmYHvFnvOUZjaVVrbqt8ObRa4yGqMlIbp9 b4S3xET+RuS1+xq9f7E/mHpscXDzejiSBpGH+Lrk1J72PubZGQNRJQ8QBzGhenxg4fADBv c+/FRBiOFspeczp7UZ3Tu/tVg3UL3Jg= X-MC-Unique: fMsX6pcwMVuS3fnOT4H7GQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v3 06/10] qemuProcessStartWithMemoryState: make it possible to use without data Date: Mon, 18 Sep 2023 15:29:23 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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.6 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: 1695043804580100005 Content-Type: text/plain; charset="utf-8"; x-default="true" When used with internal snapshots there is no memory state file so we have no data to load and decompression is not needed. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_process.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c8430bf7b7..f96918073f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8165,7 +8165,7 @@ qemuProcessStart(virConnectPtr conn, * @fd: FD pointer of memory state file * @path: path to memory state file * @snapshot: internal snapshot to load when starting QEMU process or NULL - * @data: data from memory state file + * @data: data from memory state file or NULL * @asyncJob: type of asynchronous job * @start_flags: flags to start QEMU process with * @reason: audit log reason @@ -8175,7 +8175,8 @@ qemuProcessStart(virConnectPtr conn, * is correctly decompressed so it can be loaded by QEMU process. * * When reverting to internal snapshot callers needs to pass @snapshot as = well - * correctly start QEMU process. + * correctly start QEMU process. In addition there is no memory state file= so + * it's safe to pass NULL as @data. * * When restoring VM from saved image @snapshot needs to be NULL. * @@ -8203,9 +8204,16 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, g_autofree char *errbuf =3D NULL; int rc =3D 0; =20 - if (virSaveCookieParseString(data->cookie, (virObject **)&cookie, - virDomainXMLOptionGetSaveCookie(driver->x= mlopt)) < 0) - return -1; + if (data) { + if (virSaveCookieParseString(data->cookie, (virObject **)&cookie, + virDomainXMLOptionGetSaveCookie(drive= r->xmlopt)) < 0) + return -1; + + if (qemuSaveImageDecompressionStart(data, fd, &intermediatefd, + &errbuf, &cmd) < 0) { + return -1; + } + } =20 if (qemuSaveImageDecompressionStart(data, fd, &intermediatefd, &errbuf= , &cmd) < 0) return -1; @@ -8226,7 +8234,10 @@ qemuProcessStartWithMemoryState(virConnectPtr conn, start_flags) =3D=3D 0) *started =3D true; =20 - rc =3D qemuSaveImageDecompressionStop(cmd, fd, &intermediatefd, errbuf= , *started, path); + if (data) { + rc =3D qemuSaveImageDecompressionStop(cmd, fd, &intermediatefd, er= rbuf, + *started, path); + } =20 virDomainAuditStart(vm, reason, *started); if (!*started || rc < 0) --=20 2.41.0