From nobody Sat May 4 06:17:57 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=1658485458; cv=none; d=zohomail.com; s=zohoarc; b=XxuiBVBvbm4EnS79rtt5eiZVUpyiSNkOx6/TThj2DhP9Bal8OwBzXdN6Typfv59D9NS+ZoXuYXEaW4MfT6lefyyl8y4AM+iZqzwhWHz4CSYuGLF4zWxx1ZHu8mPShfCeZr8ZIYvILYyFJupkXerV0ibQgzrIFeHBX+6GjOKavyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658485458; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HQsOY/0wFUU/+0agZmtJhS1Zt5ITwBEUUi/MfjQTJKw=; b=K5/bGo0jNlPNgtj1PnCh65xkXhPH4pBmkRTJQF10GmotBiicOYi3tDI4vyGHFigsETBPZ30DZbqKS317tcNyxAfOiTNRwKRVoSxzrzbPNCpOpoMi42DPyoT+SxnoxrR/n67TKdKDlreN+C8LPmmElVaWppTjIFq25fl3rmGESqY= 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 1658485458469302.3863621632795; Fri, 22 Jul 2022 03:24:18 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-NbIiT6ZNNm6ubgjESZAhmw-1; Fri, 22 Jul 2022 06:24:14 -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 897AA1C0BDE0; Fri, 22 Jul 2022 10:24:12 +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 10C9340CFD0B; Fri, 22 Jul 2022 10:23:25 +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 544D5194707D; Fri, 22 Jul 2022 10:23:07 +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 113AD1947078 for ; Fri, 22 Jul 2022 10:23:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E4D4C909FF; Fri, 22 Jul 2022 10:23:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E134518EBB for ; Fri, 22 Jul 2022 10:23:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 C4BCE382ECC5 for ; Fri, 22 Jul 2022 10:23:05 +0000 (UTC) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-qAFax_UFM7qyJknzjGtosQ-1; Fri, 22 Jul 2022 06:23:04 -0400 Received: by mail-wm1-f72.google.com with SMTP id v67-20020a1cac46000000b003a2be9fa09cso2327752wme.3 for ; Fri, 22 Jul 2022 03:23:04 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id f5-20020adff445000000b0021e5f32ade7sm869912wrp.68.2022.07.22.03.23.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 03:23:02 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id E072287AF87A; Fri, 22 Jul 2022 12:23:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658485457; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HQsOY/0wFUU/+0agZmtJhS1Zt5ITwBEUUi/MfjQTJKw=; b=HiZ5kZ45VSWZhsg8UScSFjyhzFEA+MbELku+pxiqEmMdZTBPl/aGTq/BLlCPlngznSE9ey Pm8VMiBPZZGS9GtE4ouXiXmpjJoLVAMdA2hFfCDK5fPO1KSiSn4HDXulg4HcNjJdipaVi2 v+JW08wllkAIIdxrwd/umkR0sTzbhkk= X-MC-Unique: NbIiT6ZNNm6ubgjESZAhmw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: qAFax_UFM7qyJknzjGtosQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=HQsOY/0wFUU/+0agZmtJhS1Zt5ITwBEUUi/MfjQTJKw=; b=zAPdAOlJKvLJmvOja0GquLfv1ECMCVc28CMfTy9BjZEgazBjjMS8d2/KoUVmqugm1p 8BvDr3Nt4E85zr/XjfDZmoxr7vqCR2uuyHflYMK6RKJxyNkKWlouxLya3VrzeeLkPsPa IE4Gxi2TNPvzh/tE3Bju0NlJK/XGCMJycdqtS/uve/DbKHuyYaj9XQ6/IFiQaOaz4kzf 3hFITjMy7wTdoZXLxgnuO2ZH2NxKQ+aNOUp4WLeunwArVStt49fvLzR7O5KoK6d+JsZi 9Y523dUdjq4LzZd/QZblwFzNie1T6HQIZ202xg56bq7sJbwyxnatVyXem7JIlvpDn/Ws WTDg== X-Gm-Message-State: AJIora+IHGAKCZkfAkxfTU5n1kcC6QSpYbizvjaWLEiIWUx7/EuuChwB sfFw9hIcIAYL8W7iyMOQ2vUT0WdIphzQO8mycx0dZyI0gdeS29IkNJ71bfzSXMBrGr1Zc69HQ06 gSgj+QOLYb4eWk7eQEqA= X-Received: by 2002:a05:6000:2cf:b0:21d:ae1f:e622 with SMTP id o15-20020a05600002cf00b0021dae1fe622mr1931788wry.183.1658485383467; Fri, 22 Jul 2022 03:23:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tDt6XwguNmqna2vsRD5rv6Hik6bhojG3Ig9Yc5wn1hR/2R3sCu7RZrseVGHL92l3pPx/jlAA== X-Received: by 2002:a05:6000:2cf:b0:21d:ae1f:e622 with SMTP id o15-20020a05600002cf00b0021dae1fe622mr1931762wry.183.1658485383078; Fri, 22 Jul 2022 03:23:03 -0700 (PDT) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH] qemu_migration: Acquire correct job in qemuMigrationSrcIsAllowed Date: Fri, 22 Jul 2022 12:22:54 +0200 Message-Id: <9e34ee4dc0daa5367efccfa2bd2e17094358fa33.1658485317.git.mkletzan@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: jdenemar@redhat.com 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: 1658485459251100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit 62627524607f added the acquiring of a job, but it is not always VIR_ASYNC_JOB_MIGRATION_OUT, so the code fails when doing save or anything = else. Correct the async job by passing it from the caller as another parameter. Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- This will hopefully fix the integration tests that failed this morning: https://gitlab.com/libvirt/libvirt/-/pipelines/594066714 src/qemu/qemu_driver.c | 8 ++++---- src/qemu/qemu_migration.c | 7 ++++--- src/qemu/qemu_migration.h | 1 + src/qemu/qemu_snapshot.c | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 75c7a8a6b225..9013e6fb8d9a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2651,13 +2651,13 @@ qemuDomainSaveInternal(virQEMUDriver *driver, virQEMUSaveData *data =3D NULL; g_autoptr(qemuDomainSaveCookie) cookie =3D NULL; =20 - if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) - goto cleanup; - if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_SAVE, VIR_DOMAIN_JOB_OPERATION_SAVE, flags) <= 0) goto cleanup; =20 + if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SAVE, = 0)) + goto cleanup; + if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("guest unexpectedly quit")); @@ -3177,7 +3177,7 @@ doCoreDump(virQEMUDriver *driver, goto cleanup; } =20 - if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) + if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_DU= MP, 0)) goto cleanup; =20 if (qemuMigrationSrcToFile(driver, vm, fd, compressor, diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 84befe7d39e7..20dc91f1cedd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1452,6 +1452,7 @@ bool qemuMigrationSrcIsAllowed(virQEMUDriver *driver, virDomainObj *vm, bool remote, + int asyncJob, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -1483,7 +1484,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, g_auto(GStrv) blockers =3D NULL; =20 if (qemuDomainGetMigrationBlockers(driver, vm, - VIR_ASYNC_JOB_MIGRATION_OUT, + asyncJob, &blockers) < 0) { return false; } @@ -2637,7 +2638,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_BEGIN3) < 0) return NULL; =20 - if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags)) + if (!qemuMigrationSrcIsAllowed(driver, vm, true, priv->job.asyncJob, f= lags)) return NULL; =20 if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) && @@ -6039,7 +6040,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver, if (!(flags & VIR_MIGRATE_OFFLINE) && virDomainObjCheckActive(vm) = < 0) goto endjob; =20 - if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags)) + if (!qemuMigrationSrcIsAllowed(driver, vm, true, VIR_ASYNC_JOB_MIG= RATION_OUT, flags)) goto endjob; =20 if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) && diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index 65c29d574405..a39f65165988 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -229,6 +229,7 @@ bool qemuMigrationSrcIsAllowed(virQEMUDriver *driver, virDomainObj *vm, bool remote, + int asyncJob, unsigned int flags); =20 int diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 833f880252af..0733d44faac4 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -291,7 +291,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); int ret =3D -1; =20 - if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) + if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SNAPSH= OT, 0)) goto cleanup; =20 if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { @@ -1422,7 +1422,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, /* do the memory snapshot if necessary */ if (memory) { /* check if migration is possible */ - if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) + if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SN= APSHOT, 0)) goto cleanup; =20 qemuDomainJobSetStatsType(priv->job.current, --=20 2.35.1