From patchwork Mon Oct 19 23:38:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 532755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 82199140E3C for ; Tue, 20 Oct 2015 11:38:36 +1100 (AEDT) Received: from localhost ([::1]:42473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoK1g-0002LP-Oo for incoming@patchwork.ozlabs.org; Mon, 19 Oct 2015 19:39:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoK0t-000210-HB for qemu-devel@nongnu.org; Mon, 19 Oct 2015 19:38:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoK0o-00023t-Qa for qemu-devel@nongnu.org; Mon, 19 Oct 2015 19:38:47 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:55926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoK0o-00023n-Lk for qemu-devel@nongnu.org; Mon, 19 Oct 2015 19:38:42 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Oct 2015 19:38:42 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Oct 2015 19:38:41 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: mdroth@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 1273BC90041 for ; Mon, 19 Oct 2015 19:26:52 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9JNceU063635550 for ; Mon, 19 Oct 2015 23:38:40 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9JNcdkt029719 for ; Mon, 19 Oct 2015 19:38:40 -0400 Received: from localhost ([9.80.85.201]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t9JNcd3p029677; Mon, 19 Oct 2015 19:38:39 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 19 Oct 2015 18:38:12 -0500 Message-Id: <1445297899-20527-8-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445297899-20527-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1445297899-20527-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15101923-0057-0000-0000-00000204407B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 129.33.205.209 Cc: peter.maydell@linaro.org, Michael Roth Subject: [Qemu-devel] [PULL v4 07/14] qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks 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 Some guests don't expose memory blocks via sysfs at all. This shouldn't be a failure, instead just return an empty list. For other access failures we still report an error. Signed-off-by: Michael Roth --- qga/commands-posix.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index a932809..ff0ba62 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2213,8 +2213,14 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp) dp = opendir("/sys/devices/system/memory/"); if (!dp) { - error_setg_errno(errp, errno, "Can't open directory" - "\"/sys/devices/system/memory/\"\n"); + /* it's ok if this happens to be a system that doesn't expose + * memory blocks via sysfs, but otherwise we should report + * an error + */ + if (errno != ENOENT) { + error_setg_errno(errp, errno, "Can't open directory" + "\"/sys/devices/system/memory/\"\n"); + } return NULL; }