From nobody Mon Feb 9 01:34:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1594930349; cv=none; d=zohomail.com; s=zohoarc; b=EGMnkl0mBS7qIJ5FWMzJrkEIOA4QKbhXFFEUrsB/oXtOLydL2AD9RGRDYwgW50oO5vDad/O1TEcp5NKDkeBgDydSv9rbHGwmqBknkwBCXGAQzZ5h1lf8EMjorxDmrEbRL13vKPdBI8pIdKDmcQoshRnPVojs2v11dA4Fq1KQ5ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594930349; 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=rBsaPXJdspF5vy/ZO3bZFHiAmQxnOhLmnmMbeEudXD8=; b=izp6tsXQ+cKeXy163VX0g5thIbZWfpRSuT/hWeeQmVN8V555ZLRDHTz5tVn/H4MIo+F2UcMj0LEut0Kk2okL9VYFf15DJ8aZrU0gGQw0ihhaZ6MAK5M/GjeHc35OzD6HGkJ5EhsMkowxgpCkDJqt0BHn4v9I0tVW7ZPBebKKoao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594930349324541.9034205871872; Thu, 16 Jul 2020 13:12:29 -0700 (PDT) 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-366-T7P5FlNNOF690wcwZW_ebQ-1; Thu, 16 Jul 2020 16:12:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89D978064AA; Thu, 16 Jul 2020 20:12: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 6B84B72ADF; Thu, 16 Jul 2020 20:12: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 3D0D51809561; Thu, 16 Jul 2020 20:12:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06GK98bK009571 for ; Thu, 16 Jul 2020 16:09:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id E59341024889; Thu, 16 Jul 2020 20:09:08 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6F2B101E58A for ; Thu, 16 Jul 2020 20:09:04 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id D165F2406BE; Thu, 16 Jul 2020 22:09:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594930348; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=rBsaPXJdspF5vy/ZO3bZFHiAmQxnOhLmnmMbeEudXD8=; b=AK7ulZoFsLmobNGW3KmdXZj288JbT0YAWGDIraoyCO5a792wWd9wjgOZFdcBNH0PsZuLrZ sREe1haXrYGn3pmSoXlxzTF220opCB90cf6bttMyZpmXgtql9lp4OHXPSetiYGRClblphb s0E7yU4+xLja2n+xa18FrPtfrwCGcHI= X-MC-Unique: T7P5FlNNOF690wcwZW_ebQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] qemu: Properly set //cpu/@migratable default value for running domains Date: Thu, 16 Jul 2020 22:08:49 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Mark Mielke 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.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since active domains which do not have the attribute already set were not started by libvirt that probed for CPU migratable property, we need to check this property on reconnect and update the domain definition accordingly. https://bugzilla.redhat.com/show_bug.cgi?id=3D1857967 Reported-by: Mark Mielke Signed-off-by: Jiri Denemark --- src/qemu/qemu_process.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 70fc24b993..d5ac8af37e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7755,6 +7755,52 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, } =20 =20 +static int +qemuProcessRefreshCPUMigratability(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virDomainDefPtr def =3D vm->def; + bool migratable; + int rc; + + if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH) + return 0; + + /* If the cpu.migratable capability is present, the migratable attribu= te + * is set correctly. */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CPU_MIGRATABLE)) + return 0; + + if (!ARCH_IS_X86(def->os.arch)) + return 0; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + rc =3D qemuMonitorGetCPUMigratable(priv->mon, &migratable); + + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; + + if (rc =3D=3D 1) + migratable =3D false; + + /* Libvirt 6.5.0 would set migratable=3D'off' for running domains even= though + * the actual default used by QEMU was 'on'. */ + if (def->cpu->migratable =3D=3D VIR_TRISTATE_SWITCH_OFF && migratable)= { + VIR_DEBUG("Fixing CPU migratable attribute"); + def->cpu->migratable =3D VIR_TRISTATE_SWITCH_ON; + } + + if (def->cpu->migratable =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + def->cpu->migratable =3D virTristateSwitchFromBool(migratable); + + return 0; +} + + static int qemuProcessRefreshCPU(virQEMUDriverPtr driver, virDomainObjPtr vm) @@ -7770,6 +7816,9 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, if (!vm->def->cpu) return 0; =20 + if (qemuProcessRefreshCPUMigratability(driver, vm, QEMU_ASYNC_JOB_NONE= ) < 0) + return -1; + if (!(host =3D virQEMUDriverGetHostCPU(driver))) { virResetLastError(); return 0; --=20 2.27.0