octavia 14.0.0.0rc1__py3-none-any.whl → 15.0.0__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.dist-info}/AUTHORS +6 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/METADATA +3 -5
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/RECORD +302 -305
- octavia-15.0.0.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.data}/data/share/octavia/LICENSE +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/README.rst +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/README.rst +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/diskimage-create.sh +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/image-tests.sh +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/requirements.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/test-requirements.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/tox.ini +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/data/share/octavia/diskimage-create/version.txt +0 -0
- {octavia-14.0.0.0rc1.data → octavia-15.0.0.data}/scripts/octavia-wsgi +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/LICENSE +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/WHEEL +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/entry_points.txt +0 -0
- {octavia-14.0.0.0rc1.dist-info → octavia-15.0.0.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,7 @@ import re
|
|
18
18
|
import shutil
|
19
19
|
import stat
|
20
20
|
import subprocess
|
21
|
+
import time
|
21
22
|
|
22
23
|
import flask
|
23
24
|
import jinja2
|
@@ -35,11 +36,11 @@ from octavia.common import utils as octavia_utils
|
|
35
36
|
|
36
37
|
LOG = logging.getLogger(__name__)
|
37
38
|
BUFFER = 100
|
39
|
+
HAPROXY_RELOAD_RETRIES = 3
|
40
|
+
HAPROXY_QUERY_RETRIES = 5
|
38
41
|
|
39
42
|
CONF = cfg.CONF
|
40
43
|
|
41
|
-
UPSTART_CONF = 'upstart.conf.j2'
|
42
|
-
SYSVINIT_CONF = 'sysvinit.conf.j2'
|
43
44
|
SYSTEMD_CONF = 'systemd.conf.j2'
|
44
45
|
|
45
46
|
JINJA_ENV = jinja2.Environment(
|
@@ -47,13 +48,11 @@ JINJA_ENV = jinja2.Environment(
|
|
47
48
|
loader=jinja2.FileSystemLoader(os.path.dirname(
|
48
49
|
os.path.realpath(__file__)
|
49
50
|
) + consts.AGENT_API_TEMPLATES))
|
50
|
-
UPSTART_TEMPLATE = JINJA_ENV.get_template(UPSTART_CONF)
|
51
|
-
SYSVINIT_TEMPLATE = JINJA_ENV.get_template(SYSVINIT_CONF)
|
52
51
|
SYSTEMD_TEMPLATE = JINJA_ENV.get_template(SYSTEMD_CONF)
|
53
52
|
|
54
53
|
|
55
54
|
# Wrap a stream so we can compute the md5 while reading
|
56
|
-
class Wrapped
|
55
|
+
class Wrapped:
|
57
56
|
def __init__(self, stream_):
|
58
57
|
self.stream = stream_
|
59
58
|
self.hash = md5(usedforsecurity=False) # nosec
|
@@ -71,7 +70,7 @@ class Wrapped(object):
|
|
71
70
|
return getattr(self.stream, attr)
|
72
71
|
|
73
72
|
|
74
|
-
class Loadbalancer
|
73
|
+
class Loadbalancer:
|
75
74
|
|
76
75
|
def get_haproxy_config(self, lb_id):
|
77
76
|
"""Gets the haproxy config
|
@@ -79,7 +78,7 @@ class Loadbalancer(object):
|
|
79
78
|
:param listener_id: the id of the listener
|
80
79
|
"""
|
81
80
|
self._check_lb_exists(lb_id)
|
82
|
-
with open(util.config_path(lb_id),
|
81
|
+
with open(util.config_path(lb_id), encoding='utf-8') as file:
|
83
82
|
cfg = file.read()
|
84
83
|
resp = webob.Response(cfg, content_type='text/plain')
|
85
84
|
resp.headers['ETag'] = (
|
@@ -126,12 +125,12 @@ class Loadbalancer(object):
|
|
126
125
|
file.write(new_config)
|
127
126
|
|
128
127
|
# use haproxy to check the config
|
129
|
-
cmd = "haproxy -c -L {
|
130
|
-
|
131
|
-
haproxy_ug=consts.HAPROXY_USER_GROUP_CFG)
|
128
|
+
cmd = (f"haproxy -c -L {peer_name} -f {name} -f "
|
129
|
+
f"{consts.HAPROXY_USER_GROUP_CFG}")
|
132
130
|
|
133
131
|
try:
|
134
|
-
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT
|
132
|
+
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT,
|
133
|
+
encoding='utf-8')
|
135
134
|
except subprocess.CalledProcessError as e:
|
136
135
|
LOG.error("Failed to verify haproxy file: %s %s", e, e.output)
|
137
136
|
# Save the last config that failed validation for debugging
|
@@ -143,43 +142,16 @@ class Loadbalancer(object):
|
|
143
142
|
# file ok - move it
|
144
143
|
os.rename(name, util.config_path(lb_id))
|
145
144
|
|
146
|
-
|
147
|
-
|
148
|
-
init_system = util.get_os_init_system()
|
149
|
-
|
150
|
-
LOG.debug('Found init system: %s', init_system)
|
151
|
-
|
152
|
-
init_path = util.init_path(lb_id, init_system)
|
145
|
+
init_path = util.init_path(lb_id)
|
153
146
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
consts.ENABLE, consts.AMP_NETNS_SVC_PREFIX + '.service')
|
160
|
-
elif init_system == consts.INIT_UPSTART:
|
161
|
-
template = UPSTART_TEMPLATE
|
162
|
-
elif init_system == consts.INIT_SYSVINIT:
|
163
|
-
template = SYSVINIT_TEMPLATE
|
164
|
-
init_enable_cmd = "insserv {file}".format(file=init_path)
|
165
|
-
else:
|
166
|
-
raise util.UnknownInitError()
|
147
|
+
template = SYSTEMD_TEMPLATE
|
148
|
+
# Render and install the network namespace systemd service
|
149
|
+
util.install_netns_systemd_service()
|
150
|
+
util.run_systemctl_command(
|
151
|
+
consts.ENABLE, consts.AMP_NETNS_SVC_PREFIX + '.service', False)
|
167
152
|
|
168
|
-
|
169
|
-
|
170
|
-
return webob.Response(json={
|
171
|
-
'message': "Unknown init system in amphora",
|
172
|
-
'details': "The amphora image is running an unknown init "
|
173
|
-
"system. We can't create the init configuration "
|
174
|
-
"file for the load balancing process."}, status=500)
|
175
|
-
|
176
|
-
if init_system == consts.INIT_SYSTEMD:
|
177
|
-
# mode 00644
|
178
|
-
mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
|
179
|
-
else:
|
180
|
-
# mode 00755
|
181
|
-
mode = (stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP |
|
182
|
-
stat.S_IROTH | stat.S_IXOTH)
|
153
|
+
# mode 00644
|
154
|
+
mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
|
183
155
|
|
184
156
|
hap_major, hap_minor = haproxy_compatibility.get_haproxy_versions()
|
185
157
|
if not os.path.exists(init_path):
|
@@ -193,9 +165,6 @@ class Loadbalancer(object):
|
|
193
165
|
haproxy_state_file=util.state_file_path(lb_id),
|
194
166
|
haproxy_socket=util.haproxy_sock_path(lb_id),
|
195
167
|
haproxy_user_group_cfg=consts.HAPROXY_USER_GROUP_CFG,
|
196
|
-
respawn_count=util.CONF.haproxy_amphora.respawn_count,
|
197
|
-
respawn_interval=(util.CONF.haproxy_amphora.
|
198
|
-
respawn_interval),
|
199
168
|
amphora_netns=consts.AMP_NETNS_SVC_PREFIX,
|
200
169
|
amphora_nsname=consts.AMPHORA_NAMESPACE,
|
201
170
|
haproxy_major_version=hap_major,
|
@@ -204,26 +173,36 @@ class Loadbalancer(object):
|
|
204
173
|
text_file.write(text)
|
205
174
|
|
206
175
|
# Make sure the new service is enabled on boot
|
207
|
-
|
176
|
+
try:
|
208
177
|
util.run_systemctl_command(
|
209
|
-
consts.ENABLE,
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
except subprocess.CalledProcessError as e:
|
215
|
-
LOG.error("Failed to enable haproxy-%(lb_id)s service: "
|
216
|
-
"%(err)s %(out)s", {'lb_id': lb_id, 'err': e,
|
217
|
-
'out': e.output})
|
218
|
-
return webob.Response(json={
|
219
|
-
'message': "Error enabling haproxy-{0} service".format(
|
220
|
-
lb_id), 'details': e.output}, status=500)
|
178
|
+
consts.ENABLE, consts.LOADBALANCER_SYSTEMD % lb_id)
|
179
|
+
except subprocess.CalledProcessError as e:
|
180
|
+
return webob.Response(json={
|
181
|
+
'message': "Error enabling octavia-keepalived service",
|
182
|
+
'details': e.output}, status=500)
|
221
183
|
|
222
184
|
res = webob.Response(json={'message': 'OK'}, status=202)
|
223
185
|
res.headers['ETag'] = stream.get_md5()
|
224
186
|
|
225
187
|
return res
|
226
188
|
|
189
|
+
def _check_haproxy_uptime(self, lb_id):
|
190
|
+
stat_sock_file = util.haproxy_sock_path(lb_id)
|
191
|
+
lb_query = haproxy_query.HAProxyQuery(stat_sock_file)
|
192
|
+
retries = HAPROXY_QUERY_RETRIES
|
193
|
+
for idx in range(retries):
|
194
|
+
try:
|
195
|
+
info = lb_query.show_info()
|
196
|
+
uptime_sec = info['Uptime_sec']
|
197
|
+
except Exception as e:
|
198
|
+
LOG.warning('Failed to get haproxy info: %s, retrying.', e)
|
199
|
+
time.sleep(1)
|
200
|
+
continue
|
201
|
+
uptime = int(uptime_sec)
|
202
|
+
return uptime
|
203
|
+
LOG.error('Failed to get haproxy uptime after %d tries.', retries)
|
204
|
+
return None
|
205
|
+
|
227
206
|
def start_stop_lb(self, lb_id, action):
|
228
207
|
action = action.lower()
|
229
208
|
if action not in [consts.AMP_ACTION_START,
|
@@ -231,7 +210,7 @@ class Loadbalancer(object):
|
|
231
210
|
consts.AMP_ACTION_RELOAD]:
|
232
211
|
return webob.Response(json={
|
233
212
|
'message': 'Invalid Request',
|
234
|
-
'details': "Unknown action: {
|
213
|
+
'details': f"Unknown action: {action}"}, status=400)
|
235
214
|
|
236
215
|
self._check_lb_exists(lb_id)
|
237
216
|
is_vrrp = (CONF.controller_worker.loadbalancer_topology ==
|
@@ -257,20 +236,45 @@ class Loadbalancer(object):
|
|
257
236
|
# failure!
|
258
237
|
LOG.warning('Failed to save haproxy-%s state!', lb_id)
|
259
238
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
239
|
+
retries = (HAPROXY_RELOAD_RETRIES
|
240
|
+
if action == consts.AMP_ACTION_RELOAD
|
241
|
+
else 1)
|
242
|
+
saved_exc = None
|
243
|
+
for idx in range(retries):
|
244
|
+
try:
|
245
|
+
util.run_systemctl_command(
|
246
|
+
action, consts.LOADBALANCER_SYSTEMD % lb_id)
|
247
|
+
except subprocess.CalledProcessError as e:
|
248
|
+
# Mitigation for
|
249
|
+
# https://bugs.launchpad.net/octavia/+bug/2054666
|
250
|
+
if ('is not active, cannot reload.' in e.output and
|
251
|
+
action == consts.AMP_ACTION_RELOAD):
|
252
|
+
|
253
|
+
saved_exc = e
|
254
|
+
|
255
|
+
# Wait a few seconds and check that haproxy was restarted
|
256
|
+
uptime = self._check_haproxy_uptime(lb_id)
|
257
|
+
# If haproxy is not reachable or was restarted more than 15
|
258
|
+
# sec ago, let's retry (or maybe restart?)
|
259
|
+
if not uptime or uptime > 15:
|
260
|
+
continue
|
261
|
+
# haproxy probably crashed and was restarted, log it and
|
262
|
+
# continue
|
263
|
+
LOG.warning("An error occured with haproxy while it "
|
264
|
+
"was reloaded, check the haproxy logs for "
|
265
|
+
"more details.")
|
266
|
+
break
|
267
|
+
if 'Job is already running' not in e.output:
|
268
|
+
return webob.Response(json={
|
269
|
+
'message': f"Error {action}ing haproxy",
|
270
|
+
'details': e.output
|
271
|
+
}, status=500)
|
272
|
+
break
|
273
|
+
else:
|
274
|
+
# no break, we reach the retry limit for reloads
|
275
|
+
return webob.Response(json={
|
276
|
+
'message': f"Error {action}ing haproxy",
|
277
|
+
'details': saved_exc.output}, status=500)
|
274
278
|
|
275
279
|
# If we are not in active/standby we need to send an IP
|
276
280
|
# advertisement (GARP or NA). Keepalived handles this for
|
@@ -283,12 +287,10 @@ class Loadbalancer(object):
|
|
283
287
|
consts.AMP_ACTION_RELOAD]:
|
284
288
|
return webob.Response(json={
|
285
289
|
'message': 'OK',
|
286
|
-
'details': 'Listener {lb_id} {action}ed'
|
287
|
-
lb_id=lb_id, action=action)}, status=202)
|
290
|
+
'details': f'Listener {lb_id} {action}ed'}, status=202)
|
288
291
|
|
289
292
|
details = (
|
290
|
-
'Configuration file is valid\
|
291
|
-
'haproxy daemon for {0} started'.format(lb_id)
|
293
|
+
f'Configuration file is valid\nhaproxy daemon for {lb_id} started'
|
292
294
|
)
|
293
295
|
|
294
296
|
return webob.Response(json={'message': 'OK', 'details': details},
|
@@ -303,9 +305,9 @@ class Loadbalancer(object):
|
|
303
305
|
# check if that haproxy is still running and if stop it
|
304
306
|
if os.path.exists(util.pid_path(lb_id)) and os.path.exists(
|
305
307
|
os.path.join('/proc', util.get_haproxy_pid(lb_id))):
|
306
|
-
cmd = "/usr/sbin/service haproxy-{0} stop".format(lb_id)
|
307
308
|
try:
|
308
|
-
|
309
|
+
util.run_systemctl_command(
|
310
|
+
consts.STOP, consts.LOADBALANCER_SYSTEMD % lb_id)
|
309
311
|
except subprocess.CalledProcessError as e:
|
310
312
|
LOG.error("Failed to stop haproxy-%s service: %s %s",
|
311
313
|
lb_id, e, e.output)
|
@@ -334,29 +336,10 @@ class Loadbalancer(object):
|
|
334
336
|
pass
|
335
337
|
|
336
338
|
# disable the service
|
337
|
-
|
338
|
-
init_path = util.init_path(lb_id, init_system)
|
339
|
+
init_path = util.init_path(lb_id)
|
339
340
|
|
340
|
-
|
341
|
-
|
342
|
-
consts.DISABLE, "haproxy-{lb_id}".format(
|
343
|
-
lb_id=lb_id))
|
344
|
-
elif init_system == consts.INIT_SYSVINIT:
|
345
|
-
init_disable_cmd = "insserv -r {file}".format(file=init_path)
|
346
|
-
elif init_system != consts.INIT_UPSTART:
|
347
|
-
raise util.UnknownInitError()
|
348
|
-
|
349
|
-
if init_system == consts.INIT_SYSVINIT:
|
350
|
-
try:
|
351
|
-
subprocess.check_output(init_disable_cmd.split(),
|
352
|
-
stderr=subprocess.STDOUT)
|
353
|
-
except subprocess.CalledProcessError as e:
|
354
|
-
LOG.error("Failed to disable haproxy-%(lb_id)s service: "
|
355
|
-
"%(err)s %(out)s", {'lb_id': lb_id, 'err': e,
|
356
|
-
'out': e.output})
|
357
|
-
return webob.Response(json={
|
358
|
-
'message': "Error disabling haproxy-{0} service".format(
|
359
|
-
lb_id), 'details': e.output}, status=500)
|
341
|
+
util.run_systemctl_command(
|
342
|
+
consts.DISABLE, consts.LOADBALANCER_SYSTEMD % lb_id, False)
|
360
343
|
|
361
344
|
# delete the directory + init script for that listener
|
362
345
|
shutil.rmtree(util.haproxy_dir(lb_id))
|
@@ -420,10 +403,10 @@ class Loadbalancer(object):
|
|
420
403
|
if not path_exists:
|
421
404
|
return webob.Response(json={
|
422
405
|
'message': 'Certificate Not Found',
|
423
|
-
'details': "No certificate with filename: {
|
424
|
-
|
406
|
+
'details': f"No certificate with filename: {filename}"},
|
407
|
+
status=404)
|
425
408
|
|
426
|
-
with open(cert_path,
|
409
|
+
with open(cert_path, encoding='utf-8') as crt_file:
|
427
410
|
cert = crt_file.read()
|
428
411
|
md5sum = md5(octavia_utils.b(cert),
|
429
412
|
usedforsecurity=False).hexdigest() # nosec
|
@@ -442,8 +425,7 @@ class Loadbalancer(object):
|
|
442
425
|
if os.path.exists(
|
443
426
|
os.path.join('/proc', util.get_haproxy_pid(lb_id))):
|
444
427
|
# Check if the listener is disabled
|
445
|
-
with open(util.config_path(lb_id),
|
446
|
-
'r', encoding='utf-8') as file:
|
428
|
+
with open(util.config_path(lb_id), encoding='utf-8') as file:
|
447
429
|
cfg = file.read()
|
448
430
|
m = re.findall('^frontend (.*)$', cfg, re.MULTILINE)
|
449
431
|
return m or []
|
@@ -458,8 +440,8 @@ class Loadbalancer(object):
|
|
458
440
|
raise exceptions.HTTPException(
|
459
441
|
response=webob.Response(json={
|
460
442
|
'message': 'Loadbalancer Not Found',
|
461
|
-
'details': "No loadbalancer with UUID: {
|
462
|
-
|
443
|
+
'details': f"No loadbalancer with UUID: {lb_id}"},
|
444
|
+
status=404))
|
463
445
|
|
464
446
|
def _check_ssl_filename_format(self, filename):
|
465
447
|
# check if the format is (xxx.)*xxx.pem
|
@@ -29,7 +29,7 @@ CONF = cfg.CONF
|
|
29
29
|
LOG = logging.getLogger(__name__)
|
30
30
|
|
31
31
|
|
32
|
-
class BaseOS
|
32
|
+
class BaseOS:
|
33
33
|
|
34
34
|
def __init__(self, os_name):
|
35
35
|
self.os_name = os_name
|
@@ -75,11 +75,13 @@ class BaseOS(object):
|
|
75
75
|
is_sriov=is_sriov)
|
76
76
|
vip_interface.write()
|
77
77
|
|
78
|
-
def write_port_interface_file(self, interface, fixed_ips, mtu
|
78
|
+
def write_port_interface_file(self, interface, fixed_ips, mtu,
|
79
|
+
is_sriov=False):
|
79
80
|
port_interface = interface_file.PortInterfaceFile(
|
80
81
|
name=interface,
|
81
82
|
mtu=mtu,
|
82
|
-
fixed_ips=fixed_ips
|
83
|
+
fixed_ips=fixed_ips,
|
84
|
+
is_sriov=is_sriov)
|
83
85
|
port_interface.write()
|
84
86
|
|
85
87
|
@classmethod
|
@@ -89,15 +91,16 @@ class BaseOS(object):
|
|
89
91
|
LOG.debug("Executing: %s", cmd)
|
90
92
|
try:
|
91
93
|
out = subprocess.check_output(cmd.split(),
|
92
|
-
stderr=subprocess.STDOUT
|
93
|
-
|
94
|
+
stderr=subprocess.STDOUT,
|
95
|
+
encoding='utf-8')
|
96
|
+
for line in out.split('\n'):
|
94
97
|
LOG.debug(line)
|
95
98
|
except subprocess.CalledProcessError as e:
|
96
99
|
LOG.error('Failed to set up %s due to error: %s %s', interface,
|
97
100
|
e, e.output)
|
98
101
|
raise exceptions.HTTPException(
|
99
102
|
response=webob.Response(json={
|
100
|
-
'message': 'Error plugging {
|
103
|
+
'message': f'Error plugging {name}',
|
101
104
|
'details': e.output}, status=500))
|
102
105
|
|
103
106
|
|
@@ -109,7 +112,7 @@ class Ubuntu(BaseOS):
|
|
109
112
|
|
110
113
|
def cmd_get_version_of_installed_package(self, package_name):
|
111
114
|
name = self._map_package_name(package_name)
|
112
|
-
return "dpkg-query -W -f=${{Version}} {name}"
|
115
|
+
return f"dpkg-query -W -f=${{Version}} {name}"
|
113
116
|
|
114
117
|
|
115
118
|
class RH(BaseOS):
|
@@ -120,7 +123,7 @@ class RH(BaseOS):
|
|
120
123
|
|
121
124
|
def cmd_get_version_of_installed_package(self, package_name):
|
122
125
|
name = self._map_package_name(package_name)
|
123
|
-
return "rpm -q --queryformat %{{VERSION}} {name}"
|
126
|
+
return f"rpm -q --queryformat %{{VERSION}} {name}"
|
124
127
|
|
125
128
|
|
126
129
|
class CentOS(RH):
|
@@ -34,7 +34,7 @@ CONF = cfg.CONF
|
|
34
34
|
LOG = logging.getLogger(__name__)
|
35
35
|
|
36
36
|
|
37
|
-
class Plug
|
37
|
+
class Plug:
|
38
38
|
def __init__(self, osutils):
|
39
39
|
self._osutils = osutils
|
40
40
|
|
@@ -89,7 +89,7 @@ class Plug(object):
|
|
89
89
|
try:
|
90
90
|
rendered_vips = self.render_vips(vips)
|
91
91
|
except ValueError as e:
|
92
|
-
vip_error_message = "Invalid VIP: {}"
|
92
|
+
vip_error_message = f"Invalid VIP: {e}"
|
93
93
|
return webob.Response(json={'message': vip_error_message},
|
94
94
|
status=400)
|
95
95
|
|
@@ -98,7 +98,7 @@ class Plug(object):
|
|
98
98
|
gateway, host_routes)
|
99
99
|
except ValueError as e:
|
100
100
|
return webob.Response(
|
101
|
-
json={'message': "Invalid VRRP Address: {}"
|
101
|
+
json={'message': f"Invalid VRRP Address: {e}"},
|
102
102
|
status=400)
|
103
103
|
|
104
104
|
# Check if the interface is already in the network namespace
|
@@ -148,14 +148,14 @@ class Plug(object):
|
|
148
148
|
for ip in fixed_ips:
|
149
149
|
try:
|
150
150
|
socket.inet_pton(socket.AF_INET, ip.get('ip_address'))
|
151
|
-
except
|
151
|
+
except OSError:
|
152
152
|
socket.inet_pton(socket.AF_INET6, ip.get('ip_address'))
|
153
153
|
|
154
154
|
def plug_network(self, mac_address, fixed_ips, mtu=None,
|
155
|
-
vip_net_info=None):
|
155
|
+
vip_net_info=None, is_sriov=False):
|
156
156
|
try:
|
157
157
|
self._check_ip_addresses(fixed_ips=fixed_ips)
|
158
|
-
except
|
158
|
+
except OSError:
|
159
159
|
return webob.Response(json={
|
160
160
|
'message': "Invalid network port"}, status=400)
|
161
161
|
|
@@ -189,7 +189,8 @@ class Plug(object):
|
|
189
189
|
vips=rendered_vips,
|
190
190
|
mtu=mtu,
|
191
191
|
vrrp_info=vrrp_info,
|
192
|
-
fixed_ips=fixed_ips
|
192
|
+
fixed_ips=fixed_ips,
|
193
|
+
is_sriov=is_sriov)
|
193
194
|
self._osutils.bring_interface_up(existing_interface, 'vip')
|
194
195
|
# Otherwise, we are just plugging a run-of-the-mill network
|
195
196
|
else:
|
@@ -197,7 +198,7 @@ class Plug(object):
|
|
197
198
|
self._osutils.write_port_interface_file(
|
198
199
|
interface=existing_interface,
|
199
200
|
fixed_ips=fixed_ips,
|
200
|
-
mtu=mtu)
|
201
|
+
mtu=mtu, is_sriov=is_sriov)
|
201
202
|
self._osutils.bring_interface_up(existing_interface, 'network')
|
202
203
|
|
203
204
|
util.send_member_advertisements(fixed_ips)
|
@@ -222,7 +223,7 @@ class Plug(object):
|
|
222
223
|
self._osutils.write_port_interface_file(
|
223
224
|
interface=netns_interface,
|
224
225
|
fixed_ips=fixed_ips,
|
225
|
-
mtu=mtu)
|
226
|
+
mtu=mtu, is_sriov=is_sriov)
|
226
227
|
|
227
228
|
# Update the list of interfaces to add to the namespace
|
228
229
|
self._update_plugged_interfaces_file(netns_interface, mac_address)
|
@@ -239,8 +240,7 @@ class Plug(object):
|
|
239
240
|
|
240
241
|
return webob.Response(json={
|
241
242
|
'message': "OK",
|
242
|
-
'details': "Plugged on interface {
|
243
|
-
interface=netns_interface)}, status=202)
|
243
|
+
'details': f"Plugged on interface {netns_interface}"}, status=202)
|
244
244
|
|
245
245
|
def _interface_by_mac(self, mac):
|
246
246
|
try:
|
@@ -277,8 +277,7 @@ class Plug(object):
|
|
277
277
|
with os.fdopen(os.open(plug_inf_file, flags, mode), 'r+') as text_file:
|
278
278
|
inf_list = [inf.split()[0].rstrip() for inf in text_file]
|
279
279
|
if mac_address not in inf_list:
|
280
|
-
text_file.write("{mac_address} {interface}\n"
|
281
|
-
mac_address=mac_address, interface=interface))
|
280
|
+
text_file.write(f"{mac_address} {interface}\n")
|
282
281
|
|
283
282
|
def _netns_interface_by_mac(self, mac_address):
|
284
283
|
with pyroute2.NetNS(consts.AMPHORA_NAMESPACE,
|
@@ -55,7 +55,7 @@ def register_app_error_handler(app):
|
|
55
55
|
app.register_error_handler(code, make_json_error)
|
56
56
|
|
57
57
|
|
58
|
-
class Server
|
58
|
+
class Server:
|
59
59
|
def __init__(self):
|
60
60
|
self.app = flask.Flask(__name__)
|
61
61
|
self._osutils = osutils.BaseOS.get_os_util()
|
@@ -223,7 +223,8 @@ class Server(object):
|
|
223
223
|
return self._plug.plug_network(port_info['mac_address'],
|
224
224
|
port_info.get('fixed_ips'),
|
225
225
|
port_info.get('mtu'),
|
226
|
-
port_info.get('vip_net_info')
|
226
|
+
port_info.get('vip_net_info'),
|
227
|
+
port_info.get('is_sriov'))
|
227
228
|
|
228
229
|
def upload_cert(self):
|
229
230
|
return certificate_update.upload_server_cert()
|
@@ -278,7 +279,7 @@ class Server(object):
|
|
278
279
|
raise exceptions.BadRequest(
|
279
280
|
description='Invalid rules information') from e
|
280
281
|
|
281
|
-
nftable_utils.
|
282
|
+
nftable_utils.write_nftable_rules_file(interface, rules_info)
|
282
283
|
|
283
284
|
nftable_utils.load_nftables_file()
|
284
285
|
|
@@ -11,11 +11,7 @@ do
|
|
11
11
|
pid) echo "Check keepalived pid file: " $file;;
|
12
12
|
*) continue;;
|
13
13
|
esac
|
14
|
-
{% if init_system == consts.INIT_SYSTEMD %}
|
15
14
|
systemctl status $(basename $file .pid) > /dev/null
|
16
|
-
{% elif init_system in (consts.INIT_UPSTART, consts.INIT_SYSVINIT) %}
|
17
|
-
kill -0 `cat $file`
|
18
|
-
{% endif %}
|
19
15
|
status=$(( $status + $? ))
|
20
16
|
done
|
21
17
|
exit $status
|