- 27 Jun, 2013 1 commit
-
-
Andrew Gilbert authored
When lxc-netstat was called by lxc-unshare, it would be given the arguments intended for netstat from the first invocation, but without anything to separate them from the arguments intended for lxc-netstat. This meant that netstat arguments like -n would result in lxc-netstat trying to process them. Signed-off-by:
Andrew Gilbert <andrewg800@gmail.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 24 Jun, 2013 2 commits
-
-
Serge Hallyn authored
In the best case we'll get errors about failing to remove it. In the worst case we'll be trying to delete the original container's rootfs. Reported-by:
zoolook <nbensa+lxcusers@gmail.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
When updating container names in hook files during a container clone, we substitute the new container name for the old any time the old name shows up as a separate word. This patch adds the four characters '.,_-' as additional delimiters. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 19 Jun, 2013 1 commit
-
-
Stéphane Graber authored
The timeout option in get_ips has been deprecated, so work around it. Signed-off-by:Stéphane Graber <stgraber@ubuntu.com>
-
- 18 Jun, 2013 1 commit
-
-
Serge Hallyn authored
The reason is that the generic code which handles reading lxc.rootfs.mount always frees the old value if not NULL. So without this setting lxc.rootfs.mount = /mnt causes segfault. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 13 Jun, 2013 1 commit
-
-
Serge Hallyn authored
Currently due to some safety checks for !rootfs.path, lxc-execute works ok if you do not set lxc.rootfs at all in your lxc.conf. But if you set lxc.rootfs = '/', then it sets up console, and when you do an lxc-execute, the console appears hung. However the lxc.rootfs NULL check was just incidental to not dereference a NULL pointer. In fact we should not be setting up a console if the container isn't running a full-fledged distro with a getty/login running on the container's /dev/console. Have lxc_execute() mark in lxc_conf that this is a lxc-execute and not an lxc-start, and don't set up the console. The issue is documented at https://sourceforge.net/p/lxc/bugs/67/ . Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com> Acked-by:
Dwight Engen <dwight.engen@oracle.com>
-
- 12 Jun, 2013 2 commits
-
-
Dwight Engen authored
Add a higher level console API that opens a tty/console and runs the mainloop as well. Rename existing API to console_getfd(). Use these in the python binding. Allow attaching a console peer after container bootup, including if the container was launched with -d. This is made possible by allocation of a "proxy" pty as the peer when the console is attached to. Improve handling of SIGWINCH, the pty size will be correctly set at the beginning of a session and future changes when using the lxc_console() API will be propagated to it as well. Refactor some common code between lxc_console.c and console.c. The variable wait4q (renamed to saw_escape) was static, making the mainloop callback not safe across threads. This wasn't a problem when the callback was in the non-threaded lxc-console, but now that it is internal to console.c, we have to take care of it. This is now contained in a per-tty state structure. Don't attempt to open /dev/null as the console peer since /dev/null cannot be added to the mainloop (epoll_ctl() fails with EPERM). This isn't needed to get the console setup (and the log to work) since the case of not having a peer at console init time has to be handled to allow for attaching to it later. Move signalfd libc wrapper/replacement to utils.h. Signed-off-by:
Dwight Engen <dwight.engen@oracle.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Natanael Copa authored
The 'lxc-init' (a lightweight init process used by lxc-execute in place of upstart etc) tries to mount /dev/mqueue during startup. If that fails (for instance due to missing support for mqueue in kernel) then it aborts execution and returns -1. This is unreasonable as very few applications actually need /dev/mqueue. This similar to what we do with /dev/shm. Signed-off-by:
Natanael Copa <ncopa@alpinelinux.org> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 11 Jun, 2013 1 commit
-
-
Serge Hallyn authored
Currently the lxc API mutexes configuration file read/writes with a lock called $lxcpath/locks/$lxcname. This fails if the container is on a rofs. This patch moves those locks under /run/lock/lxc. The $lxcpath/$lxcname/partial file is not moved - if you can't create it, you probably can't create the container either. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
- 10 Jun, 2013 6 commits
-
-
Serge Hallyn authored
I originally forgot to set ret = 0 if it succeeded, meaning that a simple 'lxc-stop -n container1' returns failure even though the stop succeeded. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
Serge Hallyn authored
otherwise we won't be allowed to set an apparmor context (on pid 1) Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
Qiang Huang authored
Right now if we use lxc-execute without log level set, we get error: lxc: invalid log priority NOTSET. Because we set log level manually in execute_start(), but didn't check if we have a valid log level or not, so fix it. Signed-off-by:
Qiang Huang <h.huangqiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Weng Meiling authored
When we use lxc-ps to show the process, it's more appropriate to show process when container is frozen. Signed-off-by:
Weng Meiling <wengmeiling.weng@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Rui Xiang authored
Sometimes, the path of lxc tools is not '/usr/bin', but '/usr/local/bin' or other. Then execvp lxc-monitord will fail in lxc_monitord_spawn. Signed-off-by:
Rui Xiang <rui.xiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Dwight Engen authored
Signed-off-by:
Dwight Engen <dwight.engen@oracle.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 05 Jun, 2013 2 commits
-
-
Serge Hallyn authored
flock is not supported on nfs. fcntl is at least supported on newer (v3 and above) nfs. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Tested-by:
zoolook <nbensa+lxcusers@gmail.com>
-
Weng Meiling authored
When we use arg --lxc to show processes in all containers, no process displays, so fix it. (Changelog: Serge: in-line fix of s/;;/;/ at line 69) Signed-off-by:
Weng Meiling <wengmeiling.weng@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 03 Jun, 2013 7 commits
-
-
Serge Hallyn authored
Create a loopfile backed container by doing: lxc-create -B loop -t template -n name or lxc-clone -B loop -o dir1 -n loop1 The rootfs in the configuration file will be loop:/var/lib/lxc/loop1/rootdev Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
With the lxc-create script, 'lxc-create -t template -h' used to call 'template -h' to get template-specific help. The api based lxc-create did not yet support that. Add a 'helpfn' method to the lxc_arguments, which is called at the end of printhelp, and passed the lxc_arguments. Use that in lxc_create to reintroduce the desired behavior. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Qiang Huang authored
Changelog: jun 3: (Serge) trivial typo fix inline. Signed-off-by:
Qiang Huang <h.huangqiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Qiang Huang authored
Fix typo in help info of lxc-create, and get rid of duplicate comments in bdev.h Signed-off-by:
Qiang Huang <h.huangqiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Qiang Huang authored
We should return -ENOMEM instead of ENOMEM when realloc fails. Signed-off-by:
Qiang Huang <h.huangqiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
Otherwise we can't see template progress. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Natanael Copa authored
If the package manager, apk-tools is missing, then: - download a static binary and public keys - verify the keys against embedded checksum - verify the signature of the static binary against the downloaded keys - use the verified static binary Signed-off-by:
Natanael Copa <ncopa@alpinelinux.org> Signed-off-by:
Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 31 May, 2013 4 commits
-
-
Serge Hallyn authored
And use it in place of the various ways we were deducing /etc/lxc/default.conf. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
Serge Hallyn authored
configure/makefile: rename default_conf to distro_conf, since it is a per-distro default. Then we'll be able to use the symbol LXC_DEFAULT_CONF in the code to refer to the installed file. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
Serge Hallyn authored
Update the LOCKING comment. Take mem_lock in want_daemonize. convert lxcapi_destroy to not use privlock/slock by hand. Fix a coverity-found potential dereference of NULL c->lxc_conf. api_cgroup_get_item() and api_cgroup_set_item(): use disklock, not memlock, since the values are set through the cgroup fs on the running container. Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Stéphane Graber <stgraber@ubuntu.com>
-
Serge Hallyn authored
If we abort the container start, and don't wait for the init task to be reaped after we kill it, then we can't remove the container cgroup because it is not empty. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 29 May, 2013 4 commits
-
-
Serge Hallyn authored
Those go through commands.c and are already mutex'ed that way. Also remove a unmatched container_disk_unlock in lxcapi_create. Since is_stopped uses getstate which is no longer locked, rename it to drop the _locked suffix. And convert save_config to taking the disk lock. This way the save_ and load_config are mutexing each other, as they should. Changelog: May 29: Per Dwight's comment, take the lock before opening the config FILE *. Only take disklock at load and save_config when we're using the container's config file, not when read/writing from/to another file. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Dwight Engen <dwight.engen@oracle.com>
-
Dwight Engen authored
Make lxc_cmd_console() return the fd from the socket connection to the caller. This fd keeps the tty slot allocated until the caller closes it. Returning the fd allows for a long lived process to close the fd and reuse consoles. Add API function for console allocation. Create test program for console API. Signed-off-by:
Dwight Engen <dwight.engen@oracle.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Qiang Huang authored
We should use the fd specified by caller. Signed-off-by:
Qiang Huang <h.huangqiang@huawei.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
Dwight Engen authored
Signed-off-by:
Dwight Engen <dwight.engen@oracle.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 28 May, 2013 2 commits
-
-
Serge Hallyn authored
Technically as Dwight has mentioned we should probably drop the locking from api_state() altogether, since those are protected through the lxc command system. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 26 May, 2013 1 commit
-
-
Serge Hallyn authored
1. implement bdev->create: python and lua: send NULL for bdevtype and bdevspecs. They'll want to be updated to pass those in in a way that makes sense, but I can't think about that right now. 2. templates: pass --rootfs If the container is backed by a device which must be mounted (i.e. lvm) then pass the actual rootfs mount destination to the templates. Note that the lxc.rootfs can be a mounted block device. The template should actually be installing the rootfs under the path where the lxc.rootfs is *mounted*. Still, some people like to run templates by hand and assume purely directory backed containers, so continue to support that use case (i.e. if no --rootfs is listed). Make sure the templates don't re-write lxc.rootfs if it is already in the config. (Most were already checking for that) 3. Replace lxc-create script with lxc_create.c program. Changelog: May 24: when creating a container, create $lxcpath/$name/partial, and flock it. When done, close that file and unlink it. In lxc_container_new() and lxcapi_start(), check for this file. If it is locked, create is ongoing. If it exists but is not locked, create() was killed - remove the container. May 24: dont disk-lock during lxcapi_create. The partial lock is sufficient. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
- 25 May, 2013 5 commits
-
-
Serge Hallyn authored
This requires implementing bdev->ops->destroy() for each of the backing store types. Then implementing lxcapi_clone(), writing lxc_destroy.c using the api, and removing the lxc-destroy.in script. (this also has a few other cleanups, like marking some functions static) Changelog: fold into destroy: fix zfs destroy destroy: use correct program name in help Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
implement c->reboot(c) in the api. Also if the container is not running, return -2. Currently lxc-stop will return 0, so you cannot tell the difference between successfull stopping and noop. Per stgraber's email: - Remove lxc-shutdown - Change lxc-stop so that: * Default behaviour is to call shutdown(), wait 15s for STOPPED, if not STOPPED, print a message to the user and call stop() [ NOTE: actually 60 seconds per followup thread] * We have a -r option to reboot the container (with proper check that the container indeed rebooted within the next 15s) * We have a -s option to shutdown the container without the automatic fallback to stop() * Add a -k option allowing a user to just kill a container (equivalent to old lxc-stop, no shutdown() call and no delay). and update manpages. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Serge Hallyn authored
Create three pairs of functions: int process_lock(void); void process_unlock(void); int container_mem_lock(struct lxc_container *c) void container_mem_unlock(struct lxc_container *c) int container_disk_lock(struct lxc_container *c); void container_disk_unlock(struct lxc_container *c); and use those in lxccontainer.c process_lock() is to protect the process state among multiple threads. container_mem_lock() is to protect a struct container among multiple threads. container_disk_lock is to protect a container on disk. Also remove the lock in lxcapi_init_pid() as Dwight suggested. Fix a typo (s/container/contain) spotted by Dwight. More locking fixes are needed, but let's first the the fundamentals right. How close does this get us? Changelog: v2: fix lxclock compile Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by:
Dwight Engen <dwight.engen@oracle.com>
-
Serge Hallyn authored
The problem: if a task is killed while holding a posix semaphore, there appears to be no way to have the semaphore be reliably autmoatically released. The only trick which seemed promising is to store the pid of the lock holder in some file and have later lock seekers check whether that task has died. Instead of going down that route, this patch switches from a named posix semaphore to flock. The advantage is that when the task is killed, its fds are closed and locks are automatically released. The disadvantage of flock is that we can't rely on it to exclude threads. Therefore c->slock must now always be wrapped inside c->privlock. This patch survived basic testing with the lxcapi_create patchset, where now killing lxc-create while it was holding the lock did not lock up future api commands. Signed-off-by:Serge Hallyn <serge.hallyn@ubuntu.com>
-
Dwight Engen authored
There were several memory leaks in the cgroup functions, notably in the success cases. The cgpath test program was refactored and additional tests added to it. It was used in various modes under valgrind to test that the leaks were fixed. Simplify lxc_cgroup_path_get() and cgroup_path_get by having them return a char * instead of an int and an output char * argument. The only return values ever used were -1 and 0, which are now handled with NULL and non-NULL returns respectively. Use consistent variable names of cgabspath when refering to an absolute path to a cgroup subsystem or file, and cgrelpath when refering to a container "group/name" within the cgroup heirarchy. Remove unused subsystem argument to lxc_cmd_get_cgroup_path(). Remove unused #define MAXPRIOLEN Make template arg to lxcapi_create() const Signed-off-by:
Dwight Engen <dwight.engen@oracle.com> Signed-off-by:
Serge Hallyn <serge.hallyn@ubuntu.com>
-