From 3ee9e7d9b7d1349ccb73a587530117f70050240a Mon Sep 17 00:00:00 2001 From: Leno Hou Date: Fri, 14 Dec 2018 10:09:59 +0000 Subject: [PATCH] feature: limit blkio device's read/write Bps/IOps fixes #2509 Signed-off-by: Leno Hou --- apis/swagger.yml | 12 ++++----- apis/types/auth_config.go | 1 + apis/types/auth_response.go | 3 ++- apis/types/blkio_stat_entry.go | 1 + apis/types/blkio_stats.go | 3 ++- apis/types/checkpoint.go | 1 + apis/types/checkpoint_create_options.go | 1 + apis/types/checkpoint_delete_options.go | 1 + apis/types/checkpoint_list_options.go | 1 + apis/types/commit.go | 1 + apis/types/container.go | 3 ++- apis/types/container_commit_options.go | 1 + apis/types/container_commit_resp.go | 1 + apis/types/container_config.go | 3 ++- apis/types/container_create_config.go | 3 ++- apis/types/container_create_resp.go | 3 ++- apis/types/container_exec_inspect.go | 3 ++- apis/types/container_json.go | 3 ++- apis/types/container_list_options.go | 1 + apis/types/container_logs_options.go | 1 + apis/types/container_process_list.go | 1 + apis/types/container_remove_options.go | 1 + apis/types/container_start_options.go | 1 + apis/types/container_state.go | 3 ++- apis/types/container_stats.go | 3 ++- apis/types/container_upgrade_config.go | 3 ++- apis/types/cpu_stats.go | 3 ++- apis/types/cpu_usage.go | 1 + apis/types/daemon_update_config.go | 1 + apis/types/device_mapping.go | 1 + apis/types/endpoint_ip_a_m_config.go | 1 + apis/types/endpoint_resource.go | 1 + apis/types/endpoint_settings.go | 3 ++- apis/types/error.go | 1 + apis/types/event_type.go | 3 ++- apis/types/events_actor.go | 1 + apis/types/events_message.go | 3 ++- apis/types/exec_create_config.go | 3 ++- apis/types/exec_create_resp.go | 1 + apis/types/exec_start_config.go | 1 + apis/types/graph_driver_data.go | 3 ++- apis/types/history_result_item.go | 3 ++- apis/types/host_config.go | 3 ++- apis/types/image_info.go | 3 ++- apis/types/index_info.go | 1 + apis/types/ip_a_m.go | 3 ++- apis/types/ip_a_m_config.go | 1 + apis/types/ip_address.go | 1 + apis/types/log_config.go | 3 ++- apis/types/memory_stats.go | 1 + apis/types/mount_point.go | 1 + apis/types/network_connect.go | 3 ++- apis/types/network_create.go | 3 ++- apis/types/network_create_config.go | 3 ++- apis/types/network_create_resp.go | 1 + apis/types/network_disconnect.go | 1 + apis/types/network_inspect_resp.go | 3 ++- apis/types/network_resource.go | 3 ++- apis/types/network_settings.go | 3 ++- apis/types/network_stats.go | 1 + apis/types/networking_config.go | 3 ++- apis/types/nvidia_config.go | 1 + apis/types/pids_stats.go | 1 + apis/types/port_binding.go | 3 ++- apis/types/port_map.go | 3 ++- apis/types/process_config.go | 3 ++- apis/types/registry_service_config.go | 3 ++- apis/types/resize_options.go | 1 + apis/types/resources.go | 8 ++++-- apis/types/restart_policy.go | 1 + apis/types/runtime.go | 1 + apis/types/search_result_item.go | 1 + apis/types/snapshotter_data.go | 3 ++- apis/types/status.go | 3 ++- apis/types/system_info.go | 3 ++- apis/types/system_version.go | 1 + apis/types/throttle_device.go | 3 ++- apis/types/throttling_data.go | 1 + apis/types/ulimit.go | 1 + apis/types/update_config.go | 14 ++-------- apis/types/volume_create_config.go | 1 + apis/types/volume_info.go | 3 ++- apis/types/volume_list_resp.go | 3 ++- apis/types/weight_device.go | 3 ++- cli/update.go | 36 +++++++++++++++---------- cri/v1alpha2/cri.go | 1 - cri/v1alpha2/cri_utils.go | 1 + cri/v1alpha2/cri_utils_test.go | 1 + daemon/mgr/container.go | 2 +- 89 files changed, 160 insertions(+), 76 deletions(-) diff --git a/apis/swagger.yml b/apis/swagger.yml index cef952501c..e13f98f9a6 100644 --- a/apis/swagger.yml +++ b/apis/swagger.yml @@ -2471,12 +2471,6 @@ definitions: type: "array" items: type: "string" - DiskQuota: - type: "object" - description: "update disk quota for container" - x-nullable: true - additionalProperties: - type: "string" ContainerUpgradeConfig: description: | @@ -2630,6 +2624,12 @@ definitions: items: type: "string" example: "c 13:* rwm" + DiskQuota: + type: "object" + description: "update disk quota for container" + x-nullable: true + additionalProperties: + type: "string" KernelMemory: description: "Kernel memory limit in bytes." type: "integer" diff --git a/apis/types/auth_config.go b/apis/types/auth_config.go index 815a6d26c5..a3dc952158 100644 --- a/apis/types/auth_config.go +++ b/apis/types/auth_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/auth_response.go b/apis/types/auth_response.go index 0b9d6d7a2a..0d2273c19e 100644 --- a/apis/types/auth_response.go +++ b/apis/types/auth_response.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/blkio_stat_entry.go b/apis/types/blkio_stat_entry.go index 28621815b1..496df103ef 100644 --- a/apis/types/blkio_stat_entry.go +++ b/apis/types/blkio_stat_entry.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/blkio_stats.go b/apis/types/blkio_stats.go index 7dcde858c4..f2d2f8ac5e 100644 --- a/apis/types/blkio_stats.go +++ b/apis/types/blkio_stats.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/checkpoint.go b/apis/types/checkpoint.go index c62e39edb3..9977925e88 100644 --- a/apis/types/checkpoint.go +++ b/apis/types/checkpoint.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/checkpoint_create_options.go b/apis/types/checkpoint_create_options.go index 9b7d010768..cd2989ba6d 100644 --- a/apis/types/checkpoint_create_options.go +++ b/apis/types/checkpoint_create_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/checkpoint_delete_options.go b/apis/types/checkpoint_delete_options.go index c6dae596b2..721ce24d2c 100644 --- a/apis/types/checkpoint_delete_options.go +++ b/apis/types/checkpoint_delete_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/checkpoint_list_options.go b/apis/types/checkpoint_list_options.go index 559e74bb1f..56b3c65a85 100644 --- a/apis/types/checkpoint_list_options.go +++ b/apis/types/checkpoint_list_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/commit.go b/apis/types/commit.go index 018f62fa28..020be1ae15 100644 --- a/apis/types/commit.go +++ b/apis/types/commit.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container.go b/apis/types/container.go index ed2e8026ac..757d7577e4 100644 --- a/apis/types/container.go +++ b/apis/types/container.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_commit_options.go b/apis/types/container_commit_options.go index 5738bdf773..bd7fd11edc 100644 --- a/apis/types/container_commit_options.go +++ b/apis/types/container_commit_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_commit_resp.go b/apis/types/container_commit_resp.go index 332c81f7f5..f48ba40ee1 100644 --- a/apis/types/container_commit_resp.go +++ b/apis/types/container_commit_resp.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_config.go b/apis/types/container_config.go index 93d9e39407..03b3b89d9f 100644 --- a/apis/types/container_config.go +++ b/apis/types/container_config.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_create_config.go b/apis/types/container_create_config.go index e0b1b7e8d7..3c5466abd6 100644 --- a/apis/types/container_create_config.go +++ b/apis/types/container_create_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/container_create_resp.go b/apis/types/container_create_resp.go index 9b2be903ac..7f78717034 100644 --- a/apis/types/container_create_resp.go +++ b/apis/types/container_create_resp.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_exec_inspect.go b/apis/types/container_exec_inspect.go index f4c184730a..dd0ee2712d 100644 --- a/apis/types/container_exec_inspect.go +++ b/apis/types/container_exec_inspect.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_json.go b/apis/types/container_json.go index 542598a600..f49dc7ad94 100644 --- a/apis/types/container_json.go +++ b/apis/types/container_json.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/container_list_options.go b/apis/types/container_list_options.go index 06a6e4694f..fac2fded2e 100644 --- a/apis/types/container_list_options.go +++ b/apis/types/container_list_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_logs_options.go b/apis/types/container_logs_options.go index 9000f722fb..0e5234037a 100644 --- a/apis/types/container_logs_options.go +++ b/apis/types/container_logs_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_process_list.go b/apis/types/container_process_list.go index ba6233e07a..f8243c70d0 100644 --- a/apis/types/container_process_list.go +++ b/apis/types/container_process_list.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_remove_options.go b/apis/types/container_remove_options.go index e50ee88fc2..a166b5ef51 100644 --- a/apis/types/container_remove_options.go +++ b/apis/types/container_remove_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_start_options.go b/apis/types/container_start_options.go index a6a354a253..88c7c5fca9 100644 --- a/apis/types/container_start_options.go +++ b/apis/types/container_start_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/container_state.go b/apis/types/container_state.go index 648965c960..e5b55fe012 100644 --- a/apis/types/container_state.go +++ b/apis/types/container_state.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_stats.go b/apis/types/container_stats.go index 43ec431696..67463221d5 100644 --- a/apis/types/container_stats.go +++ b/apis/types/container_stats.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/container_upgrade_config.go b/apis/types/container_upgrade_config.go index 039340e224..ad98f6a187 100644 --- a/apis/types/container_upgrade_config.go +++ b/apis/types/container_upgrade_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/cpu_stats.go b/apis/types/cpu_stats.go index b02262f21d..6b7d9d2725 100644 --- a/apis/types/cpu_stats.go +++ b/apis/types/cpu_stats.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/cpu_usage.go b/apis/types/cpu_usage.go index c8a096a058..f5cbfb5e48 100644 --- a/apis/types/cpu_usage.go +++ b/apis/types/cpu_usage.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/daemon_update_config.go b/apis/types/daemon_update_config.go index fe3e3cf128..5f808fa951 100644 --- a/apis/types/daemon_update_config.go +++ b/apis/types/daemon_update_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/device_mapping.go b/apis/types/device_mapping.go index 43d7b9cc23..f4a32de980 100644 --- a/apis/types/device_mapping.go +++ b/apis/types/device_mapping.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/endpoint_ip_a_m_config.go b/apis/types/endpoint_ip_a_m_config.go index fbf6378b07..7a2dc2feef 100644 --- a/apis/types/endpoint_ip_a_m_config.go +++ b/apis/types/endpoint_ip_a_m_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/endpoint_resource.go b/apis/types/endpoint_resource.go index 50368a2fc5..97c26fa6e2 100644 --- a/apis/types/endpoint_resource.go +++ b/apis/types/endpoint_resource.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/endpoint_settings.go b/apis/types/endpoint_settings.go index ad259f9191..d801c436d7 100644 --- a/apis/types/endpoint_settings.go +++ b/apis/types/endpoint_settings.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/error.go b/apis/types/error.go index 59526bdb4e..8708072027 100644 --- a/apis/types/error.go +++ b/apis/types/error.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/event_type.go b/apis/types/event_type.go index eef7aa7e0a..b5d0672611 100644 --- a/apis/types/event_type.go +++ b/apis/types/event_type.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/validate" ) diff --git a/apis/types/events_actor.go b/apis/types/events_actor.go index 13f9911555..cac242cd74 100644 --- a/apis/types/events_actor.go +++ b/apis/types/events_actor.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/events_message.go b/apis/types/events_message.go index 73526bb5fa..8e5252aa26 100644 --- a/apis/types/events_message.go +++ b/apis/types/events_message.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/exec_create_config.go b/apis/types/exec_create_config.go index 9d4b44f35b..3b66542194 100644 --- a/apis/types/exec_create_config.go +++ b/apis/types/exec_create_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/exec_create_resp.go b/apis/types/exec_create_resp.go index 6182d3efad..974ed9df5e 100644 --- a/apis/types/exec_create_resp.go +++ b/apis/types/exec_create_resp.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/exec_start_config.go b/apis/types/exec_start_config.go index 4f66aabfcb..7c71b78dae 100644 --- a/apis/types/exec_start_config.go +++ b/apis/types/exec_start_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/graph_driver_data.go b/apis/types/graph_driver_data.go index b8d4d8ac7d..ceb84b51e8 100644 --- a/apis/types/graph_driver_data.go +++ b/apis/types/graph_driver_data.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/history_result_item.go b/apis/types/history_result_item.go index 557eaca2cd..d7bb666917 100644 --- a/apis/types/history_result_item.go +++ b/apis/types/history_result_item.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/host_config.go b/apis/types/host_config.go index a9ed3b2188..00a76f3448 100644 --- a/apis/types/host_config.go +++ b/apis/types/host_config.go @@ -9,8 +9,9 @@ import ( "encoding/json" "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/image_info.go b/apis/types/image_info.go index 50436f8400..ce65581e00 100644 --- a/apis/types/image_info.go +++ b/apis/types/image_info.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/index_info.go b/apis/types/index_info.go index 168424bfcb..e976fc4690 100644 --- a/apis/types/index_info.go +++ b/apis/types/index_info.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/ip_a_m.go b/apis/types/ip_a_m.go index 276e23445d..ca0bda3ee9 100644 --- a/apis/types/ip_a_m.go +++ b/apis/types/ip_a_m.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/ip_a_m_config.go b/apis/types/ip_a_m_config.go index 0d5eb48aea..a16b09ef35 100644 --- a/apis/types/ip_a_m_config.go +++ b/apis/types/ip_a_m_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/ip_address.go b/apis/types/ip_address.go index 1560608099..4131af721b 100644 --- a/apis/types/ip_address.go +++ b/apis/types/ip_address.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/log_config.go b/apis/types/log_config.go index 666ac544ee..f93dc7720f 100644 --- a/apis/types/log_config.go +++ b/apis/types/log_config.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/memory_stats.go b/apis/types/memory_stats.go index 3e24635a6a..2f283a14a1 100644 --- a/apis/types/memory_stats.go +++ b/apis/types/memory_stats.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/mount_point.go b/apis/types/mount_point.go index 512ea882a9..26d51ac0ae 100644 --- a/apis/types/mount_point.go +++ b/apis/types/mount_point.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/network_connect.go b/apis/types/network_connect.go index d2d32d69e1..639c45e37b 100644 --- a/apis/types/network_connect.go +++ b/apis/types/network_connect.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/network_create.go b/apis/types/network_create.go index 7f0ea977fb..bbf2167a56 100644 --- a/apis/types/network_create.go +++ b/apis/types/network_create.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/network_create_config.go b/apis/types/network_create_config.go index bdda784151..22f81f300d 100644 --- a/apis/types/network_create_config.go +++ b/apis/types/network_create_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/network_create_resp.go b/apis/types/network_create_resp.go index 38cc89b651..c622e422d5 100644 --- a/apis/types/network_create_resp.go +++ b/apis/types/network_create_resp.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/network_disconnect.go b/apis/types/network_disconnect.go index f3c14ffcd3..815ea6a2ca 100644 --- a/apis/types/network_disconnect.go +++ b/apis/types/network_disconnect.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/network_inspect_resp.go b/apis/types/network_inspect_resp.go index 3754d387ad..66118a558c 100644 --- a/apis/types/network_inspect_resp.go +++ b/apis/types/network_inspect_resp.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) diff --git a/apis/types/network_resource.go b/apis/types/network_resource.go index 735ce4e538..e6e9669027 100644 --- a/apis/types/network_resource.go +++ b/apis/types/network_resource.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/network_settings.go b/apis/types/network_settings.go index 58818633aa..4d06e6ac8c 100644 --- a/apis/types/network_settings.go +++ b/apis/types/network_settings.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/network_stats.go b/apis/types/network_stats.go index 7fbb57681d..949a80ded9 100644 --- a/apis/types/network_stats.go +++ b/apis/types/network_stats.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/networking_config.go b/apis/types/networking_config.go index f5e5466546..bb9b7af7c4 100644 --- a/apis/types/networking_config.go +++ b/apis/types/networking_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/nvidia_config.go b/apis/types/nvidia_config.go index 8a0ecc1a2f..57e3c917dc 100644 --- a/apis/types/nvidia_config.go +++ b/apis/types/nvidia_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/pids_stats.go b/apis/types/pids_stats.go index 23fb346a62..699d792bbc 100644 --- a/apis/types/pids_stats.go +++ b/apis/types/pids_stats.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/port_binding.go b/apis/types/port_binding.go index cd5ae7d338..a955ee6553 100644 --- a/apis/types/port_binding.go +++ b/apis/types/port_binding.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/port_map.go b/apis/types/port_map.go index 9cc6eb15de..a0e11e737a 100644 --- a/apis/types/port_map.go +++ b/apis/types/port_map.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/validate" ) diff --git a/apis/types/process_config.go b/apis/types/process_config.go index 388b90c6f5..d8cf855ab9 100644 --- a/apis/types/process_config.go +++ b/apis/types/process_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/registry_service_config.go b/apis/types/registry_service_config.go index dbd7b5fa46..2d7e88f429 100644 --- a/apis/types/registry_service_config.go +++ b/apis/types/registry_service_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/resize_options.go b/apis/types/resize_options.go index 42c731cc6b..fcced0af03 100644 --- a/apis/types/resize_options.go +++ b/apis/types/resize_options.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/resources.go b/apis/types/resources.go index 0397dc291a..e4dc862c0c 100644 --- a/apis/types/resources.go +++ b/apis/types/resources.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) @@ -89,6 +90,9 @@ type Resources struct { // A list of devices to add to the container. Devices []*DeviceMapping `json:"Devices"` + // update disk quota for container + DiskQuota map[string]string `json:"DiskQuota,omitempty"` + // Maximum IO in bytes per second for the container system drive (Windows only) IOMaximumBandwidth uint64 `json:"IOMaximumBandwidth"` @@ -122,7 +126,7 @@ type Resources struct { // Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. MemorySwap int64 `json:"MemorySwap"` - // Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. + // Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. -1 is also accepted, as a legacy alias of 0. // Maximum: 100 // Minimum: -1 MemorySwappiness *int64 `json:"MemorySwappiness"` diff --git a/apis/types/restart_policy.go b/apis/types/restart_policy.go index afdf673027..a6d2c0f63c 100644 --- a/apis/types/restart_policy.go +++ b/apis/types/restart_policy.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/runtime.go b/apis/types/runtime.go index 96d40abffd..ab0b169097 100644 --- a/apis/types/runtime.go +++ b/apis/types/runtime.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/search_result_item.go b/apis/types/search_result_item.go index 4cc01c2d66..16855a5c12 100644 --- a/apis/types/search_result_item.go +++ b/apis/types/search_result_item.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/snapshotter_data.go b/apis/types/snapshotter_data.go index dcb1f37d3d..8018ee0654 100644 --- a/apis/types/snapshotter_data.go +++ b/apis/types/snapshotter_data.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/status.go b/apis/types/status.go index 7cd66d3916..980aea15c9 100644 --- a/apis/types/status.go +++ b/apis/types/status.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/validate" ) diff --git a/apis/types/system_info.go b/apis/types/system_info.go index db1008ba20..5dd3d89cc1 100644 --- a/apis/types/system_info.go +++ b/apis/types/system_info.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/system_version.go b/apis/types/system_version.go index 1c9b0a7c79..22a1ee3e6e 100644 --- a/apis/types/system_version.go +++ b/apis/types/system_version.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/throttle_device.go b/apis/types/throttle_device.go index afab83b517..0fa585b6a1 100644 --- a/apis/types/throttle_device.go +++ b/apis/types/throttle_device.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/throttling_data.go b/apis/types/throttling_data.go index ed94af965e..a96388080c 100644 --- a/apis/types/throttling_data.go +++ b/apis/types/throttling_data.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/ulimit.go b/apis/types/ulimit.go index 9c237df092..302e1d6069 100644 --- a/apis/types/ulimit.go +++ b/apis/types/ulimit.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/update_config.go b/apis/types/update_config.go index 41aa6b1acd..8b326c875e 100644 --- a/apis/types/update_config.go +++ b/apis/types/update_config.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" ) @@ -16,9 +17,6 @@ import ( type UpdateConfig struct { Resources - // update disk quota for container - DiskQuota map[string]string `json:"DiskQuota,omitempty"` - // A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value. // Env []string `json:"Env"` @@ -41,8 +39,6 @@ func (m *UpdateConfig) UnmarshalJSON(raw []byte) error { // AO1 var dataAO1 struct { - DiskQuota map[string]string `json:"DiskQuota,omitempty"` - Env []string `json:"Env"` Label []string `json:"Label"` @@ -53,8 +49,6 @@ func (m *UpdateConfig) UnmarshalJSON(raw []byte) error { return err } - m.DiskQuota = dataAO1.DiskQuota - m.Env = dataAO1.Env m.Label = dataAO1.Label @@ -75,8 +69,6 @@ func (m UpdateConfig) MarshalJSON() ([]byte, error) { _parts = append(_parts, aO0) var dataAO1 struct { - DiskQuota map[string]string `json:"DiskQuota,omitempty"` - Env []string `json:"Env"` Label []string `json:"Label"` @@ -84,8 +76,6 @@ func (m UpdateConfig) MarshalJSON() ([]byte, error) { RestartPolicy *RestartPolicy `json:"RestartPolicy,omitempty"` } - dataAO1.DiskQuota = m.DiskQuota - dataAO1.Env = m.Env dataAO1.Label = m.Label diff --git a/apis/types/volume_create_config.go b/apis/types/volume_create_config.go index 9f2e66c87b..dc2f316443 100644 --- a/apis/types/volume_create_config.go +++ b/apis/types/volume_create_config.go @@ -7,6 +7,7 @@ package types import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) diff --git a/apis/types/volume_info.go b/apis/types/volume_info.go index 4122e96c18..ee6e380968 100644 --- a/apis/types/volume_info.go +++ b/apis/types/volume_info.go @@ -8,8 +8,9 @@ package types import ( "encoding/json" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/volume_list_resp.go b/apis/types/volume_list_resp.go index 6d318e350a..3bad001214 100644 --- a/apis/types/volume_list_resp.go +++ b/apis/types/volume_list_resp.go @@ -8,8 +8,9 @@ package types import ( "strconv" - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/apis/types/weight_device.go b/apis/types/weight_device.go index 3d29541cb5..902505098a 100644 --- a/apis/types/weight_device.go +++ b/apis/types/weight_device.go @@ -6,8 +6,9 @@ package types // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/errors" strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) diff --git a/cli/update.go b/cli/update.go index 6799a86d69..708264fbb8 100644 --- a/cli/update.go +++ b/cli/update.go @@ -51,6 +51,10 @@ func (uc *UpdateCommand) addFlags() { flagSet.StringSliceVarP(&uc.labels, "label", "l", nil, "Set label for container") flagSet.StringVar(&uc.restartPolicy, "restart", "", "Restart policy to apply when container exits") flagSet.StringSliceVar(&uc.diskQuota, "disk-quota", nil, "Update disk quota for container(/=10g)") + flagSet.Var(&uc.blkioDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device") + flagSet.Var(&uc.blkioDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) from a device") + flagSet.Var(&uc.blkioDeviceReadIOps, "device-read-iops", "Limit read rate (bytes per second) from a device") + flagSet.Var(&uc.blkioDeviceWriteIOps, "device-write-iops", "Limit write rate (bytes per second) from a device") } // updateRun is the entry of update command. @@ -68,23 +72,28 @@ func (uc *UpdateCommand) updateRun(args []string) error { return err } - resource := types.Resources{ - CPUPeriod: uc.cpuperiod, - CPUShares: uc.cpushare, - CPUQuota: uc.cpuquota, - CpusetCpus: uc.cpusetcpus, - CpusetMems: uc.cpusetmems, - Memory: memory, - MemorySwap: memorySwap, - BlkioWeight: uc.blkioWeight, - } - - restartPolicy, err := opts.ParseRestartPolicy(uc.restartPolicy) + diskQuota, err := opts.ParseDiskQuota(uc.diskQuota) if err != nil { return err } - diskQuota, err := opts.ParseDiskQuota(uc.diskQuota) + resource := types.Resources{ + CPUPeriod: uc.cpuperiod, + CPUShares: uc.cpushare, + CPUQuota: uc.cpuquota, + CpusetCpus: uc.cpusetcpus, + CpusetMems: uc.cpusetmems, + DiskQuota: diskQuota, + Memory: memory, + MemorySwap: memorySwap, + BlkioWeight: uc.blkioWeight, + BlkioDeviceReadBps: uc.blkioDeviceReadBps.Value(), + BlkioDeviceWriteBps: uc.blkioDeviceWriteBps.Value(), + BlkioDeviceReadIOps: uc.blkioDeviceReadIOps.Value(), + BlkioDeviceWriteIOps: uc.blkioDeviceWriteIOps.Value(), + } + + restartPolicy, err := opts.ParseRestartPolicy(uc.restartPolicy) if err != nil { return err } @@ -94,7 +103,6 @@ func (uc *UpdateCommand) updateRun(args []string) error { Label: uc.labels, RestartPolicy: restartPolicy, Resources: resource, - DiskQuota: diskQuota, } apiClient := uc.cli.Client() diff --git a/cri/v1alpha2/cri.go b/cri/v1alpha2/cri.go index 8b23876ba2..7fee9209fa 100644 --- a/cri/v1alpha2/cri.go +++ b/cri/v1alpha2/cri.go @@ -1105,7 +1105,6 @@ func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.Up resources := r.GetLinux() updateConfig := &apitypes.UpdateConfig{ Resources: parseResourcesFromCRI(resources), - DiskQuota: resources.GetDiskQuota(), } err = c.ContainerMgr.Update(ctx, containerID, updateConfig) if err != nil { diff --git a/cri/v1alpha2/cri_utils.go b/cri/v1alpha2/cri_utils.go index cf4b99ad51..61e5615fa2 100644 --- a/cri/v1alpha2/cri_utils.go +++ b/cri/v1alpha2/cri_utils.go @@ -1043,6 +1043,7 @@ func parseResourcesFromCRI(runtimeResources *runtime.LinuxContainerResources) ap BlkioDeviceWriteBps: parseThrottleDeviceFromCRI(runtimeResources.GetBlkioDeviceWriteBps()), BlkioDeviceReadIOps: parseThrottleDeviceFromCRI(runtimeResources.GetBlkioDeviceRead_IOps()), BlkioDeviceWriteIOps: parseThrottleDeviceFromCRI(runtimeResources.GetBlkioDeviceWrite_IOps()), + DiskQuota: runtimeResources.GetDiskQuota(), KernelMemory: runtimeResources.GetKernelMemory(), MemoryReservation: runtimeResources.GetMemoryReservation(), MemorySwappiness: memorySwappiness, diff --git a/cri/v1alpha2/cri_utils_test.go b/cri/v1alpha2/cri_utils_test.go index ce955c78af..30d560fff1 100644 --- a/cri/v1alpha2/cri_utils_test.go +++ b/cri/v1alpha2/cri_utils_test.go @@ -100,6 +100,7 @@ var ( Memory: 1000, CpusetCpus: "0", CpusetMems: "0", + DiskQuota: map[string]string{"foo": "foo"}, BlkioWeight: uint16(100), BlkioWeightDevice: apitypesWeightDevicesSlice, BlkioDeviceReadBps: apitypesThrottleDevicesSlice, diff --git a/daemon/mgr/container.go b/daemon/mgr/container.go index 1051d59186..cc5b4035c3 100644 --- a/daemon/mgr/container.go +++ b/daemon/mgr/container.go @@ -1048,7 +1048,7 @@ func (mgr *ContainerManager) Update(ctx context.Context, name string, config *ty } // update container disk quota - if err := mgr.updateContainerDiskQuota(ctx, c, config.DiskQuota); err != nil { + if err := mgr.updateContainerDiskQuota(ctx, c, config.Resources.DiskQuota); err != nil { return errors.Wrapf(err, "failed to update diskquota of container %s", c.ID) }