From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCFqK-0003j2-Ek for qemu-devel@nongnu.org; Mon, 26 Mar 2012 15:44:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCFqI-0005Il-IA for qemu-devel@nongnu.org; Mon, 26 Mar 2012 15:44:39 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:39208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCFqI-0005IY-Dt for qemu-devel@nongnu.org; Mon, 26 Mar 2012 15:44:38 -0400 Received: by yhoo21 with SMTP id o21so5133384yho.4 for ; Mon, 26 Mar 2012 12:44:36 -0700 (PDT) Message-ID: <4F70C722.9040902@codemonkey.ws> Date: Mon, 26 Mar 2012 14:44:34 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <20120326151340.GA25460@mail.hallyn.com> In-Reply-To: <20120326151340.GA25460@mail.hallyn.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/1] If user doesn't specify a uuid, generate a random one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Serge E. Hallyn" Cc: qemu-devel@nongnu.org On 03/26/2012 10:13 AM, Serge E. Hallyn wrote: > Currently, if the user doesn't pass a uuid, the system uuid is set to > all zeros. This patch generates a random one instead. > > Is there a reason to prefer all zeros? If not, can a patch like this > one be applied? > > Signed-off-by: Serge Hallyn The other hypervisors don't have a concept of a transient guest like QEMU does. There is no state preserved between invocations of QEMU. Setting a random UUID doesn't seem like the right answer to me as it would potentially break Windows VMs. Perhaps if the DMI UUID isn't set, you could look at the root filesystem's UUID? Not all platforms have a notion of platform UUID so as Ubuntu supports more architectures, this problem would have to be dealt with eventually. Regards, Anthony Liguori > --- > vl.c | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/vl.c b/vl.c > index 112b0e0..2b53b62 100644 > --- a/vl.c > +++ b/vl.c > @@ -247,7 +247,9 @@ int nb_numa_nodes; > uint64_t node_mem[MAX_NODES]; > uint64_t node_cpumask[MAX_NODES]; > > +#include > uint8_t qemu_uuid[16]; > +bool uuid_set = false; > > static QEMUBootSetHandler *boot_set_handler; > static void *boot_set_opaque; > @@ -3030,6 +3032,7 @@ int main(int argc, char **argv, char **envp) > " Wrong format.\n"); > exit(1); > } > + uuid_set = true; > break; > case QEMU_OPTION_option_rom: > if (nb_option_roms>= MAX_OPTION_ROMS) { > @@ -3200,6 +3203,14 @@ int main(int argc, char **argv, char **envp) > exit(0); > } > > + if (!uuid_set) { > + uuid_t uuid; > + uuid_generate(uuid); > + for (i = 0; i< 16; i++) { > + qemu_uuid[i] = uuid[i]; > + } > + } > + > /* Open the logfile at this point, if necessary. We can't open the logfile > * when encountering either of the logging options (-d or -D) because the > * other one may be encountered later on the command line, changing the