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