octavia 14.0.0.0rc1__py3-none-any.whl → 15.0.0.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- octavia/amphorae/backends/agent/agent_jinja_cfg.py +1 -4
- octavia/amphorae/backends/agent/api_server/amphora_info.py +5 -5
- octavia/amphorae/backends/agent/api_server/keepalived.py +26 -53
- octavia/amphorae/backends/agent/api_server/keepalivedlvs.py +44 -83
- octavia/amphorae/backends/agent/api_server/loadbalancer.py +94 -112
- octavia/amphorae/backends/agent/api_server/lvs_listener_base.py +1 -1
- octavia/amphorae/backends/agent/api_server/osutils.py +11 -8
- octavia/amphorae/backends/agent/api_server/plug.py +12 -13
- octavia/amphorae/backends/agent/api_server/server.py +4 -3
- octavia/amphorae/backends/agent/api_server/templates/keepalived_lvs_check_script.sh.j2 +0 -4
- octavia/amphorae/backends/agent/api_server/util.py +23 -68
- octavia/amphorae/backends/agent/templates/amphora_agent_conf.template +0 -3
- octavia/amphorae/backends/health_daemon/health_daemon.py +6 -7
- octavia/amphorae/backends/health_daemon/health_sender.py +2 -2
- octavia/amphorae/backends/utils/haproxy_query.py +3 -6
- octavia/amphorae/backends/utils/interface.py +11 -50
- octavia/amphorae/backends/utils/interface_file.py +29 -16
- octavia/amphorae/backends/utils/ip_advertisement.py +1 -1
- octavia/amphorae/backends/utils/keepalivedlvs_query.py +7 -8
- octavia/amphorae/backends/utils/network_namespace.py +3 -3
- octavia/amphorae/backends/utils/nftable_utils.py +33 -11
- octavia/amphorae/drivers/driver_base.py +2 -2
- octavia/amphorae/drivers/haproxy/rest_api_driver.py +26 -38
- octavia/amphorae/drivers/health/heartbeat_udp.py +1 -1
- octavia/amphorae/drivers/keepalived/jinja/jinja_cfg.py +1 -2
- octavia/amphorae/drivers/keepalived/jinja/templates/keepalived_base.template +0 -1
- octavia/amphorae/drivers/noop_driver/driver.py +1 -1
- octavia/api/app.py +1 -2
- octavia/api/common/pagination.py +16 -22
- octavia/api/common/types.py +1 -1
- octavia/api/drivers/amphora_driver/v2/driver.py +6 -6
- octavia/api/drivers/driver_agent/driver_listener.py +3 -3
- octavia/api/drivers/driver_agent/driver_updater.py +1 -1
- octavia/api/drivers/noop_driver/driver.py +1 -1
- octavia/api/root_controller.py +2 -2
- octavia/api/v2/controllers/base.py +2 -4
- octavia/api/v2/controllers/health_monitor.py +5 -3
- octavia/api/v2/controllers/listener.py +2 -2
- octavia/api/v2/controllers/load_balancer.py +7 -0
- octavia/api/v2/controllers/member.py +12 -2
- octavia/api/v2/types/amphora.py +1 -1
- octavia/api/v2/types/availability_zone_profile.py +1 -2
- octavia/api/v2/types/availability_zones.py +1 -2
- octavia/api/v2/types/flavor_profile.py +1 -1
- octavia/api/v2/types/flavors.py +1 -1
- octavia/api/v2/types/health_monitor.py +1 -1
- octavia/api/v2/types/l7policy.py +1 -1
- octavia/api/v2/types/l7rule.py +1 -1
- octavia/api/v2/types/listener.py +3 -3
- octavia/api/v2/types/load_balancer.py +3 -3
- octavia/api/v2/types/member.py +2 -2
- octavia/api/v2/types/pool.py +2 -2
- octavia/api/v2/types/quotas.py +2 -2
- octavia/certificates/common/barbican.py +1 -1
- octavia/certificates/common/cert.py +1 -1
- octavia/certificates/generator/cert_gen.py +1 -1
- octavia/certificates/generator/local.py +5 -5
- octavia/certificates/manager/cert_mgr.py +1 -1
- octavia/certificates/manager/local.py +20 -20
- octavia/cmd/agent.py +3 -3
- octavia/cmd/driver_agent.py +2 -3
- octavia/cmd/health_checker.py +4 -4
- octavia/cmd/interface.py +4 -4
- octavia/cmd/prometheus_proxy.py +11 -13
- octavia/common/base_taskflow.py +3 -3
- octavia/common/clients.py +4 -4
- octavia/common/config.py +18 -24
- octavia/common/constants.py +28 -35
- octavia/common/data_models.py +2 -2
- octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py +5 -5
- octavia/common/jinja/logging/logging_jinja_cfg.py +1 -1
- octavia/common/jinja/lvs/jinja_cfg.py +1 -1
- octavia/common/jinja/user_data_jinja_cfg.py +1 -1
- octavia/common/keystone.py +1 -1
- octavia/common/policy.py +2 -3
- octavia/common/stats.py +1 -1
- octavia/common/tls_utils/cert_parser.py +2 -1
- octavia/common/utils.py +3 -3
- octavia/common/validate.py +9 -13
- octavia/compute/compute_base.py +1 -1
- octavia/compute/drivers/noop_driver/driver.py +1 -1
- octavia/compute/drivers/nova_driver.py +1 -1
- octavia/controller/healthmanager/health_manager.py +1 -1
- octavia/controller/housekeeping/house_keeping.py +2 -2
- octavia/controller/queue/v2/consumer.py +1 -2
- octavia/controller/queue/v2/endpoints.py +1 -1
- octavia/controller/worker/amphora_rate_limit.py +6 -6
- octavia/controller/worker/task_utils.py +1 -1
- octavia/controller/worker/v2/controller_worker.py +3 -3
- octavia/controller/worker/v2/flows/amphora_flows.py +15 -4
- octavia/controller/worker/v2/flows/flow_utils.py +6 -5
- octavia/controller/worker/v2/flows/health_monitor_flows.py +1 -1
- octavia/controller/worker/v2/flows/l7policy_flows.py +1 -1
- octavia/controller/worker/v2/flows/l7rule_flows.py +1 -1
- octavia/controller/worker/v2/flows/listener_flows.py +18 -6
- octavia/controller/worker/v2/flows/load_balancer_flows.py +1 -1
- octavia/controller/worker/v2/flows/member_flows.py +12 -19
- octavia/controller/worker/v2/flows/pool_flows.py +1 -1
- octavia/controller/worker/v2/taskflow_jobboard_driver.py +17 -3
- octavia/controller/worker/v2/tasks/compute_tasks.py +1 -3
- octavia/controller/worker/v2/tasks/network_tasks.py +3 -4
- octavia/db/base_models.py +21 -9
- octavia/db/migration/alembic_migrations/versions/034756a182a2_amphora_add_image_id.py +2 -2
- octavia/db/migration/alembic_migrations/versions/034b2dc2f3e0_modernize_l7policy_fields.py +31 -31
- octavia/db/migration/alembic_migrations/versions/0f242cf02c74_add_provider_column.py +2 -2
- octavia/db/migration/alembic_migrations/versions/10d38216ad34_add_timestamps_to_amphora.py +4 -4
- octavia/db/migration/alembic_migrations/versions/11e4bb2bb8ef_fix_ipv6_vip.py +1 -1
- octavia/db/migration/alembic_migrations/versions/13500e2e978d_update_url_and_name_size.py +6 -6
- octavia/db/migration/alembic_migrations/versions/14892634e228_update_vip.py +5 -5
- octavia/db/migration/alembic_migrations/versions/186509101b9b_add_server_group_id_to_loadbalancer.py +2 -2
- octavia/db/migration/alembic_migrations/versions/1afc932f1ca2_l7rule_support_client_cert.py +3 -3
- octavia/db/migration/alembic_migrations/versions/1e4c1d83044c_keepalived_configuration_datamodel.py +26 -26
- octavia/db/migration/alembic_migrations/versions/2351ea316465_adding_terminate_https_tls_ref_support.py +4 -4
- octavia/db/migration/alembic_migrations/versions/256852d5ff7c_add_lb_network_ip_to_amphora.py +2 -2
- octavia/db/migration/alembic_migrations/versions/27e54d00c3cd_add_monitor_address_and_port_to_member.py +4 -4
- octavia/db/migration/alembic_migrations/versions/298eac0640a7_add_amphora_vrrp_port_id_and_ha_port_id.py +4 -4
- octavia/db/migration/alembic_migrations/versions/29ff921a6eb_shared_pools.py +3 -3
- octavia/db/migration/alembic_migrations/versions/2ad093f6353f_add_listener_client_ca_tls_certificate_.py +2 -2
- octavia/db/migration/alembic_migrations/versions/31f7653ded67_allow_multiple_vips_per_loadbalancer.py +10 -10
- octavia/db/migration/alembic_migrations/versions/32e5c35b26a8_add_l7policy_and_l7rule_quota.py +4 -4
- octavia/db/migration/alembic_migrations/versions/357d17a6d5ac_update_lb_and_amphora_data_model_for_.py +20 -20
- octavia/db/migration/alembic_migrations/versions/35dee79d5865_initial_create.py +185 -185
- octavia/db/migration/alembic_migrations/versions/36b94648fef8_add_timestamp.py +2 -2
- octavia/db/migration/alembic_migrations/versions/392fb85b4419_add_primary_key_to_spares_pool.py +1 -1
- octavia/db/migration/alembic_migrations/versions/3a1e1cdb7b27_rename_amphora_host_id.py +1 -1
- octavia/db/migration/alembic_migrations/versions/3b199c848b96_create_no_monitor_operational_status.py +1 -1
- octavia/db/migration/alembic_migrations/versions/3e5b37a0bdb9_add_vrrp_ip_and_ha_ip_to_amphora.py +4 -4
- octavia/db/migration/alembic_migrations/versions/3f8ff3be828e_create_quotas_table.py +12 -12
- octavia/db/migration/alembic_migrations/versions/43287cd10fef_make_pool_lb_algorithm_larger.py +6 -6
- octavia/db/migration/alembic_migrations/versions/443fe6676637_add_network_id_to_vip.py +2 -2
- octavia/db/migration/alembic_migrations/versions/44a2414dd683_adding_name_column_to_member_and_health_.py +1 -1
- octavia/db/migration/alembic_migrations/versions/458c9ee2a011_l7_policies_and_rules.py +57 -57
- octavia/db/migration/alembic_migrations/versions/46d914b2a5e5_seed_the_spares_pool_table.py +2 -2
- octavia/db/migration/alembic_migrations/versions/48660b6643f0_add_new_states_for_amphora.py +3 -3
- octavia/db/migration/alembic_migrations/versions/4aeb9e23ad43_add_draining_operating_status.py +1 -1
- octavia/db/migration/alembic_migrations/versions/4c094013699a_update_load_balancer_amphora.py +9 -9
- octavia/db/migration/alembic_migrations/versions/4f65b4f91c39_amphora_add_flavor_id.py +2 -2
- octavia/db/migration/alembic_migrations/versions/4faaa983e7a9_update_member_address_column.py +1 -1
- octavia/db/migration/alembic_migrations/versions/4fe8240425b4_update_vip_add_subnet_id.py +2 -2
- octavia/db/migration/alembic_migrations/versions/52377704420e_add_timestamps_to_healthmonitor.py +9 -9
- octavia/db/migration/alembic_migrations/versions/5309960964f8_add_proxy_protocol_for_pool.py +3 -3
- octavia/db/migration/alembic_migrations/versions/543f5d8e4e56_add_a_column_busy_in_table_amphora_health.py +2 -2
- octavia/db/migration/alembic_migrations/versions/55874a4ceed6_add_l7policy_action_redirect_prefix.py +5 -5
- octavia/db/migration/alembic_migrations/versions/5a3ee5472c31_add_cert_expiration__infor_in_amphora_table.py +4 -4
- octavia/db/migration/alembic_migrations/versions/62816c232310_fix_migration_for_mysql_5_7.py +1 -1
- octavia/db/migration/alembic_migrations/versions/6742ca1b27c2_add_l7policy_redirect_http_code.py +2 -2
- octavia/db/migration/alembic_migrations/versions/6ac558d7fc21_add_prometheus_listener_protocol.py +3 -3
- octavia/db/migration/alembic_migrations/versions/6ffc710674ef_spares_pool_table.py +2 -2
- octavia/db/migration/alembic_migrations/versions/7432f1d4ea83_add_http_host_head_inject_for_http_health_check.py +4 -4
- octavia/db/migration/alembic_migrations/versions/74aae261694c_extend_pool_for_backend_ca_and_crl.py +4 -4
- octavia/db/migration/alembic_migrations/versions/76aacf2e176c_extend_support_udp_protocol.py +3 -3
- octavia/db/migration/alembic_migrations/versions/80dba23a159f_tags_support.py +3 -3
- octavia/db/migration/alembic_migrations/versions/82b9402e71fd_update_vip_address_size.py +1 -1
- octavia/db/migration/alembic_migrations/versions/8ac4ed24df3a_add_availability_zone_to_lb.py +4 -4
- octavia/db/migration/alembic_migrations/versions/8b47b2546312_sctp_support.py +2 -2
- octavia/db/migration/alembic_migrations/versions/8c0851bdf6c3_change_tls_container_id_length_in_sni_.py +1 -1
- octavia/db/migration/alembic_migrations/versions/92fe9857279_create_healthmanager_table.py +3 -3
- octavia/db/migration/alembic_migrations/versions/9b5473976d6d_add_provisioning_status_to_objects.py +10 -10
- octavia/db/migration/alembic_migrations/versions/a1f689aecc1d_extend_pool_for_support_backend_reencryption.py +2 -2
- octavia/db/migration/alembic_migrations/versions/a7f187cd221f_add_tls_boolean_type_for_reencryption.py +2 -2
- octavia/db/migration/alembic_migrations/versions/b9c703669314_add_flavor_and_flavor_profile_table.py +18 -18
- octavia/db/migration/alembic_migrations/versions/ba35e0fb88e1_add_backup_field_to_member.py +2 -2
- octavia/db/migration/alembic_migrations/versions/bf171d0d91c3_amphora_add_cached_zone.py +2 -2
- octavia/db/migration/alembic_migrations/versions/c761c8a71579_add_availability_zone_table.py +15 -15
- octavia/db/migration/alembic_migrations/versions/d85ca7258d21_modernize_l7rule.py +13 -13
- octavia/db/migration/alembic_migrations/versions/da371b422669_allowed_cidr_for_listeners.py +7 -7
- octavia/db/migration/alembic_migrations/versions/dcf88e59aae4_add_lb_algorithm_source_ip_port.py +3 -3
- octavia/db/migration/alembic_migrations/versions/e37941b010db_add_lb_flavor_constraint.py +11 -11
- octavia/db/migration/alembic_migrations/versions/e6672bda93bf_add_ping_and_tlshello_monitor_types.py +3 -3
- octavia/db/migration/alembic_migrations/versions/e6ee84f0abf3_add_proxy_v2_pool_protocol.py +3 -3
- octavia/db/migration/alembic_migrations/versions/ebbcc72b4e5e_add_octavia_owned_vip_column_to_vip_.py +2 -2
- octavia/db/migration/alembic_migrations/versions/f21ae3f21adc_add_client_auth_option.py +6 -6
- octavia/db/migration/alembic_migrations/versions/fc5582da7d8a_create_amphora_build_rate_limit_tables.py +11 -11
- octavia/db/migration/alembic_migrations/versions/ffad172e98c1_add_certificate_revoke_list_option.py +2 -2
- octavia/db/models.py +1 -1
- octavia/db/repositories.py +3 -3
- octavia/distributor/drivers/driver_base.py +1 -1
- octavia/distributor/drivers/noop_driver/driver.py +1 -1
- octavia/hacking/checks.py +4 -4
- octavia/image/drivers/noop_driver/driver.py +1 -1
- octavia/image/image_base.py +1 -1
- octavia/network/base.py +1 -1
- octavia/network/drivers/neutron/allowed_address_pairs.py +11 -9
- octavia/network/drivers/neutron/base.py +3 -3
- octavia/network/drivers/noop_driver/driver.py +1 -1
- octavia/policies/amphora.py +6 -12
- octavia/policies/availability_zone.py +5 -10
- octavia/policies/availability_zone_profile.py +5 -15
- octavia/policies/base.py +1 -20
- octavia/policies/flavor.py +5 -10
- octavia/policies/flavor_profile.py +5 -10
- octavia/policies/healthmonitor.py +6 -12
- octavia/policies/l7policy.py +6 -12
- octavia/policies/l7rule.py +5 -10
- octavia/policies/listener.py +7 -14
- octavia/policies/loadbalancer.py +9 -18
- octavia/policies/member.py +5 -10
- octavia/policies/pool.py +6 -12
- octavia/policies/provider.py +1 -2
- octavia/policies/provider_availability_zone.py +1 -3
- octavia/policies/provider_flavor.py +1 -2
- octavia/policies/quota.py +6 -12
- octavia/statistics/stats_base.py +1 -1
- octavia/tests/common/constants.py +1 -1
- octavia/tests/common/data_model_helpers.py +10 -10
- octavia/tests/common/sample_data_models.py +1 -1
- octavia/tests/common/sample_haproxy_prometheus +17 -17
- octavia/tests/common/sample_octavia_prometheus +6 -6
- octavia/tests/common/utils.py +2 -2
- octavia/tests/functional/amphorae/backend/agent/api_server/test_keepalivedlvs.py +36 -62
- octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py +135 -296
- octavia/tests/functional/api/drivers/driver_agent/test_driver_agent.py +10 -11
- octavia/tests/functional/api/v2/base.py +2 -3
- octavia/tests/functional/api/v2/test_amphora.py +6 -6
- octavia/tests/functional/api/v2/test_availability_zone_profiles.py +13 -14
- octavia/tests/functional/api/v2/test_availability_zones.py +19 -19
- octavia/tests/functional/api/v2/test_flavor_profiles.py +19 -20
- octavia/tests/functional/api/v2/test_flavors.py +25 -25
- octavia/tests/functional/api/v2/test_health_monitor.py +35 -18
- octavia/tests/functional/api/v2/test_l7policy.py +11 -11
- octavia/tests/functional/api/v2/test_l7rule.py +19 -20
- octavia/tests/functional/api/v2/test_listener.py +26 -28
- octavia/tests/functional/api/v2/test_load_balancer.py +17 -17
- octavia/tests/functional/api/v2/test_member.py +53 -21
- octavia/tests/functional/api/v2/test_pool.py +11 -11
- octavia/tests/functional/api/v2/test_provider.py +7 -7
- octavia/tests/functional/api/v2/test_quotas.py +9 -9
- octavia/tests/functional/db/test_models.py +1 -1
- octavia/tests/functional/db/test_repositories.py +2 -2
- octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py +60 -61
- octavia/tests/unit/amphorae/backends/agent/api_server/test_keepalived.py +3 -3
- octavia/tests/unit/amphorae/backends/agent/api_server/test_keepalivedlvs.py +1 -19
- octavia/tests/unit/amphorae/backends/agent/api_server/test_loadbalancer.py +94 -34
- octavia/tests/unit/amphorae/backends/agent/api_server/test_osutils.py +19 -21
- octavia/tests/unit/amphorae/backends/agent/api_server/test_plug.py +9 -11
- octavia/tests/unit/amphorae/backends/agent/api_server/test_util.py +11 -25
- octavia/tests/unit/amphorae/backends/agent/test_agent_jinja_cfg.py +0 -13
- octavia/tests/unit/amphorae/backends/health_daemon/test_health_daemon.py +10 -10
- octavia/tests/unit/amphorae/backends/utils/test_haproxy_query.py +1 -1
- octavia/tests/unit/amphorae/backends/utils/test_interface.py +33 -94
- octavia/tests/unit/amphorae/backends/utils/test_interface_file.py +32 -32
- octavia/tests/unit/amphorae/backends/utils/test_network_namespace.py +4 -6
- octavia/tests/unit/amphorae/backends/utils/test_nftable_utils.py +28 -22
- octavia/tests/unit/amphorae/drivers/haproxy/test_rest_api_driver_1_0.py +77 -118
- octavia/tests/unit/amphorae/drivers/health/test_heartbeat_udp.py +8 -8
- octavia/tests/unit/amphorae/drivers/keepalived/jinja/test_jinja_cfg.py +0 -4
- octavia/tests/unit/api/common/test_pagination.py +84 -14
- octavia/tests/unit/api/v2/types/test_availability_zone_profile.py +1 -1
- octavia/tests/unit/api/v2/types/test_availability_zones.py +1 -1
- octavia/tests/unit/api/v2/types/test_flavor_profile.py +1 -1
- octavia/tests/unit/api/v2/types/test_flavors.py +1 -1
- octavia/tests/unit/api/v2/types/test_health_monitor.py +1 -1
- octavia/tests/unit/api/v2/types/test_listener.py +1 -1
- octavia/tests/unit/api/v2/types/test_load_balancer.py +1 -1
- octavia/tests/unit/api/v2/types/test_pool.py +1 -1
- octavia/tests/unit/base.py +1 -0
- octavia/tests/unit/certificates/generator/local_csr.py +1 -1
- octavia/tests/unit/certificates/generator/test_local.py +5 -5
- octavia/tests/unit/certificates/manager/test_barbican.py +2 -3
- octavia/tests/unit/certificates/manager/test_barbican_legacy.py +1 -1
- octavia/tests/unit/certificates/manager/test_local.py +13 -14
- octavia/tests/unit/cmd/test_health_checker.py +1 -1
- octavia/tests/unit/cmd/test_prometheus_proxy.py +8 -1
- octavia/tests/unit/common/jinja/haproxy/combined_listeners/test_jinja_cfg.py +171 -216
- octavia/tests/unit/common/jinja/logging/test_logging_jinja_cfg.py +1 -1
- octavia/tests/unit/common/sample_configs/sample_configs_combined.py +1 -2
- octavia/tests/unit/common/test_base_taskflow.py +1 -1
- octavia/tests/unit/common/test_decorators.py +2 -2
- octavia/tests/unit/common/test_policy.py +3 -6
- octavia/tests/unit/common/tls_utils/test_cert_parser.py +4 -1
- octavia/tests/unit/controller/worker/v2/flows/test_listener_flows.py +10 -15
- octavia/tests/unit/controller/worker/v2/flows/test_load_balancer_flows.py +4 -6
- octavia/tests/unit/controller/worker/v2/tasks/test_network_tasks.py +6 -2
- octavia/tests/unit/controller/worker/v2/tasks/test_retry_tasks.py +1 -1
- octavia/tests/unit/controller/worker/v2/test_controller_worker.py +56 -1
- octavia/tests/unit/controller/worker/v2/test_taskflow_jobboard_driver.py +348 -0
- octavia/tests/unit/hacking/test_checks.py +3 -3
- octavia/tests/unit/image/drivers/noop_driver/test_driver.py +1 -1
- octavia/tests/unit/image/drivers/test_glance_driver.py +1 -1
- octavia/tests/unit/network/drivers/neutron/test_base.py +1 -1
- octavia/tests/unit/statistics/drivers/test_update_db.py +1 -1
- octavia/tests/unit/statistics/test_stats_base.py +1 -1
- octavia/volume/drivers/noop_driver/driver.py +1 -1
- octavia/volume/volume_base.py +1 -1
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/AUTHORS +6 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/METADATA +3 -5
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/RECORD +302 -305
- octavia-15.0.0.0rc1.dist-info/pbr.json +1 -0
- octavia/amphorae/backends/agent/api_server/templates/keepalived.sysvinit.j2 +0 -87
- octavia/amphorae/backends/agent/api_server/templates/keepalived.upstart.j2 +0 -29
- octavia/amphorae/backends/agent/api_server/templates/sysvinit.conf.j2 +0 -232
- octavia/amphorae/backends/agent/api_server/templates/upstart.conf.j2 +0 -71
- octavia-14.0.0.0rc1.dist-info/pbr.json +0 -1
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/LICENSE +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/README.rst +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/README.rst +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/diskimage-create.sh +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/image-tests.sh +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/requirements.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/test-requirements.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/tox.ini +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/data/share/octavia/diskimage-create/version.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.0rc1.data}/scripts/octavia-wsgi +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/LICENSE +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/WHEEL +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/entry_points.txt +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.0rc1.dist-info}/top_level.txt +0 -0
@@ -41,41 +41,18 @@ class ParsingError(Exception):
|
|
41
41
|
pass
|
42
42
|
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
def init_path(lb_id, init_system):
|
49
|
-
if init_system == consts.INIT_SYSTEMD:
|
50
|
-
return os.path.join(consts.SYSTEMD_DIR,
|
51
|
-
'haproxy-{0}.service'.format(lb_id))
|
52
|
-
if init_system == consts.INIT_UPSTART:
|
53
|
-
return os.path.join(consts.UPSTART_DIR,
|
54
|
-
'haproxy-{0}.conf'.format(lb_id))
|
55
|
-
if init_system == consts.INIT_SYSVINIT:
|
56
|
-
return os.path.join(consts.SYSVINIT_DIR,
|
57
|
-
'haproxy-{0}'.format(lb_id))
|
58
|
-
raise UnknownInitError()
|
44
|
+
def init_path(lb_id):
|
45
|
+
return os.path.join(consts.SYSTEMD_DIR, f'haproxy-{lb_id}.service')
|
59
46
|
|
60
47
|
|
61
48
|
def keepalived_lvs_dir():
|
62
49
|
return os.path.join(CONF.haproxy_amphora.base_path, 'lvs')
|
63
50
|
|
64
51
|
|
65
|
-
def keepalived_lvs_init_path(
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
str(listener_id))
|
70
|
-
if init_system == consts.INIT_UPSTART:
|
71
|
-
return os.path.join(consts.UPSTART_DIR,
|
72
|
-
consts.KEEPALIVED_UPSTART_PREFIX %
|
73
|
-
str(listener_id))
|
74
|
-
if init_system == consts.INIT_SYSVINIT:
|
75
|
-
return os.path.join(consts.SYSVINIT_DIR,
|
76
|
-
consts.KEEPALIVED_SYSVINIT_PREFIX %
|
77
|
-
str(listener_id))
|
78
|
-
raise UnknownInitError()
|
52
|
+
def keepalived_lvs_init_path(listener_id):
|
53
|
+
return os.path.join(consts.SYSTEMD_DIR,
|
54
|
+
consts.KEEPALIVEDLVS_SYSTEMD %
|
55
|
+
str(listener_id))
|
79
56
|
|
80
57
|
|
81
58
|
def keepalived_backend_check_script_dir():
|
@@ -92,15 +69,14 @@ def keepalived_lvs_pids_path(listener_id):
|
|
92
69
|
for file_ext in ['pid', 'vrrp.pid', 'check.pid']:
|
93
70
|
pids_path[file_ext] = (
|
94
71
|
os.path.join(CONF.haproxy_amphora.base_path,
|
95
|
-
|
96
|
-
|
72
|
+
f"lvs/octavia-keepalivedlvs-{str(listener_id)}."
|
73
|
+
f"{file_ext}"))
|
97
74
|
return pids_path['pid'], pids_path['vrrp.pid'], pids_path['check.pid']
|
98
75
|
|
99
76
|
|
100
77
|
def keepalived_lvs_cfg_path(listener_id):
|
101
78
|
return os.path.join(CONF.haproxy_amphora.base_path,
|
102
|
-
|
103
|
-
str(listener_id))
|
79
|
+
f"lvs/octavia-keepalivedlvs-{str(listener_id)}.conf")
|
104
80
|
|
105
81
|
|
106
82
|
def haproxy_dir(lb_id):
|
@@ -120,13 +96,13 @@ def state_file_path(lb_id):
|
|
120
96
|
|
121
97
|
|
122
98
|
def get_haproxy_pid(lb_id):
|
123
|
-
with open(pid_path(lb_id),
|
99
|
+
with open(pid_path(lb_id), encoding='utf-8') as f:
|
124
100
|
return f.readline().rstrip()
|
125
101
|
|
126
102
|
|
127
103
|
def get_keepalivedlvs_pid(listener_id):
|
128
104
|
pid_file = keepalived_lvs_pids_path(listener_id)[0]
|
129
|
-
with open(pid_file,
|
105
|
+
with open(pid_file, encoding='utf-8') as f:
|
130
106
|
return f.readline().rstrip()
|
131
107
|
|
132
108
|
|
@@ -143,14 +119,8 @@ def keepalived_dir():
|
|
143
119
|
return os.path.join(CONF.haproxy_amphora.base_path, 'vrrp')
|
144
120
|
|
145
121
|
|
146
|
-
def keepalived_init_path(
|
147
|
-
|
148
|
-
return os.path.join(consts.SYSTEMD_DIR, consts.KEEPALIVED_SYSTEMD)
|
149
|
-
if init_system == consts.INIT_UPSTART:
|
150
|
-
return os.path.join(consts.UPSTART_DIR, consts.KEEPALIVED_UPSTART)
|
151
|
-
if init_system == consts.INIT_SYSVINIT:
|
152
|
-
return os.path.join(consts.SYSVINIT_DIR, consts.KEEPALIVED_SYSVINIT)
|
153
|
-
raise UnknownInitError()
|
122
|
+
def keepalived_init_path():
|
123
|
+
return os.path.join(consts.SYSTEMD_DIR, consts.KEEPALIVED_SYSTEMD)
|
154
124
|
|
155
125
|
|
156
126
|
def keepalived_pid_path():
|
@@ -226,24 +196,6 @@ def is_lvs_listener_running(listener_id):
|
|
226
196
|
os.path.join('/proc', get_keepalivedlvs_pid(listener_id)))
|
227
197
|
|
228
198
|
|
229
|
-
def get_os_init_system():
|
230
|
-
if os.path.exists(consts.INIT_PROC_COMM_PATH):
|
231
|
-
with open(consts.INIT_PROC_COMM_PATH,
|
232
|
-
'r', encoding='utf-8') as init_comm:
|
233
|
-
init_proc_name = init_comm.read().rstrip('\n')
|
234
|
-
if init_proc_name == consts.INIT_SYSTEMD:
|
235
|
-
return consts.INIT_SYSTEMD
|
236
|
-
if init_proc_name == 'init':
|
237
|
-
init_path = consts.INIT_PATH
|
238
|
-
if os.path.exists(init_path):
|
239
|
-
args = [init_path, '--version']
|
240
|
-
init_version = subprocess.check_output(args, shell=False)
|
241
|
-
if consts.INIT_UPSTART in str(init_version, 'utf-8'):
|
242
|
-
return consts.INIT_UPSTART
|
243
|
-
return consts.INIT_SYSVINIT
|
244
|
-
return consts.INIT_UNKOWN
|
245
|
-
|
246
|
-
|
247
199
|
def install_netns_systemd_service():
|
248
200
|
flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
|
249
201
|
# mode 00644
|
@@ -267,14 +219,17 @@ def install_netns_systemd_service():
|
|
267
219
|
text_file.write(text)
|
268
220
|
|
269
221
|
|
270
|
-
def run_systemctl_command(command, service):
|
271
|
-
cmd = "systemctl {
|
222
|
+
def run_systemctl_command(command, service, raise_error=True):
|
223
|
+
cmd = f"systemctl {command} {service}"
|
272
224
|
try:
|
273
|
-
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT
|
225
|
+
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT,
|
226
|
+
encoding='utf-8')
|
274
227
|
except subprocess.CalledProcessError as e:
|
275
|
-
LOG.
|
228
|
+
LOG.debug("Failed to %(cmd)s %(srvc)s service: "
|
276
229
|
"%(err)s %(out)s", {'cmd': command, 'srvc': service,
|
277
230
|
'err': e, 'out': e.output})
|
231
|
+
if raise_error:
|
232
|
+
raise
|
278
233
|
|
279
234
|
|
280
235
|
def get_backend_for_lb_object(object_id):
|
@@ -295,7 +250,7 @@ def get_backend_for_lb_object(object_id):
|
|
295
250
|
|
296
251
|
|
297
252
|
def parse_haproxy_file(lb_id):
|
298
|
-
with open(config_path(lb_id),
|
253
|
+
with open(config_path(lb_id), encoding='utf-8') as file:
|
299
254
|
cfg = file.read()
|
300
255
|
|
301
256
|
listeners = {}
|
@@ -364,7 +319,7 @@ def vrrp_check_script_update(lb_id, action):
|
|
364
319
|
for lbid in lb_ids:
|
365
320
|
args.append(haproxy_sock_path(lbid))
|
366
321
|
|
367
|
-
cmd =
|
322
|
+
cmd = f"haproxy-vrrp-check {' '.join(args)}; exit $?"
|
368
323
|
with open(haproxy_check_script_path(), 'w', encoding='utf-8') as text_file:
|
369
324
|
text_file.write(cmd)
|
370
325
|
|
@@ -376,7 +331,7 @@ def get_haproxy_vip_addresses(lb_id):
|
|
376
331
|
:returns: List of VIP addresses (IPv4 and IPv6)
|
377
332
|
"""
|
378
333
|
vips = []
|
379
|
-
with open(config_path(lb_id),
|
334
|
+
with open(config_path(lb_id), encoding='utf-8') as file:
|
380
335
|
for line in file:
|
381
336
|
current_line = line.strip()
|
382
337
|
if current_line.startswith('bind'):
|
@@ -23,9 +23,6 @@ base_path = {{ base_path }}
|
|
23
23
|
bind_host = {{ bind_host }}
|
24
24
|
bind_port = {{ bind_port }}
|
25
25
|
haproxy_cmd = {{ haproxy_cmd }}
|
26
|
-
respawn_count = {{ respawn_count }}
|
27
|
-
respawn_interval = {{ respawn_interval }}
|
28
|
-
use_upstart = {{ use_upstart }}
|
29
26
|
user_log_facility = {{ user_log_facility }}
|
30
27
|
administrative_log_facility = {{ administrative_log_facility }}
|
31
28
|
|
@@ -15,6 +15,7 @@
|
|
15
15
|
# under the License.
|
16
16
|
|
17
17
|
import errno
|
18
|
+
import json
|
18
19
|
import os
|
19
20
|
import queue
|
20
21
|
import stat
|
@@ -22,7 +23,6 @@ import time
|
|
22
23
|
|
23
24
|
from oslo_config import cfg
|
24
25
|
from oslo_log import log as logging
|
25
|
-
import simplejson
|
26
26
|
|
27
27
|
from octavia.amphorae.backends.agent.api_server import util
|
28
28
|
from octavia.amphorae.backends.health_daemon import health_sender
|
@@ -73,8 +73,8 @@ def get_counters():
|
|
73
73
|
global COUNTERS
|
74
74
|
if COUNTERS is None:
|
75
75
|
try:
|
76
|
-
COUNTERS =
|
77
|
-
except (
|
76
|
+
COUNTERS = json.load(get_counters_file()) or {}
|
77
|
+
except (json.JSONDecodeError, AttributeError):
|
78
78
|
COUNTERS = {}
|
79
79
|
return COUNTERS
|
80
80
|
|
@@ -84,7 +84,7 @@ def persist_counters():
|
|
84
84
|
if COUNTERS is None:
|
85
85
|
return
|
86
86
|
try:
|
87
|
-
stats =
|
87
|
+
stats = json.dumps(COUNTERS)
|
88
88
|
counters_file = get_counters_file()
|
89
89
|
counters_file.truncate(0)
|
90
90
|
counters_file.write(stats)
|
@@ -118,14 +118,13 @@ def run_sender(cmd_queue):
|
|
118
118
|
# heartbeat
|
119
119
|
if os.path.isfile(keepalived_cfg_path):
|
120
120
|
# Is there a pid file for keepalived?
|
121
|
-
with open(keepalived_pid_path,
|
122
|
-
'r', encoding='utf-8') as pid_file:
|
121
|
+
with open(keepalived_pid_path, encoding='utf-8') as pid_file:
|
123
122
|
pid = int(pid_file.readline())
|
124
123
|
os.kill(pid, 0)
|
125
124
|
|
126
125
|
message = build_stats_message()
|
127
126
|
sender.dosend(message)
|
128
|
-
except
|
127
|
+
except OSError as e:
|
129
128
|
if e.errno == errno.ENOENT:
|
130
129
|
# Missing PID file, skip health heartbeat.
|
131
130
|
LOG.error('Missing keepalived PID file %s, skipping health '
|
@@ -31,7 +31,7 @@ def round_robin_addr(addrinfo_list):
|
|
31
31
|
return addrinfo
|
32
32
|
|
33
33
|
|
34
|
-
class UDPStatusSender
|
34
|
+
class UDPStatusSender:
|
35
35
|
def __init__(self):
|
36
36
|
self._update_dests()
|
37
37
|
self.v4sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
@@ -56,7 +56,7 @@ class UDPStatusSender(object):
|
|
56
56
|
self.v4sock.sendto(envelope_str, dest[4])
|
57
57
|
elif dest[0] == socket.AF_INET6:
|
58
58
|
self.v6sock.sendto(envelope_str, dest[4])
|
59
|
-
except
|
59
|
+
except OSError:
|
60
60
|
# Pass here as on amp boot it will get one or more
|
61
61
|
# error: [Errno 101] Network is unreachable
|
62
62
|
# while the networks are coming up
|
@@ -24,7 +24,7 @@ from octavia.i18n import _
|
|
24
24
|
LOG = logging.getLogger(__name__)
|
25
25
|
|
26
26
|
|
27
|
-
class HAProxyQuery
|
27
|
+
class HAProxyQuery:
|
28
28
|
"""Class used for querying the HAProxy statistics socket.
|
29
29
|
|
30
30
|
The CSV output is defined in the HAProxy documentation:
|
@@ -51,7 +51,7 @@ class HAProxyQuery(object):
|
|
51
51
|
|
52
52
|
try:
|
53
53
|
sock.connect(self.socket)
|
54
|
-
except
|
54
|
+
except OSError as e:
|
55
55
|
raise Exception(
|
56
56
|
_("HAProxy '{0}' query failed.").format(query)) from e
|
57
57
|
|
@@ -95,10 +95,7 @@ class HAProxyQuery(object):
|
|
95
95
|
"""
|
96
96
|
|
97
97
|
results = self._query(
|
98
|
-
'show stat {proxy_iid} {object_type} {server_id}'
|
99
|
-
proxy_iid=proxy_iid,
|
100
|
-
object_type=object_type,
|
101
|
-
server_id=server_id))
|
98
|
+
f'show stat {proxy_iid} {object_type} {server_id}')
|
102
99
|
list_results = results[2:].split('\n')
|
103
100
|
csv_reader = csv.DictReader(list_results)
|
104
101
|
stats_list = list(csv_reader)
|
@@ -37,7 +37,7 @@ CONF = cfg.CONF
|
|
37
37
|
LOG = logging.getLogger(__name__)
|
38
38
|
|
39
39
|
|
40
|
-
class InterfaceController
|
40
|
+
class InterfaceController:
|
41
41
|
ADD = 'add'
|
42
42
|
DELETE = 'delete'
|
43
43
|
SET = 'set'
|
@@ -106,10 +106,9 @@ class InterfaceController(object):
|
|
106
106
|
def _dhclient_up(self, interface_name):
|
107
107
|
cmd = ["/sbin/dhclient",
|
108
108
|
"-lf",
|
109
|
-
"/var/lib/dhclient/dhclient-{}.leases"
|
110
|
-
interface_name),
|
109
|
+
f"/var/lib/dhclient/dhclient-{interface_name}.leases",
|
111
110
|
"-pf",
|
112
|
-
"/run/dhclient-{}.pid"
|
111
|
+
f"/run/dhclient-{interface_name}.pid",
|
113
112
|
interface_name]
|
114
113
|
LOG.debug("Running '%s'", cmd)
|
115
114
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
@@ -118,10 +117,9 @@ class InterfaceController(object):
|
|
118
117
|
cmd = ["/sbin/dhclient",
|
119
118
|
"-r",
|
120
119
|
"-lf",
|
121
|
-
"/var/lib/dhclient/dhclient-{}.leases"
|
122
|
-
interface_name),
|
120
|
+
f"/var/lib/dhclient/dhclient-{interface_name}.leases",
|
123
121
|
"-pf",
|
124
|
-
"/run/dhclient-{}.pid"
|
122
|
+
f"/run/dhclient-{interface_name}.pid",
|
125
123
|
interface_name]
|
126
124
|
LOG.debug("Running '%s'", cmd)
|
127
125
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
@@ -134,8 +132,7 @@ class InterfaceController(object):
|
|
134
132
|
('autoconf', 1)):
|
135
133
|
cmd = ["/sbin/sysctl",
|
136
134
|
"-w",
|
137
|
-
"net.ipv6.conf.{}.{}={}"
|
138
|
-
key, value)]
|
135
|
+
f"net.ipv6.conf.{interface_name}.{key}={value}"]
|
139
136
|
LOG.debug("Running '%s'", cmd)
|
140
137
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
141
138
|
|
@@ -144,8 +141,7 @@ class InterfaceController(object):
|
|
144
141
|
('autoconf', 0)):
|
145
142
|
cmd = ["/sbin/sysctl",
|
146
143
|
"-w",
|
147
|
-
"net.ipv6.conf.{}.{}={}"
|
148
|
-
key, value)]
|
144
|
+
f"net.ipv6.conf.{interface_name}.{key}={value}"]
|
149
145
|
LOG.debug("Running '%s'", cmd)
|
150
146
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
151
147
|
|
@@ -176,47 +172,12 @@ class InterfaceController(object):
|
|
176
172
|
ip_network = ipaddress.ip_network(address, strict=False)
|
177
173
|
return ip_network.compressed
|
178
174
|
|
179
|
-
def _setup_nftables_chain(self, interface):
|
180
|
-
# TODO(johnsom) Move this to pyroute2 when the nftables library
|
181
|
-
# improves.
|
182
|
-
|
183
|
-
# Create the nftable
|
184
|
-
cmd = [consts.NFT_CMD, consts.NFT_ADD, 'table', consts.NFT_FAMILY,
|
185
|
-
consts.NFT_VIP_TABLE]
|
186
|
-
try:
|
187
|
-
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
188
|
-
except Exception as e:
|
189
|
-
if hasattr(e, 'output'):
|
190
|
-
LOG.error(e.output)
|
191
|
-
else:
|
192
|
-
LOG.error(e)
|
193
|
-
raise
|
194
|
-
|
195
|
-
# Create the chain with -310 priority to put it in front of the
|
196
|
-
# lvs-masquerade configured chain
|
197
|
-
cmd = [consts.NFT_CMD, consts.NFT_ADD, 'chain', consts.NFT_FAMILY,
|
198
|
-
consts.NFT_VIP_TABLE, consts.NFT_VIP_CHAIN,
|
199
|
-
'{', 'type', 'filter', 'hook', 'ingress', 'device',
|
200
|
-
interface.name, 'priority', consts.NFT_SRIOV_PRIORITY, ';',
|
201
|
-
'policy', 'drop', ';', '}']
|
202
|
-
try:
|
203
|
-
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
204
|
-
except Exception as e:
|
205
|
-
if hasattr(e, 'output'):
|
206
|
-
LOG.error(e.output)
|
207
|
-
else:
|
208
|
-
LOG.error(e)
|
209
|
-
raise
|
210
|
-
|
211
|
-
nftable_utils.write_nftable_vip_rules_file(interface.name, [])
|
212
|
-
|
213
|
-
nftable_utils.load_nftables_file()
|
214
|
-
|
215
175
|
def up(self, interface):
|
216
176
|
LOG.info("Setting interface %s up", interface.name)
|
217
177
|
|
218
178
|
if interface.is_sriov:
|
219
|
-
|
179
|
+
nftable_utils.write_nftable_rules_file(interface.name, [])
|
180
|
+
nftable_utils.load_nftables_file()
|
220
181
|
|
221
182
|
with pyroute2.IPRoute() as ipr:
|
222
183
|
idx = ipr.link_lookup(ifname=interface.name)[0]
|
@@ -305,8 +266,8 @@ class InterfaceController(object):
|
|
305
266
|
'RTA_DST',
|
306
267
|
'0.0.0.0' if family == socket.AF_INET else '::') # nosec
|
307
268
|
|
308
|
-
key = ("{
|
309
|
-
|
269
|
+
key = (f"{self._normalize_ip_address(dst)}/"
|
270
|
+
f"{route.get('dst_len', 0)}",
|
310
271
|
self._normalize_ip_address(attrs.get('RTA_GATEWAY')),
|
311
272
|
self._normalize_ip_address(attrs.get('RTA_PREFSRC')),
|
312
273
|
attrs.get('RTA_TABLE'))
|
@@ -13,18 +13,18 @@
|
|
13
13
|
# under the License.
|
14
14
|
|
15
15
|
import ipaddress
|
16
|
+
import json
|
16
17
|
import os
|
17
18
|
import stat
|
18
19
|
|
19
20
|
from oslo_config import cfg
|
20
|
-
import simplejson
|
21
21
|
|
22
22
|
from octavia.common import constants as consts
|
23
23
|
|
24
24
|
CONF = cfg.CONF
|
25
25
|
|
26
26
|
|
27
|
-
class InterfaceFile
|
27
|
+
class InterfaceFile:
|
28
28
|
def __init__(self, name, if_type, mtu=None, addresses=None,
|
29
29
|
routes=None, rules=None, scripts=None, is_sriov=False):
|
30
30
|
self.name = name
|
@@ -45,11 +45,11 @@ class InterfaceFile(object):
|
|
45
45
|
|
46
46
|
@classmethod
|
47
47
|
def load(cls, fp):
|
48
|
-
return
|
48
|
+
return json.load(fp)
|
49
49
|
|
50
50
|
@classmethod
|
51
51
|
def dump(cls, obj):
|
52
|
-
return
|
52
|
+
return json.dumps(obj)
|
53
53
|
|
54
54
|
@classmethod
|
55
55
|
def from_file(cls, filename):
|
@@ -88,7 +88,7 @@ class InterfaceFile(object):
|
|
88
88
|
except OSError:
|
89
89
|
pass
|
90
90
|
|
91
|
-
interface_file = "{}.json"
|
91
|
+
interface_file = f"{self.name}.json"
|
92
92
|
|
93
93
|
with os.fdopen(os.open(os.path.join(net_dir, interface_file),
|
94
94
|
flags, mode), 'w') as fp:
|
@@ -168,7 +168,7 @@ class VIPInterfaceFile(InterfaceFile):
|
|
168
168
|
})
|
169
169
|
|
170
170
|
vip_cidr = ipaddress.ip_network(
|
171
|
-
"{
|
171
|
+
f"{vip['ip_address']}/{vip['prefixlen']}",
|
172
172
|
strict=False)
|
173
173
|
self.routes.append({
|
174
174
|
consts.DST: vip_cidr.exploded,
|
@@ -227,22 +227,28 @@ class VIPInterfaceFile(InterfaceFile):
|
|
227
227
|
fixed_ip.get('host_routes', []))
|
228
228
|
self.routes.extend(host_routes)
|
229
229
|
|
230
|
+
if is_sriov:
|
231
|
+
sriov_param = ' sriov'
|
232
|
+
else:
|
233
|
+
sriov_param = ''
|
234
|
+
|
230
235
|
for ip_v in ip_versions:
|
231
236
|
self.scripts[consts.IFACE_UP].append({
|
232
237
|
consts.COMMAND: (
|
233
|
-
"/usr/local/bin/lvs-masquerade.sh add {} {}".format(
|
234
|
-
'ipv6' if ip_v == 6 else 'ipv4', name))
|
238
|
+
"/usr/local/bin/lvs-masquerade.sh add {} {}{}".format(
|
239
|
+
'ipv6' if ip_v == 6 else 'ipv4', name, sriov_param))
|
235
240
|
})
|
236
241
|
self.scripts[consts.IFACE_DOWN].append({
|
237
242
|
consts.COMMAND: (
|
238
|
-
"/usr/local/bin/lvs-masquerade.sh delete {} {}".format(
|
239
|
-
'ipv6' if ip_v == 6 else 'ipv4', name))
|
243
|
+
"/usr/local/bin/lvs-masquerade.sh delete {} {}{}".format(
|
244
|
+
'ipv6' if ip_v == 6 else 'ipv4', name, sriov_param))
|
240
245
|
})
|
241
246
|
|
242
247
|
|
243
248
|
class PortInterfaceFile(InterfaceFile):
|
244
|
-
def __init__(self, name, mtu, fixed_ips):
|
245
|
-
super().__init__(name, if_type=consts.BACKEND, mtu=mtu
|
249
|
+
def __init__(self, name, mtu, fixed_ips, is_sriov=False):
|
250
|
+
super().__init__(name, if_type=consts.BACKEND, mtu=mtu,
|
251
|
+
is_sriov=is_sriov)
|
246
252
|
|
247
253
|
if fixed_ips:
|
248
254
|
ip_versions = set()
|
@@ -271,14 +277,21 @@ class PortInterfaceFile(InterfaceFile):
|
|
271
277
|
consts.IPV6AUTO: True
|
272
278
|
})
|
273
279
|
|
280
|
+
if is_sriov:
|
281
|
+
sriov_param = ' sriov'
|
282
|
+
else:
|
283
|
+
sriov_param = ''
|
284
|
+
|
274
285
|
for ip_version in ip_versions:
|
275
286
|
self.scripts[consts.IFACE_UP].append({
|
276
287
|
consts.COMMAND: (
|
277
|
-
"/usr/local/bin/lvs-masquerade.sh add {} {}".format(
|
278
|
-
'ipv6' if ip_version == 6 else 'ipv4', name
|
288
|
+
"/usr/local/bin/lvs-masquerade.sh add {} {}{}".format(
|
289
|
+
'ipv6' if ip_version == 6 else 'ipv4', name,
|
290
|
+
sriov_param))
|
279
291
|
})
|
280
292
|
self.scripts[consts.IFACE_DOWN].append({
|
281
293
|
consts.COMMAND: (
|
282
|
-
"/usr/local/bin/lvs-masquerade.sh delete {} {}".format(
|
283
|
-
'ipv6' if ip_version == 6 else 'ipv4', name
|
294
|
+
"/usr/local/bin/lvs-masquerade.sh delete {} {}{}".format(
|
295
|
+
'ipv6' if ip_version == 6 else 'ipv4', name,
|
296
|
+
sriov_param))
|
284
297
|
})
|
@@ -80,7 +80,7 @@ def calculate_icmpv6_checksum(packet):
|
|
80
80
|
|
81
81
|
# Add up 16-bit words
|
82
82
|
num_words = len(packet) // 2
|
83
|
-
for chunk in struct.unpack("
|
83
|
+
for chunk in struct.unpack(f"!{num_words}H", packet[0:num_words * 2]):
|
84
84
|
total += chunk
|
85
85
|
|
86
86
|
# Add any left over byte
|
@@ -42,8 +42,7 @@ CHECKER_REGEX = re.compile(r"(MISC_CHECK|HTTP_GET|TCP_CHECK)")
|
|
42
42
|
|
43
43
|
|
44
44
|
def read_kernel_file(ns_name, file_path):
|
45
|
-
cmd =
|
46
|
-
ns=ns_name, lvs_stat_path=file_path))
|
45
|
+
cmd = f"ip netns exec {ns_name} cat {file_path}"
|
47
46
|
try:
|
48
47
|
output = subprocess.check_output(cmd.split(),
|
49
48
|
stderr=subprocess.STDOUT)
|
@@ -75,12 +74,12 @@ def get_listener_realserver_mapping(ns_name, listener_ip_ports,
|
|
75
74
|
ip_obj = ipaddress.ip_address(listener_ip.strip('[]'))
|
76
75
|
output = read_kernel_file(ns_name, KERNEL_LVS_PATH).split('\n')
|
77
76
|
if ip_obj.version == 4:
|
78
|
-
ip_to_hex_format = "
|
77
|
+
ip_to_hex_format = f"{ip_obj._ip:08X}"
|
79
78
|
else:
|
80
79
|
ip_to_hex_format = r'\[' + ip_obj.exploded + r'\]'
|
81
|
-
port_hex_format = "
|
80
|
+
port_hex_format = f"{int(listener_port):04X}"
|
82
81
|
idex_list.append(ip_to_hex_format + ':' + port_hex_format)
|
83
|
-
idex = "({
|
82
|
+
idex = f"({'|'.join(idex_list)})"
|
84
83
|
|
85
84
|
if health_monitor_enabled:
|
86
85
|
member_status = constants.UP
|
@@ -147,7 +146,7 @@ def get_lvs_listener_resource_ipports_nsname(listener_id):
|
|
147
146
|
# 'HealthMonitor': {'id': healthmonitor-id}}
|
148
147
|
resource_ipport_mapping = {}
|
149
148
|
with open(util.keepalived_lvs_cfg_path(listener_id),
|
150
|
-
|
149
|
+
encoding='utf-8') as f:
|
151
150
|
cfg = f.read()
|
152
151
|
|
153
152
|
ret = VS_ADDRESS_REGEX.findall(cfg)
|
@@ -192,7 +191,7 @@ def get_lvs_listener_resource_ipports_nsname(listener_id):
|
|
192
191
|
for resource_type, resource_id in resource_type_ids:
|
193
192
|
value = {'id': resource_id}
|
194
193
|
if resource_type == 'Member':
|
195
|
-
resource_type = '
|
194
|
+
resource_type = f'{resource_type}s'
|
196
195
|
if resource_type not in resource_ipport_mapping:
|
197
196
|
value = [value]
|
198
197
|
if resource_type not in resource_ipport_mapping:
|
@@ -260,7 +259,7 @@ def get_lvs_listener_pool_status(listener_id):
|
|
260
259
|
restarting = config_stat.st_mtime > check_pid_stat.st_mtime
|
261
260
|
|
262
261
|
with open(util.keepalived_lvs_cfg_path(listener_id),
|
263
|
-
|
262
|
+
encoding='utf-8') as f:
|
264
263
|
cfg = f.read()
|
265
264
|
hm_enabled = len(CHECKER_REGEX.findall(cfg)) > 0
|
266
265
|
|
@@ -15,7 +15,7 @@ import ctypes
|
|
15
15
|
import os
|
16
16
|
|
17
17
|
|
18
|
-
class NetworkNamespace
|
18
|
+
class NetworkNamespace:
|
19
19
|
"""A network namespace context manager.
|
20
20
|
|
21
21
|
Runs wrapped code inside the specified network namespace.
|
@@ -32,8 +32,8 @@ class NetworkNamespace(object):
|
|
32
32
|
raise OSError(errno, os.strerror(errno))
|
33
33
|
|
34
34
|
def __init__(self, netns):
|
35
|
-
self.current_netns = '/proc/{
|
36
|
-
self.target_netns = '/var/run/netns/{netns}'
|
35
|
+
self.current_netns = f'/proc/{os.getpid()}/ns/net'
|
36
|
+
self.target_netns = f'/var/run/netns/{netns}'
|
37
37
|
# reference: man setns(2)
|
38
38
|
self.set_netns = ctypes.CDLL('libc.so.6', use_errno=True).setns
|
39
39
|
self.set_netns.errcheck = self._error_handler
|