From nobody Sun Apr 28 07:11:22 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=1626870027; cv=none; d=zohomail.com; s=zohoarc; b=AjeHUPDRxBpXHb1tGCUIeut0OrUMyzAUlKwSlzwQnMBflK4uLMNPehyavfRhDckUvhhMmjoDHhRRYihCW1iRG7DHDCVrWqK5QtAnU8GMVE1C4ogoX9REsknk57Gbtyq92vNom8OutYU8ErHYnFZyS1M6p3yHyQ5SDk5Y1o1YjSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626870027; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=0I6YjHRvKr8/yMnWYCzHAFToUyxrSEmWKypwOHlVWe4=; b=UXowvH9PW+8+3EGd3OLzKP3pFoPKqYo3yXIk9Z0sBzWzqsFX1eIWntvaF4sr6kmj7GSjhicRkfpIkdW8MpYMCoDvmIf4pFwX2LbIRHDSGhgkJEfDOti0Zm6syAOAY2X8qqV//aJhC4WnXx7D32s107afI5ZcO3rnp/8wE1RwwoA= 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 1626870026954518.9534648248335; Wed, 21 Jul 2021 05:20:26 -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-520-EP0yiQRcP_KF6LEPYtfsXw-1; Wed, 21 Jul 2021 08:20:23 -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 59CBD801FCD; Wed, 21 Jul 2021 12:20:18 +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 3673D62A8F; Wed, 21 Jul 2021 12:20:17 +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 3544B1809C98; Wed, 21 Jul 2021 12:20: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 16LC5HZ5014308 for ; Wed, 21 Jul 2021 08:05:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 55BCD1002D71; Wed, 21 Jul 2021 12:05:17 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D446510013D7 for ; Wed, 21 Jul 2021 12:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626870025; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0I6YjHRvKr8/yMnWYCzHAFToUyxrSEmWKypwOHlVWe4=; b=WEnIh+mqUjjEY8gKbcjHZWtZ5UZaXHn06gpZfRmUvr2JC1iFVhV9/Z55+r80TDeImqk8Aj sSKSAfxHojE5IYyF1w/tWVqyGeyrXzbk6bcPZU7y7V7Ks49FO89zK5dkIyYGMrjToXnvWC yecry5/iMwWpC8MjCeBTF6kDJ5sWtGA= X-MC-Unique: EP0yiQRcP_KF6LEPYtfsXw-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH] qemu: save status xml after generating taint message Date: Wed, 21 Jul 2021 14:05:05 +0200 Message-Id: <285bd6dbacdc0833c49f75bd6be40668bb9815c8.1626869027.git.khanicov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.15 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: 1626870028757100001 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 ac1d8ef151..4b9e717c16 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6468,6 +6468,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 521063d438..8652bdc3d8 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