Commit graph

1455 commits

Author SHA1 Message Date
Andrew Gerrand
3a41b3f1ce Use a slice instead of a map of io.WriteClosers in broadcastwriter
Maps rely on the keys being comparable.
Using an interface type as the map key is dangerous,
because some interface types are not comparable.
I talked about this in my "Stupid Gopher Tricks" talk:
	https://talks.golang.org/2015/tricks.slide

In this case, if the user-provided writer is backed by a slice
(such as io.MultiWriter) then the code will panic at run time.

Signed-off-by: Andrew Gerrand <adg@golang.org>
2015-08-21 14:08:04 +01:00
Icaro Seara
82a251318a Fix typo, "fil" -> "fill"
Signed-off-by: Icaro Seara <icaro.seara@gmail.com>
2015-08-19 21:50:54 -03:00
Brian Goff
6461996c9a Merge pull request #15684 from ibuildthecloud/dont-sync
Don't globally lock on driver initialization
2015-08-19 12:48:14 -04:00
Sebastiaan van Stijn
ad91ec8c4b Merge pull request #12927 from lindenlab/custom-host-port-ranges
Proposal: Change --publish=SPEC to allow binding to custom host port ranges
2015-08-19 17:04:23 +02:00
Darren Shepherd
bf81718eba Don't globally lock on driver initialization
This patch makes it such that plugin initialization is synchronized
based on the plugin name and not globally

Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-08-18 22:25:30 -07:00
Alexandre Beslic
f192bc6f68 Merge pull request #15380 from calavera/remove_sys_info_pointers
Remove pointers from the SysInfo struct.
2015-08-17 18:40:54 -07:00
Don Kjer
e22508c702 Adding support to publish on custom host port ranges
Signed-off-by: Don Kjer <don.kjer@gmail.com>

Changing vendor/src/github.com/docker/libnetwork to match lindenlab/libnetwork custom-host-port-ranges-1.7 branch
2015-08-15 02:41:29 +00:00
Stefan J. Wernli
1c1d0c5f6f Fixing Tar functions to support Windows long paths.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2015-08-11 16:07:36 -07:00
Alexander Morozov
732af35366 Merge pull request #15404 from vbatts/vbatts-dm-zero-sized-field
devicemapper: fix zero-sized field access
2015-08-10 09:16:11 -07:00
Vincent Batts
25b0312e8c devicemapper: fix zero-sized field access
Fixes: #15279

Due to
7904946eeb
the devices field is dropped.

This solution works on go1.4 and go1.5

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-08-10 11:11:58 -04:00
Brian Goff
2441d6e0f1 Merge pull request #15074 from coolljt0725/14756_enable_golint_2
Enable golint in pkg/jsonlog and pkg/jsonmessage part of #14756
2015-08-08 07:14:53 -04:00
Lei Jitang
520fe05c54 Enable golint in pkg/jsonlog and pkg/jsonmessage.
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-08 11:28:22 +08:00
Veres Lajos
0f78f158aa typofix - https://github.com/vlajos/misspell_fixer
Signed-off-by: Veres Lajos <vlajos@gmail.com>
2015-08-07 23:25:49 +01:00
Arnaud Porterie
bad3b47438 Merge pull request #15141 from Microsoft/10662-cp
Windows [TP3] - make docker cp functional
2015-08-06 17:15:09 -07:00
David Calavera
482c54a691 Remove pointers from the SysInfo struct.
Because they can just be values.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-08-06 15:57:21 -07:00
Antonio Murdaca
826c468f2c Move sysinfo out of daemon struct
sysinfo struct was initialized at daemon startup to make sure
kernel configs such as device cgroup are present and error out if not.
The struct was embedded in daemon struct making impossible to detect
if some system config is changed at daemon runtime (i.e. someone
umount the memory cgroup). This leads to container's starts failure if
some config is changed at daemon runtime.
This patch moves sysinfo out of daemon and initilize and check it when
needed (daemon startup, containers creation, contaienrs startup for
now).

Signed-off-by: Antonio Murdaca <runcom@linux.com>
(cherry picked from commit 472b6f66e03f9a85fe8d23098dac6f55a87456d8)
2015-08-06 15:46:09 -07:00
David Calavera
ef9b1b6b70 Merge pull request #15320 from hqhq/hq_add_cgroup_check
Check sysinfo for Cpuset cpu.shares and blkio
2015-08-06 14:23:37 -07:00
John Howard
f5727e08d4 Windows - make docker cp functional
Signed-off-by: John Howard <jhoward@microsoft.com>

Conflicts:
	pkg/archive/copy.go

Make it compile

Signed-off-by: John Howard <jhoward@microsoft.com>
2015-08-06 11:22:38 -07:00
Antonio Murdaca
003529d8c0 Remove pkg/systemd
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2015-08-06 14:35:00 +02:00
Tibor Vass
04e019f7cc Merge pull request #15252 from coolljt0725/14765_enable_golint_3
Enable golint in pkg/archive
2015-08-05 19:27:48 -04:00
Qiang Huang
3ed5407e61 Check sysinfo for Cpuset cpu.shares and blkio
Carried: #14015

If kernel is compiled with CONFIG_FAIR_GROUP_SCHED disabled cpu.shares
doesn't exist.
If kernel is compiled with CONFIG_CFQ_GROUP_IOSCHED disabled blkio.weight
doesn't exist.
If kernel is compiled with CONFIG_CPUSETS disabled cpuset won't be
supported.

We need to handle these conditions by checking sysinfo and verifying them.

Signed-off-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-08-05 22:35:18 +08:00
Arnaud Porterie
4c56c9f9ba Merge pull request #14921 from aaronlehmann/int64
Fix uses of "int" where "int64" should be used instead
2015-08-04 19:16:13 -07:00
Antonio Murdaca
88443758d5 Merge pull request #14840 from HuKeping/golint-pkg-sysinfo
Fix golint warning on pkg/sysinfo
2015-08-04 20:57:39 +02:00
Lei Jitang
fb58e0d9c2 Enable golint in pkg/arcive
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-04 09:52:54 +08:00
Brian Goff
fe395e584f Merge pull request #15013 from coolljt0725/14756_enbale_golint_1
Enable golint, part of #14756
2015-08-02 22:14:18 -04:00
Lei Jitang
fcb8d8d48e Enable golint part of #14756
pkg/broadcastwriter
pkg/graphdb
pkg/httputils
pkg/ioutils

Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-08-03 09:45:05 +08:00
Hu Keping
001fc3cf5f Fix golint warning on pkg/sysinfo
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-08-01 18:24:49 +08:00
Aaron Lehmann
16b74247fb Fix uses of "int" where "int64" should be used instead
Some structures use int for sizes and UNIX timestamps. On some
platforms, int is 32 bits, so this can lead to the year 2038 issues and
overflows when dealing with large containers or layers.

Consistently use int64 to store sizes and UNIX timestamps in
api/types/types.go. Update related to code accordingly (i.e.
strconv.FormatInt instead of strconv.Itoa).

Use int64 in progressreader package to avoid integer overflow when
dealing with large quantities. Update related code accordingly.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-31 16:31:40 -07:00
David Calavera
8cd8bc1365 Merge pull request #15207 from calavera/fix_index_locking
Remove read index that causes dead lock.
2015-07-31 14:55:00 -07:00
David Calavera
02963b85e4 Remove read index that causes dead lock.
Let the iterator to lock the index when it needs it.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-31 13:53:17 -07:00
Manfred Touron
6ab7a44610 pkg/namesgenerator: add a 'names-generator' binary
Signed-off-by: Manfred Touron <m@42.am>
2015-07-31 13:07:40 +02:00
Tibor Vass
b49fc92969 Merge pull request #15123 from ewindisch/seed-pkgrand-cryptorand
Prefer crypto rand seed for pkg/rand
2015-07-30 22:41:17 -04:00
Tibor Vass
352f58a5e2 Merge pull request #15146 from kolyshkin/mkdirall
Simplify and fix MkdirAll usage
2015-07-30 22:40:57 -04:00
Alexander Morozov
fca8ba94b3 Merge pull request #14950 from ottok/master
Multiple fixes to 'docker stats' output
2015-07-30 14:02:35 -07:00
David Calavera
877d55447f Merge pull request #14885 from jlhawn/fix_cp_symlink
Fix copying of symlinks in containers
2015-07-30 13:42:40 -07:00
Alexander Morozov
ec634329dc Merge pull request #15169 from Microsoft/10662-tidydiff
Tidy platform common bits in diff
2015-07-30 13:42:27 -07:00
John Howard
786c3fafa0 Tidy platform common bits in diff
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-30 13:04:49 -07:00
Josh Hawn
bd8af5b419 Fix docker cp Behavior With Symlinks
[pkg/archive] Update archive/copy path handling

  - Remove unused TarOptions.Name field.
  - Add new TarOptions.RebaseNames field.
  - Update some of the logic around path dir/base splitting.
  - Update some of the logic behind archive entry name rebasing.

[api/types] Add LinkTarget field to PathStat

[daemon] Fix stat, archive, extract of symlinks

  These operations *should* resolve symlinks that are in the path but if the
  resource itself is a symlink then it *should not* be resolved. This patch
  puts this logic into a common function `resolvePath` which resolves symlinks
  of the path's dir in scope of the container rootfs but does not resolve the
  final element of the path. Now archive, extract, and stat operations will
  return symlinks if the path is indeed a symlink.

[api/client] Update cp path hanling

[docs/reference/api] Update description of stat

  Add the linkTarget field to the header of the archive endpoint.
  Remove path field.

[integration-cli] Fix/Add cp symlink test cases

  Copying a symlink should do just that: copy the symlink NOT
  copy the target of the symlink. Also, the resulting file from
  the copy should have the name of the symlink NOT the name of
  the target file.

  Copying to a symlink should copy to the symlink target and not
  modify the symlink itself.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-07-30 12:14:28 -07:00
Brian Goff
2b27285a0d Merge pull request #15156 from duglin/AddErrTruncIndex
Add missing typed error in truncindex
2015-07-30 14:55:40 -04:00
Kir Kolyshkin
fe45bb6d4d 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.

[v2: a separate aufs commit is merged into this one]

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

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2015-07-30 11:48:08 -07:00
Tibor Vass
1c73db81af tlsconfig: better format for error message in tlsconfig
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-30 14:15:41 -04:00
Tibor Vass
9f198e9313 Merge pull request #15100 from calavera/fix_reader_timeout
Fix reset timeout for buffer readers.
2015-07-30 13:18:06 -04:00
Doug Davis
a8465f999b Add missing typed error in truncindex
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-07-30 07:52:34 -07:00
Otto Kekäläinen
de0d8cfd0f Multiple fixes to 'docker stats' output:
* Add space between values in docker stats output for easier parsing

  Old output could not be parsed easily because there were columns
  that did not have any separator. Also values that are together
  without any space is difficult to read even for humans.

* Update unit.HumanSize comment to match what the does actually does

Signed-off-by: Otto Kekäläinen <otto@seravo.fi>
2015-07-30 10:14:57 +03:00
John Howard
95594939be Windows: Daemon build is broken
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-29 20:08:51 -07:00
Arnaud Porterie
4991aad4df Merge pull request #15126 from LK4D4/global_rand
Use global random *rand.Rand instance in pkg
2015-07-29 17:36:25 -07:00
Arnaud Porterie
c16f6bc021 Merge pull request #15040 from vbatts/vbatts-double-decompress-fix
archive, graphdriver: double decompress fix
2015-07-29 16:48:02 -07:00
Jessie Frazelle
698b089d9e Merge pull request #13542 from kvasdopil/freebsd-work
Make docker build on FreeBSD
2015-07-29 15:15:37 -07:00
Tibor Vass
3589475dc0 Merge pull request #15111 from Microsoft/fix-archive-copy-log
Fix log to logrus
2015-07-29 14:48:19 -04:00
Alexey Guskov
4e30080c64 make docker compile on freebsd
Signed-off-by: Alexey Guskov <lexag@mail.ru>
2015-07-29 21:25:56 +03:00