Received: from eggs.gnu.org ([2001:4830:134:3::10]:37589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUyFq-00045r-GB for qemu-devel@nongnu.org; Thu, 27 Aug 2015 10:34:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUyFk-0000wz-H4 for qemu-devel@nongnu.org; Thu, 27 Aug 2015 10:34:14 -0400 Received: from mail-qg0-x231.google.com ([2607:f8b0:400d:c04::231]:34478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUyFk-0000wq-Bz for qemu-devel@nongnu.org; Thu, 27 Aug 2015 10:34:08 -0400 Received: by qgeg42 with SMTP id g42so11931288qge.1 for ; Thu, 27 Aug 2015 07:34:08 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <55DF1884.2030608@redhat.com> Date: Thu, 27 Aug 2015 10:34:05 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <441C227A-2CF0-43AE-AC7F-B066708CEABD@gmail.com> <87fv36j9j6.fsf@blackfin.pond.sub.org> <20150826172550.GJ11016@localhost.localdomain> <20150826180815.GK11016@localhost.localdomain> <20150826220151.GA2669@localhost.localdomain> <2CB0CE30-A638-4933-A1D6-F65CA4910E61@gmail.com> <20150827123234.GB2669@localhost.localdomain> <56530C98-D6B3-417E-BB58-E29412283BF1@gmail.com> <20150827134943.GS24486@redhat.com> <37557843-A1BA-4822-9933-B0B8AD588C90@gmail.com> <55DF1884.2030608@redhat.com> Subject: Re: [Qemu-devel] Should we auto-generate IDs? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Jeff Cody , Markus Armbruster , qemu-devel qemu-devel , Paolo Bonzini , jsnow@redhat.com, =?iso-8859-1?Q?Andreas_F=E4rber?= On Aug 27, 2015, at 10:02 AM, Eric Blake wrote: > On 08/27/2015 07:56 AM, Programmingkid wrote: >=20 >>> If we did have auto-generated names, we would need to come up with a >>> scheme that is not going to clash with any existing naming that = users >>> of QEMU may already be doing, otherwise we risk causing a = regression. >>> Something as simple as what you suggest has non-trivial chance of >>> clashing. >>=20 >> Actually there is a way to prevent clashing. When QEMU auto-generates = a >> name, it could scan all the ID's to see if there is a clash. If the = ID is already >> taken, just increment the ID until it is detected to be unique. The = previous >> threads on this subject has patches that did just that. This means = that a >> ID scheme that is just a single number would work without clashes.=20 >=20 > No, because you cannot predict what FUTURE names the user will = request. > The name generated by qemu must be IMPOSSIBLE to request manually, and > not just one that happens not to clash at the current moment. If I add a device with an ID that is taken, QEMU can just say sorry that = ID is already taken. I could just increment the ID myself until I find one that is = unique. It is a simple algorithm. Maybe you are talking about some program that has hard = coded ID's it depends on. If that is the case, perhaps this management program = could be made to be a little flexible. Or use a 160-bit SHA-1 generated ID that = is virtually guaranteed to always be unique. What about this scenario. There are 1 million devices added to QEMU, and = I need to add a device with an ID. Each of the 1 million devices already have an = ID. If I don't want to try to find a unique ID myself, having QEMU do it for me would make = things much easier. How would I find this device's ID? I could issue some kind of monitor = command that gives me the ID. This feature doesn't appear to be implemented yet. This will = change. A future ' info all-devices ' command would probably do it.=