From patchwork Fri Nov 3 14:18:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: ZhiPeng Lu X-Patchwork-Id: 833894 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=) 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 3yT3wQ4cLjz9s8J for ; Sat, 4 Nov 2017 01:18:46 +1100 (AEDT) Received: from localhost ([::1]:36903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAcnz-0001k3-T3 for incoming@patchwork.ozlabs.org; Fri, 03 Nov 2017 10:18:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eAcnk-0001jM-7P for qemu-devel@nongnu.org; Fri, 03 Nov 2017 10:18:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eAcnf-0006Wx-VG for qemu-devel@nongnu.org; Fri, 03 Nov 2017 10:18:28 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:57670 helo=mxct.zte.com.cn) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eAcnf-0006N5-K3 for qemu-devel@nongnu.org; Fri, 03 Nov 2017 10:18:23 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 4C0AA9D026B159CDA0B8; Fri, 3 Nov 2017 22:18:15 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id vA3EI6Pl086084; Fri, 3 Nov 2017 22:18:06 +0800 (GMT-8) (envelope-from lu.zhipeng@zte.com.cn) Received: from ceshi.localdomain ([10.74.120.130]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017110322181369-515616 ; Fri, 3 Nov 2017 22:18:13 +0800 From: ZhiPeng Lu To: jasowang@redhat.com Date: Fri, 3 Nov 2017 22:18:05 +0800 Message-Id: <1509718685-7993-1-git-send-email-lu.zhipeng@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-11-03 22:18:13, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-11-03 22:17:51 X-MAIL: mse01.zte.com.cn vA3EI6Pl086084 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH v2] net: add print link status of nic in print_net_client function 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: ZhiPeng Lu , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We can directly know the information of vm by executing "info network" command, including the link state of nics, without executing other commands again. Signed-off-by: ZhiPeng Lu Reviewed-by: Jiyun Fan Reviewed-by: Philippe Mathieu-Daudé --- v2: correct commit messages --- net/net.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index 39ef546..9e349cb 100644 --- a/net/net.c +++ b/net/net.c @@ -1298,10 +1298,14 @@ void print_net_client(Monitor *mon, NetClientState *nc) { NetFilterState *nf; - monitor_printf(mon, "%s: index=%d,type=%s,%s\n", nc->name, + monitor_printf(mon, "%s: index=%d,type=%s,%s", nc->name, nc->queue_index, NetClientDriver_str(nc->info->type), nc->info_str); + if (nc->info->type == NET_CLIENT_DRIVER_NIC) { + monitor_printf(mon, ",link status:%s", nc->link_down ? "down" : "up"); + } + monitor_printf(mon, "\n"); if (!QTAILQ_EMPTY(&nc->filters)) { monitor_printf(mon, "filters:\n"); }