Commit Graph

1589 Commits

Author SHA1 Message Date
Alexander Morozov 45cbce3e45 Merge pull request #162 from kolyshkin/mkdirall
Simplify and fix os.MkdirAll() usage
2015-07-29 19:43:34 -07:00
Kir Kolyshkin 6f82d4b544 Simplify and fix os.MkdirAll() usage
TL;DR: check for IsExist(err) after a failed MkdirAll() is both
redundant and wrong -- so two reasons to remove it.

Quoting MkdirAll documentation:

> MkdirAll creates a directory named path, along with any necessary
> parents, and returns nil, or else returns an error. If path
> is already a directory, MkdirAll does nothing and returns nil.

This means two things:

1. If a directory to be created already exists, no error is
returned.

2. If the error returned is IsExist (EEXIST), it means there exists
a non-directory with the same name as MkdirAll need to use for
directory. Example: we want to MkdirAll("a/b"), but file "a"
(or "a/b") already exists, so MkdirAll fails.

The above is a theory, based on quoted documentation and my UNIX
knowledge.

3. In practice, though, current MkdirAll implementation [1] returns
ENOTDIR in most of cases described in #2, with the exception when
there is a race between MkdirAll and someone else creating the
last component of MkdirAll argument as a file. In this very case
MkdirAll() will indeed return EEXIST.

Because of #1, IsExist check after MkdirAll is not needed.

Because of #2 and #3, ignoring IsExist error is just plain wrong,
as directory we require is not created. It's cleaner to report
the error now.

Note this error is all over the tree, I guess due to copy-paste,
or trying to follow the same usage pattern as for Mkdir(),
or some not quite correct examples on the Internet.

[1] https://github.com/golang/go/blob/f9ed2f75/src/os/path.go

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2015-07-29 18:03:27 -07:00
Mrunal Patel b40c790184 Merge pull request #159 from LK4D4/change_state_dir
Change default state directory to /run/oci
2015-07-28 18:12:29 -07:00
Mrunal Patel 9dd338f57e Merge pull request #161 from marcosnils/test_args
Add test arguments to Makefile targets
2015-07-28 18:10:20 -07:00
Alexander Morozov 11ef5bfcd9 Change default state directory to /run/oci
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-28 17:02:56 -07:00
Marcos Lilljedahl 5bc1360d89 Add TESTFLAGS to Makefile targets
This commit allows to send `go test` arguments to current makefile
`test` and `localtest` targets.

A usage example would be `make test TESTFLAGS="-run=SomeTestFunction"`
to easily run a single test function.

Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2015-07-28 19:55:44 -03:00
Mrunal Patel d6a23c7ee3 Merge pull request #158 from estesp/correct-readme
Update README.md to correct comment about spec and user
2015-07-28 08:18:35 -07:00
Phil Estes 7082ed370e Update README.md to correct comment about spec and user
Now that the generated spec (and the example above in the README) use
uid/gid and don't have the hardcoded `daemon` entry, the statement about
changing `daemon` to `root` no longer applies.  Also added a comment
about using the `runc spec` command to generate `config.json`.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-07-28 10:27:09 -04:00
Mrunal Patel 6de84a5afc Merge pull request #157 from crosbymichael/network-info
Only add network info if NEWNET is set
2015-07-27 16:50:29 -07:00
Michael Crosby 732c3e4b4a Merge pull request #156 from mrunalp/close_fix
Fix files not closed in mountinfo parsing function
2015-07-27 16:45:43 -07:00
Michael Crosby b14412ec36 Only add network info if NEWNET is set
Only add the localhost interface information to the config if the NEWNET
flag is passed on the namespaces.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-07-27 16:36:28 -07:00
Mrunal Patel 0e72bfb815 Fix files not closed in mountinfo parsing function
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-07-27 19:33:39 -04:00
Michael Crosby 6ee61aead2 Merge pull request #154 from mrunalp/signal_fix
signal: Fix leak
2015-07-27 10:35:00 -07:00
Mrunal Patel 9d281a503e signal: Fix leak
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-07-27 13:05:15 -04:00
Mrunal Patel 6c86daa6c9 Merge pull request #129 from shishir-a412ed/sd_notify
systemd integration with container runtime for supporting sd_notify protocol
2015-07-27 09:44:55 -07:00
Michael Crosby 4507c068ba Merge pull request #145 from LK4D4/sysfs_ro
Remount /sys/fs/cgroup as RO if MS_RDONLY was passed
2015-07-27 09:12:55 -07:00
Alexander Morozov 6485adffaa Merge pull request #152 from laijs/error-propagation
test: propagate the error to the caller
2015-07-25 10:15:16 -07:00
Lai Jiangshan f26935eb0c test: propagate the error to the caller
When the copyBusybox() fails, the error message should be
propagated to the caller of newRootfs().

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-07-25 22:25:43 +08:00
Mrunal Patel 016bb8aaea Merge pull request #147 from fabiokung/loopback-up
bring the loopback interface up inside containers
2015-07-24 09:50:51 -07:00
Mrunal Patel 32aa2756ca Merge pull request #148 from jhjeong-kr/typo
typo: tempory -> temporary
2015-07-23 20:46:12 -07:00
Jin-Hwan Jeong 491cfef259 typo: tempory -> temporary
Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
2015-07-24 11:19:25 +09:00
Fabio Kung 963fc63fca bring the loopback interface up
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
2015-07-23 19:07:24 -07:00
Mrunal Patel dfc8d4aa26 Merge pull request #138 from crosbymichael/maintainers
Update maintainers guide
2015-07-23 09:38:56 -07:00
Shishir Mahajan 27bfd1e2d1 systemd integration with container runtime for supporting sd_notify protocol
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2015-07-22 15:53:26 -04:00
Alexander Morozov d89964eed3 Remount /sys/fs/cgroup as RO if MS_RDONLY was passed in m.Flags
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-22 11:05:40 -07:00
Alexander Morozov 1ed929f177 Merge pull request #114 from brahmaroutu/gccgo_stacktrace_loops
avoid infinite loop with GCCGO
2015-07-21 11:05:09 -07:00
Michael Crosby 77692920fb Update maintainers guide
This makes some changes to the maintainer's guide and roles within the
project.  It removed the concept of a BDFL and carries over the chief
maintainer role into the project.  BDFL sucks and we can do better and
these changed help to make many more things specific around adding new
maintainers and removing them as well.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-07-21 10:59:56 -07:00
Rohit Jnagal 33494b111b Merge pull request #144 from LK4D4/create_symlinks_for_merged_cgroups
Create symlinks for merged cgroups
2015-07-20 17:09:11 -07:00
Alexander Morozov d3217084b5 Create symlinks for merged cgroups
This allows software be not aware about existence of merged cgroups.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-20 16:12:28 -07:00
Mrunal Patel 073e76c9fc Merge pull request #142 from avagin/cr
ct: give criu informations about cgroup mounts
2015-07-20 15:13:03 -07:00
Rohit Jnagal 39c49e41d8 Merge pull request #143 from LK4D4/fix_parent
Fix subsystem path with abs parent
2015-07-20 14:55:16 -07:00
Andrey Vagin af4a5e708a ct: give criu informations about cgroup mounts
Actually cgroup mounts are bind-mounts, so they should be
handled by the same way.

Reported-by: Ross Boucher <rboucher@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-07-20 22:56:07 +03:00
Alexander Morozov c0e18b96fb Fix subsystem path with abs parent
Sometimes subsystem can be mounted to path like "subsystem1,subsystem2",
so we need to handle this.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-20 11:48:58 -07:00
Alexander Morozov 1eeb86fbf2 Merge pull request #137 from mrunalp/revert_cgroup_ro
Revert "Remount /sys/fs/cgroup as readonly always"
2015-07-17 14:53:39 -07:00
Mrunal Patel 5b805276c2 Revert "Remount /sys/fs/cgroup as readonly always"
This reverts commit 18de1a273e.
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2015-07-17 17:50:46 -04:00
Mrunal Patel 618e0caeca Merge pull request #135 from LK4D4/fix_apply_cgroups
Substract source mount from cgroup dir
2015-07-17 13:55:01 -07:00
Mrunal Patel 11370f02c5 Merge pull request #136 from LK4D4/remount_sysfs
Remount /sys/fs/cgroup as readonly always
2015-07-17 13:45:17 -07:00
Alexander Morozov 18de1a273e Remount /sys/fs/cgroup as readonly always
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-17 12:45:09 -07:00
Alexander Morozov fc31076c23 Substract source mount from cgroup dir
This is needed because for nested containers cgroups. Without this patch
they creating unnecessary intermediate cgroup like:
/sys/fs/cgroup/memory/system.slice/docker-9409d9f0b68fb9e9d7d532d5b3f35e7c7f9cca1312af392ae3b28436f1f2998f.scope/system.slice/docker-9409d9f0b68fb9e9d7d532d5b3f35e7c7f9cca1312af392ae3b28436f1f2998f.scope/docker/908ebcc9c13584a14322ec070bd971e0de62f126c0cd95c079acdb99990ad3a3

It is because in /proc/self/cgroup we see paths from host, and they don't
exist in container.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-17 11:41:58 -07:00
Mrunal Patel 2598484b97 Merge pull request #130 from LK4D4/cgroups_mount_fix
Cgroups mount fix
2015-07-16 10:49:13 -07:00
Mrunal Patel 48ac2222e5 Merge pull request #131 from LK4D4/name_cgroup
Fix handling name= cgroups
2015-07-15 14:43:09 -07:00
Alexander Morozov e289cf734b Fix handling name= cgroups
Before name=systemd cgroup was mounted inside container to
/sys/fs/cgroup/name=systemd, which is wrong, it should be
/sys/fs/cgroup/systemd

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-15 13:58:17 -07:00
Alexander Morozov f6eb19c0d5 Tests for mounting cgroups
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-15 11:07:03 -07:00
Alexander Morozov 40b9b89107 Substract bindmount path from cgroup dir
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-15 10:41:25 -07:00
Mrunal Patel 42aa891a6b Merge pull request #91 from hqhq/hq_add_cgroup_mount
Add cgroup mount in the recommended config
2015-07-15 09:51:24 -07:00
Mrunal Patel da0f867bf7 Merge pull request #117 from jhjeong-kr/master
Fixed two typos
2015-07-15 08:27:52 -07:00
Mrunal Patel cc341952ac Merge pull request #120 from lizf-os/support-memory-swappines-v2
Add memory swappiness support
2015-07-15 08:25:22 -07:00
Alexander Morozov 0d948945b0 Merge pull request #127 from hqhq/hq_fix_tmpfs_mount
Correct tmpfs mount for cgroup
2015-07-14 22:11:52 -07:00
Qiang Huang d7181a73e4 Add cgroup mount in the recommended config
And allow cgroup mount take flags from user configs.
As we show ro in the recommendation, so hard-coded
read-only flag should be removed.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-07-15 09:31:39 +08:00
Jin-Hwan Jeong 094a83b25e in signals.go: depeding -> depending
in tty.go: pty -> tty

Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
2015-07-15 10:11:24 +09:00