From nobody Fri Apr 19 17:54:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1605729565; cv=none; d=zohomail.com; s=zohoarc; b=WSV51IiJvA45B+g3CXSg10b6rYzkgXy1WFZ1Y3uSaYR9qBVsptS0VyFdh74/hwZU5BCOBL4g04aJBdNhXF5E03YH2nBx+T8cP1v9EFKtZP3rR5qDxLglt6NgXAPoYLWx8gQeflPuny+MBTAapr+9+AU3BVgmLwFbZAwSLHZw/GE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605729565; h=Content-Type:Content-Transfer-Encoding:Cc: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=6mDBvpqkNtQravJ5h6zGf8p8VrqXHk+K9TJdx4BbOO0=; b=LbhQrmCwSlQSzDsBOMuOy0GY+hv538CjlGXw5etxHfJXk+GhhzG4YFfOvJTgCxyKEdfQ0LJQZiFMB/yuGgosROLeNBn926s6k7o/WZbWxPgHbdJ4sQxWVZfUi/Gm/HGHi6zw35SrRgTNHrlnx6KOSNu4fI+z66c1Rzl+FUhulK4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605729565759893.6913281143311; Wed, 18 Nov 2020 11:59:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-Tak0NphHO02K2JzBM8eDjw-1; Wed, 18 Nov 2020 14:59:22 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8631810919E8; Wed, 18 Nov 2020 19:59:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F6CC10016FF; Wed, 18 Nov 2020 19:59:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DABA41809CA2; Wed, 18 Nov 2020 19:59:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AIJwvMV021591 for ; Wed, 18 Nov 2020 14:58:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6D8622166BA3; Wed, 18 Nov 2020 19:58:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 688332166BA2 for ; Wed, 18 Nov 2020 19:58:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D0531021F7C for ; Wed, 18 Nov 2020 19:58:55 +0000 (UTC) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-o-a1NH-VNvqKrxyKTqNeKA-1; Wed, 18 Nov 2020 14:58:52 -0500 Received: by mail-qk1-f176.google.com with SMTP id u4so3057662qkk.10 for ; Wed, 18 Nov 2020 11:58:52 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c7:d88a:482:7c39:5cca:96f6]) by smtp.gmail.com with ESMTPSA id n21sm7022757qke.21.2020.11.18.11.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 11:58:51 -0800 (PST) X-MC-Unique: Tak0NphHO02K2JzBM8eDjw-1 X-MC-Unique: o-a1NH-VNvqKrxyKTqNeKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6mDBvpqkNtQravJ5h6zGf8p8VrqXHk+K9TJdx4BbOO0=; b=GLJSJn5rYhm0DCzd8tJ9bJ5EKmMMSqwu5YsPnn4rlI7asLVt5RGhoKXcLcYs+adld8 1O5r+T3sbfHG8fiI8Wxn43gbsvtBcKgn2jOPJBHrqzb9HYNAx4EATBncQ0sm38ih0nvB Q97u8rqFJ2wPnGgKcs0MBO2oBcPjI7M1xg30q2RYscq9aFMYZ7UqGPJLMJiZnC2o4+CJ TG8V2k6cM8kZ+1Yh6TjN5H0Y6Rd6hccD9CdbXzRkF40L9+KFQj2M5T4ty6Cq7qUhnRao vJEaZZ3ClMF9xp2qjmLhz3FyJKUNeOdFwELObNKUlsJYBW3wNuQ9WfWkmWar9zt86TNg TuKQ== X-Gm-Message-State: AOAM533OuKXQekcWuFkX5qs71f4t7r0tEWuZqHokyUSSo5dk835AikAc y9LfFZNyeyQSgkrEvcWm8+NHtyECg7Y= X-Google-Smtp-Source: ABdhPJzMsQPLqYIPpWxLER71vFNvnmrguSln/ikjE4+lIj4UlA2jQotYJxqniByqiJIKp7ANZTaP8Q== X-Received: by 2002:a37:9e16:: with SMTP id h22mr6462227qke.481.1605729531991; Wed, 18 Nov 2020 11:58:51 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 2/6] qemu: move memory size align to qemuProcessPrepareDomain() Date: Wed, 18 Nov 2020 16:58:30 -0300 Message-Id: <20201118195834.1187381-3-danielhb413@gmail.com> In-Reply-To: <20201118195834.1187381-1-danielhb413@gmail.com> References: <20201118195834.1187381-1-danielhb413@gmail.com> 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.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Content-Type: text/plain; charset="utf-8" qemuBuildCommandLine() is calling qemuDomainAlignMemorySizes(), which is an operation that changes live XML and domain and has little to do with the command line build process. Move it to qemuProcessPrepareDomain() where we're supposed to make live XML and domain changes before launch. qemuProcessStart() is setting VIR_QEMU_PROCESS_START_NEW if !migrate && !snapshot, same conditions used in qemuBuildCommandLine() to call qemuDomainAlignMemorySizes(), making this change seamless. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 3 --- src/qemu/qemu_process.c | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 34b5746c1a..2bcdb28244 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9792,9 +9792,6 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, =20 qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps); =20 - if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0) - return NULL; - if (qemuBuildMemCommandLine(cmd, def, qemuCaps, priv) < 0) return NULL; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3677da635c..39c3edf4b9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6493,6 +6493,12 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, if (qemuExtDevicesPrepareDomain(driver, vm) < 0) return -1; =20 + if (flags & VIR_QEMU_PROCESS_START_NEW) { + VIR_DEBUG("Aligning guest memory"); + if (qemuDomainAlignMemorySizes(vm->def) < 0) + return -1; + } + for (i =3D 0; i < vm->def->nchannels; i++) { if (qemuDomainPrepareChannel(vm->def->channels[i], priv->channelTargetDir) < 0) --=20 2.26.2