* [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
@ 2008-07-28 13:25 Chris Lalancette
2008-08-05 13:43 ` Gerd Hoffmann
0 siblings, 1 reply; 6+ messages in thread
From: Chris Lalancette @ 2008-07-28 13:25 UTC (permalink / raw)
To: qemu-devel; +Cc: gleb
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
As suggested by Anthony, this patch and the next one were split apart. This
patch just adds the basic plumbing to qemu to be able to set the uuid on the
command-line, and retrieve the information via "info uuid".
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Cc: Gleb Natapov <gleb@qumranet.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
[-- Attachment #2: qemu-dmi-uuid-2.patch --]
[-- Type: text/x-patch, Size: 5263 bytes --]
diff -urp qemu.patch1/configure qemu.patch2/configure
--- qemu.patch1/configure 2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/configure 2008-07-28 14:18:47.000000000 +0200
@@ -108,6 +108,7 @@ uname_release=""
curses="yes"
nptl="yes"
mixemu="no"
+uuid="yes"
# OS specific
targetos=`uname -s`
@@ -271,6 +272,8 @@ for opt do
;;
--fmod-inc=*) fmod_inc="$optarg"
;;
+ --disable-uuid) uuid="no"
+ ;;
--audio-card-list=*) audio_card_list="$optarg"
;;
--audio-drv-list=*) audio_drv_list="$optarg"
@@ -433,6 +436,7 @@ echo " --enable-darwin-user enable
echo " --disable-darwin-user disable all darwin usermode emulation targets"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
+echo " --disable-uuid disable UUID support"
echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
echo " --disable-vde disable support for vde network"
@@ -851,6 +855,19 @@ EOF
fi
fi # test "$curses"
+##########################################
+# uuid library
+if test "$uuid" = "yes" ; then
+ uuid=no
+ cat > $TMPC << EOF
+#include <uuid/uuid.h>
+int main(void) { uuid_t u; return 0; }
+EOF
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC -luuid 2> /dev/null ; then
+ uuid=yes
+ fi
+fi # test "$uuid"
+
# Check if tools are available to build documentation.
if [ -x "`which texi2html 2>/dev/null`" ] && \
[ -x "`which pod2man 2>/dev/null`" ]; then
@@ -922,6 +939,7 @@ echo "Documentation $build_docs"
echo "uname -r $uname_release"
echo "NPTL support $nptl"
echo "vde support $vde"
+echo "UUID Support $uuid"
if test $sdl_too_old = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1122,6 +1140,10 @@ if test "$vnc_tls" = "yes" ; then
echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
echo "#define CONFIG_VNC_TLS 1" >> $config_h
fi
+if test "$uuid" = "yes" ; then
+ echo "CONFIG_UUID=yes" >> $config_mak
+ echo "#define CONFIG_UUID 1" >> $config_h
+fi
qemu_version=`head $source_path/VERSION`
echo "VERSION=$qemu_version" >>$config_mak
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
diff -urp qemu.patch1/Makefile.target qemu.patch2/Makefile.target
--- qemu.patch1/Makefile.target 2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/Makefile.target 2008-07-28 14:18:47.000000000 +0200
@@ -515,6 +515,10 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
LIBS += $(CONFIG_VNC_TLS_LIBS)
endif
+ifdef CONFIG_UUID
+LIBS += -luuid
+endif
+
# SCSI layer
OBJS+= lsi53c895a.o esp.o
diff -urp qemu.patch1/monitor.c qemu.patch2/monitor.c
--- qemu.patch1/monitor.c 2008-07-28 12:11:23.000000000 +0200
+++ qemu.patch2/monitor.c 2008-07-28 15:08:56.000000000 +0200
@@ -1363,6 +1363,20 @@ static void do_inject_nmi(int cpu_index)
}
#endif
+static void do_info_uuid(void)
+{
+ extern char *qemu_uuid;
+#ifdef CONFIG_UUID
+ term_printf("uuid: ");
+ if (qemu_uuid == NULL)
+ term_printf("Not set\n");
+ else
+ term_printf("%s\n", qemu_uuid);
+#else
+ term_printf("uuid support: not compiled\n");
+#endif
+}
+
static term_cmd_t term_cmds[] = {
{ "help|?", "s?", do_help,
"[cmd]", "show the help" },
@@ -1502,6 +1516,7 @@ static term_cmd_t info_cmds[] = {
{ "slirp", "", do_info_slirp,
"", "show SLIRP statistics", },
#endif
+ { "uuid", "", do_info_uuid, "", "show UUID information" },
{ NULL, NULL, },
};
diff -urp qemu.patch1/vl.c qemu.patch2/vl.c
--- qemu.patch1/vl.c 2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/vl.c 2008-07-28 14:18:47.000000000 +0200
@@ -252,6 +252,8 @@ static int64_t qemu_icount_bias;
QEMUTimer *icount_rt_timer;
QEMUTimer *icount_vm_timer;
+const char *qemu_uuid;
+
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
/***********************************************************/
@@ -7574,6 +7576,10 @@ static void help(int exitcode)
"-no-shutdown stop before shutdown\n"
"-loadvm [tag|id] start right away with a saved state (loadvm in monitor)\n"
"-vnc display start a VNC server on display\n"
+#ifdef CONFIG_UUID
+ "-uuid %%08x-%%04x-%%04x-%%012x\n"
+ " specify machine UUID\n"
+#endif
#ifndef _WIN32
"-daemonize daemonize QEMU after initializing\n"
#endif
@@ -7690,6 +7696,7 @@ enum {
QEMU_OPTION_clock,
QEMU_OPTION_startdate,
QEMU_OPTION_tb_size,
+ QEMU_OPTION_uuid,
QEMU_OPTION_icount,
};
@@ -7779,6 +7786,9 @@ const QEMUOption qemu_options[] = {
#ifdef CONFIG_CURSES
{ "curses", 0, QEMU_OPTION_curses },
#endif
+#ifdef CONFIG_UUID
+ { "uuid", HAS_ARG, QEMU_OPTION_uuid },
+#endif
/* temporary options */
{ "usb", 0, QEMU_OPTION_usb },
@@ -8553,6 +8563,11 @@ int main(int argc, char **argv)
case QEMU_OPTION_daemonize:
daemonize = 1;
break;
+#ifdef CONFIG_UUID
+ case QEMU_OPTION_uuid:
+ qemu_uuid = optarg;
+ break;
+#endif
case QEMU_OPTION_option_rom:
if (nb_option_roms >= MAX_OPTION_ROMS) {
fprintf(stderr, "Too many option ROMs\n");
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
2008-07-28 13:25 [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu Chris Lalancette
@ 2008-08-05 13:43 ` Gerd Hoffmann
2008-08-05 13:53 ` Gleb Natapov
2008-08-05 13:53 ` Chris Lalancette
0 siblings, 2 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2008-08-05 13:43 UTC (permalink / raw)
To: qemu-devel; +Cc: gleb
Chris Lalancette wrote:
> As suggested by Anthony, this patch and the next one were split apart. This
> patch just adds the basic plumbing to qemu to be able to set the uuid on the
> command-line, and retrieve the information via "info uuid".
What is the point of CONFIG_UUID and the libuuid test in that patch?
I can't see any dependency on it in the source code. IMHO the -uuid
switch should be present unconditionally.
Oh, and I'd like to see a cleaned up patch merged soon, even if the qemu
<=> bochs bios communication path isn't worked out yet. I need the uuid
for xen support too.
cheers,
Gerd
PS: Anyone knows a way to make thunderbird include inline attachments in
the reply, so I can comment the patches better?
--
http://kraxel.fedorapeople.org/xenner/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
2008-08-05 13:43 ` Gerd Hoffmann
@ 2008-08-05 13:53 ` Gleb Natapov
2008-08-05 14:36 ` Andreas Färber
2008-08-05 13:53 ` Chris Lalancette
1 sibling, 1 reply; 6+ messages in thread
From: Gleb Natapov @ 2008-08-05 13:53 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Tue, Aug 05, 2008 at 03:43:39PM +0200, Gerd Hoffmann wrote:
> Chris Lalancette wrote:
> > As suggested by Anthony, this patch and the next one were split apart. This
> > patch just adds the basic plumbing to qemu to be able to set the uuid on the
> > command-line, and retrieve the information via "info uuid".
>
> What is the point of CONFIG_UUID and the libuuid test in that patch?
> I can't see any dependency on it in the source code. IMHO the -uuid
> switch should be present unconditionally.
Here is the patch series where there is no CONFIG_UUID test (was posted
here two month ago):
http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00443.html
http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00444.html
And this one checks for libuuid and uses it for random uuid generation if
available (UUID should be RFC compliant):
http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00446.html
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
2008-08-05 13:43 ` Gerd Hoffmann
2008-08-05 13:53 ` Gleb Natapov
@ 2008-08-05 13:53 ` Chris Lalancette
2008-08-05 14:32 ` Gerd Hoffmann
1 sibling, 1 reply; 6+ messages in thread
From: Chris Lalancette @ 2008-08-05 13:53 UTC (permalink / raw)
To: qemu-devel; +Cc: gleb
Gerd Hoffmann wrote:
> Chris Lalancette wrote:
>> As suggested by Anthony, this patch and the next one were split apart. This
>> patch just adds the basic plumbing to qemu to be able to set the uuid on the
>> command-line, and retrieve the information via "info uuid".
>
> What is the point of CONFIG_UUID and the libuuid test in that patch?
> I can't see any dependency on it in the source code. IMHO the -uuid
> switch should be present unconditionally.
Hm, CONFIG_UUID is used, for instance, to control whether we output the -uuid
part of the help string. There are other uses in the patch as well.
I think the problem with including it unconditionally is that it drags in the
uuid library, which may or may not always be available. Now, as far as I can
tell, that library comes with e2fsprogs, so basically any Linux system will have
it, but that might not be the case for other OS's.
Chris Lalancette
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
2008-08-05 13:53 ` Chris Lalancette
@ 2008-08-05 14:32 ` Gerd Hoffmann
0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2008-08-05 14:32 UTC (permalink / raw)
To: qemu-devel; +Cc: gleb
Chris Lalancette wrote:
> Gerd Hoffmann wrote:
>> Chris Lalancette wrote:
>>> As suggested by Anthony, this patch and the next one were split apart. This
>>> patch just adds the basic plumbing to qemu to be able to set the uuid on the
>>> command-line, and retrieve the information via "info uuid".
>> What is the point of CONFIG_UUID and the libuuid test in that patch?
>> I can't see any dependency on it in the source code. IMHO the -uuid
>> switch should be present unconditionally.
>
> Hm, CONFIG_UUID is used, for instance, to control whether we output the -uuid
> part of the help string. There are other uses in the patch as well.
Sure.
> I think the problem with including it unconditionally is that it drags in the
> uuid library, which may or may not always be available.
Does it? As far I can see none of the bits wrapped into #ifdef
CONFIG_UUID actually calls that library.
If you wanna do stuff like generating a uuid in case none was specified
on the command line, _then_ you'll need libuuid and those parts should
be compiled conditionally. I don't see the point for the -uuid cmd line
switch though.
Gleb's patches seem to have organized things this way according to his
reply (didn't check list archive).
cheers,
Gerd
--
http://kraxel.fedorapeople.org/xenner/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
2008-08-05 13:53 ` Gleb Natapov
@ 2008-08-05 14:36 ` Andreas Färber
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Färber @ 2008-08-05 14:36 UTC (permalink / raw)
To: qemu-devel, Gleb Natapov; +Cc: Gerd Hoffmann
Am 05.08.2008 um 15:53 schrieb Gleb Natapov:
> On Tue, Aug 05, 2008 at 03:43:39PM +0200, Gerd Hoffmann wrote:
>> Chris Lalancette wrote:
>>> As suggested by Anthony, this patch and the next one were split
>>> apart. This
>>> patch just adds the basic plumbing to qemu to be able to set the
>>> uuid on the
>>> command-line, and retrieve the information via "info uuid".
>>
>> What is the point of CONFIG_UUID and the libuuid test in that patch?
>> I can't see any dependency on it in the source code. IMHO the -uuid
>> switch should be present unconditionally.
> Here is the patch series where there is no CONFIG_UUID test (was
> posted
> here two month ago):
> http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00443.html
> http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00444.html
>
> And this one checks for libuuid and uses it for random uuid
> generation if
> available (UUID should be RFC compliant):
> http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00446.html
It seemed general consensus that we don't want values randomly
generated at runtime in QEMU, rather having some constant, widely
acceptable value and leaving it to either management tools or the user
determining them. There was a long discussion about this topic before,
concerning IPv4 subnets.
I don't really see a use case where we'd want a universally unique ID
generated by QEMU at runtime either - it would seem better to generate
it using some external tool (e.g., uuidgen or GUIDgen) and then pass
the same value as command line argument (or config file option) to a
certain virtual machine. After all it's supposed to be unique and not
changing with each QEMU invocation.
Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-08-05 14:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28 13:25 [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu Chris Lalancette
2008-08-05 13:43 ` Gerd Hoffmann
2008-08-05 13:53 ` Gleb Natapov
2008-08-05 14:36 ` Andreas Färber
2008-08-05 13:53 ` Chris Lalancette
2008-08-05 14:32 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).