From patchwork Mon Mar 26 15:13:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Serge E. Hallyn" X-Patchwork-Id: 148765 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 39AC6B6EF3 for ; Tue, 27 Mar 2012 02:13:42 +1100 (EST) Received: from localhost ([::1]:52421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCBc3-0000La-FC for incoming@patchwork.ozlabs.org; Mon, 26 Mar 2012 11:13:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCBbw-0000L1-JC for qemu-devel@nongnu.org; Mon, 26 Mar 2012 11:13:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCBbq-0007so-A2 for qemu-devel@nongnu.org; Mon, 26 Mar 2012 11:13:32 -0400 Received: from 50-56-35-84.static.cloud-ips.com ([50.56.35.84]:60604 helo=mail.hallyn.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCBbq-0007rx-5z for qemu-devel@nongnu.org; Mon, 26 Mar 2012 11:13:26 -0400 Received: by mail.hallyn.com (Postfix, from userid 1000) id 7460110C75B; Mon, 26 Mar 2012 15:13:40 +0000 (UTC) Date: Mon, 26 Mar 2012 15:13:40 +0000 From: "Serge E. Hallyn" To: qemu-devel@nongnu.org Message-ID: <20120326151340.GA25460@mail.hallyn.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 50.56.35.84 Subject: [Qemu-devel] [PATCH 1/1] If user doesn't specify a uuid, generate a random one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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