From patchwork Wed Sep 24 05:45:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lijun X-Patchwork-Id: 392737 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 AA8401400B2 for ; Wed, 24 Sep 2014 15:46:15 +1000 (EST) Received: from localhost ([::1]:57421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWfP2-0000kz-Lo for incoming@patchwork.ozlabs.org; Wed, 24 Sep 2014 01:46:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWfOf-0000U0-DQ for qemu-devel@nongnu.org; Wed, 24 Sep 2014 01:45:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWfOW-0008LU-Bc for qemu-devel@nongnu.org; Wed, 24 Sep 2014 01:45:49 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:56658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWfOV-0008K7-S7 for qemu-devel@nongnu.org; Wed, 24 Sep 2014 01:45:40 -0400 Received: by mail-pa0-f53.google.com with SMTP id hz1so7843284pad.26 for ; Tue, 23 Sep 2014 22:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ubgDKYyY+N9f6X2pW7A8gtjmgJAg2ggebPkzzG+8tM8=; b=AcaeBPKAB46LLnhCtyuHoANQ91go9m2rVeAWw9ViuLWgJDL1eZyedGmcXCW4513IVJ 15rM0+iQQ+udy4s09hfO1O2Phdp5tzX3D7RWGOTSYyQAowortLddffgDJsHFvfCkcOer vRn09w8n/97S2dMBpx+COv1hzJ55lyBzp6f5PF0GpbpbY+xf0LjwcfERg5+XWCHWLVfq u+qWovY1PQaWp6MHps17tiYEkE9S+hCn3+5GGBQwWET2VvrdJ7DJLcD6cSDpOuFE2Ciq aiqy7fI3w0ss13g7+NAiFG9DOggWK8UQdoIa+AWpanrmZse58E3QgNKKHXBULfD9n9YC t1sQ== X-Received: by 10.70.56.41 with SMTP id x9mr4476176pdp.130.1411537533569; Tue, 23 Sep 2014 22:45:33 -0700 (PDT) Received: from localhost ([203.114.244.88]) by mx.google.com with ESMTPSA id nd6sm13635491pbc.28.2014.09.23.22.45.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 22:45:32 -0700 (PDT) From: Jun Li To: qemu-devel@nongnu.org Date: Wed, 24 Sep 2014 13:45:27 +0800 Message-Id: <1411537527-16715-1-git-send-email-junmuzi@gmail.com> X-Mailer: git-send-email 1.9.3 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::235 Cc: kwolf@redhat.com, famz@redhat.com, Jun Li , juli@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2] Modify qemu_opt_rename to realize renaming all items in opts 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 Add realization of rename all items in opts for qemu_opt_rename. e.g: When add bps twice in command line, need to rename all bps to throttling.bps-total. This patch solved following bug: Bug 1145586 - qemu-kvm will give strange hint when add bps twice for a drive ref:https://bugzilla.redhat.com/show_bug.cgi?id=1145586 Signed-off-by: Jun Li Reviewed-by: Eric Blake --- blockdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index b361fbb..ed95b76 100644 --- a/blockdev.c +++ b/blockdev.c @@ -536,8 +536,8 @@ static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to) { const char *value; - value = qemu_opt_get(opts, from); - if (value) { + /* rename all items in opts */ + while ((value = qemu_opt_get(opts, from))) { qemu_opt_set(opts, to, value); qemu_opt_unset(opts, from); }