Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
d33e0695
Kaydet (Commit)
d33e0695
authored
Agu 23, 2016
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge branch 'DaoCloud-feature/memory_support'
üst
7b7e07e6
fc72ac66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
utils.py
docker/utils/utils.py
+16
-2
utils_test.py
tests/unit/utils_test.py
+14
-0
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
d33e0695
...
...
@@ -613,8 +613,10 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
cap_drop
=
None
,
devices
=
None
,
extra_hosts
=
None
,
read_only
=
None
,
pid_mode
=
None
,
ipc_mode
=
None
,
security_opt
=
None
,
ulimits
=
None
,
log_config
=
None
,
mem_limit
=
None
,
memswap_limit
=
None
,
mem_swappiness
=
None
,
cgroup_parent
=
None
,
group_add
=
None
,
cpu_quota
=
None
,
mem_limit
=
None
,
memswap_limit
=
None
,
mem_reservation
=
None
,
kernel_memory
=
None
,
mem_swappiness
=
None
,
cgroup_parent
=
None
,
group_add
=
None
,
cpu_quota
=
None
,
cpu_period
=
None
,
blkio_weight
=
None
,
blkio_weight_device
=
None
,
device_read_bps
=
None
,
device_write_bps
=
None
,
device_read_iops
=
None
,
...
...
@@ -638,6 +640,18 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
if
memswap_limit
is
not
None
:
host_config
[
'MemorySwap'
]
=
parse_bytes
(
memswap_limit
)
if
mem_reservation
:
if
version_lt
(
version
,
'1.21'
):
raise
host_config_version_error
(
'mem_reservation'
,
'1.21'
)
host_config
[
'MemoryReservation'
]
=
parse_bytes
(
mem_reservation
)
if
kernel_memory
:
if
version_lt
(
version
,
'1.21'
):
raise
host_config_version_error
(
'kernel_memory'
,
'1.21'
)
host_config
[
'KernelMemory'
]
=
parse_bytes
(
kernel_memory
)
if
mem_swappiness
is
not
None
:
if
version_lt
(
version
,
'1.20'
):
raise
host_config_version_error
(
'mem_swappiness'
,
'1.20'
)
...
...
tests/unit/utils_test.py
Dosyayı görüntüle @
d33e0695
...
...
@@ -171,6 +171,20 @@ class HostConfigTest(base.BaseTestCase):
with
pytest
.
raises
(
InvalidVersion
):
create_endpoint_config
(
version
=
'1.21'
,
aliases
=
[
'foo'
,
'bar'
])
def
test_create_host_config_with_mem_reservation
(
self
):
config
=
create_host_config
(
version
=
'1.21'
,
mem_reservation
=
67108864
)
self
.
assertEqual
(
config
.
get
(
'MemoryReservation'
),
67108864
)
self
.
assertRaises
(
InvalidVersion
,
lambda
:
create_host_config
(
version
=
'1.20'
,
mem_reservation
=
67108864
))
def
test_create_host_config_with_kernel_memory
(
self
):
config
=
create_host_config
(
version
=
'1.21'
,
kernel_memory
=
67108864
)
self
.
assertEqual
(
config
.
get
(
'KernelMemory'
),
67108864
)
self
.
assertRaises
(
InvalidVersion
,
lambda
:
create_host_config
(
version
=
'1.20'
,
kernel_memory
=
67108864
))
class
UlimitTest
(
base
.
BaseTestCase
):
def
test_create_host_config_dict_ulimit
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment