]> xenbits.xensource.com Git - libvirt.git/commitdiff
Explicitly pass uml_dir argument to user-mode-linux
authorSoren Hansen <soren@linux2go.dk>
Wed, 25 Aug 2010 09:03:42 +0000 (11:03 +0200)
committerEric Blake <eblake@redhat.com>
Tue, 31 Aug 2010 16:13:05 +0000 (10:13 -0600)
uml_dir overrides user-mode-linux's default of ~/.uml. This is needed
for a couple of different reasons:

libvirt expects this to default to virGetUserDirectory(geteuid()) +
'/.uml'. However, user-mode-linux actually uses the HOME environment
variable to determine where to look for the uml sockets, but if running
libvirtd under sudo (which I routinely do during development), $HOME is
pointing at my user's homedir, while my euid is 0, so libvirt looks in
/root.

Also (and this was my actual motivation for this patch), if HOME isn't
set at all, user-mode-linux utterly fails. Looking at the code, it seems
it's meant to emit a warning, but alas, it doesn't for some reason.
If running libvirtd from upstart, HOME is not set, so any system using
upstart will need this change.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
src/uml/uml_conf.c

index 65b06c5901f9c22d62b3ac9d18c5717c137e3b93..4906192f2d690dafcdd6d9e0686de2961efed3bf 100644 (file)
@@ -409,7 +409,7 @@ static char *umlNextArg(char *args)
  * for a given virtual machine.
  */
 int umlBuildCommandLine(virConnectPtr conn,
-                        struct uml_driver *driver ATTRIBUTE_UNUSED,
+                        struct uml_driver *driver,
                         virDomainObjPtr vm,
                         fd_set *keepfd,
                         const char ***retargv,
@@ -499,7 +499,6 @@ int umlBuildCommandLine(virConnectPtr conn,
     ADD_ENV_COPY("LD_PRELOAD");
     ADD_ENV_COPY("LD_LIBRARY_PATH");
     ADD_ENV_COPY("PATH");
-    ADD_ENV_COPY("HOME");
     ADD_ENV_COPY("USER");
     ADD_ENV_COPY("LOGNAME");
     ADD_ENV_COPY("TMPDIR");
@@ -508,6 +507,7 @@ int umlBuildCommandLine(virConnectPtr conn,
     //ADD_ARG_PAIR("con0", "fd:0,fd:1");
     ADD_ARG_PAIR("mem", memory);
     ADD_ARG_PAIR("umid", vm->def->name);
+    ADD_ARG_PAIR("uml_dir", driver->monitorDir);
 
     if (vm->def->os.root)
         ADD_ARG_PAIR("root", vm->def->os.root);