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
2b34e0b8
Kaydet (Commit)
2b34e0b8
authored
Eyl 29, 2016
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Eyl 29, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1224 from mferon/addRestartPolicyUpdateSupport
Add support for restart policy update
üst
ce52e091
a665c8c4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
container.py
docker/api/container.py
+9
-1
api.md
docs/api.md
+1
-0
container_test.py
tests/integration/container_test.py
+30
-0
No files found.
docker/api/container.py
Dosyayı görüntüle @
2b34e0b8
...
...
@@ -421,7 +421,8 @@ class ContainerApiMixin(object):
def
update_container
(
self
,
container
,
blkio_weight
=
None
,
cpu_period
=
None
,
cpu_quota
=
None
,
cpu_shares
=
None
,
cpuset_cpus
=
None
,
cpuset_mems
=
None
,
mem_limit
=
None
,
mem_reservation
=
None
,
memswap_limit
=
None
,
kernel_memory
=
None
mem_reservation
=
None
,
memswap_limit
=
None
,
kernel_memory
=
None
,
restart_policy
=
None
):
url
=
self
.
_url
(
'/containers/{0}/update'
,
container
)
data
=
{}
...
...
@@ -445,6 +446,13 @@ class ContainerApiMixin(object):
data
[
'MemorySwap'
]
=
utils
.
parse_bytes
(
memswap_limit
)
if
kernel_memory
:
data
[
'KernelMemory'
]
=
utils
.
parse_bytes
(
kernel_memory
)
if
restart_policy
:
if
utils
.
version_lt
(
self
.
_version
,
'1.23'
):
raise
errors
.
InvalidVersion
(
'restart policy update is not supported '
'for API version < 1.23'
)
data
[
'RestartPolicy'
]
=
restart_policy
res
=
self
.
_post_json
(
url
,
data
=
data
)
return
self
.
_result
(
res
,
True
)
...
...
docs/api.md
Dosyayı görüntüle @
2b34e0b8
...
...
@@ -1126,6 +1126,7 @@ Update resource configs of one or more containers.
*
mem_reservation (int or str): Memory soft limit
*
memswap_limit (int or str): Total memory (memory + swap), -1 to disable swap
*
kernel_memory (int or str): Kernel memory limit
*
restart_policy (dict): Restart policy dictionary
**Returns**
(dict): Dictionary containing a
`Warnings`
key.
...
...
tests/integration/container_test.py
Dosyayı görüntüle @
2b34e0b8
...
...
@@ -1104,6 +1104,36 @@ class ContainerUpdateTest(helpers.BaseTestCase):
inspect_data
=
self
.
client
.
inspect_container
(
container
)
self
.
assertEqual
(
inspect_data
[
'HostConfig'
][
'Memory'
],
new_mem_limit
)
@requires_api_version
(
'1.23'
)
def
test_restart_policy_update
(
self
):
old_restart_policy
=
{
'MaximumRetryCount'
:
0
,
'Name'
:
'always'
}
new_restart_policy
=
{
'MaximumRetryCount'
:
42
,
'Name'
:
'on-failure'
}
container
=
self
.
client
.
create_container
(
BUSYBOX
,
[
'sleep'
,
'60'
],
host_config
=
self
.
client
.
create_host_config
(
restart_policy
=
old_restart_policy
)
)
self
.
tmp_containers
.
append
(
container
)
self
.
client
.
start
(
container
)
self
.
client
.
update_container
(
container
,
restart_policy
=
new_restart_policy
)
inspect_data
=
self
.
client
.
inspect_container
(
container
)
self
.
assertEqual
(
inspect_data
[
'HostConfig'
][
'RestartPolicy'
][
'MaximumRetryCount'
],
new_restart_policy
[
'MaximumRetryCount'
]
)
self
.
assertEqual
(
inspect_data
[
'HostConfig'
][
'RestartPolicy'
][
'Name'
],
new_restart_policy
[
'Name'
]
)
class
ContainerCPUTest
(
helpers
.
BaseTestCase
):
@requires_api_version
(
'1.18'
)
...
...
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