From nobody Wed Nov 27 07:41:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1554921010; cv=none; d=zoho.com; s=zohoarc; b=KXUy6KQwp6p9V2hSdlpQj6BFRsv9sqIzlPHNftQDwjL6duag8DQ6sB3ErOXvcBRVpicmO80WBBybxvtNetyrLQb8JbleqJRSqs1rNSEew1b/xskmLNSll3jVXLgRuTvzGK8YRwlwAQ4t32kSq1Mt/2xW2QP2ke07XHxpJZXc4lQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554921010; 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:ARC-Authentication-Results; bh=HCmpm8gZd5AC1boo2myBuRvGrG+ypFh+kojBXdIbw9Q=; b=jYcBb673cpLPxN3OxAmN6QFeid/2x6SRkUGHhrrmib8JivVB8Bzt39KFX2t7a6/ajPB+NS78F6fIvZLaufaDHfywvcf7reTg0rVtuFbk7pMN82J5CtxfluztRGfWoqO/MCHDgMOVLPUkSIakI3cvo0TltzC82Ef4dZ+PqdjmByg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155492101086555.214569211959656; Wed, 10 Apr 2019 11:30:10 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A963D3089EC3; Wed, 10 Apr 2019 18:30:08 +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 5B6DD5B6A3; Wed, 10 Apr 2019 18:30:08 +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 F0D80181AC8E; Wed, 10 Apr 2019 18:30:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3AITkYv002693 for ; Wed, 10 Apr 2019 14:29:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3CD21A915; Wed, 10 Apr 2019 18:29:46 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-123-233.rdu2.redhat.com [10.10.123.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BE8019C6F; Wed, 10 Apr 2019 18:29:46 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 10 Apr 2019 14:29:35 -0400 Message-Id: <05fe015e52f81def27c444ae323242d502bdf033.1554919494.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] qemu: monitor: cleanup loadvm error handling 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 10 Apr 2019 18:30:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Drop redundant NULL checks, add error string prefixes, consolidate a few indentical reports. Signed-off-by: Cole Robinson --- src/qemu/qemu_monitor_text.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 0b2c1a6aed..414da0ca28 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -215,28 +215,25 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, c= onst char *name) if (qemuMonitorHMPCommand(mon, cmd, &reply)) goto cleanup; =20 - if (strstr(reply, "No block device supports snapshots") !=3D NULL) { + if (strstr(reply, "No block device supports snapshots")) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("this domain does not have a device to load snaps= hots")); goto cleanup; - } else if (strstr(reply, "Could not find snapshot") !=3D NULL) { + } else if (strstr(reply, "Could not find snapshot")) { virReportError(VIR_ERR_OPERATION_INVALID, _("the snapshot '%s' does not exist, and was not lo= aded"), name); goto cleanup; - } else if (strstr(reply, "Snapshots not supported on device") !=3D NUL= L) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); - goto cleanup; - } else if (strstr(reply, "Could not open VM state file") !=3D NULL) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); - goto cleanup; - } else if (strstr(reply, "Error") !=3D NULL - && strstr(reply, "while loading VM state") !=3D NULL) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + } else if (strstr(reply, "Snapshots not supported on device")) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("Failed to load snapshot: %s"), reply); goto cleanup; - } else if (strstr(reply, "Error") !=3D NULL - && strstr(reply, "while activating snapshot on") !=3D NULL) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + } else if (strstr(reply, "Could not open VM state file") || + (strstr(reply, "Error") && + (strstr(reply, "while loading VM state") || + strstr(reply, "while activating snapshot on")))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to load snapshot: %s"), reply); goto cleanup; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list