From nobody Wed May 8 23:39:01 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=1631718986; cv=none; d=zohomail.com; s=zohoarc; b=FbGAmadgPXdtw35MkEGm8eMfGNCM7gMgMk1RE+pmirMsymApIDBq1b98GyCZQWwBGm6jbXXC+wQ4SXNNKCc1QXZjjSH/r474Z8qoKGoas1sI8NO4FFci5QGWiYwSl8Jk2Nz6XveiupevFuURvVTY4KXwYkdlyuIrrcuIWjFDpk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631718986; 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=Spit71X85Ah3aFhBY1x3UlqR9fCCe0kSUZtkQQEtVxQ=; b=CYxkry8qLEKa48dx+zVYPPsmRY+cS3fCCxh9VAaPE08EswYZh98OLqiyEqnkT0pl1/X34g88nRdfK3k8E6NZIoxw55jjJDzC/KPTweo6o9LW3OiLQejn0YBGlQcyiiCAqbtcCLuj+h+uHQjhlqgIqF8g3Q/7HypL1jtNXVQrLNk= 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 1631718986761893.5003515383459; Wed, 15 Sep 2021 08:16: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-472-Sj5_Uw1SM1-_Zsgwnhl2Bg-1; Wed, 15 Sep 2021 11:16:18 -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 5546A18D6A51; Wed, 15 Sep 2021 15:15:48 +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 B127F6A912; Wed, 15 Sep 2021 15:15: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 5FCE0180142F; Wed, 15 Sep 2021 15:15:46 +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 18FFFiO2027394 for ; Wed, 15 Sep 2021 11:15:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E2851B5B7; Wed, 15 Sep 2021 15:15:44 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73FCC781EE for ; Wed, 15 Sep 2021 15:15:44 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 370C5240B11; Wed, 15 Sep 2021 17:15:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631718985; 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=Spit71X85Ah3aFhBY1x3UlqR9fCCe0kSUZtkQQEtVxQ=; b=W3MbFQAyF5ixmxaBlghJ+8LKQaP/lwGecIvItoSmsgcf2p8fylZZTxWw55MqrmPkW3SOBN 1Fu8IkK9xS5tgsYjlCyyF7EtjjkKtaXJEeoeH9dHfk/RuZC7V2aj2K1ppkyKUvCtdAixL5 JGkYOpExvE8O/XtZgUtMNa/033XbOZ8= X-MC-Unique: Sj5_Uw1SM1-_Zsgwnhl2Bg-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] virsh: Make code flow in cmdManagedSaveRemove more straightforward Date: Wed, 15 Sep 2021 17:14:57 +0200 Message-Id: <7c0012dee7fa6ff69bfdb5711a3ad8e16e18f12e.1631718897.git.jdenemar@redhat.com> 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.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: 1631718987592100001 Content-Type: text/plain; charset="utf-8" By doing so we can get rid of the code which violates our coding style guidelines. Signed-off-by: Jiri Denemark Reviewed-by: Jonathon Jongsma --- tools/virsh-domain.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e5bd1fdd75..ca56c3b33d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4788,18 +4788,19 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd = *cmd) return false; } =20 - if (hassave) { - if (virDomainManagedSaveRemove(dom, 0) < 0) { - vshError(ctl, _("Failed to remove managed save image for domai= n '%s'"), - name); - return false; - } - else - vshPrintExtra(ctl, _("Removed managedsave image for domain '%s= '"), name); - } - else + if (hassave =3D=3D 0) { vshPrintExtra(ctl, _("Domain '%s' has no manage save image; remova= l skipped"), name); + return true; + } + + if (virDomainManagedSaveRemove(dom, 0) < 0) { + vshError(ctl, _("Failed to remove managed save image for domain '%= s'"), + name); + return false; + } + + vshPrintExtra(ctl, _("Removed managedsave image for domain '%s'"), nam= e); =20 return true; } --=20 2.33.0