From nobody Mon Apr 29 13:33:03 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=1629816303; cv=none; d=zohomail.com; s=zohoarc; b=JSssjo7zjLgTHBNksavw7oCAqNgZEuYI8b4wCUooOktNxe9Q1p4fGEFFWSpBPoe7DDiVb8S8M7DlEP6JO58BMVkSN5XCEzb4kBUvOYSJeLDAvEarnTv6qb5DvrHJaid01qNrJU10yZ0viZG1kXAnllUudsrKCQ0SSqX7mYN6HA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816303; 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=Dh0Mb9LPkGc/4whNbY4AhCmNqUZMMmA0L+sLwqTmZC8=; b=IODi9ge53sHkTba94i94PisLk48A+uSDStULs/Vn8LSh4vg0ZMFG2WaeaSk3oLtwsfmUF6kPR5CAz8kjdHqShEautfVk3QEUjIBVYX5aCxS3xCiAu3VY8frWUX+hSOB9T9puaqsvLj/6AwXzon4pkMmVxlKsJnaxmk/Hk+lcUAU= 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 162981630381939.325953626745104; Tue, 24 Aug 2021 07:45:03 -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-207-ygoRmrLGNOCfwboC1dQ93w-1; Tue, 24 Aug 2021 10:44:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8309838E65; Tue, 24 Aug 2021 14:44:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AC1660E1C; Tue, 24 Aug 2021 14:44:54 +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 515914BB7C; Tue, 24 Aug 2021 14:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEirib005444 for ; Tue, 24 Aug 2021 10:44:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id B56BF69323; Tue, 24 Aug 2021 14:44:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1635D18432 for ; Tue, 24 Aug 2021 14:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816302; 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=Dh0Mb9LPkGc/4whNbY4AhCmNqUZMMmA0L+sLwqTmZC8=; b=PWCwowLLs0zpPHmEp2dqWotGLXYv4kQnZLRacsXp0SnptHzFP2h0HWnOudZ1x3CG0uulc4 ZwhhPbxyGFV5Euw/CP0hMubZBBts/Vv1eawdmQCdvRh33Oe8sFLrkYYifUj30TQRsuTt5A IZWpbBGvaxaOFYuCMp9dnvA4/oW9dIw= X-MC-Unique: ygoRmrLGNOCfwboC1dQ93w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/22] qemuMonitorJSONSetWatchdogAction: Use automatic memory clearing Date: Tue, 24 Aug 2021 16:44:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1629816305872100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8e5af9f79a..8fb2bf4dc3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8560,9 +8560,8 @@ int qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, const char *action) { - virJSONValue *cmd; - virJSONValue *reply =3D NULL; - int ret =3D -1; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; if (!(cmd =3D qemuMonitorJSONMakeCommand("watchdog-set-action", "s:action", action, @@ -8570,17 +8569,12 @@ qemuMonitorJSONSetWatchdogAction(qemuMonitor *mon, return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return -1; if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return 0; } --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816366; cv=none; d=zohomail.com; s=zohoarc; b=WvxxvxnIWB+nR+vLQYIiZaQNZhtcTVl14bAN40WrgNSDUwoE1tefLs7NLvZNcjd7Wv6+BPUqAg5b1xsP3SYj4FqTsT1PHny7iJV22guCReRYQUfZGDapCrA5ofbzeynWHmwQUDliRs1nspaD8fIcTe6Jh694c1HxiFKwpliKmxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816366; 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=B8hp/ActkkTj5bxCmLWFjjspBYYL7RSOy5eeEfSPBhI=; b=Ac4AuNbBYPxyMIYLjZtofDSRQGteVid8FzsXkhzcGcKLh0aYjiMD7joAtCEokaDB401YJVXQW0VA6Hqc993p3Gmw7/1tnnCjqw8jAGRUvoFNL/ZM08eiEpc+hmjtvJz1AaV1qvvNAbGHKZ2xDQ0CbH8vtKBaysa6VxhglyMubf0= 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 1629816366497822.063574603246; Tue, 24 Aug 2021 07:46:06 -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-252-VgKFYeKDPAq8XKYrFvJm6Q-1; Tue, 24 Aug 2021 10:45:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE0EF101C8A6; Tue, 24 Aug 2021 14:45:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C06F21017CE8; Tue, 24 Aug 2021 14:45:03 +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 8FD7C4A7C9; Tue, 24 Aug 2021 14:45:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEj2RM005478 for ; Tue, 24 Aug 2021 10:45:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id DF68B6A8FE; Tue, 24 Aug 2021 14:45:02 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 368016A8F7 for ; Tue, 24 Aug 2021 14:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816365; 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=B8hp/ActkkTj5bxCmLWFjjspBYYL7RSOy5eeEfSPBhI=; b=JOVS+9alBsuKGUjAxbUzuir16Sqrxa/pSmZkFsf7c5ogGL1UjTR6bduxqQvyxU0S7SsrhV ZaYXAkcoPPXerosjaTT1nWP0UtsAnvkB4J/8OK4tBOQdfw1u1mL6jCuZE/ahuoq9lUU2ff yfAQKxtCFmV7g+pDJqeH6jNgCFUOVyQ= X-MC-Unique: VgKFYeKDPAq8XKYrFvJm6Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/22] qemuDomainSetLifecycleAction: Add a note about argument range-check Date: Tue, 24 Aug 2021 16:44:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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: 1629816367299100001 Content-Type: text/plain; charset="utf-8" The public API wrapper range-checks the arguments. Save the next reader the hassle of looking it up. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 444e9e5cbc..2de17aaa4e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19654,6 +19654,8 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, virDomainDef *persistentDef =3D NULL; int ret =3D -1; + /* note that 'action' and 'type' are range-checked in the public API w= rapper */ + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816321; cv=none; d=zohomail.com; s=zohoarc; b=PEG/QDFLI3sgr/DxjN6+WGLxY1iPfBmp8DFqUM0fzapKYev0vJVZ7jh8e4tpHgM5MSsQH0H8AehsMBqhXKpfovxQrSw6WcL7nGaHyMAiisXDRq1edxI8b+nJbDXB0qH5K6y8IGRKfSeoFKY29R9UeHj+WuueZbwxd+KZlnSVdPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816321; 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=90TUvOO0nfbrJG7I1MivwkZK9xvnH6550CveBw3JSP0=; b=dfVaWZmYVXEkATcj/EQgjWEik+uQA7aYWwe5OGsCijXjd8yhbQ3PlyjJkCduy+c78o4jNwMj8nb46plon6nO8zKX6pB9oR10RwLVEHb3LSmVCmQ98lVoot8typ9HD6cUU4TvxGSSRNkzV+BLObI4y4mLPsveYFWCad5eoW0gckE= 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 1629816321274668.4806462307184; Tue, 24 Aug 2021 07:45:21 -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-557-KFT15hOrNHCgGlNBSm32HQ-1; Tue, 24 Aug 2021 10:45:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FCF3192CC40; Tue, 24 Aug 2021 14:45:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26D7F2B6C3; Tue, 24 Aug 2021 14:45:13 +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 E869F4A7CB; Tue, 24 Aug 2021 14:45:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjB1Q005511 for ; Tue, 24 Aug 2021 10:45:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 10C7C18436; Tue, 24 Aug 2021 14:45:11 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47F811ABD7 for ; Tue, 24 Aug 2021 14:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816320; 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=90TUvOO0nfbrJG7I1MivwkZK9xvnH6550CveBw3JSP0=; b=MJKyyhhB3kTGeKBX1ziOcaoR6y1RXI5hXEAV5JSoAhqk9AR9XMY1mXYRGcvXYSKlYLL1mR 054x4/ZTHHDZZKJN7hJAMmbYikeunE8jM1ddZSmg7yx9AQIdehyqq19UpYu22yJbiUOrbU nKzJrkGUwZvkdEvRk2BWBDRgHiMjxuc= X-MC-Unique: KFT15hOrNHCgGlNBSm32HQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/22] qemu: driver: Use 'qemuDomainSaveStatus' for saving status XML Date: Tue, 24 Aug 2021 16:44:24 +0200 Message-Id: <7b23a88670daffd6c9101c835659fec716e13292.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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: 1629816322407100001 Content-Type: text/plain; charset="utf-8" We've got multiple random open-coded versions. Switch to the helper function which doesn't report errors as they'd be mostly wrong as the operation was indeed successful. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 96 ++++++++++++------------------------------ 1 file changed, 26 insertions(+), 70 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2de17aaa4e..39347f84c7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1869,8 +1869,7 @@ static int qemuDomainSuspend(virDomainPtr dom) if (qemuProcessStopCPUs(driver, vm, reason, QEMU_ASYNC_JOB_NONE) <= 0) goto endjob; } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); ret =3D 0; endjob: @@ -1927,8 +1926,7 @@ static int qemuDomainResume(virDomainPtr dom) goto endjob; } } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); ret =3D 0; endjob: @@ -2522,8 +2520,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPt= r dom, int period, } def->memballoon->period =3D period; - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentDef) { @@ -3623,7 +3620,6 @@ processGuestPanicEvent(virQEMUDriver *driver, { qemuDomainObjPrivate *priv =3D vm->privateData; virObjectEvent *event =3D NULL; - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); bool removeInactive =3D false; unsigned long flags =3D VIR_DUMP_MEMORY_ONLY; @@ -3648,10 +3644,7 @@ processGuestPanicEvent(virQEMUDriver *driver, virObjectEventStateQueue(driver->domainEventState, event); - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) { - VIR_WARN("Unable to save status on vm %s after state change", - vm->def->name); - } + qemuDomainSaveStatus(vm); if (virDomainLockProcessPause(driver->lockManager, vm, &priv->lockStat= e) < 0) VIR_WARN("Unable to release lease on %s", vm->def->name); @@ -3704,7 +3697,6 @@ processDeviceDeletedEvent(virQEMUDriver *driver, virDomainObj *vm, const char *devAlias) { - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); virDomainDeviceDef dev; VIR_DEBUG("Removing device %s from domain %p %s", @@ -3728,9 +3720,7 @@ processDeviceDeletedEvent(virQEMUDriver *driver, goto endjob; } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - VIR_WARN("unable to save domain status after removing device %s", - devAlias); + qemuDomainSaveStatus(vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -4045,7 +4035,6 @@ processSerialChangedEvent(virQEMUDriver *driver, const char *devAlias, bool connected) { - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); virDomainChrDeviceState newstate; virObjectEvent *event =3D NULL; virDomainDeviceDef dev; @@ -4096,9 +4085,7 @@ processSerialChangedEvent(virQEMUDriver *driver, dev.data.chr->state =3D newstate; - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - VIR_WARN("unable to save status of domain %s after updating state = of " - "channel %s", vm->def->name, devAlias); + qemuDomainSaveStatus(vm); if (STREQ_NULLABLE(dev.data.chr->target.name, "org.qemu.guest_agent.0"= )) { if (newstate =3D=3D VIR_DOMAIN_CHR_DEVICE_STATE_CONNECTED) { @@ -4520,7 +4507,6 @@ qemuDomainPinVcpuLive(virDomainObj *vm, virDomainDef *def, int vcpu, virQEMUDriver *driver, - virQEMUDriverConfig *cfg, virBitmap *cpumap) { virBitmap *tmpmap =3D NULL; @@ -4572,8 +4558,7 @@ qemuDomainPinVcpuLive(virDomainObj *vm, vcpuinfo->cpumask =3D tmpmap; tmpmap =3D NULL; - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto cleanup; + qemuDomainSaveStatus(vm); if (g_snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH, VIR_DOMAIN_TUNABLE_CPU_VCPUPIN, vcpu) < 0) { @@ -4646,7 +4631,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, } if (def && - qemuDomainPinVcpuLive(vm, def, vcpu, driver, cfg, pcpumap) < 0) + qemuDomainPinVcpuLive(vm, def, vcpu, driver, pcpumap) < 0) goto endjob; if (persistentDef) { @@ -4787,8 +4772,7 @@ qemuDomainPinEmulator(virDomainPtr dom, virBitmapFree(def->cputune.emulatorpin); def->cputune.emulatorpin =3D virBitmapNewCopy(pcpumap); - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); str =3D virBitmapFormat(pcpumap); if (virTypedParamsAddString(&eventParams, &eventNparams, @@ -5247,8 +5231,7 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virProcessSetAffinity(iothrid->thread_id, pcpumap, false) < 0) goto endjob; - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); if (g_snprintf(paramField, VIR_TYPED_PARAM_FIELD_LENGTH, VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN, iothread_id) <= 0) { @@ -5694,8 +5677,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentDef) { @@ -7825,8 +7807,7 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObj *vm, * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - return -1; + qemuDomainSaveStatus(vm); } /* Finally, if no error until here, we can save config. */ @@ -7964,15 +7945,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr = dom, * device we're going to update. */ if ((ret =3D qemuDomainUpdateDeviceLive(vm, dev_copy, dom, force))= < 0) goto endjob; - /* - * update domain status forcibly because the domain status may be - * changed even if we failed to attach the device. For example, - * a new controller may be created. - */ - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) { - ret =3D -1; - goto endjob; - } + + qemuDomainSaveStatus(vm); } /* Finally, if no error until here, we can save config. */ @@ -8057,13 +8031,7 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriver *d= river, if (rc =3D=3D 0 && qemuDomainUpdateDeviceList(driver, vm, QEMU_ASY= NC_JOB_NONE) < 0) goto cleanup; - /* - * update domain status forcibly because the domain status may be - * changed even if we failed to attach the device. For example, - * a new controller may be created. - */ - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto cleanup; + qemuDomainSaveStatus(vm); } /* Finally, if no error until here, we can save config. */ @@ -8436,9 +8404,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, if (def) { ret =3D virDomainCgroupSetupDomainBlkioParameters(priv->cgroup, de= f, params, nparams); - - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (ret < 0) goto endjob; @@ -8613,9 +8579,8 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, params, nparams) < 0) goto endjob; - if (def && - virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + if (def) + qemuDomainSaveStatus(vm); if (persistentDef && virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir) < = 0) @@ -8876,8 +8841,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, -1, mode, nodeset) < 0) goto endjob; - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentDef) { @@ -9068,8 +9032,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO; } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentDef) { @@ -9520,8 +9483,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr do= m, } } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); if (eventNparams) { event =3D virDomainEventTunableNewFromDom(dom, eventParams, eventN= params); @@ -10418,8 +10380,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, goto endjob; } - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentNet) { @@ -14444,7 +14405,6 @@ qemuDomainBlockJobAbort(virDomainPtr dom, { virQEMUDriver *driver =3D dom->conn->privateData; virDomainDiskDef *disk =3D NULL; - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); bool pivot =3D !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT); bool async =3D !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC); g_autoptr(qemuBlockJobData) job =3D NULL; @@ -14508,7 +14468,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, job->state =3D QEMU_BLOCKJOB_STATE_ABORTING; } - ignore_value(virDomainObjSave(vm, driver->xmlopt, cfg->stateDir)); + qemuDomainSaveStatus(vm); if (!async) { qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE); @@ -16191,8 +16151,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainSetGroupBlockIoTune(def, &info); - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); if (eventNparams) { event =3D virDomainEventTunableNewFromDom(dom, eventParams, ev= entNparams); @@ -19686,8 +19645,7 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, qemuDomainModifyLifecycleAction(def, type, action); - if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto endjob; + qemuDomainSaveStatus(vm); } if (persistentDef) { @@ -20225,9 +20183,7 @@ qemuDomainAgentSetResponseTimeout(virDomainPtr dom, QEMU_DOMAIN_PRIVATE(vm)->agentTimeout =3D timeout; - if (virDomainObjIsActive(vm) && - virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) - goto cleanup; + qemuDomainSaveStatus(vm); ret =3D 0; --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816333; cv=none; d=zohomail.com; s=zohoarc; b=exxUTI228blKoPS9zf6Q0l6rxXIVsjftcx4x/oV8T3TyQv+V9WkXLCdxukByoWbHh893W5nksRxEh2scQEdqsIAj8cSWijPPtyppxw5TFbOlIU7BnqYmdNOKj48E56tLKI1H9l6a6y3bfoppmhSB74/3yZtbMTPFXm69ro73Gjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816333; 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=3wQSKt0a7KDwYwX/cZcq4NdwqDsimfVxVFuoQzbDI20=; b=Zc1H9pPoq40S9DLlxnebyzNiHoSKUbewLVbtAynXrB7u8SX7piISTM5uX+A2LZJV1hk3P8xXF3DrVYjrwlNhhl7dUkv0z8S/W/yp6wg2Jl+b1V3Z0jx62DPWzRIzpON39Q3iE6DoVWF+W9V3e8CC5coR+vYExCEIjK2f4rMXqzY= 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 1629816333126174.23936647933704; Tue, 24 Aug 2021 07:45:33 -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-366-Vngjhu4bNu-h9IUNzDcCwg-1; Tue, 24 Aug 2021 10:45:29 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E35A101C8B4; Tue, 24 Aug 2021 14:45:20 +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 ED7E010372CC; Tue, 24 Aug 2021 14:45:19 +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 B90DC181A1F3; Tue, 24 Aug 2021 14:45:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjIW9005591 for ; Tue, 24 Aug 2021 10:45:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0876D6A8F7; Tue, 24 Aug 2021 14:45:18 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59BA71ABD7 for ; Tue, 24 Aug 2021 14:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816332; 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=3wQSKt0a7KDwYwX/cZcq4NdwqDsimfVxVFuoQzbDI20=; b=aM7ryXWrz2Bv+HYh8x5oOyr3cJvS+XC4vnKGGNqx6oeoeCEa7qZ8pnYNYpAQGSGzIdaQsC y1NM2hzEvGFIMe2ePBRVt+LQnNlTurUSja4RVTHVneoExrzpWcyIH0goBR2Xohkzhev9FV g9M0YX2adfinePmLkcMLCukZeMY3ZnQ= X-MC-Unique: Vngjhu4bNu-h9IUNzDcCwg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/22] qemu: validate: Reformat header and purge unused includes Date: Tue, 24 Aug 2021 16:44:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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: 1629816334664100003 Content-Type: text/plain; charset="utf-8" Use the new style header formatting. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_validate.h b/src/qemu/qemu_validate.h index 271460d019..19629ac3af 100644 --- a/src/qemu/qemu_validate.h +++ b/src/qemu/qemu_validate.h @@ -20,19 +20,21 @@ #pragma once -#include - #include "domain_conf.h" #include "qemu_capabilities.h" -#include "qemu_conf.h" -int qemuValidateDomainDef(const virDomainDef *def, - void *opaque, - void *parseOpaque); -int qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, - const virDomainDef *def, - virQEMUCaps *qemuCaps); -int qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, +int +qemuValidateDomainDef(const virDomainDef *def, + void *opaque, + void *parseOpaque); + +int +qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, const virDomainDef *def, - void *opaque, - void *parseOpaque); + virQEMUCaps *qemuCaps); + +int +qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, + const virDomainDef *def, + void *opaque, + void *parseOpaque); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816332; cv=none; d=zohomail.com; s=zohoarc; b=GF/FEPhWW3eaAfUUyKNUeeM+BVRqOW2s4yYm6nLGSu24Z1qy+ESZBl8MOQ4OeDKG3unQ8yC76ewlDzsp1RYfrHZK6RNLVfNk3UUc8soWfjLuWrRkO8NqUC1y13MEZ5yJwDK0Mm9IMtuAoJ1r8Xg0wqDfQB2if2pYYKegEvhg5ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816332; 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=+RKO1nh+jEQuF8qPuzFyWbKNuGIdrbCn3wIinr85vkU=; b=oDsWKtHU6muEO0ICzZYXUJ0o8wvyHcrqMMVrYMB2IAiZyuwKYjKr1eBCr4v4v3ZDN8c0JdJX9L+ipAv/Lelo6Dck/ELder/pIJKT+6Kz8Lq3Q299IaphWYGKlPYEMH38uhBZpi5cOJF+HPRolVsW7J7hYNpZR7w/eWgPMpurYhs= 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 1629816332020799.0480951776766; Tue, 24 Aug 2021 07:45:32 -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-479-sMQED9QCPkiPyRNaxmID7w-1; Tue, 24 Aug 2021 10:45:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 27064192CC45; Tue, 24 Aug 2021 14:45:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 013CA1017CE7; Tue, 24 Aug 2021 14:45:21 +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 BC46F4A704; Tue, 24 Aug 2021 14:45:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjJh7005608 for ; Tue, 24 Aug 2021 10:45:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1CCA61ABD7; Tue, 24 Aug 2021 14:45:19 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74A4417D4E for ; Tue, 24 Aug 2021 14:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816330; 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=+RKO1nh+jEQuF8qPuzFyWbKNuGIdrbCn3wIinr85vkU=; b=D0wsSQbsuqdKD4MTw1GxBfFaWHKzlx4BOBZ9xmYyqKt0CrW3/l/vzcFOAHbwztpyFfhoZ0 9ko2Fe++c/1RdX0r2k0lMzp4LIFXVZ8boL8TqEaCqIPLy3shRq3I2Vh2vSnZikU0JWRlH+ bQnuMMVeSqeeOCmyCVQ8Hg2sbO7zs9I= X-MC-Unique: sMQED9QCPkiPyRNaxmID7w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/22] qemu: Reject 'rename-restart' action for 'on_reboot'/'on_poweroff'/'on_crash' Date: Tue, 24 Aug 2021 16:44:26 +0200 Message-Id: <04b0435a786a21a70f50e28249216b7eb06e31bf.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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: 1629816332586100001 Content-Type: text/plain; charset="utf-8" The qemu driver didn't ever implement any meaningful handling for the 'rename-restart' action. At this point the following handling would take place: 'on_reboot' set to 'rename-restart' is ignored on guest-initiated reboots, the guest simply reboots. For on_poweroff set to 'rename-restart' the following happens: guest initiated shutdown -> 'destroy' libvirt initiated shutdown -> 'reboot' In addition when 'on_reboot' is 'destroy' in addition to 'on_poweroff' being 'rename-restart' the guest is able to execute instructions after issuing a reset before libvirt terminates it. This will be addressed separately later. Forbid the flag in the qemu def validator and update the documentation to be factual. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 6 +++--- src/qemu/qemu_validate.c | 32 ++++++++++++++++++++++++++++++++ src/qemu/qemu_validate.h | 5 +++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 512e6abd27..fba4765e35 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1743,12 +1743,12 @@ Each of these states allow for the same four possib= le actions. ``preserve`` The domain will be terminated and its resource preserved to allow analy= sis. ``rename-restart`` - The domain will be terminated and then restarted with a new name. + The domain will be terminated and then restarted with a new name. (Only + supported by the libxl hypervisor driver.) QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the ``destroy`` and ``restart`` actions. The ``preserve`` action for an -``on_reboot`` event is treated as a ``destroy`` and the ``rename-restart`` -action for an ``on_poweroff`` event is treated as a ``restart`` event. +``on_reboot`` event is treated as a ``destroy``. The ``on_crash`` event supports these additional actions :since:`since 0.8= .4` . diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index e5c4e3af26..7bd8d8d9e7 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1063,6 +1063,35 @@ qemuValidateDomainDeviceInfo(virDomainDef *def G_GNU= C_UNUSED, return 0; } + +int +qemuValidateLifecycleAction(virDomainLifecycleAction onPoweroff, + virDomainLifecycleAction onReboot, + virDomainLifecycleAction onCrash) +{ + /* The qemu driver doesn't yet implement any meaningful handling for + * VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME */ + if (onPoweroff =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME || + onReboot =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME || + onCrash =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("qemu driver doesn't support the 'rename-restart'= action for 'on_reboot'/'on_poweroff'/'on_crash'")); + return -1; + } + + return 0; +} + + +static int +qemuValidateDomainLifecycleAction(const virDomainDef *def) +{ + return qemuValidateLifecycleAction(def->onPoweroff, + def->onReboot, + def->onCrash); +} + + int qemuValidateDomainDef(const virDomainDef *def, void *opaque, @@ -1157,6 +1186,9 @@ qemuValidateDomainDef(const virDomainDef *def, } } + if (qemuValidateDomainLifecycleAction(def) < 0) + return -1; + if (qemuValidateDomainDefCpu(driver, def, qemuCaps) < 0) return -1; diff --git a/src/qemu/qemu_validate.h b/src/qemu/qemu_validate.h index 19629ac3af..1e0546633c 100644 --- a/src/qemu/qemu_validate.h +++ b/src/qemu/qemu_validate.h @@ -38,3 +38,8 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, const virDomainDef *def, void *opaque, void *parseOpaque); + +int +qemuValidateLifecycleAction(virDomainLifecycleAction onPoweroff, + virDomainLifecycleAction onReboot, + virDomainLifecycleAction onCrash); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816486; cv=none; d=zohomail.com; s=zohoarc; b=K1g6OQRRZD+cLD9V1Nf+KZS0IHvSWVuO4E1QTTK+gKH3F2763xQlDSelylwbAAF+4Wb33PI8lCBnIFrVBMkU1y3YOzVAyT/fzapXMmocZ6FXuybeApAH59pMfU5NjHL3785jGumW1w8PpCMlSPofmT7CCcVtfvgV/4M620XQw9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816486; 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=R+XDMatuqi8W81QnPw2+VlSAna3NX8T453Fhl0iaqLs=; b=gNRHcMv0cWTTT4xAUGBocZKGCkjYoceFSbgek48bSdi09Dj+smMHuEiTxH3hLKv0I/ji/DPZ3dg93imQeKbMUG92eNYVjV8pnyIT7SWeaudPQBSNocJEd+kTycnPZ/mfu1lxsdtMZW9R38hwM4K0hxX0RcFa2nKfWhj1+QaRJWM= 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 1629816486728397.65306889983594; Tue, 24 Aug 2021 07:48:06 -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-259-aiTacyc7M1eMt6yKQIyYxg-1; Tue, 24 Aug 2021 10:45:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0FF45229; Tue, 24 Aug 2021 14:45:23 +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 AE8D227C5F; Tue, 24 Aug 2021 14:45:23 +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 5A8F9181A2A7; Tue, 24 Aug 2021 14:45:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjKak005630 for ; Tue, 24 Aug 2021 10:45:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 39E591ABD7; Tue, 24 Aug 2021 14:45:20 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81FD017D4E for ; Tue, 24 Aug 2021 14:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816485; 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=R+XDMatuqi8W81QnPw2+VlSAna3NX8T453Fhl0iaqLs=; b=Jw0250kpVLiH91qAqJYtibbE23r1Nw0qzWYkwmsPlbzLa/TpJzdBljNsm/MkGvB2IhEyq0 Z78z3JVED1VTRaSQn2CprDMW2Y5KnsBZKYNSYG/vZlaI1SMczd6nBJiflk9dBKyENTCItk faE5a4hVtBa+BS7jXtzs+e8zWGKQcEE= X-MC-Unique: aiTacyc7M1eMt6yKQIyYxg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/22] qemu: driver: Validate lifecycle actions in 'qemuDomainSetLifecycleAction' Date: Tue, 24 Aug 2021 16:44:27 +0200 Message-Id: <828efe54a646cc5a608ccc279500bf1c737ace5b.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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: 1629816488724100003 Content-Type: text/plain; charset="utf-8" Some actions are not supported by qemu. Use the recently added 'qemuValidateLifecycleAction' helper to ensure that the API does the same validation as we do on startup in the validation callbacks. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 39347f84c7..0472f54a37 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -53,6 +53,7 @@ #include "qemu_namespace.h" #include "qemu_saveimage.h" #include "qemu_snapshot.h" +#include "qemu_validate.h" #include "virerror.h" #include "virlog.h" @@ -19577,6 +19578,36 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, } +static int +qemuDomainSetLifecycleActionValidate(virDomainDef *def, + virDomainLifecycle type, + virDomainLifecycleAction action) +{ + virDomainLifecycleAction onPoweroff =3D def->onPoweroff; + virDomainLifecycleAction onReboot =3D def->onReboot; + virDomainLifecycleAction onCrash =3D def->onCrash; + + switch (type) { + case VIR_DOMAIN_LIFECYCLE_POWEROFF: + onPoweroff =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_REBOOT: + onReboot =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_CRASH: + onCrash =3D action; + break; + case VIR_DOMAIN_LIFECYCLE_LAST: + break; + } + + if (qemuValidateLifecycleAction(onPoweroff, onReboot, onCrash) < 0) + return -1; + + return 0; +} + + static void qemuDomainModifyLifecycleAction(virDomainDef *def, virDomainLifecycle type, @@ -19635,6 +19666,10 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) goto endjob; + if ((def && qemuDomainSetLifecycleActionValidate(def, type, action) < = 0) || + (persistentDef && qemuDomainSetLifecycleActionValidate(persistent= Def, type, action) < 0)) + goto endjob; + if (def) { if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816336; cv=none; d=zohomail.com; s=zohoarc; b=Q20QfsagZzbk1nAisvMTfd4RIzeAlNCfeWlNHIfF/JcgewZUvqu8RfuJkpzrU0Vojn5GGKdXAa7ejEILmdoV2Xh+IDBg4RdYFTXOppITpLllVmmm+Tcn5nQyO9KQLc4WyVgd+rpyR1SR+yP8sr3Hhqfw79VoOwqXIDHqoQH5Zk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816336; 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=oTtnI7rktKXaFGSIMZLGDOq+5Gg1DsBXMGtPOWQfHdg=; b=JIwSyW/qUVwKisE5sJ+R0AyHAz+/1mYJpRZY5tJdKDxcMXfD+rxBdcyJArP9qYZ0sl44nFfuQku5g01w5MT7jOZdosNtbL28KQlcmc+YCTYVRxuCiFozVMLhrFaYpU561BQO4D761a/UAFDGfC2yjuT/Dzs9h0OHTamnaeBScdo= 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 1629816336405267.3568474253533; Tue, 24 Aug 2021 07:45:36 -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-562-pGhTCzguOVSuePkCIMpqDA-1; Tue, 24 Aug 2021 10:45:33 -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 8052B8015C7; Tue, 24 Aug 2021 14:45:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 578991BCF0; Tue, 24 Aug 2021 14:45:27 +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 25E004A708; Tue, 24 Aug 2021 14:45:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjQXw005648 for ; Tue, 24 Aug 2021 10:45:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id A91121ABDF; Tue, 24 Aug 2021 14:45:26 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CB2A6A900 for ; Tue, 24 Aug 2021 14:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816335; 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=oTtnI7rktKXaFGSIMZLGDOq+5Gg1DsBXMGtPOWQfHdg=; b=bFcnk1kSNyJOP2eWA5DbzejYIGYXYGX50NfvnHpet8HAKa5bxOKlShxOt7xFNpfDoSKNlH RD91AnihYv5mQLN4o3amMvqwpxDbcYiemNsHiftldkhxQuUflaXbMkJB0hpU/+jUaoI6gN 3A3T9nm4JHS+nKnXBS+phxI01ObKua8= X-MC-Unique: pGhTCzguOVSuePkCIMpqDA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/22] qemu: Reject 'preserve' action for 'on_reboot'/'on_poweroff'/'on_crash' Date: Tue, 24 Aug 2021 16:44:28 +0200 Message-Id: <3acede348de5a54d2f2e9c567887265682d23a44.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816337171100001 Content-Type: text/plain; charset="utf-8" The qemu driver didn't ever implement any meaningful handling for the 'preserve' action. Forbid the flag in the qemu def validator and update the documentation to be factual. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 3 +-- src/qemu/qemu_validate.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index fba4765e35..a894a51c00 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1747,8 +1747,7 @@ Each of these states allow for the same four possible= actions. supported by the libxl hypervisor driver.) QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the -``destroy`` and ``restart`` actions. The ``preserve`` action for an -``on_reboot`` event is treated as a ``destroy``. +``destroy`` and ``restart`` actions. The ``on_crash`` event supports these additional actions :since:`since 0.8= .4` . diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 7bd8d8d9e7..d27c3b6c6c 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1079,6 +1079,16 @@ qemuValidateLifecycleAction(virDomainLifecycleAction= onPoweroff, return -1; } + /* The qemu driver doesn't yet implement any meaningful handling for + * VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE */ + if (onPoweroff =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE || + onReboot =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE || + onCrash =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("qemu driver doesn't support the 'preserve' actio= n for 'on_reboot'/'on_poweroff'/'on_crash'")); + return -1; + } + return 0; } --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816338; cv=none; d=zohomail.com; s=zohoarc; b=EZx5inw/wEo6BL5FXyRo7cxmZM0OCnQlNP2GhMh3L/Rqngoq4gHoqLg0JQylHS7aEe6JsjIATi9US/tnT6wXpCM85dst85Dc0H6sLmsnLKhsxnR1Lr6IYMUkNG7QdV1o8tTxl/Meaej24RYoF3l5iFVlf69DtXKmTfHuTj+osOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816338; 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=O+/uYdH8o50KncDo1PiEYG6pGzRKABiV5NagLvqY4mY=; b=NAwB4tJqIPBfeD1Z7L8U4/WbZeDHD5i1kIjsm/YwrCrigIBlTPqIelawT0RX9UzrVtuJumldaYcAs02DaUDUbVytp6jSahIHkbjwNh5z0/j1MjzpBmQAyNRRyoE/qn71hwkdMTrjDZO4Pmc8F2PxxzoM5kPYzrjpvJzb0Jbgp4U= 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 1629816338069703.9612594982902; Tue, 24 Aug 2021 07:45:38 -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-102-KHx3Ea8aMaSgahnVamVAMQ-1; Tue, 24 Aug 2021 10:45:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07789838E82; Tue, 24 Aug 2021 14:45:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D08CF1036D27; Tue, 24 Aug 2021 14:45:29 +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 732CF4A70C; Tue, 24 Aug 2021 14:45:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjREk005656 for ; Tue, 24 Aug 2021 10:45:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id B959E1ABD7; Tue, 24 Aug 2021 14:45:27 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17D4E17D4E for ; Tue, 24 Aug 2021 14:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816337; 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=O+/uYdH8o50KncDo1PiEYG6pGzRKABiV5NagLvqY4mY=; b=PSC5uh613daDBrOCdHiaAawHP4eNzcU5MWMeqHvd87BJuiYDYxjivuCGNQJkVteSyRpbtE vq3x272b8+95AWMY/FxVDL35EYGF2aTZegy/1vujhpzZTKUzNCsOK9f9YqqaZllfyc6XyS AiSFyPcsDU3Lipq6g3t5bkzupTvy9P4= X-MC-Unique: KHx3Ea8aMaSgahnVamVAMQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/22] qemu: Honor 'restart' action for 'on_poweroff' Date: Tue, 24 Aug 2021 16:44:29 +0200 Message-Id: <1c2b7c4e6395a528e3b3f8a7091efb8c30d20a5a.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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: 1629816339398100001 Content-Type: text/plain; charset="utf-8" We simply terminate qemu instead of issuing a reset as the semantics of the setting dictate. Fix it by handling it identically to 'fake reboot'. We need to forbid the combination of 'onReboot' -> 'destroy' and 'onPoweroff' -> reboot though as the handling would be hairy and it honetly makes no sense. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 3 ++- src/qemu/qemu_process.c | 6 ++++-- src/qemu/qemu_validate.c | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index a894a51c00..1f3136b3f2 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1747,7 +1747,8 @@ Each of these states allow for the same four possible= actions. supported by the libxl hypervisor driver.) QEMU/KVM supports the ``on_poweroff`` and ``on_reboot`` events handling the -``destroy`` and ``restart`` actions. +``destroy`` and ``restart`` actions, but the combiatnion of ``on_poweroff`= ` set +to ``restart`` and ``on_reboot`` set to ``destroy`` is forbidden. The ``on_crash`` event supports these additional actions :since:`since 0.8= .4` . diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 77da9992f4..5958a48182 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -543,7 +543,8 @@ qemuProcessShutdownOrReboot(virQEMUDriver *driver, { qemuDomainObjPrivate *priv =3D vm->privateData; - if (priv->fakeReboot) { + if (priv->fakeReboot || + vm->def->onPoweroff =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) { g_autofree char *name =3D g_strdup_printf("reboot-%s", vm->def->na= me); virThread th; @@ -619,7 +620,8 @@ qemuProcessHandleShutdown(qemuMonitor *mon G_GNUC_UNUSE= D, /* In case of fake reboot qemu shutdown state is transient so don't * change domain state nor send events. */ - if (!priv->fakeReboot) { + if (!priv->fakeReboot || + vm->def->onPoweroff !=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART) { VIR_DEBUG("Transitioned guest %s to shutdown state", vm->def->name); virDomainObjSetState(vm, diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index d27c3b6c6c..8906aa52d9 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1089,6 +1089,15 @@ qemuValidateLifecycleAction(virDomainLifecycleAction= onPoweroff, return -1; } + /* the qemu driver can't meaningfully handle + * onPoweroff -> reboot + onReboot -> destroy */ + if (onPoweroff =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART && + onReboot =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("qemu driver doesn't support 'onReboot' set to 'd= estroy and 'onPoweroff' set to 'reboot'")); + return -1; + } + return 0; } --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816340; cv=none; d=zohomail.com; s=zohoarc; b=bYL67GPp5uCBzVORIT8abIxg6v4cJQsGvd5yDWMl5Plqj8/96TQYGQVB+feFwNvKsEEVzSNr/dTgpO2ttSbFQ/uqO9DxKUdnx2gNNXbAAVlgmqgbWLP9ezrxAfjArNgY8e7UHU03NaJjcC+BKfn1vfM1ELoxUboaimvxMGRX1CU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816340; 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=2Y1YLZOGUK9KExVvFxklnr1wCBK77c00JxGg89t8DDw=; b=SGsVj4wYOfjAzvAJalFxPGSU0dw8mK9t3X+2PhUV1afPvS8mORvKm0Sp6GQyEshrLspVRg/V7ARAmKiSi4nVKvd5yCbqXXN5lquHP3IDzwrxc08aT6Rm73aCDG9I2EMMMCFOFyoy3doQOqsQP2Qa7qGRH7awDss0kQOuduLnxm4= 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 1629816340858488.2419262408016; Tue, 24 Aug 2021 07:45:40 -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-61-D42-hvJgPtedvfidC6XVAw-1; Tue, 24 Aug 2021 10:45:37 -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 F00301F67D; Tue, 24 Aug 2021 14:45:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C67CA1BCF0; Tue, 24 Aug 2021 14:45:30 +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 8C1A94A70F; Tue, 24 Aug 2021 14:45:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjSnu005664 for ; Tue, 24 Aug 2021 10:45:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id CEA9E1ABD7; Tue, 24 Aug 2021 14:45:28 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3227F6A8FE for ; Tue, 24 Aug 2021 14:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816339; 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=2Y1YLZOGUK9KExVvFxklnr1wCBK77c00JxGg89t8DDw=; b=R3DBM2/dQ0QzhFu0c/oNt9zQzW7hTc/1JvtmndrZdy7qBq2De6VTtIxexU4yTJIuGOkrad D6tTL9xFyCi+F3q30PjjKRTB0Oe35AkvN7UxVYsDOA4fjdo8SEXHJ7AzAW/NAr8CY0H7x6 /F41jMv1TojAr5mViA1gVRa/0pTfaHM= X-MC-Unique: D42-hvJgPtedvfidC6XVAw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/22] qemu: capablities: Detect presence of 'set-action' as QEMU_CAPS_SET_ACTION Date: Tue, 24 Aug 2021 16:44:30 +0200 Message-Id: <7413f44ad0a21d90606506ed235d1cd61bac2a9e.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816341356100003 Content-Type: text/plain; charset="utf-8" The 'set-action' QMP command allows modifying the behaviour when the guest resets. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + 6 files changed, 7 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 286d34ae54..70c3ec2f0c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -637,6 +637,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "confidential-guest-support", /* QEMU_CAPS_MACHINE_CONFIDENT= AL_GUEST_SUPPORT */ "query-display-options", /* QEMU_CAPS_QUERY_DISPLAY_OPTIONS = */ "s390-pv-guest", /* QEMU_CAPS_S390_PV_GUEST */ + "set-action", /* QEMU_CAPS_SET_ACTION */ ); @@ -1180,6 +1181,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = =3D { { "query-display-options", QEMU_CAPS_QUERY_DISPLAY_OPTIONS }, { "blockdev-reopen", QEMU_CAPS_BLOCKDEV_REOPEN }, { "set-numa-node", QEMU_CAPS_NUMA }, + { "set-action", QEMU_CAPS_SET_ACTION }, }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 17fe91dae9..bc762d1916 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -617,6 +617,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-= guest-support */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp comman= d present */ QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ + QEMU_CAPS_SET_ACTION, /* 'set-action' QMP command */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.0.0.aarch64.xml index c65884deca..dcc41ed067 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml @@ -210,6 +210,7 @@ + 6000000 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_6.0.0.s390x.xml index 7124e5194a..ebcca6e114 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml @@ -164,6 +164,7 @@ + 6000000 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0.x86_64.xml index 7e06d93c0f..4951644354 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -254,6 +254,7 @@ + 6000000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.1.0.x86_64.xml index 1fad52ba90..1ba344ea1c 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml @@ -256,6 +256,7 @@ + 6000090 0 43100243 --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816340; cv=none; d=zohomail.com; s=zohoarc; b=KUbiphRGqZru5G5nQKnbdcJFKmrVWdxSvEhIQi46EA/JSiFfQP5BSzd9TewyOtz6NqNNotyvUpXQCnTxLsD/W0DwxSkd6nDoBp4GntJsm7lrIblVS6Rvd4G79hsUnzBHVTHn9Txl+Z5erUp9kocp0W8UUbco28hFAAhds82YP5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816340; 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=ssaqTO+bfKi9IItJqTOJa1v5LoqzJkOxDUnHdTM5/Xc=; b=dB3Sbg3HQYUn9gWOh1x9K5sKN6UFvWBS9m/wA9pO2B9G+4+KIRSYakMMlLOwFtDV3IozE3VzE9hTx7MhkEdxjIE5FrlAqmooTwsHOEfKHMs0HGqQq5JH99IY1hLFT0bsfHxGmUDzK2cTybGyJTlbDWNVg2IRpA7gMVXXnAVXqmw= 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 1629816340808616.3146578996591; Tue, 24 Aug 2021 07:45:40 -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-307-Sc2GsLhvMnmFQr7nOISTQg-1; Tue, 24 Aug 2021 10:45:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8EE6087D563; Tue, 24 Aug 2021 14:45:32 +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 6F41E60C0F; Tue, 24 Aug 2021 14:45:32 +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 3BBC9181A2AA; Tue, 24 Aug 2021 14:45:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjTsx005683 for ; Tue, 24 Aug 2021 10:45:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id E5BE61ABD7; Tue, 24 Aug 2021 14:45:29 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 427DB17D4E for ; Tue, 24 Aug 2021 14:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816339; 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=ssaqTO+bfKi9IItJqTOJa1v5LoqzJkOxDUnHdTM5/Xc=; b=b29kJYauj+EPj0npNpB54MHfYrAo8ncj2uarQnCYCbw2qGRdwdp+Mu0Inddqg7ROmtW9hL +iNmGeI/jOiA/6sV+8RhCw9KPUEqwkHVw7qIgkef2IxiQKKuOExLlIhsd756g1ZucZFFm1 qIzq8mwvtS/9fr3XuOxATmxARmIwq+g= X-MC-Unique: Sc2GsLhvMnmFQr7nOISTQg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/22] qemu: monitor: Implement monitor code for 'set-action' command Date: Tue, 24 Aug 2021 16:44:31 +0200 Message-Id: <145ae9b53d815024c28ffd2e767cf862590e645f.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1629816341406100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 16 ++++++++ src/qemu/qemu_monitor.h | 49 ++++++++++++++++++++++ src/qemu/qemu_monitor_json.c | 79 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 7 ++++ tests/qemumonitorjsontest.c | 6 +++ 5 files changed, 157 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 14fb605e92..42846349c4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4609,3 +4609,19 @@ qemuMonitorQueryDirtyRate(qemuMonitor *mon, return qemuMonitorJSONQueryDirtyRate(mon, info); } + + +int +qemuMonitorSetAction(qemuMonitor *mon, + qemuMonitorActionShutdown shutdown, + qemuMonitorActionReboot reboot, + qemuMonitorActionWatchdog watchdog, + qemuMonitorActionPanic panic) +{ + VIR_DEBUG("shutdown=3D%u, reboot=3D%u, watchdog=3D%u panic=3D%u", + shutdown, reboot, watchdog, panic); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONSetAction(mon, shutdown, reboot, watchdog, panic= ); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 8af271dc96..2f08357c0c 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -101,6 +101,48 @@ struct _qemuMonitorRdmaGidStatus { }; +typedef enum { + QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, /* do not change the current settin= g */ + QEMU_MONITOR_ACTION_SHUTDOWN_POWEROFF, + QEMU_MONITOR_ACTION_SHUTDOWN_PAUSE, + + QEMU_MONITOR_ACTION_SHUTDOWN_LAST +} qemuMonitorActionShutdown; + + +typedef enum { + QEMU_MONITOR_ACTION_REBOOT_KEEP, /* do not change the current setting = */ + QEMU_MONITOR_ACTION_REBOOT_RESET, + QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN, + + QEMU_MONITOR_ACTION_REBOOT_LAST +} qemuMonitorActionReboot; + + +typedef enum { + QEMU_MONITOR_ACTION_WATCHDOG_KEEP, /* do not change the current settin= g */ + QEMU_MONITOR_ACTION_WATCHDOG_RESET, + QEMU_MONITOR_ACTION_WATCHDOG_SHUTDOWN, + QEMU_MONITOR_ACTION_WATCHDOG_POWEROFF, + QEMU_MONITOR_ACTION_WATCHDOG_PAUSE, + QEMU_MONITOR_ACTION_WATCHDOG_DEBUG, + QEMU_MONITOR_ACTION_WATCHDOG_NONE, + QEMU_MONITOR_ACTION_WATCHDOG_INJECT_NMI, + + QEMU_MONITOR_ACTION_WATCHDOG_LAST +} qemuMonitorActionWatchdog; + + +typedef enum { + QEMU_MONITOR_ACTION_PANIC_KEEP, /* do not change the current setting */ + QEMU_MONITOR_ACTION_PANIC_PAUSE, + QEMU_MONITOR_ACTION_PANIC_SHUTDOWN, + QEMU_MONITOR_ACTION_PANIC_NONE, + + QEMU_MONITOR_ACTION_PANIC_LAST +} qemuMonitorActionPanic; + + typedef enum { QEMU_MONITOR_JOB_TYPE_UNKNOWN, /* internal value, not exposed by qemu = */ QEMU_MONITOR_JOB_TYPE_COMMIT, @@ -1488,3 +1530,10 @@ struct _qemuMonitorDirtyRateInfo { int qemuMonitorQueryDirtyRate(qemuMonitor *mon, qemuMonitorDirtyRateInfo *info); + +int +qemuMonitorSetAction(qemuMonitor *mon, + qemuMonitorActionShutdown shutdown, + qemuMonitorActionReboot reboot, + qemuMonitorActionWatchdog watchdog, + qemuMonitorActionPanic panic); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8fb2bf4dc3..8d3c4031a6 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9325,3 +9325,82 @@ qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon, return qemuMonitorJSONExtractDirtyRateInfo(data, info); } + + +VIR_ENUM_DECL(qemuMonitorActionShutdown); +VIR_ENUM_IMPL(qemuMonitorActionShutdown, + QEMU_MONITOR_ACTION_SHUTDOWN_LAST, + "", + "poweroff", + "pause"); + +VIR_ENUM_DECL(qemuMonitorActionReboot); +VIR_ENUM_IMPL(qemuMonitorActionReboot, + QEMU_MONITOR_ACTION_REBOOT_LAST, + "", + "reset", + "shutdown"); + +VIR_ENUM_DECL(qemuMonitorActionWatchdog); +VIR_ENUM_IMPL(qemuMonitorActionWatchdog, + QEMU_MONITOR_ACTION_WATCHDOG_LAST, + "", + "reset", + "shutdown", + "poweroff", + "pause", + "debug", + "none", + "inject-nmi"); + +VIR_ENUM_DECL(qemuMonitorActionPanic); +VIR_ENUM_IMPL(qemuMonitorActionPanic, + QEMU_MONITOR_ACTION_PANIC_LAST, + "", + "pause", + "shutdown", + "none"); + + +int +qemuMonitorJSONSetAction(qemuMonitor *mon, + qemuMonitorActionShutdown shutdown, + qemuMonitorActionReboot reboot, + qemuMonitorActionWatchdog watchdog, + qemuMonitorActionPanic panic) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + const char *actionShutdown =3D NULL; + const char *actionReboot =3D NULL; + const char *actionWatchdog =3D NULL; + const char *actionPanic =3D NULL; + + if (shutdown !=3D QEMU_MONITOR_ACTION_SHUTDOWN_KEEP) + actionShutdown =3D qemuMonitorActionShutdownTypeToString(shutdown); + + if (reboot !=3D QEMU_MONITOR_ACTION_REBOOT_KEEP) + actionReboot =3D qemuMonitorActionRebootTypeToString(reboot); + + if (watchdog !=3D QEMU_MONITOR_ACTION_WATCHDOG_KEEP) + actionWatchdog =3D qemuMonitorActionWatchdogTypeToString(watchdog); + + if (panic !=3D QEMU_MONITOR_ACTION_PANIC_KEEP) + actionPanic =3D qemuMonitorActionPanicTypeToString(panic); + + if (!(cmd =3D qemuMonitorJSONMakeCommand("set-action", + "S:shutdown", actionShutdown, + "S:reboot", actionReboot, + "S:watchdog", actionWatchdog, + "S:panic", actionPanic, + NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + return -1; + + return 0; +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index fbeab2bf6d..c8cf734a1c 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -703,3 +703,10 @@ qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon, int qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon, qemuMonitorDirtyRateInfo *info); + +int +qemuMonitorJSONSetAction(qemuMonitor *mon, + qemuMonitorActionShutdown shutdown, + qemuMonitorActionReboot reboot, + qemuMonitorActionWatchdog watchdog, + qemuMonitorActionPanic panic); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 6d7ecb0ab1..9ec5f06981 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1204,6 +1204,11 @@ GEN_TEST_FUNC(qemuMonitorJSONBitmapRemove, "foodev",= "newnode") GEN_TEST_FUNC(qemuMonitorJSONJobDismiss, "jobname") GEN_TEST_FUNC(qemuMonitorJSONJobComplete, "jobname") GEN_TEST_FUNC(qemuMonitorJSONBlockJobCancel, "jobname", true) +GEN_TEST_FUNC(qemuMonitorJSONSetAction, + QEMU_MONITOR_ACTION_SHUTDOWN_PAUSE, + QEMU_MONITOR_ACTION_REBOOT_RESET, + QEMU_MONITOR_ACTION_WATCHDOG_SHUTDOWN, + QEMU_MONITOR_ACTION_PANIC_SHUTDOWN) static int testQemuMonitorJSONqemuMonitorJSONNBDServerStart(const void *opaque) @@ -3067,6 +3072,7 @@ mymain(void) DO_TEST_GEN(qemuMonitorJSONJobDismiss); DO_TEST_GEN(qemuMonitorJSONJobComplete); DO_TEST_GEN(qemuMonitorJSONBlockJobCancel); + DO_TEST_GEN(qemuMonitorJSONSetAction); DO_TEST(qemuMonitorJSONGetBalloonInfo); DO_TEST(qemuMonitorJSONGetBlockInfo); DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816367; cv=none; d=zohomail.com; s=zohoarc; b=EvctwLaRWL4NU6BfCxS78iZChVuILdqGfcgjEr57Lghs9FzqVx0qs0wrqQuhA+hHR6PYjhtUg4O68Nmoesvj1y4ENrc3L0Sd/v+xl3JMRaQZgsrKj2HVwXAkER8PeQIrfoktWDDrgbU6udKNc492ai+tGbMNTDinsKlcs6z6qCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816367; 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=8jREBVhwyI74VYof32d3Sbm7+yhhtzT1AcJ3BQ06J+w=; b=i0ZgJ2W/S3Gw59Olhgz6vrJnJEPWmpVFSgjbBWzeITZIGf4EzHorRS1YLdvgqvP8A869oD40HZUE35gSoHf5LhAt78Wncyew2Tm+HmFe8y6wkYaM4o0W9M0Og4AfsR0v235vj7u4kCaL7BJZ/dymR84KxwKMlqoztmXFw95BCkw= 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 1629816367394816.0590991743568; Tue, 24 Aug 2021 07:46:07 -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-292-dO6ev4BgPMeOYxX7yC1egg-1; Tue, 24 Aug 2021 10:45:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B34F8100F784; Tue, 24 Aug 2021 14:45:33 +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 8844390BA; Tue, 24 Aug 2021 14:45:33 +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 3219F181A2AD; Tue, 24 Aug 2021 14:45:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjVbo005709 for ; Tue, 24 Aug 2021 10:45:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1CA4D17D4E; Tue, 24 Aug 2021 14:45:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AFE71ABD7 for ; Tue, 24 Aug 2021 14:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816366; 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=8jREBVhwyI74VYof32d3Sbm7+yhhtzT1AcJ3BQ06J+w=; b=fTz1n9LQURwJ7+slsKfhVRvA1jF8eXwR65p2GaDLiFVhQszLTIcaOY8RNQRMADjExOg8wW LS8iGoDdgwdQ9GeyWEke1NDPh89V8zQdlsMJ5N8gkMLY8W3oFu75gmK81Fw8Bm/g4YnJbt lnBZYBawJ11+K/T6hNRWitWnS+fxCJY= X-MC-Unique: dO6ev4BgPMeOYxX7yC1egg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/22] qemuDomainAttachWatchdog: Use 'set-action' instead of 'watchdog-set-action' if supported Date: Tue, 24 Aug 2021 16:44:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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: 1629816369459100003 Content-Type: text/plain; charset="utf-8" If current qemu supports 'set-action' use it instead of the single-use command. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 54 +++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c3c49fe080..64580b573b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3117,8 +3117,6 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver, int ret =3D -1; qemuDomainObjPrivate *priv =3D vm->privateData; virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_WATCHDOG, { .watchdog = =3D watchdog } }; - virDomainWatchdogAction actualAction =3D watchdog->action; - const char *actionStr =3D NULL; g_autofree char *watchdogstr =3D NULL; bool releaseAddress =3D false; int rv; @@ -3146,17 +3144,59 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver, if (!(watchdogstr =3D qemuBuildWatchdogDevStr(vm->def, watchdog, priv-= >qemuCaps))) goto cleanup; + qemuDomainObjEnterMonitor(driver, vm); + /* QEMU doesn't have a 'dump' action; we tell qemu to 'pause', then libvirt listens for the watchdog event, and we perform the dump ourselves. so convert 'dump' to 'pause' for the qemu cli */ - if (actualAction =3D=3D VIR_DOMAIN_WATCHDOG_ACTION_DUMP) - actualAction =3D VIR_DOMAIN_WATCHDOG_ACTION_PAUSE; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { + qemuMonitorActionWatchdog watchdogaction =3D QEMU_MONITOR_ACTION_W= ATCHDOG_KEEP; - actionStr =3D virDomainWatchdogActionTypeToString(actualAction); + switch (watchdog->action) { + case VIR_DOMAIN_WATCHDOG_ACTION_RESET: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_RESET; + break; - qemuDomainObjEnterMonitor(driver, vm); + case VIR_DOMAIN_WATCHDOG_ACTION_SHUTDOWN: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_SHUTDOWN; + break; + + case VIR_DOMAIN_WATCHDOG_ACTION_POWEROFF: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_POWEROFF; + break; + + case VIR_DOMAIN_WATCHDOG_ACTION_PAUSE: + case VIR_DOMAIN_WATCHDOG_ACTION_DUMP: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_PAUSE; + break; + + case VIR_DOMAIN_WATCHDOG_ACTION_NONE: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_NONE; + break; + + case VIR_DOMAIN_WATCHDOG_ACTION_INJECTNMI: + watchdogaction =3D QEMU_MONITOR_ACTION_WATCHDOG_INJECT_NMI; + break; + + case VIR_DOMAIN_WATCHDOG_ACTION_LAST: + default: + break; + }; + + rv =3D qemuMonitorSetAction(priv->mon, + QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, + QEMU_MONITOR_ACTION_REBOOT_KEEP, + watchdogaction, + QEMU_MONITOR_ACTION_PANIC_KEEP); + } else { + virDomainWatchdogAction actualAction =3D watchdog->action; - rv =3D qemuMonitorSetWatchdogAction(priv->mon, actionStr); + if (actualAction =3D=3D VIR_DOMAIN_WATCHDOG_ACTION_DUMP) + actualAction =3D VIR_DOMAIN_WATCHDOG_ACTION_PAUSE; + + rv =3D qemuMonitorSetWatchdogAction(priv->mon, + virDomainWatchdogActionTypeToStr= ing(actualAction)); + } if (rv >=3D 0) rv =3D qemuMonitorAddDevice(priv->mon, watchdogstr); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816344; cv=none; d=zohomail.com; s=zohoarc; b=Dbzj8gVv5UfjanQt4pA2lTtR877D3OYrekD/lCePwOis981Gzi8sqBh6h0Mwf13Dv41z/DG6Ea5yLZmq/TnDEF5ZIGkt10RUzoz+b+mrZ6R0quLXf3w0qzqM/t0nJ7dW7WcscAz04mOOljiHELCmqAqcxmnPsGWK2lKEsD1/x+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816344; 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=BJkYmZo4gsya5mfa/DZYSOPmV5ChLVrVV0XyL1+BCE0=; b=Ygh1GUxEY5gKA9GlFNFhDYLZlFp0ZQxB7cA0ZfIGdv2THBMDc6ZvzcMHtAgA490F/K6kzWvAYUe1yMMFTk2SnpXZwgUZFUpHpDkk8VU/QElFCC1dpdyzSnfgk0+fJe+G+k0HgJaOqlF1pGH3Q6AbK8EzVCQC2/wGiZzeo1nFvbM= 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 1629816344825829.3054727250069; Tue, 24 Aug 2021 07:45:44 -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-170-14wLxrgaNm-3A1RXxQqIMw-1; Tue, 24 Aug 2021 10:45:41 -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 8EC75838E70; Tue, 24 Aug 2021 14:45:35 +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 7261A226F0; Tue, 24 Aug 2021 14:45:35 +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 1064C181A3ED; Tue, 24 Aug 2021 14:45:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjWqL005720 for ; Tue, 24 Aug 2021 10:45:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 422871ABDF; Tue, 24 Aug 2021 14:45:32 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87AC917D4E for ; Tue, 24 Aug 2021 14:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816343; 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=BJkYmZo4gsya5mfa/DZYSOPmV5ChLVrVV0XyL1+BCE0=; b=DxzLNhdLbXbPQcMn/saO73ucra+0aeedPjhT8vHFPdebBWfL4ZuteaMC1aecBjlhp52jRN EW9WQ9lyeCg85OjhUNl0y7a6fbHeFYnufrW9nGtvKaXG8o1MIvhRRDYNmMtK827+iSOgKC tWdOTUBLP88K4kabD6qNn8DplLjDijE= X-MC-Unique: 14wLxrgaNm-3A1RXxQqIMw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/22] qemuxml2argvtest: Add 'LATEST' version of 'misc-no-reboot' test case Date: Tue, 24 Aug 2021 16:44:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816345996100001 Content-Type: text/plain; charset="utf-8" Upcoming patches will modify how '-no-reboot' is handled when qemu supports the 'set-action' QMP command. Add a test for it. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- .../misc-no-reboot.x86_64-latest.args | 35 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 2 files changed, 36 insertions(+) create mode 100644 tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args b/tes= ts/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args new file mode 100644 index 0000000000..197b6375a7 --- /dev/null +++ b/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dp= c.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-reboot \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ +-audiodev id=3Daudio1,driver=3Dnone \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 00a85988d6..95abc9d83b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1610,6 +1610,7 @@ mymain(void) DO_TEST("misc-enable-s4", QEMU_CAPS_PIIX_DISABLE_S4); DO_TEST_PARSE_ERROR_NOCAPS("misc-enable-s4"); DO_TEST_NOCAPS("misc-no-reboot"); + DO_TEST_CAPS_LATEST("misc-no-reboot"); DO_TEST_NOCAPS("misc-uuid"); DO_TEST_PARSE_ERROR_NOCAPS("vhost_queues-invalid"); DO_TEST("net-vhostuser", QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816368; cv=none; d=zohomail.com; s=zohoarc; b=YNqdNKy/MWudxJtvS/zCIKWA3nuubAC01fXTeTY6HFd88imuKugyd/q/Z1FCjo9q+naia1Q9nC9cyRKmYChkPSCQyKpcRYaRtkHMYN083ViqYpdVKS49rfhRLjBNeUIpIpBaXCiYq/e/+oJ1Gf3wfEKt+cUluRvZNefeJ3sDX3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816368; 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=9CGdl5MgXl46W3r0Fk+ZhmtNIZJ5lnJ0uC4/YIDCFlI=; b=VZIgslRqIV3kdJC7hGdgEmHmFUcIuwX4Ay+erBY1lxNmKDsdyPp+g6MwPn8wU3nUmoR/rWcxs08bZ0/s03pUzA0/3CYcZdIUlckqBoGP7rBwWj9a64ypCOBin938ajQIgLM7q1aq6MhiHNSucKheMXfJ/f9f/h/aKcm9oOnxIpA= 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 1629816368431494.4978001906412; Tue, 24 Aug 2021 07:46:08 -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-194-7jtorMpvOWq7YOA4PMVzgA-1; Tue, 24 Aug 2021 10:45:41 -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 DFC38838E6C; Tue, 24 Aug 2021 14:45:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 886746A056; Tue, 24 Aug 2021 14:45:35 +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 541C44A711; Tue, 24 Aug 2021 14:45:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjX6N005736 for ; Tue, 24 Aug 2021 10:45:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A5841ABD7; Tue, 24 Aug 2021 14:45:33 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD59917D4E for ; Tue, 24 Aug 2021 14:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816367; 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=9CGdl5MgXl46W3r0Fk+ZhmtNIZJ5lnJ0uC4/YIDCFlI=; b=fhCtExHfY2VjVeuksBSwxEAJmJ3J72J3Iye1CxhE4tP72mRot+kEkYqPyoDRzwpSB0nSLF OwZCXaCZTpYPRtWkKrpUEDGCOyXmyRqVjX4pJZDuGSTB8t2a37hW0u3uC44fIyFiBtglqG fT3mjU2XIw9AhQsg5N6BbzvHlVi4sqY= X-MC-Unique: 7jtorMpvOWq7YOA4PMVzgA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/22] qemuDomainObjPrivate: Annotate 'allowReboot' field Date: Tue, 24 Aug 2021 16:44:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816369628100005 Content-Type: text/plain; charset="utf-8" Save further readers the headache of determining what it actually does and note that it's not used with qemu version supporting the 'set-action' command. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index abc3c7158d..f3c6bb3390 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -154,6 +154,14 @@ struct _qemuDomainObjPrivate { bool fakeReboot; bool pausedShutdown; + /* allowReboot: + * + * Unused with new QEMU versions which have QEMU_CAPS_SET_ACTION. + * + * Otherwise if it's set to VIR_TRISTATE_BOOL_YES, QEMU was started wi= th + * -no-shutdown, and if set to VIR_TRISTATE_BOOL_NO qemu was started w= ith + * -no-reboot instead. + */ virTristateBool allowReboot; int jobs_queued; --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816433; cv=none; d=zohomail.com; s=zohoarc; b=U5UlmzaSeP/HzQlg6Nd90i7i6a5WERkAcGy/4FTHwO7Dk+JWX6wKbdp4LNtCcEq4klyBW/VrJiKTUzxWNfU27qMq/S9YwZoq8R/lsSjS40aJUhetb05XfZrWhVhuZEtEp4GNYn5bQF2SqHpFINyoafXAxBp7UuJgxDkdnKKtilY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816433; 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=tNpwzKuVA3glusiviJjqYyUroqc/nxB7kXyOrfrhpU8=; b=BeBSgNrX8twkWMedNs4ewwKYFcV2DNYifE91p9nao9p3OmZgPUkZiouK93SstS7X2t/5bp9jPT8AvDITTlD+5XVuMcaidD33PSC7ZhHttIQQDIEaRUCPgrIliDoUeNQQ2m8z8AMdOxISjLyge91XU0kkAjRGLxdQU5WBGd7xG8o= 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 1629816433735618.7676244508365; Tue, 24 Aug 2021 07:47:13 -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-485-ANyrLtxUP3SQxX6eYG-3ng-1; Tue, 24 Aug 2021 10:45:46 -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 F341D1008065; Tue, 24 Aug 2021 14:45:40 +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 C792360871; Tue, 24 Aug 2021 14:45:40 +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 8C6D5181A3F2; Tue, 24 Aug 2021 14:45:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjc63005830 for ; Tue, 24 Aug 2021 10:45:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFAB61ABDF; Tue, 24 Aug 2021 14:45:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46B2118432 for ; Tue, 24 Aug 2021 14:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816432; 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=tNpwzKuVA3glusiviJjqYyUroqc/nxB7kXyOrfrhpU8=; b=NYXg3qD0tlqHJZJRXUk3FgBjA6+UviDVaVtvErKIKZfrIOzjRxrBAL2KrVV5kKyYA4N4QT PiJm4xiwj6GjbGHWhXe9v5zRv75CrF0mjdjIPDC14zK3yW8jSGPuG0gZXWQFxL6AYpcSdO AGnf4KL6TUBSkIBQ6iELfMNQOoG3F1k= X-MC-Unique: ANyrLtxUP3SQxX6eYG-3ng-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/22] qemu: migration: Don't transfer 'allowReboot' flag Date: Tue, 24 Aug 2021 16:44:35 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816434238100003 Content-Type: text/plain; charset="utf-8" The original idea was to ensure that the destination has the same original state of the '-no-reboot' flag to ensure identical behaviour of the 'vidDomainModifyLifecycleAction' API. With newer qemu's we'll be able to modify the behaviour using the monitor so old daemons won't be able to keep up anyways. Remove this feature as it's not very useful and will be replaced by a proper solution. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 5 ----- src/qemu/qemu_migration_cookie.c | 22 ------------------- src/qemu/qemu_migration_cookie.h | 4 ---- .../basic-xml2xml-out.xml | 1 - .../full-xml2xml-out.xml | 1 - .../modern-dom-out-dest.xml | 1 - .../modern-dom-out-source.xml | 1 - .../nbd-bitmaps-xml2xml-out.xml | 1 - 8 files changed, 36 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b441d0226c..dd226ea4bc 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2415,8 +2415,6 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, if (priv->origCPU) cookieFlags |=3D QEMU_MIGRATION_COOKIE_CPU; - cookieFlags |=3D QEMU_MIGRATION_COOKIE_ALLOW_REBOOT; - if (!(flags & VIR_MIGRATE_OFFLINE)) cookieFlags |=3D QEMU_MIGRATION_COOKIE_CAPS; @@ -2876,7 +2874,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver, QEMU_MIGRATION_COOKIE_MEMORY_HOTP= LUG | QEMU_MIGRATION_COOKIE_CPU_HOTPLUG= | QEMU_MIGRATION_COOKIE_CPU | - QEMU_MIGRATION_COOKIE_ALLOW_REBOO= T | QEMU_MIGRATION_COOKIE_CAPS | QEMU_MIGRATION_COOKIE_BLOCK_DIRTY= _BITMAPS))) goto cleanup; @@ -2933,8 +2930,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver, goto stopjob; stopProcess =3D true; - priv->allowReboot =3D mig->allowReboot; - if (!(incoming =3D qemuMigrationDstPrepare(vm, tunnel, protocol, listenAddress, port, dataFD[0]))) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index b67728f9c0..c7b010f0a0 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -558,18 +558,6 @@ qemuMigrationCookieAddCPU(qemuMigrationCookie *mig, } -static void -qemuMigrationCookieAddAllowReboot(qemuMigrationCookie *mig, - virDomainObj *vm) -{ - qemuDomainObjPrivate *priv =3D vm->privateData; - - mig->allowReboot =3D priv->allowReboot; - - mig->flags |=3D QEMU_MIGRATION_COOKIE_ALLOW_REBOOT; -} - - static int qemuMigrationCookieAddCaps(qemuMigrationCookie *mig, virDomainObj *vm, @@ -901,9 +889,6 @@ qemuMigrationCookieXMLFormat(virQEMUDriver *driver, if (mig->flags & QEMU_MIGRATION_COOKIE_CPU && mig->cpu) virCPUDefFormatBufFull(buf, mig->cpu, NULL); - if (mig->flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT) - qemuDomainObjPrivateXMLFormatAllowReboot(buf, mig->allowReboot); - if (mig->flags & QEMU_MIGRATION_COOKIE_CAPS) qemuMigrationCookieCapsXMLFormat(buf, mig->caps); @@ -1407,10 +1392,6 @@ qemuMigrationCookieXMLParse(qemuMigrationCookie *mig, false) < 0) return -1; - if (flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT && - qemuDomainObjPrivateXMLParseAllowReboot(ctxt, &mig->allowReboot) <= 0) - return -1; - if (flags & QEMU_MIGRATION_COOKIE_CAPS && !(mig->caps =3D qemuMigrationCookieCapsXMLParse(ctxt))) return -1; @@ -1491,9 +1472,6 @@ qemuMigrationCookieFormat(qemuMigrationCookie *mig, qemuMigrationCookieAddCPU(mig, dom) < 0) return -1; - if (flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT) - qemuMigrationCookieAddAllowReboot(mig, dom); - if (flags & QEMU_MIGRATION_COOKIE_CAPS && qemuMigrationCookieAddCaps(mig, dom, party) < 0) return -1; diff --git a/src/qemu/qemu_migration_cookie.h b/src/qemu/qemu_migration_coo= kie.h index 6ac7b2084c..1726e5f2da 100644 --- a/src/qemu/qemu_migration_cookie.h +++ b/src/qemu/qemu_migration_cookie.h @@ -52,7 +52,6 @@ typedef enum { QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG =3D (1 << QEMU_MIGRATION_COOKIE_F= LAG_MEMORY_HOTPLUG), QEMU_MIGRATION_COOKIE_CPU_HOTPLUG =3D (1 << QEMU_MIGRATION_COOKIE_FLAG= _CPU_HOTPLUG), QEMU_MIGRATION_COOKIE_CPU =3D (1 << QEMU_MIGRATION_COOKIE_FLAG_CPU), - QEMU_MIGRATION_COOKIE_ALLOW_REBOOT =3D (1 << QEMU_MIGRATION_COOKIE_FLA= G_ALLOW_REBOOT), QEMU_MIGRATION_COOKIE_CAPS =3D (1 << QEMU_MIGRATION_COOKIE_FLAG_CAPS), QEMU_MIGRATION_COOKIE_BLOCK_DIRTY_BITMAPS =3D (1 << QEMU_MIGRATION_COO= KIE_FLAG_BLOCK_DIRTY_BITMAPS), } qemuMigrationCookieFeatures; @@ -168,9 +167,6 @@ struct _qemuMigrationCookie { /* If flags & QEMU_MIGRATION_COOKIE_CPU */ virCPUDef *cpu; - /* If flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT */ - virTristateBool allowReboot; - /* If flags & QEMU_MIGRATION_COOKIE_CAPS */ qemuMigrationCookieCaps *caps; diff --git a/tests/qemumigrationcookiexmldata/basic-xml2xml-out.xml b/tests= /qemumigrationcookiexmldata/basic-xml2xml-out.xml index 42b351047e..e05f3c3a83 100644 --- a/tests/qemumigrationcookiexmldata/basic-xml2xml-out.xml +++ b/tests/qemumigrationcookiexmldata/basic-xml2xml-out.xml @@ -3,7 +3,6 @@ dcf47dbd-46d1-4d5b-b442-262a806a333a hostname 4a802f00-4cba-5df6-9679-a08c4c5b577f - diff --git a/tests/qemumigrationcookiexmldata/full-xml2xml-out.xml b/tests/= qemumigrationcookiexmldata/full-xml2xml-out.xml index a07dd1f147..61fcaff13f 100644 --- a/tests/qemumigrationcookiexmldata/full-xml2xml-out.xml +++ b/tests/qemumigrationcookiexmldata/full-xml2xml-out.xml @@ -211,7 +211,6 @@ 14 - diff --git a/tests/qemumigrationcookiexmldata/modern-dom-out-dest.xml b/tes= ts/qemumigrationcookiexmldata/modern-dom-out-dest.xml index ba84c65a3d..246efc06aa 100644 --- a/tests/qemumigrationcookiexmldata/modern-dom-out-dest.xml +++ b/tests/qemumigrationcookiexmldata/modern-dom-out-dest.xml @@ -6,7 +6,6 @@ - diff --git a/tests/qemumigrationcookiexmldata/modern-dom-out-source.xml b/t= ests/qemumigrationcookiexmldata/modern-dom-out-source.xml index ba84c65a3d..246efc06aa 100644 --- a/tests/qemumigrationcookiexmldata/modern-dom-out-source.xml +++ b/tests/qemumigrationcookiexmldata/modern-dom-out-source.xml @@ -6,7 +6,6 @@ - diff --git a/tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-out.xml b= /tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-out.xml index 09b6fa291c..2bd6de42be 100644 --- a/tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-out.xml +++ b/tests/qemumigrationcookiexmldata/nbd-bitmaps-xml2xml-out.xml @@ -29,7 +29,6 @@ - --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816567; cv=none; d=zohomail.com; s=zohoarc; b=g1otmmKp3vicCVdBeHxUiFTlU4GWRl+HRNIJdoTbBQhkDznTjVXNtE8cRbfePEl+RMvpc9IA64Ywo4NtrrszvLf2kf8cdYi4eFof/Lko1lWBdDr32k+81JanLio9/vdnXP/NW25TBdaxHoE8MRGBhM0TXf8NKQY7wfm80maNL0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816567; 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=bZuaCCg1ItWcKVVBWfqbclqBYpV8ZDu9aCL0TOEjkRw=; b=gSSVJXd2J22RkR9KIixFpVqncnTU6PA3A1MaIk6Hexr3NMSM2N0HDdgjJG+DfYonHlzW9MXKGzXMlgVSL8gsxklzRT3oHfbsZd6ZvDs0ToGLGcVzp6hZri5VpMmWV+LS4rFyU7mIRufU7ibg6p0+BD199K37ShwgUlxF5ffRHjw= 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 1629816566933633.0892957069775; Tue, 24 Aug 2021 07:49: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-560-MddXi9P6NEy5E8zDwfw-ZA-1; Tue, 24 Aug 2021 10:45:47 -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 E7781809CD8; Tue, 24 Aug 2021 14:45:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE0AC60854; Tue, 24 Aug 2021 14:45:41 +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 9A7974A717; Tue, 24 Aug 2021 14:45:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEje7V005854 for ; Tue, 24 Aug 2021 10:45:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 182AA18432; Tue, 24 Aug 2021 14:45:40 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F5761ABDF for ; Tue, 24 Aug 2021 14:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816565; 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=bZuaCCg1ItWcKVVBWfqbclqBYpV8ZDu9aCL0TOEjkRw=; b=U6BdD6oSKwGeL49W+ShJrtvbloMrZeeS7u4Komr4ZSsXciC6NfON8+s/Qsgptc+o0U0dUp 8burtfYkPIiJHV0n/RWgFmtfO7FvqIIbuGQDBPU9zhjOsDpNkULebqKGolK1rhbYQ/I+FL z++dKs1Ej7tzwkc4cmNIN3hrHHdtJEA= X-MC-Unique: MddXi9P6NEy5E8zDwfw-ZA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/22] qemu: domain: Remove qemuDomainIsUsingNoShutdown Date: Tue, 24 Aug 2021 16:44:36 +0200 Message-Id: <988af6a0ae081b2e58b26252027174dd93ef9aa0.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816568924100001 Content-Type: text/plain; charset="utf-8" Directly use 'priv->allowReboot' as we now document what the behaiour is to avoid another lookup. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 4 +--- src/qemu/qemu_domain.c | 16 ---------------- src/qemu/qemu_domain.h | 3 --- src/qemu/qemu_process.c | 3 +-- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2756f46b51..5b743dd1ad 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6165,11 +6165,9 @@ qemuBuildPMCommandLine(virCommand *cmd, { virQEMUCaps *qemuCaps =3D priv->qemuCaps; - /* Only add -no-reboot option if each event destroys domain */ if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) virCommandAddArg(cmd, "-no-reboot"); - - if (qemuDomainIsUsingNoShutdown(priv)) + else virCommandAddArg(cmd, "-no-shutdown"); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9baa4b5d90..ce355d37a0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11149,22 +11149,6 @@ qemuDomainRunningReasonToResumeEvent(virDomainRunn= ingReason reason) } -/* qemuDomainIsUsingNoShutdown: - * @priv: Domain private data - * - * We can receive an event when QEMU stops. If we use no-shutdown, then - * we can watch for this event and do a soft/warm reboot. - * - * Returns: @true when -no-shutdown either should be or was added to the - * command line. - */ -bool -qemuDomainIsUsingNoShutdown(qemuDomainObjPrivate *priv) -{ - return priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_YES; -} - - bool qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *disk) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f3c6bb3390..cb1cd968d5 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1001,9 +1001,6 @@ void qemuDomainStorageIdReset(qemuDomainObjPrivate *p= riv); virDomainEventResumedDetailType qemuDomainRunningReasonToResumeEvent(virDomainRunningReason reason); -bool -qemuDomainIsUsingNoShutdown(qemuDomainObjPrivate *priv); - bool qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *disk); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5958a48182..c9cdff4e82 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8751,8 +8751,7 @@ qemuProcessReconnect(void *opaque) * domain crashed; otherwise, if the monitor was started, * then we can blame ourselves, else we failed before the * monitor started so we don't really know. */ - if (!priv->mon && tryMonReconn && - qemuDomainIsUsingNoShutdown(priv)) + if (!priv->mon && tryMonReconn && priv->allowReboot =3D=3D VIR_TRI= STATE_BOOL_YES) state =3D VIR_DOMAIN_SHUTOFF_CRASHED; else if (priv->mon) state =3D VIR_DOMAIN_SHUTOFF_DAEMON; --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816353; cv=none; d=zohomail.com; s=zohoarc; b=AfnZOD0WAH2QfT15KMKdBwfVtdO4LL5LsEkrXy6gGThAvqpOV+xyKSt7u3/N+4bgm7or19PBzCV7sR+bx6PW0T3ZyI+7HBery2heZIf3qSzdeEHNIA+Sj9sFU8mgP+zpPtHCRpLiUEFWCQT3wQXb4x+FO6WxMVhmlks2Y+tqM+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816353; 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=TVACjqSHdHloAJrVudYlvl1tMmPLFTlAVJqpFW7fPT0=; b=N7VwgUKp/PJF7qVptpZVYHensXgCSVQLenXnM69ovRciA0vJlh6SiIuDFOWKwJ95fkrdKDq82T+e37GVV8DRKcS0NiNr8/bdgLEvBX783yp37DP/Q0Orhfn+VRihSSU28biCZc3NUPt++q/6yY0Tvo+darfW+zaKGfsylDgp50o= 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 162981635317734.64315343286967; Tue, 24 Aug 2021 07:45:53 -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-136-LwIO3gJJNOKxdB66tXN3xQ-1; Tue, 24 Aug 2021 10:45:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA9623E74D; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 913121893C; Tue, 24 Aug 2021 14:45:44 +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 616A24A71C; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjf3I005869 for ; Tue, 24 Aug 2021 10:45:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2509718432; Tue, 24 Aug 2021 14:45:41 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844531BCF0 for ; Tue, 24 Aug 2021 14:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816352; 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=TVACjqSHdHloAJrVudYlvl1tMmPLFTlAVJqpFW7fPT0=; b=Dvck+MRlmyqkLyY+SN60v/jNBkHOPobbv3cQkkBqnWYdakePFliqFovPYdXNtJhfuzg6CU +vAYq9YLy0cBdSgvi7DzPbbzagKacVO9TW+Qch7JIp5B/wltff+vgFKI3MU+F5R0pd/l7h oZhSTLNb/Kl+LXunquJZNaAfqiVEZts= X-MC-Unique: LwIO3gJJNOKxdB66tXN3xQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/22] qemuDomainSetLifecycleAction: Forbid live update of 'on_reboot' Date: Tue, 24 Aug 2021 16:44:37 +0200 Message-Id: <3f059b28b66c0a4eae360bc6b1f2991e5d6685ff.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 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: 1629816355172100001 Content-Type: text/plain; charset="utf-8" Without the ability to tell qemu to change the behaviour on reboot of the guest it's fundamentally unsafe to change the action as the guest would be able to execute instructions after the reboot before libvirt terminates it due to the async nature of QMP events. Stricten the code for now until we implement support for 'set-action' QMP command. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0472f54a37..3c57d67d1c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19671,10 +19671,11 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, goto endjob; if (def) { - if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) { + if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO || + (type =3D=3D VIR_DOMAIN_LIFECYCLE_REBOOT && + def->onReboot !=3D action)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot update lifecycle action because QEMU " - "was started with -no-reboot option")); + _("cannot update lifecycle action because QEMU = was started with incompatible -no-reboot setting")); goto endjob; } --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816424; cv=none; d=zohomail.com; s=zohoarc; b=jnsrhncVs1gHRAUcePuzaAhWCAQeKNE1m+fHCUAV7Ir9pbHJKDAbI39m+kpx6uJ5h7RVCSxt4OBijBi9tTj1WSMZ74S88f0LMdr76GEuovv3Wxlm1e0duxR8UQx7RsklLBFh2UNXWYSm9YQ0NmUrB1l3HtZxOQSjgEyliQluHgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816424; 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=yhWrxZd46IdvVuTmGDt+VTi7UQURNXB+trMA59/VO14=; b=d9+GlsVwX4EEOk6Yh3y/3VgduKOkOeM5RvB81rAThxYlF5ArsFC4X5M7ZfnxxtuvIfWIPqtR6lXLyEbeR4c5OOzTqfwTGbbiW7hBkqs8Hvvg6LDMv2PpbFXVYN3AJCDgsYt1iq1KsLaEIXOoejjcolnzZ5C9vlwFo/HXo/cYkFk= 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 1629816424132726.8316842053216; Tue, 24 Aug 2021 07:47:04 -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-136-iCgbdn7gPCSSmCk1LoUC2g-1; Tue, 24 Aug 2021 10:45:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A52ED804037; Tue, 24 Aug 2021 14:45:44 +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 8876E60C0F; Tue, 24 Aug 2021 14:45:44 +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 56C04181A3F6; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjgQ3005913 for ; Tue, 24 Aug 2021 10:45:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 397CE17D4E; Tue, 24 Aug 2021 14:45:42 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 878381BCF0 for ; Tue, 24 Aug 2021 14:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816423; 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=yhWrxZd46IdvVuTmGDt+VTi7UQURNXB+trMA59/VO14=; b=gkiaYBe/wrNX3GpBpxlo9/ssN1lBradc9BEVtjOb3gMoLZsPlim1GcGcndBT59R5hz4o1/ kEPRn+m1M/I1pmUv8p4unHOCh+V2rBUK9zsCCfgSCtwurm9dlMzP0M7Qg+Yl6THG4uMNHO fOcMsezPzEENPOgWZP1ZP9Yl0qLWW5U= X-MC-Unique: iCgbdn7gPCSSmCk1LoUC2g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/22] qemuProcessHandleReset: Don't emulate lifecycle actions for RESET event Date: Tue, 24 Aug 2021 16:44:38 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1629816424936100001 Content-Type: text/plain; charset="utf-8" The RESET event is delivered by qemu only when the guest OS is actually allowed to reboot ('-no-reboot' or equivalent is not used) and due to the nature of async handling of the events VM is actually already executing guest code after the reboot, until our code gets to killing it. In general it should have been impossible to reach a state where the reboot action is 'destroy' but we didn't use '-no-reboot' but due to various bugs it was. Due to the fact that this was not a desired operation and additionally guest code already is executing I think the best option is not to kill the VM any more (possible data loss?) and rely for the proper fix where we use the new 'set-action' QMP command to enable an equivalent behaviour to '-no-reboot' during runtime. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c9cdff4e82..a839d587c2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -443,27 +443,6 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); - if (vm->def->onReboot =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY || - vm->def->onReboot =3D=3D VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE) { - - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) - goto cleanup; - - if (!virDomainObjIsActive(vm)) { - VIR_DEBUG("Ignoring RESET event from inactive domain %s", - vm->def->name); - goto endjob; - } - - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED, - QEMU_ASYNC_JOB_NONE, 0); - virDomainAuditStop(vm, "destroyed"); - qemuDomainRemoveInactive(driver, vm); - endjob: - qemuDomainObjEndJob(driver, vm); - } - - cleanup: virObjectUnlock(vm); virObjectEventStateQueue(driver->domainEventState, event); } --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816356; cv=none; d=zohomail.com; s=zohoarc; b=GryVVj9oonwmbkAIJT2RBeV2h9M4JJ6bw3Gu+OTGRZXI5x1qS/syBPabyoaugzCX9g6eEl1f365GBqPjkrDAy0ih90Zl0liDpfJ1ojzXSiicYUVGNLFSxHNWcaGUSY7dW8bTJyYO3Z7embKjG5FBJZ3kaXFWkRaneMIhP/JKSFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816356; 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=/1eAECd1/YUE/i+oUusKTqKIx0SQ175pNUSZz4qsHCU=; b=JruFHL1ZbiTGTZHg4czyn0B7Im6N1hdEWM2qzJ+9+BskOY+/fdFIHfgwy7sGoLraOBvQbYLIuCK7qLrEquIYziN59oE0dAlW2hdB6EoDEQ//2WHtAoCGcFc9/vYXqlL7h1QGwSMoi/KVc2IpexLehSfzHPGsh40nriaQyOU1smk= 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 1629816356891264.9958721588159; Tue, 24 Aug 2021 07:45:56 -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-148-H-ARReDSOZ6XHn_xy9Co9g-1; Tue, 24 Aug 2021 10:45:53 -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 98AF7100E425; Tue, 24 Aug 2021 14:45:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CD6160854; Tue, 24 Aug 2021 14:45:46 +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 4C76B4A71E; Tue, 24 Aug 2021 14:45:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjhEj005922 for ; Tue, 24 Aug 2021 10:45:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6139217D4E; Tue, 24 Aug 2021 14:45:43 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD1E018432 for ; Tue, 24 Aug 2021 14:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816355; 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=/1eAECd1/YUE/i+oUusKTqKIx0SQ175pNUSZz4qsHCU=; b=WZ07UZ2VKcXrGpCOoTpNVOH/2FxPW4bWpq97v7u/5X79lb6NPfILEMw0zdT+wf2Ja6Sh6M +dlv8lw8Nf2PS8hZXrd8bCl0Nf9e4T84dJ6WKm/eIiS03gMBUp4MwGqGEZdqHroILqzHOR 1xIbO37iJTF+Nxh6cvZ/hAuzMQSG8F8= X-MC-Unique: H-ARReDSOZ6XHn_xy9Co9g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 18/22] qemuProcessLaunch: Setup handling of 'on_reboot' via QMP when starting the process Date: Tue, 24 Aug 2021 16:44:39 +0200 Message-Id: <69d66c8e3b96054efbcdeddc42aa3d736b02f3f8.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816357748100006 Content-Type: text/plain; charset="utf-8" Rather than using '-no-reboot' use the QMP command to update the lifecycle action of 'on_reboot'. This will be identical to how we set the behaviour during lifetime and also avoids problems with use of the 'system-reset' QMP command during bringup of the VM (used to update the firmware table of disks when disks were hotplugged as part of startup). Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a839d587c2..c41c6ab793 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7024,6 +7024,37 @@ qemuProcessSetupDisksTransient(virDomainObj *vm, } +static int +qemuProcessSetupLifecycleActions(virDomainObj *vm, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + int rc; + + if (!(virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION))) + return 0; + + /* for now we handle only onReboot->destroy here as an alternative to + * '-no-reboot' on the commandline */ + if (vm->def->onReboot !=3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY) + return 0; + + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + return -1; + + rc =3D qemuMonitorSetAction(priv->mon, + QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, + QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN, + QEMU_MONITOR_ACTION_WATCHDOG_KEEP, + QEMU_MONITOR_ACTION_PANIC_KEEP); + + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + return -1; + + return 0; +} + + /** * qemuProcessLaunch: * @@ -7382,6 +7413,10 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; } + VIR_DEBUG("Setting handling of lifecycle actions"); + if (qemuProcessSetupLifecycleActions(vm, asyncJob) < 0) + goto cleanup; + ret =3D 0; cleanup: --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816356; cv=none; d=zohomail.com; s=zohoarc; b=IuD3YaS0G7AnuSTbEHzKVekjgijCEmQFADS7Gscd+RUG4I+Gji7Muz6zcsaSVKY0Z3rfyD2yFM+63boDyP/ZoxxmBJQgfTkkaVaJCRlUTbJ4BAGXe5yTHimBtukItfn+kfT9QNaV6KuztetjwiqsehP1Yd4Xzt0MMdwTC0ZmtEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816356; 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=rUaY+7xG5QofL/3lD0OD9krxol++Nj4SZ7T2D49mT0I=; b=nTeLytlnLBxoYw/TaLTbrAMjRdFGzrEhaAkpEyqw/pSQRN5x3ivzLHmT+C6IJOYtkFFfqwpkEvOE0NVavqSLndcoitBeYyyDCv6KNL+9WYxR9z8R91X0H0TqlKj17ZY71zQa/gMXiF6U/iSwPUkgVZSgVfy7ZPjKfnrdczWMFX8= 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 1629816356411337.12197239469276; Tue, 24 Aug 2021 07:45:56 -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-440-SO4wzgZ9OI-bYfheUb-hBQ-1; Tue, 24 Aug 2021 10:45:53 -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 A2B8E1075641; Tue, 24 Aug 2021 14:45:47 +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 88A4560854; Tue, 24 Aug 2021 14:45:47 +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 5381F181A6D6; Tue, 24 Aug 2021 14:45:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEji8w005939 for ; Tue, 24 Aug 2021 10:45:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79B5617D4E; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C30D018432 for ; Tue, 24 Aug 2021 14:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816355; 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=rUaY+7xG5QofL/3lD0OD9krxol++Nj4SZ7T2D49mT0I=; b=TLIE+xNc6SXv24hD8kZW3yrAamOOqKRtCMr3Ka9xzyd6iDamuwdlkRkLSZp4ZbNDKNGMRK y9gLJA34YL5yMkfGFNKnQ8xuya1cm3HhH7l+X5oXtq/K/otJROMXyuAScY9QLOSxNmunmd ETx51OeEe+d8jH+6S6iUT5xPkCEQ0AU= X-MC-Unique: SO4wzgZ9OI-bYfheUb-hBQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/22] qemu: command: Always use '-no-shutdown' Date: Tue, 24 Aug 2021 16:44:40 +0200 Message-Id: <32ab547567248eb63e43ca96447da35e2e3c6c2e.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1629816357618100005 Content-Type: text/plain; charset="utf-8" The '-no-shutdown' flag prevents qemu from terminating if a shutdown was requested. Libvirt will handle the termination of the qemu process anyways and using this consistently will allow greater flexibility for the virDomainSetLifecycleAction API as well as will allow using the 'system-reset' QMP command during startup to reinitiate devices exported to the firmware. This efectively partially reverts 0e034efaf9b963760516a65413fd9771034357aa Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 12 +++++++++--- src/qemu/qemu_process.c | 4 +++- .../misc-no-reboot.x86_64-latest.args | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5b743dd1ad..b230314f7f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6165,10 +6165,16 @@ qemuBuildPMCommandLine(virCommand *cmd, { virQEMUCaps *qemuCaps =3D priv->qemuCaps; - if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) - virCommandAddArg(cmd, "-no-reboot"); - else + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { + /* with new qemu we always want '-no-shutdown' on startup and we s= et + * all the other behaviour later during startup */ virCommandAddArg(cmd, "-no-shutdown"); + } else { + if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) + virCommandAddArg(cmd, "-no-reboot"); + else + virCommandAddArg(cmd, "-no-shutdown"); + } if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { if (def->features[VIR_DOMAIN_FEATURE_ACPI] !=3D VIR_TRISTATE_SWITC= H_ON) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c41c6ab793..bbcef47885 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8765,7 +8765,9 @@ qemuProcessReconnect(void *opaque) * domain crashed; otherwise, if the monitor was started, * then we can blame ourselves, else we failed before the * monitor started so we don't really know. */ - if (!priv->mon && tryMonReconn && priv->allowReboot =3D=3D VIR_TRI= STATE_BOOL_YES) + if (!priv->mon && tryMonReconn && + (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_YES || + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION))) state =3D VIR_DOMAIN_SHUTOFF_CRASHED; else if (priv->mon) state =3D VIR_DOMAIN_SHUTOFF_DAEMON; diff --git a/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args b/tes= ts/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args index 197b6375a7..f34e9c8708 100644 --- a/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args +++ b/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args @@ -23,7 +23,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ --no-reboot \ +-no-shutdown \ -no-acpi \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816360; cv=none; d=zohomail.com; s=zohoarc; b=S/vmj80Cgt3vmyNe2cvfWECmm8cr4NxFb/KTVlDFqu4mCZQT+kXDi7EXbZ2kBm9x8AlNwg1FzoujlIfj+nXLnz4teI16VNoylp3IInV0J1X8hVN/hOH5DLqzFpAJb84cM+DXpe5LThpPll8Xz6YXQLJ/R4iPt5l3XlPuDaB1DYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816360; 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=xRpAqgtSKfkX8K/OIXJNsjZdkB5AU2F/6j//gFX6MO8=; b=RE0/7Ro9lSzQgEMPRtnqP1KwAmUBz/vp0mkXt7LkpcyWpZ3gDyZi1PplqrZHaT5zl6Xa2Q4DVlnZfHLLGXC/mGfTXCflG99q4BdgGWr/ObHiyfXsb2fyetLH+QDSJTQo3aEGqgxmw9yhabfQ40rSV14+27tbKeefAdHqlEJMtlc= 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 1629816360470522.8168976214763; Tue, 24 Aug 2021 07:46:00 -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-194-Ljdk3q8BOQeO_7VWL06CIQ-1; Tue, 24 Aug 2021 10:45:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8888A838E6E; Tue, 24 Aug 2021 14:45:50 +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 692E560C0F; Tue, 24 Aug 2021 14:45:50 +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 34045181A6E5; Tue, 24 Aug 2021 14:45:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjjgn005965 for ; Tue, 24 Aug 2021 10:45:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 854E018432; Tue, 24 Aug 2021 14:45:45 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id E431A17D4E for ; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816359; 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=xRpAqgtSKfkX8K/OIXJNsjZdkB5AU2F/6j//gFX6MO8=; b=D+mIv031gRfygkEGNbPVU1hWJgmz5hfxCyUcgpBWvLLY4aMTM2kdrg3m4h8nVcu22wGHmD 7Splbq39/XWs9Xv8cf/mCGmdVtFJxiwe1piCuDIYCxw0NuhhJ3lo2b3vdKlCkJ7tvGW61G AUUcCESNIa6XaaWTPGnKLw4dcXAzo8s= X-MC-Unique: Ljdk3q8BOQeO_7VWL06CIQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/22] qemu: process: Don't set 'allowReboot' when qemu supports 'set-action' Date: Tue, 24 Aug 2021 16:44:41 +0200 Message-Id: <2d26a61044e340c8f2c9dce7f9f80e7b588c4c29.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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: 1629816361615100001 Content-Type: text/plain; charset="utf-8" We don't use the value of the flag when the new handling is in place so we don't have to initialize it. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bbcef47885..e2bcd23954 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6354,6 +6354,11 @@ qemuProcessPrepareAllowReboot(virDomainObj *vm) virDomainDef *def =3D vm->def; qemuDomainObjPrivate *priv =3D vm->privateData; + /* with 'set-action' QMP command we don't need to keep this around as + * we always update qemu with the proper state */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) + return; + if (priv->allowReboot !=3D VIR_TRISTATE_BOOL_ABSENT) return; --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816370; cv=none; d=zohomail.com; s=zohoarc; b=LSUvKLoDGPK+eiCgLcUBGtnqYxuU8/DuynNOei4GaNk+QxHRfAsTIWw3EBU0Z5EZ5Sg1S2rnfArMLKc/9O3xKvecjdgHhwoT3nZBpnv/MPxaoHfVNLpT9DVskb0CjFwRzgnIjRYJGck1IhLpquVkECD9r4aAbUsYm69XX9ZYlpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816370; 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=uX0xoOb3iQohz0SVbS2zSA13lVClD71VfOBuCSizUKg=; b=ZoEwDYir4ntmNv147Lgh/mFhts8OHZCgCJRzNNvOA+pRpT9wL7ZCT4hV8nnQ5Hcd7MFe+EqQn2aFU5P5WsAemrZ1awi/iKGEtiOx9/kdxhayoSvk2Pfub2L44Ia3oa75oIJ4nuGFLldr0FAOEoijtoaObOz+fQksiAQ4ho0XdNo= 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 1629816370411607.644264353577; Tue, 24 Aug 2021 07:46:10 -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-423-OSwdi7ztONKLL_Jr8bLBdw-1; Tue, 24 Aug 2021 10:46:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41ADA192D792; Tue, 24 Aug 2021 14:45:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2308E620DE; Tue, 24 Aug 2021 14:45:50 +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 E089150038; Tue, 24 Aug 2021 14:45:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjkFq005975 for ; Tue, 24 Aug 2021 10:45:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id A6D2518432; Tue, 24 Aug 2021 14:45:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id F34CC17D4E for ; Tue, 24 Aug 2021 14:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816369; 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=uX0xoOb3iQohz0SVbS2zSA13lVClD71VfOBuCSizUKg=; b=gOa+8UwMyzSlYyEfY5i0fJPm0lD4qnb397nmA6IlOEH1OVI+KI3PWwek4ZFDMaATCDbZU0 v3QCAiJU7ETPH00lfhfN60OlcBvxECOesC/VA+PKLFPxj/Nm4gnitTKtEw+IMt6FZkdbzJ hWro6I26tTsepdrn9dSz7qbrBcnM8ZU= X-MC-Unique: OSwdi7ztONKLL_Jr8bLBdw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 21/22] qemuDomainSetLifecycleAction: Properly update 'onReboot' action in qemu Date: Tue, 24 Aug 2021 16:44:42 +0200 Message-Id: <2a2117c786b76583cb35cb1064d2ccb07f29a3ca.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 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: 1629816371328100007 Content-Type: text/plain; charset="utf-8" When qemu supports 'set-action' command we can update what happens on reboot. Additionally we can fully relax the checks as we now properly update the lifecycle actions. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 69 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3c57d67d1c..961f521f4b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19629,6 +19629,58 @@ qemuDomainModifyLifecycleAction(virDomainDef *def, } +static int +qemuDomainModifyLifecycleActionLive(virDomainObj *vm, + virDomainLifecycle type, + virDomainLifecycleAction action) +{ + qemuMonitorActionReboot monReboot =3D QEMU_MONITOR_ACTION_REBOOT_KEEP; + qemuDomainObjPrivate *priv =3D vm->privateData; + virQEMUDriver *driver =3D priv->driver; + int rc; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) + return 0; + + /* For now we only update 'reboot' action here as we want to keep the + * shutdown action as is (we're emulating the outcome anyways)) */ + if (type !=3D VIR_DOMAIN_LIFECYCLE_REBOOT || + vm->def->onReboot =3D=3D action) + return 0; + + + switch (action) { + case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: + monReboot =3D QEMU_MONITOR_ACTION_REBOOT_SHUTDOWN; + break; + + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: + monReboot =3D QEMU_MONITOR_ACTION_REBOOT_RESET; + break; + + case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: + case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: + case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: + case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: + return 0; + } + + + qemuDomainObjEnterMonitor(driver, vm); + + rc =3D qemuMonitorSetAction(priv->mon, + QEMU_MONITOR_ACTION_SHUTDOWN_KEEP, + monReboot, + QEMU_MONITOR_ACTION_WATCHDOG_KEEP, + QEMU_MONITOR_ACTION_PANIC_KEEP); + + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; + + return 0; +} + static int qemuDomainSetLifecycleAction(virDomainPtr dom, @@ -19671,14 +19723,19 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, goto endjob; if (def) { - if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO || - (type =3D=3D VIR_DOMAIN_LIFECYCLE_REBOOT && - def->onReboot !=3D action)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot update lifecycle action because QEMU = was started with incompatible -no-reboot setting")); - goto endjob; + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { + if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO || + (type =3D=3D VIR_DOMAIN_LIFECYCLE_REBOOT && + def->onReboot !=3D action)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot update lifecycle action because Q= EMU was started with incompatible -no-reboot setting")); + goto endjob; + } } + if (qemuDomainModifyLifecycleActionLive(vm, type, action) < 0) + goto endjob; + qemuDomainModifyLifecycleAction(def, type, action); qemuDomainSaveStatus(vm); --=20 2.31.1 From nobody Mon Apr 29 13:33:03 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=1629816438; cv=none; d=zohomail.com; s=zohoarc; b=KiQ3FbVEWTEgDsBsN3k64CbkQNC2vvo8T7ARc6b/VobWiK3KWre58kZ3Vc33sZmJSIMUTF4WQ19RjH+XfXHmIED6LVf+ugGMp0TMOAQBFnSHwGXGtd8GI3jP/7nOLwDx0CfjrPbSYFhI1M8BFfAPOu+6GkmPwp5fieoao+dgin8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816438; 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=hhpxH7C3nM9cIxDA0uvmw3yRVG+dT0Y6y/jCtwN64X4=; b=lMIZbQMcONKGfGx8iyMMsIU1TkIW/TEl/DixwSW5k6tuAz1Mzd3TSe3+mjk4xcMZLHUvGlPyUXZtntH6kY0U2QuIip/dTENdqMBFEx70oRBkZSzG1UGl3B2EZxv9xzkTp9ajo1f3zgL+5K4VYHqq8KRjTk4erLO1TDtnVFAWrr0= 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 1629816438449134.66142642952707; Tue, 24 Aug 2021 07:47:18 -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-59-vZP6FUAeNDiwByY6i7TOXA-1; Tue, 24 Aug 2021 10:46:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 422645A082; Tue, 24 Aug 2021 14:45:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19B731017CE8; Tue, 24 Aug 2021 14:45:53 +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 D71F75003B; Tue, 24 Aug 2021 14:45:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEjlXK006017 for ; Tue, 24 Aug 2021 10:45:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id CEE5018432; Tue, 24 Aug 2021 14:45:47 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 299D418649 for ; Tue, 24 Aug 2021 14:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816437; 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=hhpxH7C3nM9cIxDA0uvmw3yRVG+dT0Y6y/jCtwN64X4=; b=buQdlj4Ci9L2XI0W9NpHFPzhkgu2zfds6ghqHuMoy69BMAdQbHDLjmZrFRKUEQeqZVm9tm qQPIKTO3WyIPGhN7XKyDTdeQOgmHOZhf9/9xHn74jmKLfNnfhlJUWL5EnW4B9/FvOFVkPx syQHmlCQZ9HAN/iyXeYFJhuJZ578A/M= X-MC-Unique: vZP6FUAeNDiwByY6i7TOXA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/22] qemu: process: Ignore 'RESET' event during startup Date: Tue, 24 Aug 2021 16:44:43 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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: 1629816438850100001 Content-Type: text/plain; charset="utf-8" In cases when we are adding a disk with sharing backend (and thus hotplugging it) we need to re-initialize ACPI tables so that the VM boots from the correct device. This has a side-effect of emitting the RESET event and forwarding it to the clients which is not correct. Fix this by ignoring RESET events during startup of the VM. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e2bcd23954..fc273b6365 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -429,12 +429,24 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, void *opaque) { virQEMUDriver *driver =3D opaque; - virObjectEvent *event; + virObjectEvent *event =3D NULL; qemuDomainObjPrivate *priv; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + virDomainState state; + int reason; virObjectLock(vm); + state =3D virDomainObjGetState(vm, &reason); + + /* ignore reset events on VM startup. Libvirt in certain instances doe= s a + * reset during startup so that the ACPI tables are re-generated */ + if (state =3D=3D VIR_DOMAIN_PAUSED && + reason =3D=3D VIR_DOMAIN_PAUSED_STARTING_UP) { + VIR_DEBUG("ignoring reset event during startup"); + goto unlock; + } + event =3D virDomainEventRebootNewFromObj(vm); priv =3D vm->privateData; if (priv->agent) @@ -443,6 +455,7 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) VIR_WARN("Failed to save status on vm %s", vm->def->name); + unlock: virObjectUnlock(vm); virObjectEventStateQueue(driver->domainEventState, event); } --=20 2.31.1