Lint: E121/E126 continuation line under/over-indented for hanging indent

This commit is contained in:
Joshua Boniface 2020-11-07 14:58:13 -05:00
parent 9135c5e3e4
commit 6f66b77a00
9 changed files with 441 additions and 473 deletions

View File

@ -237,12 +237,11 @@ def run_benchmark(self, pool):
--bs={bs} \
--readwrite={rw}
""".format(
pool=pool,
volume=volume,
test=test,
bs=test_matrix[test]['bs'],
rw=test_matrix[test]['rw']
)
pool=pool,
volume=volume,
test=test,
bs=test_matrix[test]['bs'],
rw=test_matrix[test]['rw'])
retcode, stdout, stderr = pvc_common.run_os_command(fio_cmd)
if retcode:

View File

@ -432,41 +432,40 @@ Rd: {osd_rdops: <{osd_rdops_length}} \
Wr: {osd_wrops: <{osd_wrops_length}} \
{osd_wrdata: <{osd_wrdata_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
osd_id_length=osd_id_length,
osd_node_length=osd_node_length,
osd_up_length=osd_up_length,
osd_in_length=osd_in_length,
osd_size_length=osd_size_length,
osd_pgs_length=osd_pgs_length,
osd_weight_length=osd_weight_length,
osd_reweight_length=osd_reweight_length,
osd_used_length=osd_used_length,
osd_free_length=osd_free_length,
osd_util_length=osd_util_length,
osd_var_length=osd_var_length,
osd_wrops_length=osd_wrops_length,
osd_wrdata_length=osd_wrdata_length,
osd_rdops_length=osd_rdops_length,
osd_rddata_length=osd_rddata_length,
osd_id='ID',
osd_node='Node',
osd_up='Up',
osd_in='In',
osd_size='Size',
osd_pgs='PGs',
osd_weight='Wt',
osd_reweight='ReWt',
osd_used='Used',
osd_free='Free',
osd_util='Util%',
osd_var='Var',
osd_wrops='OPS',
osd_wrdata='Data',
osd_rdops='OPS',
osd_rddata='Data'
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
osd_id_length=osd_id_length,
osd_node_length=osd_node_length,
osd_up_length=osd_up_length,
osd_in_length=osd_in_length,
osd_size_length=osd_size_length,
osd_pgs_length=osd_pgs_length,
osd_weight_length=osd_weight_length,
osd_reweight_length=osd_reweight_length,
osd_used_length=osd_used_length,
osd_free_length=osd_free_length,
osd_util_length=osd_util_length,
osd_var_length=osd_var_length,
osd_wrops_length=osd_wrops_length,
osd_wrdata_length=osd_wrdata_length,
osd_rdops_length=osd_rdops_length,
osd_rddata_length=osd_rddata_length,
osd_id='ID',
osd_node='Node',
osd_up='Up',
osd_in='In',
osd_size='Size',
osd_pgs='PGs',
osd_weight='Wt',
osd_reweight='ReWt',
osd_used='Used',
osd_free='Free',
osd_util='Util%',
osd_var='Var',
osd_wrops='OPS',
osd_wrdata='Data',
osd_rdops='OPS',
osd_rddata='Data')
)
for osd_information in sorted(osd_list, key=lambda x: int(x['id'])):
@ -500,44 +499,43 @@ Wr: {osd_wrops: <{osd_wrops_length}} \
{osd_wrops: <{osd_wrops_length}} \
{osd_wrdata: <{osd_wrdata_length}} \
{end_bold}'.format(
bold='',
end_bold='',
end_colour=ansiprint.end(),
osd_id_length=osd_id_length,
osd_node_length=osd_node_length,
osd_up_length=osd_up_length,
osd_in_length=osd_in_length,
osd_size_length=osd_size_length,
osd_pgs_length=osd_pgs_length,
osd_weight_length=osd_weight_length,
osd_reweight_length=osd_reweight_length,
osd_used_length=osd_used_length,
osd_free_length=osd_free_length,
osd_util_length=osd_util_length,
osd_var_length=osd_var_length,
osd_wrops_length=osd_wrops_length,
osd_wrdata_length=osd_wrdata_length,
osd_rdops_length=osd_rdops_length,
osd_rddata_length=osd_rddata_length,
osd_id=osd_information['id'],
osd_node=osd_information['stats']['node'],
osd_up_colour=osd_up_colour,
osd_up=osd_up_flag,
osd_in_colour=osd_in_colour,
osd_in=osd_in_flag,
osd_size=osd_information['stats']['size'],
osd_pgs=osd_information['stats']['pgs'],
osd_weight=osd_information['stats']['weight'],
osd_reweight=osd_information['stats']['reweight'],
osd_used=osd_information['stats']['used'],
osd_free=osd_information['stats']['avail'],
osd_util=osd_util,
osd_var=osd_var,
osd_wrops=osd_information['stats']['wr_ops'],
osd_wrdata=osd_information['stats']['wr_data'],
osd_rdops=osd_information['stats']['rd_ops'],
osd_rddata=osd_information['stats']['rd_data']
)
bold='',
end_bold='',
end_colour=ansiprint.end(),
osd_id_length=osd_id_length,
osd_node_length=osd_node_length,
osd_up_length=osd_up_length,
osd_in_length=osd_in_length,
osd_size_length=osd_size_length,
osd_pgs_length=osd_pgs_length,
osd_weight_length=osd_weight_length,
osd_reweight_length=osd_reweight_length,
osd_used_length=osd_used_length,
osd_free_length=osd_free_length,
osd_util_length=osd_util_length,
osd_var_length=osd_var_length,
osd_wrops_length=osd_wrops_length,
osd_wrdata_length=osd_wrdata_length,
osd_rdops_length=osd_rdops_length,
osd_rddata_length=osd_rddata_length,
osd_id=osd_information['id'],
osd_node=osd_information['stats']['node'],
osd_up_colour=osd_up_colour,
osd_up=osd_up_flag,
osd_in_colour=osd_in_colour,
osd_in=osd_in_flag,
osd_size=osd_information['stats']['size'],
osd_pgs=osd_information['stats']['pgs'],
osd_weight=osd_information['stats']['weight'],
osd_reweight=osd_information['stats']['reweight'],
osd_used=osd_information['stats']['used'],
osd_free=osd_information['stats']['avail'],
osd_util=osd_util,
osd_var=osd_var,
osd_wrops=osd_information['stats']['wr_ops'],
osd_wrdata=osd_information['stats']['wr_data'],
osd_rdops=osd_information['stats']['rd_ops'],
osd_rddata=osd_information['stats']['rd_data'])
)
return '\n'.join(osd_list_output)
@ -743,35 +741,34 @@ Rd: {pool_read_ops: <{pool_read_ops_length}} \
Wr: {pool_write_ops: <{pool_write_ops_length}} \
{pool_write_data: <{pool_write_data_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
pool_id_length=pool_id_length,
pool_name_length=pool_name_length,
pool_used_length=pool_used_length,
pool_usedpct_length=pool_usedpct_length,
pool_free_length=pool_free_length,
pool_objects_length=pool_num_objects_length,
pool_clones_length=pool_num_clones_length,
pool_copies_length=pool_num_copies_length,
pool_degraded_length=pool_num_degraded_length,
pool_write_ops_length=pool_write_ops_length,
pool_write_data_length=pool_write_data_length,
pool_read_ops_length=pool_read_ops_length,
pool_read_data_length=pool_read_data_length,
pool_id='ID',
pool_name='Name',
pool_used='Used',
pool_usedpct='%',
pool_free='Free',
pool_objects='Count',
pool_clones='Clones',
pool_copies='Copies',
pool_degraded='Degraded',
pool_write_ops='OPS',
pool_write_data='Data',
pool_read_ops='OPS',
pool_read_data='Data'
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
pool_id_length=pool_id_length,
pool_name_length=pool_name_length,
pool_used_length=pool_used_length,
pool_usedpct_length=pool_usedpct_length,
pool_free_length=pool_free_length,
pool_objects_length=pool_num_objects_length,
pool_clones_length=pool_num_clones_length,
pool_copies_length=pool_num_copies_length,
pool_degraded_length=pool_num_degraded_length,
pool_write_ops_length=pool_write_ops_length,
pool_write_data_length=pool_write_data_length,
pool_read_ops_length=pool_read_ops_length,
pool_read_data_length=pool_read_data_length,
pool_id='ID',
pool_name='Name',
pool_used='Used',
pool_usedpct='%',
pool_free='Free',
pool_objects='Count',
pool_clones='Clones',
pool_copies='Copies',
pool_degraded='Degraded',
pool_write_ops='OPS',
pool_write_data='Data',
pool_read_ops='OPS',
pool_read_data='Data')
)
for pool_information in sorted(pool_list, key=lambda x: int(x['stats']['id'])):
@ -791,35 +788,34 @@ Wr: {pool_write_ops: <{pool_write_ops_length}} \
{pool_write_ops: <{pool_write_ops_length}} \
{pool_write_data: <{pool_write_data_length}} \
{end_bold}'.format(
bold='',
end_bold='',
pool_id_length=pool_id_length,
pool_name_length=pool_name_length,
pool_used_length=pool_used_length,
pool_usedpct_length=pool_usedpct_length,
pool_free_length=pool_free_length,
pool_objects_length=pool_num_objects_length,
pool_clones_length=pool_num_clones_length,
pool_copies_length=pool_num_copies_length,
pool_degraded_length=pool_num_degraded_length,
pool_write_ops_length=pool_write_ops_length,
pool_write_data_length=pool_write_data_length,
pool_read_ops_length=pool_read_ops_length,
pool_read_data_length=pool_read_data_length,
pool_id=pool_information['stats']['id'],
pool_name=pool_information['name'],
pool_used=pool_information['stats']['used_bytes'],
pool_usedpct=pool_information['stats']['used_percent'],
pool_free=pool_information['stats']['free_bytes'],
pool_objects=pool_information['stats']['num_objects'],
pool_clones=pool_information['stats']['num_object_clones'],
pool_copies=pool_information['stats']['num_object_copies'],
pool_degraded=pool_information['stats']['num_objects_degraded'],
pool_write_ops=pool_information['stats']['write_ops'],
pool_write_data=pool_information['stats']['write_bytes'],
pool_read_ops=pool_information['stats']['read_ops'],
pool_read_data=pool_information['stats']['read_bytes']
)
bold='',
end_bold='',
pool_id_length=pool_id_length,
pool_name_length=pool_name_length,
pool_used_length=pool_used_length,
pool_usedpct_length=pool_usedpct_length,
pool_free_length=pool_free_length,
pool_objects_length=pool_num_objects_length,
pool_clones_length=pool_num_clones_length,
pool_copies_length=pool_num_copies_length,
pool_degraded_length=pool_num_degraded_length,
pool_write_ops_length=pool_write_ops_length,
pool_write_data_length=pool_write_data_length,
pool_read_ops_length=pool_read_ops_length,
pool_read_data_length=pool_read_data_length,
pool_id=pool_information['stats']['id'],
pool_name=pool_information['name'],
pool_used=pool_information['stats']['used_bytes'],
pool_usedpct=pool_information['stats']['used_percent'],
pool_free=pool_information['stats']['free_bytes'],
pool_objects=pool_information['stats']['num_objects'],
pool_clones=pool_information['stats']['num_object_clones'],
pool_copies=pool_information['stats']['num_object_copies'],
pool_degraded=pool_information['stats']['num_objects_degraded'],
pool_write_ops=pool_information['stats']['write_ops'],
pool_write_data=pool_information['stats']['write_bytes'],
pool_read_ops=pool_information['stats']['read_ops'],
pool_read_data=pool_information['stats']['read_bytes'])
)
return '\n'.join(pool_list_output)
@ -1053,23 +1049,22 @@ def format_list_volume(volume_list):
{volume_format: <{volume_format_length}} \
{volume_features: <{volume_features_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
volume_name_length=volume_name_length,
volume_pool_length=volume_pool_length,
volume_size_length=volume_size_length,
volume_objects_length=volume_objects_length,
volume_order_length=volume_order_length,
volume_format_length=volume_format_length,
volume_features_length=volume_features_length,
volume_name='Name',
volume_pool='Pool',
volume_size='Size',
volume_objects='Objects',
volume_order='Order',
volume_format='Format',
volume_features='Features',
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
volume_name_length=volume_name_length,
volume_pool_length=volume_pool_length,
volume_size_length=volume_size_length,
volume_objects_length=volume_objects_length,
volume_order_length=volume_order_length,
volume_format_length=volume_format_length,
volume_features_length=volume_features_length,
volume_name='Name',
volume_pool='Pool',
volume_size='Size',
volume_objects='Objects',
volume_order='Order',
volume_format='Format',
volume_features='Features')
)
for volume_information in volume_list:
@ -1082,23 +1077,22 @@ def format_list_volume(volume_list):
{volume_format: <{volume_format_length}} \
{volume_features: <{volume_features_length}} \
{end_bold}'.format(
bold='',
end_bold='',
volume_name_length=volume_name_length,
volume_pool_length=volume_pool_length,
volume_size_length=volume_size_length,
volume_objects_length=volume_objects_length,
volume_order_length=volume_order_length,
volume_format_length=volume_format_length,
volume_features_length=volume_features_length,
volume_name=volume_information['name'],
volume_pool=volume_information['pool'],
volume_size=volume_information['stats']['size'],
volume_objects=volume_information['stats']['objects'],
volume_order=volume_information['stats']['order'],
volume_format=volume_information['stats']['format'],
volume_features=','.join(volume_information['stats']['features']),
)
bold='',
end_bold='',
volume_name_length=volume_name_length,
volume_pool_length=volume_pool_length,
volume_size_length=volume_size_length,
volume_objects_length=volume_objects_length,
volume_order_length=volume_order_length,
volume_format_length=volume_format_length,
volume_features_length=volume_features_length,
volume_name=volume_information['name'],
volume_pool=volume_information['pool'],
volume_size=volume_information['stats']['size'],
volume_objects=volume_information['stats']['objects'],
volume_order=volume_information['stats']['order'],
volume_format=volume_information['stats']['format'],
volume_features=','.join(volume_information['stats']['features']))
)
return '\n'.join(sorted(volume_list_output))
@ -1251,15 +1245,14 @@ def format_list_snapshot(snapshot_list):
{snapshot_volume: <{snapshot_volume_length}} \
{snapshot_pool: <{snapshot_pool_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
snapshot_name_length=snapshot_name_length,
snapshot_volume_length=snapshot_volume_length,
snapshot_pool_length=snapshot_pool_length,
snapshot_name='Name',
snapshot_volume='Volume',
snapshot_pool='Pool',
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
snapshot_name_length=snapshot_name_length,
snapshot_volume_length=snapshot_volume_length,
snapshot_pool_length=snapshot_pool_length,
snapshot_name='Name',
snapshot_volume='Volume',
snapshot_pool='Pool')
)
for snapshot_information in snapshot_list:
@ -1271,15 +1264,14 @@ def format_list_snapshot(snapshot_list):
{snapshot_volume: <{snapshot_volume_length}} \
{snapshot_pool: <{snapshot_pool_length}} \
{end_bold}'.format(
bold='',
end_bold='',
snapshot_name_length=snapshot_name_length,
snapshot_volume_length=snapshot_volume_length,
snapshot_pool_length=snapshot_pool_length,
snapshot_name=snapshot_name,
snapshot_volume=snapshot_volume,
snapshot_pool=snapshot_pool,
)
bold='',
end_bold='',
snapshot_name_length=snapshot_name_length,
snapshot_volume_length=snapshot_volume_length,
snapshot_pool_length=snapshot_pool_length,
snapshot_name=snapshot_name,
snapshot_volume=snapshot_volume,
snapshot_pool=snapshot_pool)
)
return '\n'.join(sorted(snapshot_list_output))
@ -1380,15 +1372,14 @@ def format_list_benchmark(config, benchmark_information):
{seq_header: <{seq_header_length}} \
{rand_header: <{rand_header_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
benchmark_job_length=benchmark_job_length,
seq_header_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'] + 3,
rand_header_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'] + 2,
benchmark_job='Benchmark Job',
seq_header='Sequential (4M blocks):',
rand_header='Random (4K blocks):'
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
benchmark_job_length=benchmark_job_length,
seq_header_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'] + 3,
rand_header_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'] + 2,
benchmark_job='Benchmark Job',
seq_header='Sequential (4M blocks):',
rand_header='Random (4K blocks):')
)
benchmark_list_output.append('{bold}\
@ -1398,19 +1389,18 @@ def format_list_benchmark(config, benchmark_information):
{rand_benchmark_bandwidth: <{rand_benchmark_bandwidth_length}} \
{rand_benchmark_iops: <{rand_benchmark_iops_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
benchmark_job_length=benchmark_job_length,
seq_benchmark_bandwidth_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + 2,
seq_benchmark_iops_length=benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'],
rand_benchmark_bandwidth_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + 1,
rand_benchmark_iops_length=benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'],
benchmark_job='',
seq_benchmark_bandwidth='R/W Bandwith/s',
seq_benchmark_iops='R/W IOPS',
rand_benchmark_bandwidth='R/W Bandwith/s',
rand_benchmark_iops='R/W IOPS'
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
benchmark_job_length=benchmark_job_length,
seq_benchmark_bandwidth_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + 2,
seq_benchmark_iops_length=benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'],
rand_benchmark_bandwidth_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + 1,
rand_benchmark_iops_length=benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'],
benchmark_job='',
seq_benchmark_bandwidth='R/W Bandwith/s',
seq_benchmark_iops='R/W IOPS',
rand_benchmark_bandwidth='R/W Bandwith/s',
rand_benchmark_iops='R/W IOPS')
)
for benchmark in benchmark_information:
@ -1441,19 +1431,18 @@ def format_list_benchmark(config, benchmark_information):
{rand_benchmark_bandwidth: <{rand_benchmark_bandwidth_length}} \
{rand_benchmark_iops: <{rand_benchmark_iops_length}} \
{end_bold}'.format(
bold='',
end_bold='',
benchmark_job_length=benchmark_job_length,
seq_benchmark_bandwidth_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + 2,
seq_benchmark_iops_length=benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'],
rand_benchmark_bandwidth_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + 1,
rand_benchmark_iops_length=benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'],
benchmark_job=benchmark_job,
seq_benchmark_bandwidth=seq_benchmark_bandwidth,
seq_benchmark_iops=seq_benchmark_iops,
rand_benchmark_bandwidth=rand_benchmark_bandwidth,
rand_benchmark_iops=rand_benchmark_iops
)
bold='',
end_bold='',
benchmark_job_length=benchmark_job_length,
seq_benchmark_bandwidth_length=benchmark_bandwidth_length['seq_read'] + benchmark_bandwidth_length['seq_write'] + 2,
seq_benchmark_iops_length=benchmark_iops_length['seq_read'] + benchmark_iops_length['seq_write'],
rand_benchmark_bandwidth_length=benchmark_bandwidth_length['rand_read_4K'] + benchmark_bandwidth_length['rand_write_4K'] + 1,
rand_benchmark_iops_length=benchmark_iops_length['rand_read_4K'] + benchmark_iops_length['rand_write_4K'],
benchmark_job=benchmark_job,
seq_benchmark_bandwidth=seq_benchmark_bandwidth,
seq_benchmark_iops=seq_benchmark_iops,
rand_benchmark_bandwidth=rand_benchmark_bandwidth,
rand_benchmark_iops=rand_benchmark_iops)
)
return '\n'.join(benchmark_list_output)

View File

@ -109,15 +109,11 @@ def format_info(cluster_information, oformat):
ainformation.append('{}Cluster health:{} {}{}{}'.format(ansiprint.purple(), ansiprint.end(), health_colour, cluster_information['health'], ansiprint.end()))
if cluster_information['health_msg']:
for line in cluster_information['health_msg']:
ainformation.append(
' > {}'.format(line)
)
ainformation.append(' > {}'.format(line))
ainformation.append('{}Storage health:{} {}{}{}'.format(ansiprint.purple(), ansiprint.end(), storage_health_colour, cluster_information['storage_health'], ansiprint.end()))
if cluster_information['storage_health_msg']:
for line in cluster_information['storage_health_msg']:
ainformation.append(
' > {}'.format(line)
)
ainformation.append(' > {}'.format(line))
ainformation.append('')
ainformation.append('{}Primary node:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['primary_node']))
ainformation.append('{}Cluster upstream IP:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['upstream_ip']))

View File

@ -480,25 +480,24 @@ def format_list(config, network_list):
{net_v4_flag: <{net_v4_flag_length}} \
{net_dhcp4_flag: <{net_dhcp4_flag_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
net_vni_length=net_vni_length,
net_description_length=net_description_length,
net_nettype_length=net_nettype_length,
net_domain_length=net_domain_length,
net_v6_flag_length=net_v6_flag_length,
net_dhcp6_flag_length=net_dhcp6_flag_length,
net_v4_flag_length=net_v4_flag_length,
net_dhcp4_flag_length=net_dhcp4_flag_length,
net_vni='VNI',
net_description='Description',
net_nettype='Type',
net_domain='Domain',
net_v6_flag='IPv6',
net_dhcp6_flag='DHCPv6',
net_v4_flag='IPv4',
net_dhcp4_flag='DHCPv4',
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
net_vni_length=net_vni_length,
net_description_length=net_description_length,
net_nettype_length=net_nettype_length,
net_domain_length=net_domain_length,
net_v6_flag_length=net_v6_flag_length,
net_dhcp6_flag_length=net_dhcp6_flag_length,
net_v4_flag_length=net_v4_flag_length,
net_dhcp4_flag_length=net_dhcp4_flag_length,
net_vni='VNI',
net_description='Description',
net_nettype='Type',
net_domain='Domain',
net_v6_flag='IPv6',
net_dhcp6_flag='DHCPv6',
net_v4_flag='IPv4',
net_dhcp4_flag='DHCPv4')
)
for network_information in network_list:
@ -513,8 +512,7 @@ def format_list(config, network_list):
else:
v6_flag = 'False'
network_list_output.append(
'{bold}\
network_list_output.append('{bold}\
{net_vni: <{net_vni_length}} \
{net_description: <{net_description_length}} \
{net_nettype: <{net_nettype_length}} \
@ -524,30 +522,29 @@ def format_list(config, network_list):
{v4_flag_colour}{net_v4_flag: <{net_v4_flag_length}}{colour_off} \
{dhcp4_flag_colour}{net_dhcp4_flag: <{net_dhcp4_flag_length}}{colour_off} \
{end_bold}'.format(
bold='',
end_bold='',
net_vni_length=net_vni_length,
net_description_length=net_description_length,
net_nettype_length=net_nettype_length,
net_domain_length=net_domain_length,
net_v6_flag_length=net_v6_flag_length,
net_dhcp6_flag_length=net_dhcp6_flag_length,
net_v4_flag_length=net_v4_flag_length,
net_dhcp4_flag_length=net_dhcp4_flag_length,
net_vni=network_information['vni'],
net_description=network_information['description'],
net_nettype=network_information['type'],
net_domain=network_information['domain'],
net_v6_flag=v6_flag,
v6_flag_colour=v6_flag_colour,
net_dhcp6_flag=network_information['ip6']['dhcp_flag'],
dhcp6_flag_colour=dhcp6_flag_colour,
net_v4_flag=v4_flag,
v4_flag_colour=v4_flag_colour,
net_dhcp4_flag=network_information['ip4']['dhcp_flag'],
dhcp4_flag_colour=dhcp4_flag_colour,
colour_off=ansiprint.end()
)
bold='',
end_bold='',
net_vni_length=net_vni_length,
net_description_length=net_description_length,
net_nettype_length=net_nettype_length,
net_domain_length=net_domain_length,
net_v6_flag_length=net_v6_flag_length,
net_dhcp6_flag_length=net_dhcp6_flag_length,
net_v4_flag_length=net_v4_flag_length,
net_dhcp4_flag_length=net_dhcp4_flag_length,
net_vni=network_information['vni'],
net_description=network_information['description'],
net_nettype=network_information['type'],
net_domain=network_information['domain'],
net_v6_flag=v6_flag,
v6_flag_colour=v6_flag_colour,
net_dhcp6_flag=network_information['ip6']['dhcp_flag'],
dhcp6_flag_colour=dhcp6_flag_colour,
net_v4_flag=v4_flag,
v4_flag_colour=v4_flag_colour,
net_dhcp4_flag=network_information['ip4']['dhcp_flag'],
dhcp4_flag_colour=dhcp4_flag_colour,
colour_off=ansiprint.end())
)
return '\n'.join(sorted(network_list_output))
@ -582,17 +579,16 @@ def format_list_dhcp(dhcp_lease_list):
{lease_mac_address: <{lease_mac_address_length}} \
{lease_timestamp: <{lease_timestamp_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
lease_hostname_length=lease_hostname_length,
lease_ip4_address_length=lease_ip4_address_length,
lease_mac_address_length=lease_mac_address_length,
lease_timestamp_length=lease_timestamp_length,
lease_hostname='Hostname',
lease_ip4_address='IP Address',
lease_mac_address='MAC Address',
lease_timestamp='Timestamp'
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
lease_hostname_length=lease_hostname_length,
lease_ip4_address_length=lease_ip4_address_length,
lease_mac_address_length=lease_mac_address_length,
lease_timestamp_length=lease_timestamp_length,
lease_hostname='Hostname',
lease_ip4_address='IP Address',
lease_mac_address='MAC Address',
lease_timestamp='Timestamp')
)
for dhcp_lease_information in dhcp_lease_list:
@ -602,17 +598,16 @@ def format_list_dhcp(dhcp_lease_list):
{lease_mac_address: <{lease_mac_address_length}} \
{lease_timestamp: <{lease_timestamp_length}} \
{end_bold}'.format(
bold='',
end_bold='',
lease_hostname_length=lease_hostname_length,
lease_ip4_address_length=lease_ip4_address_length,
lease_mac_address_length=lease_mac_address_length,
lease_timestamp_length=12,
lease_hostname=str(dhcp_lease_information['hostname']),
lease_ip4_address=str(dhcp_lease_information['ip4_address']),
lease_mac_address=str(dhcp_lease_information['mac_address']),
lease_timestamp=str(dhcp_lease_information['timestamp'])
)
bold='',
end_bold='',
lease_hostname_length=lease_hostname_length,
lease_ip4_address_length=lease_ip4_address_length,
lease_mac_address_length=lease_mac_address_length,
lease_timestamp_length=12,
lease_hostname=str(dhcp_lease_information['hostname']),
lease_ip4_address=str(dhcp_lease_information['ip4_address']),
lease_mac_address=str(dhcp_lease_information['mac_address']),
lease_timestamp=str(dhcp_lease_information['timestamp']))
)
return '\n'.join(sorted(dhcp_lease_list_output))
@ -654,17 +649,16 @@ def format_list_acl(acl_list):
{acl_description: <{acl_description_length}} \
{acl_rule: <{acl_rule_length}} \
{end_bold}'.format(
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
acl_direction_length=acl_direction_length,
acl_order_length=acl_order_length,
acl_description_length=acl_description_length,
acl_rule_length=acl_rule_length,
acl_direction='Direction',
acl_order='Order',
acl_description='Description',
acl_rule='Rule',
)
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
acl_direction_length=acl_direction_length,
acl_order_length=acl_order_length,
acl_description_length=acl_description_length,
acl_rule_length=acl_rule_length,
acl_direction='Direction',
acl_order='Order',
acl_description='Description',
acl_rule='Rule')
)
for acl_information in acl_list:
@ -674,17 +668,16 @@ def format_list_acl(acl_list):
{acl_description: <{acl_description_length}} \
{acl_rule: <{acl_rule_length}} \
{end_bold}'.format(
bold='',
end_bold='',
acl_direction_length=acl_direction_length,
acl_order_length=acl_order_length,
acl_description_length=acl_description_length,
acl_rule_length=acl_rule_length,
acl_direction=acl_information['direction'],
acl_order=acl_information['order'],
acl_description=acl_information['description'],
acl_rule=acl_information['rule'],
)
bold='',
end_bold='',
acl_direction_length=acl_direction_length,
acl_order_length=acl_order_length,
acl_description_length=acl_description_length,
acl_rule_length=acl_rule_length,
acl_direction=acl_information['direction'],
acl_order=acl_information['order'],
acl_description=acl_information['description'],
acl_rule=acl_information['rule'])
)
return '\n'.join(sorted(acl_list_output))

View File

@ -808,33 +808,32 @@ Meta: {template_node_limit: <{template_node_limit_length}} \
{template_node_selector: <{template_node_selector_length}} \
{template_node_autostart: <{template_node_autostart_length}} \
{template_migration_method: <{template_migration_method_length}}{end_bold}'.format(
template_name_length=template_name_length,
template_id_length=template_id_length,
template_vcpu_length=template_vcpu_length,
template_vram_length=template_vram_length,
template_serial_length=template_serial_length,
template_vnc_length=template_vnc_length,
template_vnc_bind_length=template_vnc_bind_length,
template_node_limit_length=template_node_limit_length,
template_node_selector_length=template_node_selector_length,
template_node_autostart_length=template_node_autostart_length,
template_migration_method_length=template_migration_method_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_state_colour='',
end_colour='',
template_name='Name',
template_id='ID',
template_vcpu='vCPUs',
template_vram='vRAM [MB]',
template_serial='Serial',
template_vnc='VNC',
template_vnc_bind='VNC bind',
template_node_limit='Limit',
template_node_selector='Selector',
template_node_autostart='Autostart',
template_migration_method='Migration'
)
template_name_length=template_name_length,
template_id_length=template_id_length,
template_vcpu_length=template_vcpu_length,
template_vram_length=template_vram_length,
template_serial_length=template_serial_length,
template_vnc_length=template_vnc_length,
template_vnc_bind_length=template_vnc_bind_length,
template_node_limit_length=template_node_limit_length,
template_node_selector_length=template_node_selector_length,
template_node_autostart_length=template_node_autostart_length,
template_migration_method_length=template_migration_method_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_state_colour='',
end_colour='',
template_name='Name',
template_id='ID',
template_vcpu='vCPUs',
template_vram='vRAM [MB]',
template_serial='Serial',
template_vnc='VNC',
template_vnc_bind='VNC bind',
template_node_limit='Limit',
template_node_selector='Selector',
template_node_autostart='Autostart',
template_migration_method='Migration')
# Format the string (elements)
for template in sorted(template_data, key=lambda i: i.get('name', None)):
@ -922,17 +921,16 @@ def format_list_template_network(template_template):
template_list_output_header = '{bold}{template_name: <{template_name_length}} {template_id: <{template_id_length}} \
{template_mac_template: <{template_mac_template_length}} \
{template_networks: <{template_networks_length}}{end_bold}'.format(
template_name_length=template_name_length,
template_id_length=template_id_length,
template_mac_template_length=template_mac_template_length,
template_networks_length=template_networks_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_name='Name',
template_id='ID',
template_mac_template='MAC template',
template_networks='Network VNIs'
)
template_name_length=template_name_length,
template_id_length=template_id_length,
template_mac_template_length=template_mac_template_length,
template_networks_length=template_networks_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_name='Name',
template_id='ID',
template_mac_template='MAC template',
template_networks='Network VNIs')
# Format the string (elements)
for template in sorted(template_template, key=lambda i: i.get('name', None)):
@ -1022,27 +1020,26 @@ def format_list_template_storage(template_template):
{template_disk_filesystem: <{template_disk_filesystem_length}} \
{template_disk_fsargs: <{template_disk_fsargs_length}} \
{template_disk_mountpoint: <{template_disk_mountpoint_length}}{end_bold}'.format(
template_name_length=template_name_length,
template_id_length=template_id_length,
template_disk_id_length=template_disk_id_length,
template_disk_pool_length=template_disk_pool_length,
template_disk_source_length=template_disk_source_length,
template_disk_size_length=template_disk_size_length,
template_disk_filesystem_length=template_disk_filesystem_length,
template_disk_fsargs_length=template_disk_fsargs_length,
template_disk_mountpoint_length=template_disk_mountpoint_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_name='Name',
template_id='ID',
template_disk_id='Disk ID',
template_disk_pool='Pool',
template_disk_source='Source Volume',
template_disk_size='Size [GB]',
template_disk_filesystem='Filesystem',
template_disk_fsargs='Arguments',
template_disk_mountpoint='Mountpoint'
)
template_name_length=template_name_length,
template_id_length=template_id_length,
template_disk_id_length=template_disk_id_length,
template_disk_pool_length=template_disk_pool_length,
template_disk_source_length=template_disk_source_length,
template_disk_size_length=template_disk_size_length,
template_disk_filesystem_length=template_disk_filesystem_length,
template_disk_fsargs_length=template_disk_fsargs_length,
template_disk_mountpoint_length=template_disk_mountpoint_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
template_name='Name',
template_id='ID',
template_disk_id='Disk ID',
template_disk_pool='Pool',
template_disk_source='Source Volume',
template_disk_size='Size [GB]',
template_disk_filesystem='Filesystem',
template_disk_fsargs='Arguments',
template_disk_mountpoint='Mountpoint')
# Format the string (elements)
for template in sorted(template_template, key=lambda i: i.get('name', None)):
@ -1115,14 +1112,13 @@ def format_list_userdata(userdata_data, lines=None):
# Format the string (header)
userdata_list_output_header = '{bold}{userdata_name: <{userdata_name_length}} {userdata_id: <{userdata_id_length}} \
{userdata_data}{end_bold}'.format(
userdata_name_length=userdata_name_length,
userdata_id_length=userdata_id_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
userdata_name='Name',
userdata_id='ID',
userdata_data='Document'
)
userdata_name_length=userdata_name_length,
userdata_id_length=userdata_id_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
userdata_name='Name',
userdata_id='ID',
userdata_data='Document')
# Format the string (elements)
for data in sorted(userdata_data, key=lambda i: i.get('name', None)):
@ -1190,14 +1186,13 @@ def format_list_script(script_data, lines=None):
# Format the string (header)
script_list_output_header = '{bold}{script_name: <{script_name_length}} {script_id: <{script_id_length}} \
{script_data}{end_bold}'.format(
script_name_length=script_name_length,
script_id_length=script_id_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
script_name='Name',
script_id='ID',
script_data='Script'
)
script_name_length=script_name_length,
script_id_length=script_id_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
script_name='Name',
script_id='ID',
script_data='Script')
# Format the string (elements)
for script in sorted(script_data, key=lambda i: i.get('name', None)):
@ -1296,23 +1291,22 @@ def format_list_ova(ova_data):
{ova_disk_pool: <{ova_disk_pool_length}} \
{ova_disk_volume_format: <{ova_disk_volume_format_length}} \
{ova_disk_volume_name: <{ova_disk_volume_name_length}}{end_bold}'.format(
ova_name_length=ova_name_length,
ova_id_length=ova_id_length,
ova_disk_id_length=ova_disk_id_length,
ova_disk_pool_length=ova_disk_pool_length,
ova_disk_size_length=ova_disk_size_length,
ova_disk_volume_format_length=ova_disk_volume_format_length,
ova_disk_volume_name_length=ova_disk_volume_name_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
ova_name='Name',
ova_id='ID',
ova_disk_id='Disk ID',
ova_disk_size='Size [GB]',
ova_disk_pool='Pool',
ova_disk_volume_format='Format',
ova_disk_volume_name='Source Volume',
)
ova_name_length=ova_name_length,
ova_id_length=ova_id_length,
ova_disk_id_length=ova_disk_id_length,
ova_disk_pool_length=ova_disk_pool_length,
ova_disk_size_length=ova_disk_size_length,
ova_disk_volume_format_length=ova_disk_volume_format_length,
ova_disk_volume_name_length=ova_disk_volume_name_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
ova_name='Name',
ova_id='ID',
ova_disk_id='Disk ID',
ova_disk_size='Size [GB]',
ova_disk_pool='Pool',
ova_disk_volume_format='Format',
ova_disk_volume_name='Source Volume')
# Format the string (elements)
for ova in sorted(ova_data, key=lambda i: i.get('name', None)):
@ -1425,26 +1419,25 @@ Templates: {profile_system_template: <{profile_system_template_length}} \
Data: {profile_userdata: <{profile_userdata_length}} \
{profile_script: <{profile_script_length}} \
{profile_arguments}{end_bold}'.format(
profile_name_length=profile_name_length,
profile_id_length=profile_id_length,
profile_source_length=profile_source_length,
profile_system_template_length=profile_system_template_length,
profile_network_template_length=profile_network_template_length,
profile_storage_template_length=profile_storage_template_length,
profile_userdata_length=profile_userdata_length,
profile_script_length=profile_script_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
profile_name='Name',
profile_id='ID',
profile_source='Source',
profile_system_template='System',
profile_network_template='Network',
profile_storage_template='Storage',
profile_userdata='Userdata',
profile_script='Script',
profile_arguments='Script Arguments'
)
profile_name_length=profile_name_length,
profile_id_length=profile_id_length,
profile_source_length=profile_source_length,
profile_system_template_length=profile_system_template_length,
profile_network_template_length=profile_network_template_length,
profile_storage_template_length=profile_storage_template_length,
profile_userdata_length=profile_userdata_length,
profile_script_length=profile_script_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
profile_name='Name',
profile_id='ID',
profile_source='Source',
profile_system_template='System',
profile_network_template='Network',
profile_storage_template='Storage',
profile_userdata='Userdata',
profile_script='Script',
profile_arguments='Script Arguments')
# Format the string (elements)
for profile in sorted(profile_data, key=lambda i: i.get('name', None)):
@ -1530,23 +1523,22 @@ VM: {task_vm_name: <{task_vm_name_length}} \
{task_vm_profile: <{task_vm_profile_length}} \
{task_vm_define: <{task_vm_define_length}} \
{task_vm_start: <{task_vm_start_length}}{end_bold}'.format(
task_id_length=task_id_length,
task_type_length=task_type_length,
task_worker_length=task_worker_length,
task_vm_name_length=task_vm_name_length,
task_vm_profile_length=task_vm_profile_length,
task_vm_define_length=task_vm_define_length,
task_vm_start_length=task_vm_start_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
task_id='Job ID',
task_type='Status',
task_worker='Worker',
task_vm_name='Name',
task_vm_profile='Profile',
task_vm_define='Define?',
task_vm_start='Start?'
)
task_id_length=task_id_length,
task_type_length=task_type_length,
task_worker_length=task_worker_length,
task_vm_name_length=task_vm_name_length,
task_vm_profile_length=task_vm_profile_length,
task_vm_define_length=task_vm_define_length,
task_vm_start_length=task_vm_start_length,
bold=ansiprint.bold(),
end_bold=ansiprint.end(),
task_id='Job ID',
task_type='Status',
task_worker='Worker',
task_vm_name='Name',
task_vm_profile='Profile',
task_vm_define='Define?',
task_vm_start='Start?')
# Format the string (elements)
for task in sorted(task_data, key=lambda i: i.get('type', None)):

View File

@ -520,10 +520,10 @@ def move_vm(zk_conn, domain, target_node, wait=False, force_live=False):
lock = zkhandler.exclusivelock(zk_conn, '/domains/{}/state'.format(dom_uuid))
lock.acquire()
zkhandler.writedata(zk_conn, {
'/domains/{}/state'.format(dom_uuid): target_state,
'/domains/{}/node'.format(dom_uuid): target_node,
'/domains/{}/lastnode'.format(dom_uuid): ''
})
'/domains/{}/state'.format(dom_uuid): target_state,
'/domains/{}/node'.format(dom_uuid): target_node,
'/domains/{}/lastnode'.format(dom_uuid): ''
})
lock.release()
if wait:

View File

@ -165,11 +165,11 @@ class DNSNetworkInstance(object):
# Connect to the database
self.sql_conn = psycopg2.connect(
"host='{}' port='{}' dbname='{}' user='{}' password='{}' sslmode='disable'".format(
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
)
)
sql_curs = self.sql_conn.cursor()
@ -241,11 +241,11 @@ class DNSNetworkInstance(object):
# Connect to the database
self.sql_conn = psycopg2.connect(
"host='{}' port='{}' dbname='{}' user='{}' password='{}' sslmode='disable'".format(
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
)
)
sql_curs = self.sql_conn.cursor()
@ -297,11 +297,11 @@ class AXFRDaemonInstance(object):
# after the leader transitions
self.sql_conn = psycopg2.connect(
"host='{}' port='{}' dbname='{}' user='{}' password='{}' sslmode='disable'".format(
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
self.config['pdns_postgresql_host'],
self.config['pdns_postgresql_port'],
self.config['pdns_postgresql_dbname'],
self.config['pdns_postgresql_user'],
self.config['pdns_postgresql_password']
)
)

View File

@ -733,17 +733,17 @@ if enable_networking:
common.run_os_command(
'/bin/mkdir --parents {}/networks'.format(
config['nft_dynamic_directory']
)
)
)
common.run_os_command(
'/bin/mkdir --parents {}/static'.format(
config['nft_dynamic_directory']
)
)
)
common.run_os_command(
'/bin/mkdir --parents {}'.format(
config['nft_dynamic_directory']
)
)
)
# Set up the basic features of the nftables firewall

View File

@ -452,9 +452,8 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
firewall_rules += self.firewall_rules_v4
output = "{}\n# User rules\n{}\n".format(
firewall_rules,
'\n'.join(full_ordered_rules)
)
firewall_rules,
'\n'.join(full_ordered_rules))
with open(self.nftables_netconf_filename, 'w') as nfnetfile:
nfnetfile.write(dedent(output))