From patchwork Fri Apr 26 11:44:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 239821 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 244BB2C0170 for ; Fri, 26 Apr 2013 21:48:39 +1000 (EST) Received: from localhost ([::1]:49872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVh8l-0004Dk-LK for incoming@patchwork.ozlabs.org; Fri, 26 Apr 2013 07:48:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVh5l-00006v-7z for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVh5i-0001Ui-CI for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:45:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVh5h-0001UZ-Ui for qemu-devel@nongnu.org; Fri, 26 Apr 2013 07:45:26 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3QBjO5J029546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Apr 2013 07:45:24 -0400 Received: from localhost (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3QBjMfF020318; Fri, 26 Apr 2013 07:45:23 -0400 From: Stefan Hajnoczi To: Date: Fri, 26 Apr 2013 13:44:36 +0200 Message-Id: <1366976682-10251-17-git-send-email-stefanha@redhat.com> In-Reply-To: <1366976682-10251-1-git-send-email-stefanha@redhat.com> References: <1366976682-10251-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Stefan Hajnoczi , MORITA Kazutaka Subject: [Qemu-devel] [PATCH 08/11] sheepdog: add SD_RES_READONLY result code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: MORITA Kazutaka Sheepdog returns SD_RES_READONLY when qemu sends write requests to the snapshot vdi. This adds the result code and makes sd_strerror() print its error reason. Signed-off-by: MORITA Kazutaka Signed-off-by: Stefan Hajnoczi --- block/sheepdog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index 4326664..f4e7204 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -68,6 +68,7 @@ #define SD_RES_WAIT_FOR_JOIN 0x17 /* Waiting for other nodes joining */ #define SD_RES_JOIN_FAILED 0x18 /* Target node had failed to join sheepdog */ #define SD_RES_HALT 0x19 /* Sheepdog is stopped serving IO request */ +#define SD_RES_READONLY 0x1A /* Object is read-only */ /* * Object ID rules @@ -349,6 +350,7 @@ static const char * sd_strerror(int err) {SD_RES_WAIT_FOR_JOIN, "Sheepdog is waiting for other nodes joining"}, {SD_RES_JOIN_FAILED, "Target node had failed to join sheepdog"}, {SD_RES_HALT, "Sheepdog is stopped serving IO request"}, + {SD_RES_READONLY, "Object is read-only"}, }; for (i = 0; i < ARRAY_SIZE(errors); ++i) {