qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] If user doesn't specify a uuid, generate a


From: Serge E. Hallyn
Subject: Re: [Qemu-devel] [PATCH 1/1] If user doesn't specify a uuid, generate a random one
Date: Mon, 26 Mar 2012 19:35:18 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

Quoting Brian Jackson (address@hidden):
> On Mon, 26 Mar 2012 10:13:40 -0500, Serge E. Hallyn
> <address@hidden> 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 <address@hidden>
> >---
> > 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 <uuid/uuid.h>
> 
> 
> 
> This adds a hard dep on libuuid (prior to this it's optional and
> only impacts the vdi block driver).

Yup.  If that's a problem we can re-implement our own, if the
change in default behavior is acceptable.

> > 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]