From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55176 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM0YT-0003ae-Hl for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM0YP-0001bn-D4 for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:17:29 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:64222) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM0YP-0001bY-8Q for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:17:25 -0400 Received: by iwn10 with SMTP id 10so617486iwn.4 for ; Tue, 08 Jun 2010 08:17:24 -0700 (PDT) Message-ID: <4C0E5F00.30700@codemonkey.ws> Date: Tue, 08 Jun 2010 10:17:20 -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> <4C0E4096.9020705@codemonkey.ws> <4C0E4952.3040209@redhat.com> In-Reply-To: <4C0E4952.3040209@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: Gerd Hoffmann Cc: Paolo Bonzini , Glauber Costa , qemu-devel@nongnu.org On 06/08/2010 08:44 AM, Gerd Hoffmann wrote: > On 06/08/10 15:07, Anthony Liguori wrote: >>>> 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. > > Hmm. I think qemuopts need to carry information about the option > types, whenever it is single-entry or multiple-entry. > > Oh, and likewise for the sections. With multiple (unnamed) [device] > sections we want create multiple (id-less) device sections. With > multiple [machine] sections we probably want to merge the options > instead. > >> Or more specifically: >> >> foo.conf: >> >> [drive] >> file=foo.img >> if=virtio >> id=bar > > This would be '[drive "bar"]' without id= line btw. > >> 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. > > Or the user's config the global config. > > For multi-entry options this will be tricky. What do you expect to > happen here: > > global.conf > [net "user"] > type="slirp" > guestfwd= > > user.conf > [net "user"] > guestfwd= > guestfwd= > > Which forwardings will be active then? All of them? Or will the > user.conf forwardings override the global one? What'd expect is: [net "user"] guestfwd = .. I think multiple entry options are probably not a good thing to have. Regards, Anthony Liguori > cheers, > Gerd >