ipvsadm '--exact' arg to ensure outputs are ints
Currently the keepalivedlvs_query script calls ipvsadm -Ln --stats to query the local lvs for connection information. If any of these values grow large enough they will be abbreviated with human- friendly suffixes (K, M, G) and cause the get_ipvsadm_info func to raise an exception when it receives a non-integer value from its command output. By using the --exact argument in addition to the existing arguments, we can ensure the output is always expanded numbers, per the ipvsadm man page, and will only ever offer integer outputs to the get_ipvsadm_info command. Change-Id: I2e8c0be2221c0c23b752fdf2cdff065cddf830a5 Story: 2006791 Task: 37331
This commit is contained in:
parent
43577a6c04
commit
0682fb977a
|
@ -280,8 +280,9 @@ def get_udp_listener_pool_status(listener_id):
|
|||
|
||||
def get_ipvsadm_info(ns_name, is_stats_cmd=False):
|
||||
cmd_list = ['ip', 'netns', 'exec', ns_name, 'ipvsadm', '-Ln']
|
||||
# use --exact to ensure output is integer only
|
||||
if is_stats_cmd:
|
||||
cmd_list.append('--stats')
|
||||
cmd_list += ['--stats', '--exact']
|
||||
output = subprocess.check_output(cmd_list, stderr=subprocess.STDOUT)
|
||||
if isinstance(output, bytes):
|
||||
output = output.decode('utf-8')
|
||||
|
|
Loading…
Reference in New Issue