[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Modify qemu_opt_rename to realize renaming all item
From: |
Jun Li |
Subject: |
[Qemu-devel] [PATCH] Modify qemu_opt_rename to realize renaming all items in opts |
Date: |
Tue, 23 Sep 2014 21:13:08 +0800 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH] Modify qemu_opt_rename to realize renaming all items in opts,
Jun Li <=