From patchwork Fri Apr 15 17:02:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 611047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qmkQD0dNQz9t6B for ; Sat, 16 Apr 2016 03:03:32 +1000 (AEST) Received: from localhost ([::1]:37907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar79W-0005JC-7L for incoming@patchwork.ozlabs.org; Fri, 15 Apr 2016 13:03:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar78k-0003d2-8D for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:02:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar78i-0003gk-Qj for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:02:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar78c-0003cr-8L; Fri, 15 Apr 2016 13:02:34 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D05A8C01AA22; Fri, 15 Apr 2016 17:02:33 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3FH2RWY018652; Fri, 15 Apr 2016 13:02:32 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 15 Apr 2016 19:02:06 +0200 Message-Id: <1460739742-5315-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1460739742-5315-1-git-send-email-kwolf@redhat.com> References: <1460739742-5315-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/19] block/vpc: set errp in vpc_create 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: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jeff Cody Add more useful error information to failure paths in vpc_create(). Signed-off-by: Jeff Cody Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block/vpc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/vpc.c b/block/vpc.c index 3713ec3..5aded1a 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -874,6 +874,7 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp) } else if (!strcmp(disk_type_param, "fixed")) { disk_type = VHD_FIXED; } else { + error_setg(errp, "Invalid disk type, %s", disk_type_param); ret = -EINVAL; goto out; } @@ -924,6 +925,7 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp) total_sectors = total_size / BDRV_SECTOR_SIZE; /* Allow a maximum disk size of approximately 2 TB */ if (total_sectors > VHD_MAX_SECTORS) { + error_setg(errp, "Disk size is too large, max size is 2040 GiB"); ret = -EFBIG; goto out; } @@ -974,6 +976,9 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp) } else { ret = create_fixed_disk(blk, buf, total_size); } + if (ret < 0) { + error_setg(errp, "Unable to create or write VHD header"); + } out: blk_unref(blk);