From nobody Sun May 5 16:42:55 2024 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=1658384483; cv=none; d=zohomail.com; s=zohoarc; b=cWlSLjJ8u2AzTMBagllXp7CFcMNEhlshtVml/9R9JAm4PumETDF6gIaaex7J9M8OBLsB2IThxU4WdQQONHpYN661vkayyxB46HR+UB8h93bt3rLT5doM+j01sWMmOjTkLlIElO4+25B4iM25L80C/xeABNlq0OWq0XaAChC8bCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658384483; 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=vKyBuIIzrEEz5DW1RjiopEu8z74J7wa0nK1K05fXNS8=; b=MmtDh+H9y4Qukh8vxic4zbs9NRN05J5kItFFm8AAwz2LNGdK+85nBYT1aHnSvuiXKrWI77VIoRaqySB88hDkKth6MqlRmkkgj+mTCk1DF4z/oTekdngqkGp3UQYxRvf5HAvz9EorBNgbXbLApvuXck3L959Y3pwvQD/S0VlPyB0= 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 16583844835411002.5938608210049; Wed, 20 Jul 2022 23:21:23 -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-623-D7yGFLcDNceFqeK20YqZpg-1; Thu, 21 Jul 2022 02:21:18 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 036B0806012; Thu, 21 Jul 2022 06:21:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2143401E7B; Thu, 21 Jul 2022 06:21:14 +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 5EE691947051; Thu, 21 Jul 2022 06:21:14 +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 BD4F21947051 for ; Thu, 21 Jul 2022 06:21:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AD8F090A00; Thu, 21 Jul 2022 06:21:13 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 945E118ECB; Thu, 21 Jul 2022 06:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658384481; 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=vKyBuIIzrEEz5DW1RjiopEu8z74J7wa0nK1K05fXNS8=; b=THYBna/7uvN/tj+IKOcsVUvQgin2vaJG4qo5blhJO2UlEm7W7XHdg58V52B9e8aVolpvVv eTroRCJWUV5SLusaWLtjHdA81c0nekVur0Ifbxw3lc+x1h9n7nKYZWLP5GDcO4HQ726hGZ OWnilLvqoHvuARolfdOP5uojYoAmzcY= X-MC-Unique: D7yGFLcDNceFqeK20YqZpg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: don't try to query QEMU about migration blockers during offline migration Date: Thu, 21 Jul 2022 02:21:12 -0400 Message-Id: <20220721062113.254515-2-laine@redhat.com> In-Reply-To: <20220721062113.254515-1-laine@redhat.com> References: <20220721062113.254515-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 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: , Cc: Eugenio Perez Martin Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658384484986100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The new code that queries QEMU about migration blockers was put at the top of qemuMigrationSrcIsAllowed(), but that function can also be called in the case of offline migration (ie when the domain is inactive / QEMU isn't running). This check should have been put inside the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move it there. Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31 Signed-off-by: Laine Stump Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 5d1e5f987b..6fc5791f61 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1455,22 +1455,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, int nsnapshots; int pauseReason; size_t i; - bool blockedReasonsCap =3D virQEMUCapsGet(priv->qemuCaps, - QEMU_CAPS_MIGRATION_BLOCKED_RE= ASONS); - - /* Ask qemu if it have a migration blocker */ - if (blockedReasonsCap) { - g_auto(GStrv) blockers =3D NULL; - if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0) - return false; - - if (blockers && blockers[0]) { - g_autofree char *reasons =3D g_strjoinv("; ", blockers); - virReportError(VIR_ERR_OPERATION_INVALID, - _("cannot migrate domain: %s"), reasons); - return false; - } - } =20 /* perform these checks only when migrating to remote hosts */ if (remote) { @@ -1488,6 +1472,24 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, =20 /* following checks don't make sense for offline migration */ if (!(flags & VIR_MIGRATE_OFFLINE)) { + bool blockedReasonsCap =3D virQEMUCapsGet(priv->qemuCaps, + QEMU_CAPS_MIGRATION_BLOCKE= D_REASONS); + + /* Ask qemu if it has a migration blocker */ + if (blockedReasonsCap) { + g_auto(GStrv) blockers =3D NULL; + + if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0) + return false; + + if (blockers && blockers[0]) { + g_autofree char *reasons =3D g_strjoinv("; ", blockers); + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot migrate domain: %s"), reasons); + return false; + } + } + if (remote) { /* cancel migration if disk I/O error is emitted while migrati= ng */ if (flags & VIR_MIGRATE_ABORT_ON_ERROR && --=20 2.35.3 From nobody Sun May 5 16:42:55 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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=1658384489; cv=none; d=zohomail.com; s=zohoarc; b=cgRQAH7F8oPxgpr1lOagzlBJlvQu/qhlyTAspSj15Vw6C7nXPXyP2EAvLqVI29PZNy9Hu+pGHObBRcc/Tf5UPV71DXASnBjQ6+pEf+EtsmaSUBMTC5UaLNly5myvzoSiOOetjc1GhaamhnKyvB8PEeaYxOssVLnryTScVqdSqfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658384489; 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=GR+jq8oI8C257aOtirNrsdcMgg+t0Y7/D6b0L144/9w=; b=hITsWcKmml72U1C3u6jhl5We/ut/vCixU/8DicdnghzhS2C7xvCvebxFRN2NJoG3n3cSlE1I/00Nz00cSfiVbvHLVXjL7A6usUIqgtk4zptfflJirQvJCBU/i4ZU15j5fNqVju6KlV+Uw5CwaPNW6XBL8RBefjLC38jLKFnX2U4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1658384489331907.6034522636331; Wed, 20 Jul 2022 23:21:29 -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-626-7ply5NVoOC-oFO2p2I0C-Q-1; Thu, 21 Jul 2022 02:21:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23C34811E76; Thu, 21 Jul 2022 06:21:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0ED4940CFD0A; Thu, 21 Jul 2022 06:21:16 +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 ACCB41947052; Thu, 21 Jul 2022 06:21:15 +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 1694419466DF for ; Thu, 21 Jul 2022 06:21:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D26F118ECB; Thu, 21 Jul 2022 06:21:13 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B97A494561; Thu, 21 Jul 2022 06:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658384488; 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=GR+jq8oI8C257aOtirNrsdcMgg+t0Y7/D6b0L144/9w=; b=U7lH+8HaqS6y7ld61OhGOuhC7nWGL0lVZtCVQds9ErcdDT8q1oY6FPNNJ9c4wqlVg5AzrY 4yHfSQ4B9jKZ62KWCBx2fIoOxOtXkhSNe6YyAoX6TUo9lwi2V9HigcfPXa7ov+qEh9mGSP fNATPAtsNxNjtSXQc+DEJNPpP5HeFkA= X-MC-Unique: 7ply5NVoOC-oFO2p2I0C-Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: skip hardcoded hostdev migration check if QEMU can do it for us Date: Thu, 21 Jul 2022 02:21:13 -0400 Message-Id: <20220721062113.254515-3-laine@redhat.com> In-Reply-To: <20220721062113.254515-1-laine@redhat.com> References: <20220721062113.254515-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 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: , Cc: Eugenio Perez Martin Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658384491072100002 Content-Type: text/plain; charset="utf-8"; x-default="true" libvirt currently will block migration for any vfio-assigned device unless it is a network device that is associated with a virtio-net failover device (ie. if the hostdev object has a teaming->type =3D=3D VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT). In the future there will be other vfio devices that can be migrated, so we don't want to rely on this hardcoded block. QEMU 6.0+ will anyway inform us of any devices that will block migration (as a part of qemuDomainGetMigrationBlockers()), so we only need to do the hardcoded check in the case of old QEMU that can't provide that information. Signed-off-by: Laine Stump Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6fc5791f61..4ad5b7af39 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1488,6 +1488,14 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, _("cannot migrate domain: %s"), reasons); return false; } + } else { + /* checks here are for anything that doesn't need to be + * checked by libvirt if running QEMU that can be queried + * about migration blockers. + */ + + if (!qemuMigrationSrcIsAllowedHostdev(vm->def)) + return false; } =20 if (remote) { @@ -1514,9 +1522,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, return false; } =20 - if (!qemuMigrationSrcIsAllowedHostdev(vm->def)) - return false; - if (vm->def->cpu) { /* QEMU blocks migration and save with invariant TSC enabled * unless TSC frequency is explicitly set. --=20 2.35.3