From patchwork Mon Jul 23 20:17:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 948064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JijIKuWG"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ZDtQ6y12z9s3N for ; Tue, 24 Jul 2018 07:20:46 +1000 (AEST) Received: from localhost ([::1]:36721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiG4-000702-I3 for incoming@patchwork.ozlabs.org; Mon, 23 Jul 2018 17:20:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhKK-0003Y5-KO for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhKH-0005As-DX for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:04 -0400 Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:35550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhKH-0005Ae-82; Mon, 23 Jul 2018 16:21:01 -0400 Received: by mail-oi0-x230.google.com with SMTP id i12-v6so3504850oik.2; Mon, 23 Jul 2018 13:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=nIcdRG13OwHhVSw9tUDr/TTtXiyQtkraJxUayg18V2E=; b=JijIKuWGPftCBTiJKV9kqUR7F3bBEf+DNkhlf97kT40BolkxT3NtgLnNPiAToGnvI+ Fjp0+WsgZ4sqUElfSyhXZIVdMDR0+F1Wncmobq0D6V0Pyk838VYSEvRyJNqiXeh8afbX fi4iMDlRiyFIshG0OkRSS+R4ypa8yIciPxXQeV2JCnx1t3+D1oKWTTNtG8/gMTIAZYZH ol7dN9cfgOqPL+MoMZXXbHZbWYi/vD5ykwJtl4ldrWPfhT1yLbSGcVj1qbXL/ZDFLWFK UGcVG6E2FLi6N8ui6AEX5UOQXF5sJRM/GuJtJMylTtaqqX7iyVj/jkpD9enDTsvFRlhi TlQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=nIcdRG13OwHhVSw9tUDr/TTtXiyQtkraJxUayg18V2E=; b=X4CpiK95D7vJjDQnFIDH/zn33DCXq3WW6FHMSNJ45E2wqa+y6yyMS7oDmuZM8E7zzo 8eS2haHNgMi07JP+9e6eJveVdzh6tvH946WEC1/HLPsGiBq4YcO1cxBlDkqEan/0UxA5 BFDwCH0frcdwmxxdGUrdTCgVYxrVsZTlTD4mdy0NL40N4XyN20QamGgJypVdoJHDeqOB 4YLJ12HsextZAmrVWCoQV858TitawSxLSmNjRgHpuL0zL69F62bAq3w52qql9dI3GC0C cWZWbUTmQ17qdYyNrfZcRfQ4hNN1zH/052Sm9NxkmiQ7z4WMqOS24kAWjXnYJVTulRFZ SgRg== X-Gm-Message-State: AOUpUlEcNdBfOsVXlv/kqV8UfB5eODtK4s/ZfRYFHLbpTB7S3xfEu/yi 8peDMfUqBecVm/1b/wfxhn5QVNmDO4f5mw== X-Google-Smtp-Source: AAOMgpctwR21S1graZQMNjoptv+viF7cuqk0aWVA9O897JXOyBg5P+5m+z2MdeeYbH+9S6pbAAd5Tg== X-Received: by 2002:aca:d5cd:: with SMTP id m196-v6mr305129oig.160.1532377260070; Mon, 23 Jul 2018 13:21:00 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id f4-v6sm2838788oic.52.2018.07.23.13.20.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:59 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:17 -0500 Message-Id: <20180723201748.25573-69-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::230 Subject: [Qemu-devel] [PATCH 68/99] blockjob: expose error string via query X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: John Snow When we've reached the concluded state, we need to expose the error state if applicable. Add the new field. This should be sufficient for determining if a job completed successfully or not after concluding; if we want to discriminate based on how it failed more mechanically, we can always add an explicit return code enumeration later. I didn't bother to make it only show up if we are in the concluded state; I don't think it's necessary. Cc: qemu-stable@nongnu.org Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf (cherry picked from commit ab9ba614556ac5b0f8d96b99e0dba19f1e28d6c2) Signed-off-by: Michael Roth --- blockjob.c | 2 ++ qapi/block-core.json | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/blockjob.c b/blockjob.c index 27f957e571..4de48166b2 100644 --- a/blockjob.c +++ b/blockjob.c @@ -831,6 +831,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp) info->status = job->status; info->auto_finalize = job->auto_finalize; info->auto_dismiss = job->auto_dismiss; + info->has_error = job->ret != 0; + info->error = job->ret ? g_strdup(strerror(-job->ret)) : NULL; return info; } diff --git a/qapi/block-core.json b/qapi/block-core.json index c50517bff3..7da3bea6bc 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1172,6 +1172,9 @@ # @auto-dismiss: Job will dismiss itself when CONCLUDED, moving to the NULL # state and disappearing from the query list. (since 2.12) # +# @error: Error information if the job did not complete successfully. +# Not set if the job completed successfully. (since 2.12.1) +# # Since: 1.1 ## { 'struct': 'BlockJobInfo', @@ -1179,7 +1182,8 @@ 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int', 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool', 'status': 'BlockJobStatus', - 'auto-finalize': 'bool', 'auto-dismiss': 'bool' } } + 'auto-finalize': 'bool', 'auto-dismiss': 'bool', + '*error': 'str' } } ## # @query-block-jobs: