From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57219 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLyY3-0004QU-2H for qemu-devel@nongnu.org; Tue, 08 Jun 2010 09:09:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLyWn-0000zx-Dd for qemu-devel@nongnu.org; Tue, 08 Jun 2010 09:07:52 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:60622) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLyWn-0000zY-BS for qemu-devel@nongnu.org; Tue, 08 Jun 2010 09:07:37 -0400 Received: by gyd5 with SMTP id 5so3200483gyd.4 for ; Tue, 08 Jun 2010 06:07:36 -0700 (PDT) Message-ID: <4C0E4096.9020705@codemonkey.ws> Date: Tue, 08 Jun 2010 08:07:34 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 01/22] QemuOpts: fix a bug in QemuOpts when setting an option twice References: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> <1275954730-8196-2-git-send-email-aliguori@us.ibm.com> <4C0DF69D.4040306@redhat.com> <4C0E1C3B.9020701@redhat.com> In-Reply-To: <4C0E1C3B.9020701@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Glauber Costa , Gerd Hoffmann , qemu-devel@nongnu.org On 06/08/2010 05:32 AM, Paolo Bonzini wrote: > On 06/08/2010 09:51 AM, Gerd Hoffmann wrote: >> On 06/08/10 01:51, Anthony Liguori wrote: >>> Right now, if you set a QemuOpts option in a section twice, when >>> you get the option you'll receive the value that was set the first >>> time. This is less than ideal because if you're manipulating >>> options in two places like a global config followed by the command >>> line, you really want the later to override the former. >>> >>> This patch fixes this behavior. >> >> Note that this reverses the ordering for users which want multiple >> values (slirp forwarding for example). > > And qemu_opt_find seems to have thought about this too: > > static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name) > { > QemuOpt *opt; > > QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { > if (strcmp(opt->name, name) != 0) > continue; > return opt; > } > return NULL; > } > > Can you show the behavior with commandline arguments only? The problem I was trying to address can be seen with something like: -drive file=foo.img,if=virtio,file=bar.img You get no error, and foo.img is what gets used. It's fair to argue this is a silly use case but what I'm trying to achieve is to make it possible to do: -drive file=foo.img,if=virtio,id=bar -drive file=bar.img,id=bar Or more specifically: foo.conf: [drive] file=foo.img if=virtio id=bar qemu -readconfig foo.conf -drive file=bar.img,id=bar IMHO, what's specified next on the command line ought to override what's in the config. Suggestions how to achieve this in a more elegant way would be appreciated. Regards, Anthony Liguori > Paolo >