@@ -615,8 +615,12 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
615
615
security_opt = None , ulimits = None , log_config = None ,
616
616
mem_limit = None , memswap_limit = None , mem_swappiness = None ,
617
617
cgroup_parent = None , group_add = None , cpu_quota = None ,
618
- cpu_period = None , oom_kill_disable = False , shm_size = None ,
619
- version = None , tmpfs = None , oom_score_adj = None ):
618
+ cpu_period = None , blkio_weight = None ,
619
+ blkio_weight_device = None , device_read_bps = None ,
620
+ device_write_bps = None , device_read_iops = None ,
621
+ device_write_iops = None , oom_kill_disable = False ,
622
+ shm_size = None , version = None , tmpfs = None ,
623
+ oom_score_adj = None ):
620
624
621
625
host_config = {}
622
626
@@ -792,6 +796,58 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
792
796
793
797
host_config ['CpuPeriod' ] = cpu_period
794
798
799
+ if blkio_weight :
800
+ if not isinstance (blkio_weight , int ):
801
+ raise host_config_type_error ('blkio_weight' , blkio_weight , 'int' )
802
+ if version_lt (version , '1.22' ):
803
+ raise host_config_version_error ('blkio_weight' , '1.22' )
804
+ host_config ["BlkioWeight" ] = blkio_weight
805
+
806
+ if blkio_weight_device :
807
+ if not isinstance (blkio_weight_device , list ):
808
+ raise host_config_type_error (
809
+ 'blkio_weight_device' , blkio_weight_device , 'list'
810
+ )
811
+ if version_lt (version , '1.22' ):
812
+ raise host_config_version_error ('blkio_weight_device' , '1.22' )
813
+ host_config ["BlkioWeightDevice" ] = blkio_weight_device
814
+
815
+ if device_read_bps :
816
+ if not isinstance (device_read_bps , list ):
817
+ raise host_config_type_error (
818
+ 'device_read_bps' , device_read_bps , 'list'
819
+ )
820
+ if version_lt (version , '1.22' ):
821
+ raise host_config_version_error ('device_read_bps' , '1.22' )
822
+ host_config ["BlkioDeviceReadBps" ] = device_read_bps
823
+
824
+ if device_write_bps :
825
+ if not isinstance (device_write_bps , list ):
826
+ raise host_config_type_error (
827
+ 'device_write_bps' , device_write_bps , 'list'
828
+ )
829
+ if version_lt (version , '1.22' ):
830
+ raise host_config_version_error ('device_write_bps' , '1.22' )
831
+ host_config ["BlkioDeviceWriteBps" ] = device_write_bps
832
+
833
+ if device_read_iops :
834
+ if not isinstance (device_read_iops , list ):
835
+ raise host_config_type_error (
836
+ 'device_read_iops' , device_read_iops , 'list'
837
+ )
838
+ if version_lt (version , '1.22' ):
839
+ raise host_config_version_error ('device_read_iops' , '1.22' )
840
+ host_config ["BlkioDeviceReadIOps" ] = device_read_iops
841
+
842
+ if device_write_iops :
843
+ if not isinstance (device_write_iops , list ):
844
+ raise host_config_type_error (
845
+ 'device_write_iops' , device_write_iops , 'list'
846
+ )
847
+ if version_lt (version , '1.22' ):
848
+ raise host_config_version_error ('device_write_iops' , '1.22' )
849
+ host_config ["BlkioDeviceWriteIOps" ] = device_write_iops
850
+
795
851
if tmpfs :
796
852
if version_lt (version , '1.22' ):
797
853
raise host_config_version_error ('tmpfs' , '1.22' )
0 commit comments