From nobody Sun May 5 01:18:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1627389789; cv=none; d=zohomail.com; s=zohoarc; b=cRdog1J3ZTbtQ/72xx6gxOS6JGkEfKS5LcBeszNS7PsFGZBLTKRkcfCOWkQyipDFbIz9CDXUleMTqVdorKhYOtM7aXi2NdqOinT5c2m9bul8KVZdIuiDAHpQ6F+PkaRnOx1SrFgzUWSeJQWYVxFBSq8YTV34tIl+YyIyPf6olY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627389789; 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=BJ8m4m2X7QPLkQjSGTf3vY0yh4whWYoQv3fMuJMexKU=; b=btIQloyZy/4trULSzvfaAQHhQkPum9JHesaVDn5Ofsv2oX/dIApNp8dgyEG5Ge11iXjM1pHeVl4QRwceZyJUJzsKt2t/MIGkXeibx39Kw6OEXa1cH2lOfcXDWfsUIQi/pBislEhrXjFhukh0SlEe23JRipzSN0noX8ElfCxZZ10= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1627389789515179.7722063517449; Tue, 27 Jul 2021 05:43:09 -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-190-TZYJbPtRMqSC-JoJHBjcCA-1; Tue, 27 Jul 2021 08:41:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D2DA100F764; Tue, 27 Jul 2021 12:41:49 +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 E43A460854; Tue, 27 Jul 2021 12:41:48 +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 A68CD181A2A8; Tue, 27 Jul 2021 12:41:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16RCaA6B019293 for ; Tue, 27 Jul 2021 08:36:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9252B19D7C; Tue, 27 Jul 2021 12:36:10 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.34.244.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C41F19C79 for ; Tue, 27 Jul 2021 12:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627389788; 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=BJ8m4m2X7QPLkQjSGTf3vY0yh4whWYoQv3fMuJMexKU=; b=C2GZOwcqCMIA1ew07Eyz7vyR4MYfZNZUF0Li/LjEIfTpaCbnsYwA2IWzxuQ/snUmvSP0n9 wGWJ9d7fqEJ/FMjPdT1Lr8AXskZxQi1+amkf2gyqErRlBIzFFQX825IM5LdGRkBovXPOBV w8PMebRiuooY5mrMWAfgWCwJ3IfIMyU= X-MC-Unique: TZYJbPtRMqSC-JoJHBjcCA-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v1] qemu: save status xml after generating taint message Date: Tue, 27 Jul 2021 14:35:59 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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.13 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: 1627389790995100001 Content-Type: text/plain; charset="utf-8" We didn't always save status xml after generating new taint message, which resulted in it being deleted in case of a libvirtd restart. Some taint messages were preserved thanks to saving status xml separately at the end of the calling functions (which makes sense, because qemuDomainObjTaint was usually called there multiple times). But for special cases (e.g. When only few taint messages are generated) we need a separate function for generating them and saving status xml explicitly. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1965589 Signed-off-by: Kristina Hanicova --- src/qemu/qemu_domain.c | 11 +++++++++++ src/qemu/qemu_domain.h | 5 +++++ src/qemu/qemu_driver.c | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7e2efc8168..ce55ac39c1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6464,6 +6464,17 @@ void qemuDomainObjTaint(virQEMUDriver *driver, qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL); } =20 +void qemuDomainObjTaintAndSave(virQEMUDriver *driver, + virDomainObj *obj, + virDomainTaintFlags taint, + qemuDomainLogContext *logCtxt) +{ + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + + qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL); + ignore_value(virDomainObjSave(obj, driver->xmlopt, cfg->stateDir)); +} + void qemuDomainObjTaintMsg(virQEMUDriver *driver, virDomainObj *obj, virDomainTaintFlags taint, diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index acf6ca5ab6..9bd711cbd4 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -568,6 +568,11 @@ void qemuDomainObjTaint(virQEMUDriver *driver, virDomainTaintFlags taint, qemuDomainLogContext *logCtxt); =20 +void qemuDomainObjTaintAndSave(virQEMUDriver *driver, + virDomainObj *obj, + virDomainTaintFlags taint, + qemuDomainLogContext *logCtxt); + void qemuDomainObjTaintMsg(virQEMUDriver *driver, virDomainObj *obj, virDomainTaintFlags taint, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0b35bbc15c..195c0ba7a0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14010,7 +14010,7 @@ static int qemuDomainQemuMonitorCommand(virDomainPt= r domain, const char *cmd, =20 priv =3D vm->privateData; =20 - qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_MONITOR, NULL); + qemuDomainObjTaintAndSave(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_MONITOR,= NULL); =20 hmp =3D !!(flags & VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP); =20 @@ -16877,7 +16877,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, if (!qemuDomainAgentAvailable(vm, true)) goto endjob; =20 - qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, NUL= L); + qemuDomainObjTaintAndSave(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_GA_COMMA= ND, NULL); =20 agent =3D qemuDomainObjEnterAgent(vm); ret =3D qemuAgentArbitraryCommand(agent, cmd, &result, timeout); --=20 2.31.1