Received: from eggs.gnu.org ([2001:4830:134:3::10]:59041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWPuN-0007gn-Hn for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:13:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWPuE-0003gK-G0 for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:13:31 -0400 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:41816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWPuE-0003f8-3w for qemu-devel@nongnu.org; Tue, 23 Sep 2014 09:13:22 -0400 Received: by mail-pa0-f49.google.com with SMTP id lf10so6535615pab.22 for ; Tue, 23 Sep 2014 06:13:15 -0700 (PDT) From: Jun Li Date: Tue, 23 Sep 2014 21:13:08 +0800 Message-Id: <1411477988-10678-1-git-send-email-junmuzi@gmail.com> Subject: [Qemu-devel] [PATCH] Modify qemu_opt_rename to realize renaming all items in opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, juli@redhat.com, famz@redhat.com, Jun Li , stefanha@redhat.com 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. Signed-off-by: Jun Li --- 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 --- blockdev.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index b361fbb..7c39a06 100644 --- a/blockdev.c +++ b/blockdev.c @@ -536,10 +536,15 @@ static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to) { const char *value; - value = qemu_opt_get(opts, from); - if (value) { - qemu_opt_set(opts, to, value); - qemu_opt_unset(opts, from); + /* rename all items */ + while (1) { + value = qemu_opt_get(opts, from); + if (value) { + qemu_opt_set(opts, to, value); + qemu_opt_unset(opts, from); + } else { + break; + } } } -- 1.9.3