Commit Graph

1413 Commits

Author SHA1 Message Date
c3a2ab168f Merge pull request #15141 from Microsoft/10662-cp
Windows [TP3] - make docker cp functional
Upstream-commit: 04cd81401ad721cc3e1222c08fd81a1133737548
Component: engine
2015-08-06 17:15:09 -07:00
0655529aa6 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)
Upstream-commit: b2d06b6fba307a8972d08477ef8b711e31ace433
Component: engine
2015-08-06 15:46:09 -07:00
f147ed75c5 Merge pull request #15320 from hqhq/hq_add_cgroup_check
Check sysinfo for Cpuset cpu.shares and blkio
Upstream-commit: 9ce0a20c01ec0a8e0c3a1a45fba566600e7e9d4d
Component: engine
2015-08-06 14:23:37 -07:00
efe044b445 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>
Upstream-commit: 2a237615c0915b60b8dc6c13a377bb766780ecbf
Component: engine
2015-08-06 11:22:38 -07:00
23d0cda657 Remove pkg/systemd
Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: 931645c46056ae24b2df51c447b6df1a66b2ca30
Component: engine
2015-08-06 14:35:00 +02:00
9d9a4fd0c0 Merge pull request #15252 from coolljt0725/14765_enable_golint_3
Enable golint in pkg/archive
Upstream-commit: 8534090476b6eae66f1eca81e8bc0e0c61ed7197
Component: engine
2015-08-05 19:27:48 -04:00
f23264da83 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>
Upstream-commit: b7599d58cb103e3b13b3a51553fd69f5f8b60893
Component: engine
2015-08-05 22:35:18 +08:00
aa73b79fe2 Merge pull request #14921 from aaronlehmann/int64
Fix uses of "int" where "int64" should be used instead
Upstream-commit: 7374852be9def787921aea2ca831771982badecf
Component: engine
2015-08-04 19:16:13 -07:00
f031716448 Merge pull request #14840 from HuKeping/golint-pkg-sysinfo
Fix golint warning on pkg/sysinfo
Upstream-commit: 23dab01ed245c5a5132a2deb7ea26c0a984ec198
Component: engine
2015-08-04 20:57:39 +02:00
3ba45e7906 Enable golint in pkg/arcive
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: ba332b7d12fba16e8c604728a44986886eeb07d6
Component: engine
2015-08-04 09:52:54 +08:00
5947da9f2e Merge pull request #15013 from coolljt0725/14756_enbale_golint_1
Enable golint, part of #14756
Upstream-commit: dce1488ae56df8c4fe8cac4dde1858745f7f8cbf
Component: engine
2015-08-02 22:14:18 -04:00
e840b8ec78 Enable golint part of #14756
pkg/broadcastwriter
pkg/graphdb
pkg/httputils
pkg/ioutils

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 27a8f9937ece67015d06b219bb8aa5cc4f6b7d32
Component: engine
2015-08-03 09:45:05 +08:00
cd1228889c Fix golint warning on pkg/sysinfo
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 7390cc5300d260a853c68d6eb25493fefaecca43
Component: engine
2015-08-01 18:24:49 +08:00
761b152e62 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>
Upstream-commit: 1f61084d83aea37b212468aaa975020094b7f7c9
Component: engine
2015-07-31 16:31:40 -07:00
14e1d4c1cc Merge pull request #15207 from calavera/fix_index_locking
Remove read index that causes dead lock.
Upstream-commit: 3e0b0c59e6ae56454c3e68876cc1936f04999920
Component: engine
2015-07-31 14:55:00 -07:00
df2916dab1 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>
Upstream-commit: 5ed84009b33642ca1f1eac8b99001842d93e2494
Component: engine
2015-07-31 13:53:17 -07:00
8a201393ad pkg/namesgenerator: add a 'names-generator' binary
Signed-off-by: Manfred Touron <m@42.am>
Upstream-commit: 08006506651498cd8647123daadc7abde37ecb7d
Component: engine
2015-07-31 13:07:40 +02:00
935ca110b9 Merge pull request #15123 from ewindisch/seed-pkgrand-cryptorand
Prefer crypto rand seed for pkg/rand
Upstream-commit: 9a9a12b35168c3b4391139982bc613db2ff97834
Component: engine
2015-07-30 22:41:17 -04:00
385c38be8c Merge pull request #15146 from kolyshkin/mkdirall
Simplify and fix MkdirAll usage
Upstream-commit: 8d2739df980a1af76ad50e5c423134815186b61c
Component: engine
2015-07-30 22:40:57 -04:00
0c28668f97 Merge pull request #14950 from ottok/master
Multiple fixes to 'docker stats' output
Upstream-commit: 85051832522ca217401d6eb4ddda1b1a7fdce9ad
Component: engine
2015-07-30 14:02:35 -07:00
a55bf4a409 Merge pull request #14885 from jlhawn/fix_cp_symlink
Fix copying of symlinks in containers
Upstream-commit: 030f61df3db2c053d68aacddc2c6893db3dee6ce
Component: engine
2015-07-30 13:42:40 -07:00
2f014c412e Merge pull request #15169 from Microsoft/10662-tidydiff
Tidy platform common bits in diff
Upstream-commit: 9431acbc0ab819ba3040b680e8ca05318c9c9156
Component: engine
2015-07-30 13:42:27 -07:00
7a72702c89 Tidy platform common bits in diff
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 5ab9654bc4ebcf49f95c91e16ecb09bbe7779b50
Component: engine
2015-07-30 13:04:49 -07:00
0a7e55f30a 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)
Upstream-commit: 75f6929b449a59335572436862d644afacf55cdb
Component: engine
2015-07-30 12:14:28 -07:00
bded7814ff Merge pull request #15156 from duglin/AddErrTruncIndex
Add missing typed error in truncindex
Upstream-commit: b149d9d0d9b3e784ee16c6ebc4fb4faceb19e703
Component: engine
2015-07-30 14:55:40 -04:00
3c8e934faf 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>
Upstream-commit: a83a76934787a20e96389d33bd56a09369f9b808
Component: engine
2015-07-30 11:48:08 -07:00
3f75e1a44a tlsconfig: better format for error message in tlsconfig
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: c7a04fda2ad804601385f054c19b69cf43fcfe46
Component: engine
2015-07-30 14:15:41 -04:00
6d2e92af9b Merge pull request #15100 from calavera/fix_reader_timeout
Fix reset timeout for buffer readers.
Upstream-commit: bfccd328be0842806eb65d80768becbb433b7772
Component: engine
2015-07-30 13:18:06 -04:00
8e069cb4e8 Add missing typed error in truncindex
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 18b13813358f9cb9f3028f34f59ed254bd16bb3f
Component: engine
2015-07-30 07:52:34 -07:00
eaafbe08a2 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>
Upstream-commit: b619220ce11770ffaea068b54d3975c74f7c24f9
Component: engine
2015-07-30 10:14:57 +03:00
9abcd15501 Windows: Daemon build is broken
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b43dc0d93c3678c3fe5e6247aa19a2bf71ef35d6
Component: engine
2015-07-29 20:08:51 -07:00
01ea6979df Merge pull request #15126 from LK4D4/global_rand
Use global random *rand.Rand instance in pkg
Upstream-commit: 4c7cf30260eac73f8bfe31fcc4450216965e224c
Component: engine
2015-07-29 17:36:25 -07:00
197e6f60b8 Merge pull request #15040 from vbatts/vbatts-double-decompress-fix
archive, graphdriver: double decompress fix
Upstream-commit: 8724e8953d446ade61856d4944126ffccb2aead9
Component: engine
2015-07-29 16:48:02 -07:00
4cd45101c0 Merge pull request #13542 from kvasdopil/freebsd-work
Make docker build on FreeBSD
Upstream-commit: 75f8bdd970e5355a6238e7b41a9f1aee9cd3f890
Component: engine
2015-07-29 15:15:37 -07:00
abf825af14 Merge pull request #15111 from Microsoft/fix-archive-copy-log
Fix log to logrus
Upstream-commit: c09c497c71e3fbcec6fee6ee0f4eb5097fc1b4b7
Component: engine
2015-07-29 14:48:19 -04:00
59df5a01ec make docker compile on freebsd
Signed-off-by: Alexey Guskov <lexag@mail.ru>
Upstream-commit: 26c03d561ab126287bb3034cc23477d18869a888
Component: engine
2015-07-29 21:25:56 +03:00
a7dc60d0d3 Fix log to logrus
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2bf73c4b1a3b195ee426e74d221a9df032aaa89e
Component: engine
2015-07-29 09:58:07 -07:00
f7e9c2e779 Prefer crypto rand seed for pkg/rand
Crypto rand is a much better seed for math/rand than
time. In the event we use math/rand where we should not,
this will make it a safer source of random numbers.

Although potentially dangerous, this will still fallback
to time should crypto/rand for any reason fail.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: 4742a3964fd276a825a5ff4d1cf8417ae88abcb1
Component: engine
2015-07-29 12:55:57 -04:00
7dccd4ea15 Use global random *rand.Rand instance in pkg
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 51cdcf3c9df04a34945c976cfe2bdbad6fee122a
Component: engine
2015-07-29 09:30:48 -07:00
67bf5ba305 Replace GenerateRandomID with GenerateNonCryptoID
This allow us to avoid entropy usage in non-crypto critical places.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6bca8ec3c9ccc169c53b3d7060fe5c8ba8670aac
Component: engine
2015-07-28 22:31:01 -07:00
5ca33487e4 Add GenerateNonCryptoID function to avoid entropy exhaustion
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 4553b6af4badd3e182204ed2178348b894688460
Component: engine
2015-07-28 22:31:01 -07:00
6876cc1bf2 Add global instance of *(math/rand).Rand and Reader
You can read random bytes from Reader without exhausting entropy.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6963b9c71694509d8511264655f05c203f5b8f97
Component: engine
2015-07-28 22:30:57 -07:00
116e469838 Fix reset timeout for buffer readers.
Use our goroutine-safe random source.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 40ea67a5962d5e47f883421a637c93b888206677
Component: engine
2015-07-28 14:30:18 -07:00
abb741354a archive, chrootarchive: split out decompression
In `ApplyLayer` and `Untar`, the stream is magically decompressed. Since
this is not able to be toggled, rather than break this ./pkg/ API, add
an `ApplyUncompressedLayer` and `UntarUncompressed` that does not
magically decompress the layer stream.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 56bf275e32fc27bd31c5dba6b715336b43981695
Component: engine
2015-07-28 16:36:38 -04:00
3f76e1b38f Fix golint for pkg/mflag
Signed-off-by: Félix Cantournet <felix.cantournet@cloudwatt.com>
Upstream-commit: 8e6ad2171a2fbf51d127326c215608475c031b41
Component: engine
2015-07-28 15:32:42 +02:00
6ceeb0ed2b Fix golint nit in term_windows.go
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 35e498beca13de4ef8cecf45c0d132cc38daf0d5
Component: engine
2015-07-27 17:40:49 -07:00
809c751de2 Merge pull request #14838 from Microsoft/10662-ansirewrite
Windows: CLI Improvement (TP3)
Upstream-commit: 33358f80e592686bb1872d9d50a4dd1e0391487f
Component: engine
2015-07-27 17:30:14 -07:00
2db54e3ac2 Lint on pkg/* packages
- pkg/useragent
- pkg/units
- pkg/ulimit
- pkg/truncindex
- pkg/timeoutconn
- pkg/term
- pkg/tarsum
- pkg/tailfile
- pkg/systemd
- pkg/stringutils
- pkg/stringid
- pkg/streamformatter
- pkg/sockets
- pkg/signal
- pkg/proxy
- pkg/progressreader
- pkg/pools
- pkg/plugins
- pkg/pidfile
- pkg/parsers
- pkg/parsers/filters
- pkg/parsers/kernel
- pkg/parsers/operatingsystem

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 18c7c67308bd4a24a41028e63c2603bb74eac85e
Component: engine
2015-07-27 21:26:21 +02:00
1237e8ea97 Merge pull request #14959 from runcom/remove-pkg-systemd-booted-go
Remove pkg/systemd/booted.go
Upstream-commit: b48b6de623cb45509e4cf45d3b5b1b5d29a7e9d9
Component: engine
2015-07-27 10:22:58 -07:00
7eed677896 *: s/direcotry/directory/g typo
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 7b4e6fc47b5b4b25f74f12419005098478e16ce7
Component: engine
2015-07-27 11:29:28 -04:00