From nobody Thu May 2 00:17:58 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=1627029461; cv=none; d=zohomail.com; s=zohoarc; b=CnlF5zjdVCK06/C28jm5o+BYx1qkjiofVt4FQl0kCfi5FYAECQ+Kb7BRHUcFp0EIRpqbT3NldZc0LcceufXs8UUQ9kbEmbsT8JcMndF76bWROTlHl//ZASi250h5J/49vAqpCdMgWyCtm3JI0+86M4XpIFAcyJ/0lKDKDlhcjrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627029461; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=MXZ+XgJ7CL78Hf6VSiW7Xwj4jRUtPwuWDjQdoVQxamA=; b=cp/mmTuAZrYa3YI46bdPtm4BaDeD1veerB4NeYoQ14/ZKutGooCe3xgIO0wzaFnk9eNDuBarC9Pgu0OV/eLk++fgQr2CIzzhUIGn7fq3Go8LElQDzIuSAF6Bv7wUCzp5frRERYdxdKIxE+ZBn7lwh4IWrg0FU0hVIR30F9Rhjz0= 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 1627029461175870.2373908232606; Fri, 23 Jul 2021 01:37:41 -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-477-x0shp0RFMWWCLRLmloYXlQ-1; Fri, 23 Jul 2021 04:37:38 -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 DC70E1026202; Fri, 23 Jul 2021 08:37: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 B523960C81; Fri, 23 Jul 2021 08:37:31 +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 F3AF9180BAB0; Fri, 23 Jul 2021 08:37:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16N8ZbPi015568 for ; Fri, 23 Jul 2021 04:35:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id D68545278D; Fri, 23 Jul 2021 08:35:37 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4893C60862 for ; Fri, 23 Jul 2021 08:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627029460; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MXZ+XgJ7CL78Hf6VSiW7Xwj4jRUtPwuWDjQdoVQxamA=; b=WSyYFciRbtjDgAVTElYLQsEzqMOpXLMkucX0NmCz4hK1ZjOs8Zk04kcnYbd9QJHsK8+ryZ +s/oQOVBFEZ8wU5e2I4Wn7BISj+kro82Re/jNaD3apkrI/ZJNwwE45akZDzZH7XmblDfKu kaEdbIbuNYpIKDHm077G+w5SJoYRNXM= X-MC-Unique: x0shp0RFMWWCLRLmloYXlQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] virsh: fix setmem flags logic Date: Fri, 23 Jul 2021 10:35:27 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1627029463135100001 Content-Type: text/plain; charset="utf-8" When we dropped virDomainSetMemory usage it got kind of tricky to figure out the flags correctly. Originally the logic was following: no option | --current | --live | --config | --live --config ----------+-----------+--------+----------+---------------- LIVE | CURRENT | LIVE | CONFIG | LIVE & CONFIG But after the commit removing virDomainSetMemory usage it changed to: no option | --current | --live | --config | --live --config ----------+-----------+--------+-----------------+---------------- LIVE | CURRENT | LIVE | LIVE & CONFIG | LIVE & CONFIG This commit fixes the logic back to the original behavior except for ESX, HyperV and Virtuozzo drivers where virDomainSetMemory() default behavior was CURRENT instead of LIVE. Fixes: ce8138564bba0def7d7195814fba4555915d60d5 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1980199 Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- tools/virsh-domain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6fb057736b..f9962f0515 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9005,10 +9005,15 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd) VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, config); =20 - if (current) + if (config || live || current) { flags =3D VIR_DOMAIN_AFFECT_CURRENT; - if (config) - flags |=3D VIR_DOMAIN_AFFECT_CONFIG; + + if (config) + flags |=3D VIR_DOMAIN_AFFECT_CONFIG; + + if (live) + flags |=3D VIR_DOMAIN_AFFECT_LIVE; + } =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; --=20 2.31.1