]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: export container=lxc-libvirt for systemd
authorEric Blake <eblake@redhat.com>
Tue, 24 Jan 2012 18:51:01 +0000 (11:51 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 25 Jan 2012 15:25:37 +0000 (08:25 -0700)
Systemd detects containers based on whether they have
an environment variable starting with 'container=lxc';
using a longer name fits the expectations, while also
allowing detection of who created the container.

Requested by Lennart Poettering, in response to
https://bugs.freedesktop.org/show_bug.cgi?id=45175

* src/lxc/lxc_container.c (lxcContainerBuildInitCmd): Add another
env-var.

src/lxc/lxc_container.c

index dcd65efe34b4f8285961e1dead6fd509058e0334..6eb188d3287b5e656338d36b37dccdd6bd5ddc83 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2011 Red Hat, Inc.
+ * Copyright (C) 2008-2012 Red Hat, Inc.
  * Copyright (C) 2008 IBM Corp.
  *
  * lxc_container.c: file description
@@ -119,6 +119,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef)
 
     virCommandAddEnvString(cmd, "PATH=/bin:/sbin");
     virCommandAddEnvString(cmd, "TERM=linux");
+    virCommandAddEnvString(cmd, "container=lxc-libvirt");
     virCommandAddEnvPair(cmd, "LIBVIRT_LXC_UUID", uuidstr);
     virCommandAddEnvPair(cmd, "LIBVIRT_LXC_NAME", vmDef->name);
     if (vmDef->os.cmdline)