From nobody Mon Feb 9 01:57:55 2026 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=1681914280; cv=none; d=zohomail.com; s=zohoarc; b=CjkChcrHjDpY/X++Y74AadUH0kUayXvZRVP3wHtxpvks7KwKj1jPchNWqQEvcW3vIg7+zmNysjE86Q4BrEcrC06y0HT4AyE2nsHa9f/SGdju0buyuRwaRnwUcVqIjRdkJvlfo2bBBzDlvHkdtnJxX7YdhvYeoEecy25xWODY0m8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681914280; 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=6IMarqXAOEhnAZ4uyFfzQt5ze0HXGwRNhB145kl6LMQ=; b=EH6nz8PiXHhppVp3P0KycnrsPvMs5exu8dRVtRnDBJ5lmAKEDNa9gCofF+4fWIylCkkZ0yGXJFgt7N2elGenxjE8pIF+5ScYne1fjfkuedU8/Mv5v1ZPF0iQPcxVRivFGaHx3X/IwAbZflYa0jVTAJvzASFicLThH7ZHK4ddSrU= 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 1681914280804775.921840120777; Wed, 19 Apr 2023 07:24:40 -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-370-Ti_JjwJ9Or2V2CH5qbnPNQ-1; Wed, 19 Apr 2023 10:24:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CBBB181DB85; Wed, 19 Apr 2023 14:24: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 AB47D2027179; Wed, 19 Apr 2023 14:24: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 796301946A40; Wed, 19 Apr 2023 14:24:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C687119465A0 for ; Wed, 19 Apr 2023 14:07:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AB12C2026D3C; Wed, 19 Apr 2023 14:07:27 +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 A3CB42026D25 for ; Wed, 19 Apr 2023 14:07:27 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 8975C3815EE8 for ; Wed, 19 Apr 2023 14:07:27 +0000 (UTC) Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-aXSWphdOO4yDyUBsri_Flg-1; Wed, 19 Apr 2023 10:07:26 -0400 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-63b54d92622so2081318b3a.0 for ; Wed, 19 Apr 2023 07:07:24 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id e21-20020aa78255000000b0063b675f01a5sm9465657pfn.11.2023.04.19.07.07.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 07:07:22 -0700 (PDT) Received: from wheatley.. (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id E690FFB38650 for ; Wed, 19 Apr 2023 16:07:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681914279; 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=6IMarqXAOEhnAZ4uyFfzQt5ze0HXGwRNhB145kl6LMQ=; b=eoC4SkWrL/uyS89o6tZEXxx4f7gqBCLyLv4xZfRFJ7CXcLzXT/940+n3WvcmDiRaMdK+dd UmIuIOCTrTTJhw73FUgqsXzYdvnEYCAOL7Wd9V13DMgHoUim05rjkJHAb7QlTjQXV9CaZs vD7vxUqcCzH4JjPkFrZtksIGrsj+bO4= X-MC-Unique: Ti_JjwJ9Or2V2CH5qbnPNQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: aXSWphdOO4yDyUBsri_Flg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681913243; x=1684505243; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6IMarqXAOEhnAZ4uyFfzQt5ze0HXGwRNhB145kl6LMQ=; b=bnPdLueySafSgIrKh7OwK0bCJW6Fvb/prnMDrjhV8/IFfMKCxxslDX6Pzegv3hDzlv L2wx4LCgubU+r/kOPyXJ9gz2GFvCLX0GEnRLkKR9WzDg/l5Az87Rpg+rdlCc7bLCui18 XpsdsTKvKx0hzt3WLq7KiexH6w3sWlhLV9MzIchGlpmHmyMglC+ji4szT10ATfOWo2WH +qyEV3b2ICccz6X5AzXdMKxlPZzyBKnX37hpK7gWc/CNz3KfsUahx8NSntZlwJyMtdC4 yKo4yEsqXTCJbodYDPsm6whuk5V1iJgKKC8efHnN0XluuK2VQ4IevCdqBSoEzM90oFOJ R1KQ== X-Gm-Message-State: AAQBX9fWo15s8rklKnnKAdVbwYnSMns7W8YvqqS1iO1ZUKqKYSolDS+Y 3nIvTX/xOJxqLi/eDYenT5OVhZa3YB4DqaJc6+xmpv7/w1KUHHZ2/L1+/OhCjvVi341UxwkvOVA iXvDRvMCvrnvmmpAv3+X/aCbaK3QRwyFiNApOVWg2UTkq5W7lK8I4XCGYdsGuyR0rA6LwCxEGg2 0qYHdV1w== X-Received: by 2002:a05:6a00:b83:b0:637:f1ae:d3e with SMTP id g3-20020a056a000b8300b00637f1ae0d3emr4130105pfj.25.1681913243434; Wed, 19 Apr 2023 07:07:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bxdIiYdY9AS9ffZtFcPaT0d2QqKrg996QdASqUhBj/fZ3kAnq5e9BotoaaLFRfIprs9cQSUQ== X-Received: by 2002:a05:6a00:b83:b0:637:f1ae:d3e with SMTP id g3-20020a056a000b8300b00637f1ae0d3emr4130077pfj.25.1681913242998; Wed, 19 Apr 2023 07:07:22 -0700 (PDT) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 6/7] qemu: Validate watchdog action compatibility per-device Date: Wed, 19 Apr 2023 16:07:09 +0200 Message-Id: <1623d5cde41e1b4fb04459736e8057034bc11dfd.1681913144.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.4 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: 1681914282257100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This makes it also work during attach. Also add a test for attaching a watchdog with incompatible action. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2187278 Signed-off-by: Martin Kletzander --- src/qemu/qemu_validate.c | 22 ++++++++++--------- tests/qemuhotplugtest.c | 3 +++ .../qemuhotplug-watchdog-reset.xml | 1 + ...plug-base-live+watchdog+watchdog-reset.xml | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-watchdog-reset= .xml create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-base-live+watc= hdog+watchdog-reset.xml diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a03f7056b191..b2c3fd1785bc 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1114,16 +1114,6 @@ qemuValidateDomainDefWatchdogs(const virDomainDef *d= ef) size_t i =3D 0; =20 for (i =3D 0; i < def->nwatchdogs; i++) { - /* We could theoretically support different watchdogs having dump = and - * pause, but let's be honest, we support multiple watchdogs only - * because we need to be able to add a second, implicit one, not b= ecause - * it is a brilliant idea to have multiple watchdogs. */ - if (def->watchdogs[i]->action !=3D def->watchdogs[0]->action) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("watchdogs with different actions are not sup= ported " - "with this QEMU binary")); - return -1; - } =20 if (def->watchdogs[i]->model =3D=3D VIR_DOMAIN_WATCHDOG_MODEL_ITCO= ) { if (found_itco) { @@ -2308,6 +2298,18 @@ static int qemuValidateDomainWatchdogDef(const virDomainWatchdogDef *dev, const virDomainDef *def) { + /* We could theoretically support different watchdogs having dump and + * pause, but let's be honest, we support multiple watchdogs only + * because we need to be able to add a second, implicit one, not becau= se + * it is a brilliant idea to have multiple watchdogs. */ + if (def->nwatchdogs && + def->watchdogs[0]->action !=3D dev->action) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("watchdogs with different actions are not support= ed " + "with this QEMU binary")); + return -1; + } + switch ((virDomainWatchdogModel) dev->model) { case VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB: if (dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 63a6833cfde7..6aaccce55b39 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -908,6 +908,9 @@ mymain(void) DO_TEST_DETACH("x86_64", "base-live", "watchdog-user-alias-full", fals= e, false, "device_del", QMP_DEVICE_DELETED("ua-UserWatchdog") QMP= _OK); =20 + /* attaching a watchdog with different action should fail */ + DO_TEST_ATTACH("x86_64", "base-live+watchdog", "watchdog-reset", true,= false, NULL); + DO_TEST_ATTACH("x86_64", "base-live", "guestfwd", false, true, "getfd", QMP_OK, "chardev-add", QMP_OK, diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-watchdog-reset.xml b/= tests/qemuhotplugtestdevices/qemuhotplug-watchdog-reset.xml new file mode 100644 index 000000000000..cb1c072e1ac2 --- /dev/null +++ b/tests/qemuhotplugtestdevices/qemuhotplug-watchdog-reset.xml @@ -0,0 +1 @@ + diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog+wa= tchdog-reset.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watch= dog+watchdog-reset.xml new file mode 120000 index 000000000000..d3d1764fd897 --- /dev/null +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog+watchdog-= reset.xml @@ -0,0 +1 @@ +qemuhotplug-base-live+watchdog.xml \ No newline at end of file --=20 2.40.0