From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXt9q-0002os-M4 for qemu-devel@nongnu.org; Mon, 03 Aug 2009 04:44:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXt9m-0002nV-RX for qemu-devel@nongnu.org; Mon, 03 Aug 2009 04:44:38 -0400 Received: from [199.232.76.173] (port=56058 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXt9m-0002nP-Lg for qemu-devel@nongnu.org; Mon, 03 Aug 2009 04:44:34 -0400 Received: from mx2.redhat.com ([66.187.237.31]:57670) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MXt9m-0005fm-2Y for qemu-devel@nongnu.org; Mon, 03 Aug 2009 04:44:34 -0400 Message-ID: <4A76A36C.6070209@redhat.com> Date: Mon, 03 Aug 2009 10:44:28 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 05/10] QemuOpts: add -set option References: <1249035941-4562-1-git-send-email-kraxel@redhat.com> <1249035941-4562-6-git-send-email-kraxel@redhat.com> <4A732385.1030806@codemonkey.ws> In-Reply-To: <4A732385.1030806@codemonkey.ws> 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: Anthony Liguori Cc: qemu-devel@nongnu.org On 07/31/09 19:01, Anthony Liguori wrote: > Gerd Hoffmann wrote: >> One use case will be file for drives (no filename quoting issues), i.e. >> >> -drive id=test,if=virtio >> -set drive.test.file=/vmdisk/test-virtio.img >> >> It will work for any other option (assuming handled by QemuOpts) though. >> Except for id= for obvious reasons ;). > > How can we make it work for id? Do we want to? > That is, it would be good to be able to fully define the drive via -set. > I think this is necessary to introduce a config file. Here is a short writeup how IDs are handled in the current implementation: -drive params creates a new drive without id. You can't use -set with that one. -drive params,id=foo creates a new drive named 'foo'. Trying to create another one named 'foo' doesn't work, qemu will complain that it already exists. -set drive.foo.param=value configure the (existing) drive foo. So you need '-drive id=something' as minimum to create a new drive, then you can set all parameters via -set if you want. Ordering of the command line options is important, the -drive switch which creates the new drive must come first. This all isn't set in stone, it can be changed without too much effort. We can make -set silently create a new drive in case the used id doesn't exist. We can allow two -drive switches with the same id, so you could do -drive id=foo,if=scsi -drive id=foo,unit=3 and have the same effect as -drive id=foo,id=scsi,unit=3. I just found the current behavior most useful for the command line. If you mistype an ID you most likely get a useful error message from the parser for example. A config file is a completely different story, the config file parser can implement different behavior. It also depends on the config file format of course. We could use git-style: [drive "foo"] if=scsi unit=3 file=/path/to/image In that case we don't have that problem in the first place ;) We could use somthing simliar to -set, i.e. drive.foo.if = scsi drive.foo.unit = 4 drive.foo.file = /path/to/image Then the parser will of course create drive "foo" when it finds config entries for it. cheers, Gerd