diff --git a/neutron/agent/dhcp/agent.py b/neutron/agent/dhcp/agent.py index 6eb8700a1d5..cd911a0e9d0 100644 --- a/neutron/agent/dhcp/agent.py +++ b/neutron/agent/dhcp/agent.py @@ -968,7 +968,7 @@ class DhcpAgentWithStateReport(DhcpAgent): self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.failed_report_state = False self.agent_state = { - 'binary': 'neutron-dhcp-agent', + 'binary': constants.AGENT_PROCESS_DHCP, 'host': host, 'availability_zone': self.conf.AGENT.availability_zone, 'topic': topics.DHCP_AGENT, diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index bb651835668..b6da1d31f77 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -17,6 +17,7 @@ import sys from neutron_lib.agent import topics +from neutron_lib import constants from oslo_config import cfg from oslo_service import service @@ -45,7 +46,7 @@ def main(): config.setup_logging() config.setup_privsep() server = neutron_service.Service.create( - binary='neutron-dhcp-agent', + binary=constants.AGENT_PROCESS_DHCP, topic=topics.DHCP_AGENT, report_interval=cfg.CONF.AGENT.report_interval, manager='neutron.agent.dhcp.agent.DhcpAgentWithStateReport') diff --git a/neutron/agent/l3/agent.py b/neutron/agent/l3/agent.py index f3048a9325c..7ffb025b8cd 100644 --- a/neutron/agent/l3/agent.py +++ b/neutron/agent/l3/agent.py @@ -923,7 +923,7 @@ class L3NATAgentWithStateReport(L3NATAgent): self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.failed_report_state = False self.agent_state = { - 'binary': 'neutron-l3-agent', + 'binary': lib_const.AGENT_PROCESS_L3, 'host': host, 'availability_zone': self.conf.AGENT.availability_zone, 'topic': topics.L3_AGENT, diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 3d966ccbb9a..d79e8cc6e48 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -17,6 +17,7 @@ import sys from neutron_lib.agent import topics +from neutron_lib import constants from oslo_config import cfg from oslo_service import service @@ -49,7 +50,7 @@ def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'): config.setup_logging() config.setup_privsep() server = neutron_service.Service.create( - binary='neutron-l3-agent', + binary=constants.AGENT_PROCESS_L3, topic=topics.L3_AGENT, report_interval=cfg.CONF.AGENT.report_interval, manager=manager) diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index 82dedb8fd80..1841bb331d4 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -276,7 +276,7 @@ class UnixDomainMetadataProxy(object): self.failed_state_report = False self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { - 'binary': 'neutron-metadata-agent', + 'binary': constants.AGENT_PROCESS_METADATA, 'host': cfg.CONF.host, 'topic': 'N/A', 'configurations': { @@ -333,7 +333,8 @@ class UnixDomainMetadataProxy(object): return MODE_MAP[mode] def run(self): - server = agent_utils.UnixDomainWSGIServer('neutron-metadata-agent') + server = agent_utils.UnixDomainWSGIServer( + constants.AGENT_PROCESS_METADATA) server.start(MetadataProxyHandler(self.conf), self.conf.metadata_proxy_socket, workers=self.conf.metadata_workers, diff --git a/neutron/cmd/eventlet/agents/dhcp.py b/neutron/cmd/eventlet/agents/dhcp.py index f1c04cf330c..168cf3603b2 100644 --- a/neutron/cmd/eventlet/agents/dhcp.py +++ b/neutron/cmd/eventlet/agents/dhcp.py @@ -10,8 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.agent import dhcp_agent +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_DHCP, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + dhcp_agent.main() diff --git a/neutron/cmd/eventlet/agents/l3.py b/neutron/cmd/eventlet/agents/l3.py index e44acd509b3..d090c427ace 100644 --- a/neutron/cmd/eventlet/agents/l3.py +++ b/neutron/cmd/eventlet/agents/l3.py @@ -10,8 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.agent import l3_agent +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_L3, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + l3_agent.main() diff --git a/neutron/cmd/eventlet/agents/metadata.py b/neutron/cmd/eventlet/agents/metadata.py index 17ad50a012e..1ae8be5bad4 100644 --- a/neutron/cmd/eventlet/agents/metadata.py +++ b/neutron/cmd/eventlet/agents/metadata.py @@ -10,8 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.agent import metadata_agent +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_METADATA, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + metadata_agent.main() diff --git a/neutron/cmd/eventlet/agents/ovn_metadata.py b/neutron/cmd/eventlet/agents/ovn_metadata.py index 3465fa9ab28..7e122081163 100644 --- a/neutron/cmd/eventlet/agents/ovn_metadata.py +++ b/neutron/cmd/eventlet/agents/ovn_metadata.py @@ -10,8 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.agent.ovn import metadata_agent +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_OVN_METADATA, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + metadata_agent.main() diff --git a/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py b/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py index 2ffc2300bef..4d77983296f 100644 --- a/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py +++ b/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py @@ -12,10 +12,17 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + import \ neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent \ as agent_main +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_LINUXBRIDGE, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + agent_main.main() diff --git a/neutron/cmd/eventlet/plugins/macvtap_neutron_agent.py b/neutron/cmd/eventlet/plugins/macvtap_neutron_agent.py index 9438dbac53f..ea84d0a002e 100644 --- a/neutron/cmd/eventlet/plugins/macvtap_neutron_agent.py +++ b/neutron/cmd/eventlet/plugins/macvtap_neutron_agent.py @@ -12,9 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.plugins.ml2.drivers.macvtap.agent import ( macvtap_neutron_agent as agent_main) +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_MACVTAP, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + agent_main.main() diff --git a/neutron/cmd/eventlet/plugins/ovs_neutron_agent.py b/neutron/cmd/eventlet/plugins/ovs_neutron_agent.py index 1f7d2cddcee..6851d60152d 100644 --- a/neutron/cmd/eventlet/plugins/ovs_neutron_agent.py +++ b/neutron/cmd/eventlet/plugins/ovs_neutron_agent.py @@ -13,8 +13,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + import neutron.plugins.ml2.drivers.openvswitch.agent.main as agent_main +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_OVS, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + agent_main.main() diff --git a/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py b/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py index 7695fc4a68b..4d7cc623ae1 100644 --- a/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py +++ b/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py @@ -12,9 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + import neutron.plugins.ml2.drivers.mech_sriov.agent.sriov_nic_agent \ as agent_main +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_NIC_SWITCH, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + agent_main.main() diff --git a/neutron/cmd/eventlet/services/metering_agent.py b/neutron/cmd/eventlet/services/metering_agent.py index b5f9b3fa74d..4813a5735f2 100644 --- a/neutron/cmd/eventlet/services/metering_agent.py +++ b/neutron/cmd/eventlet/services/metering_agent.py @@ -10,8 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +import setproctitle + from neutron.services.metering.agents import metering_agent +from neutron_lib import constants def main(): + proctitle = "%s (%s)" % ( + constants.AGENT_PROCESS_METERING, setproctitle.getproctitle()) + setproctitle.setproctitle(proctitle) + metering_agent.main() diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py index 2efd7cefa67..ac5464c04c8 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -61,7 +61,6 @@ from neutron.plugins.ml2.drivers.linuxbridge.agent \ LOG = logging.getLogger(__name__) -LB_AGENT_BINARY = 'neutron-linuxbridge-agent' BRIDGE_NAME_PREFIX = "brq" MAX_VLAN_POSTFIX_LEN = 5 VXLAN_INTERFACE_PREFIX = "vxlan-" @@ -1059,8 +1058,8 @@ def main(): quitting_rpc_timeout = cfg.CONF.AGENT.quitting_rpc_timeout agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout, constants.AGENT_TYPE_LINUXBRIDGE, - LB_AGENT_BINARY) - setup_profiler.setup("neutron-linuxbridge-agent", cfg.CONF.host) + constants.AGENT_PROCESS_LINUXBRIDGE) + setup_profiler.setup(constants.AGENT_PROCESS_LINUXBRIDGE, cfg.CONF.host) LOG.info("Agent initialized successfully, now running... ") launcher = service.launch(cfg.CONF, agent, restart_method='mutate') launcher.wait() diff --git a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py index 0dabf8afd8a..e218bd3e9fc 100644 --- a/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/macvtap/agent/macvtap_neutron_agent.py @@ -35,7 +35,6 @@ from neutron.plugins.ml2.drivers.macvtap import macvtap_common LOG = logging.getLogger(__name__) -MACVTAP_AGENT_BINARY = "neutron-macvtap-agent" MACVTAP_FS = "/sys/class/net/" EXTENSION_DRIVER_TYPE = 'macvtap' @@ -220,7 +219,7 @@ def main(): agent = ca.CommonAgentLoop(manager, polling_interval, quitting_rpc_timeout, constants.AGENT_TYPE_MACVTAP, - MACVTAP_AGENT_BINARY) + constants.AGENT_PROCESS_MACVTAP) LOG.info("Agent initialized successfully, now running... ") launcher = service.launch(cfg.CONF, agent, restart_method='mutate') launcher.wait() diff --git a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py index b48f6af045d..bddd31185b6 100644 --- a/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py +++ b/neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py @@ -172,7 +172,7 @@ class SriovNicSwitchAgent(object): # TODO(mangelajo): optimize resource_versions (see ovs agent) self.agent_state = { - 'binary': 'neutron-sriov-nic-agent', + 'binary': n_constants.AGENT_PROCESS_NIC_SWITCH, 'host': self.conf.host, 'topic': n_constants.L2_AGENT_TOPIC, 'configurations': configurations, @@ -580,6 +580,6 @@ def main(): LOG.exception("Agent Initialization Failed") raise SystemExit(1) # Start everything. - setup_profiler.setup("neutron-sriov-nic-agent", cfg.CONF.host) + setup_profiler.setup(n_constants.AGENT_PROCESS_NIC_SWITCH, cfg.CONF.host) LOG.info("Agent initialized successfully, now running... ") agent.daemon_loop() diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index c78c5d4e21d..3f9f7e01fe2 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -322,7 +322,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, # versions about resources which are common, # or which are used by specific extensions. self.agent_state = { - 'binary': 'neutron-openvswitch-agent', + 'binary': n_const.AGENT_PROCESS_OVS, 'host': host, 'topic': n_const.L2_AGENT_TOPIC, 'configurations': {'bridge_mappings': self.bridge_mappings, diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index 8561663aff7..26dbdf3101f 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -253,7 +253,7 @@ class MeteringAgentWithStateReport(MeteringAgent): self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.failed_report_state = False self.agent_state = { - 'binary': 'neutron-metering-agent', + 'binary': constants.AGENT_PROCESS_METERING, 'host': host, 'topic': topics.METERING_AGENT, 'configurations': { @@ -302,7 +302,7 @@ def main(): config.setup_logging() config.setup_privsep() server = neutron_service.Service.create( - binary='neutron-metering-agent', + binary=constants.AGENT_PROCESS_METERING, topic=topics.METERING_AGENT, report_interval=cfg.CONF.AGENT.report_interval, manager='neutron.services.metering.agents.' diff --git a/neutron/tests/common/helpers.py b/neutron/tests/common/helpers.py index cf4b3600cf1..a9557f52264 100644 --- a/neutron/tests/common/helpers.py +++ b/neutron/tests/common/helpers.py @@ -57,7 +57,7 @@ def _get_l3_agent_dict(host, agent_mode, internal_only=True, az=DEFAULT_AZ): return { 'agent_type': constants.AGENT_TYPE_L3, - 'binary': 'neutron-l3-agent', + 'binary': constants.AGENT_PROCESS_L3, 'host': host, 'topic': topics.L3_AGENT, 'availability_zone': az, @@ -82,7 +82,7 @@ def register_l3_agent(host=HOST, agent_mode=constants.L3_AGENT_MODE_LEGACY, def _get_dhcp_agent_dict(host, networks=0, az=DEFAULT_AZ): agent = { - 'binary': 'neutron-dhcp-agent', + 'binary': constants.AGENT_PROCESS_DHCP, 'host': host, 'topic': topics.DHCP_AGENT, 'agent_type': constants.AGENT_TYPE_DHCP, @@ -161,7 +161,7 @@ def _get_l2_agent_dict(host, agent_type, binary, tunnel_types=None, def register_ovs_agent(host=HOST, agent_type=constants.AGENT_TYPE_OVS, - binary='neutron-openvswitch-agent', + binary=constants.AGENT_PROCESS_OVS, tunnel_types=['vxlan'], tunneling_ip='20.0.0.1', interface_mappings=None, bridge_mappings=None, l2pop_network_types=None, plugin=None, start_flag=True, @@ -176,7 +176,7 @@ def register_ovs_agent(host=HOST, agent_type=constants.AGENT_TYPE_OVS, def register_linuxbridge_agent(host=HOST, agent_type=constants.AGENT_TYPE_LINUXBRIDGE, - binary='neutron-linuxbridge-agent', + binary=constants.AGENT_PROCESS_LINUXBRIDGE, tunnel_types=['vxlan'], tunneling_ip='20.0.0.1', interface_mappings=None, bridge_mappings=None, plugin=None): @@ -189,7 +189,7 @@ def register_linuxbridge_agent(host=HOST, def register_macvtap_agent(host=HOST, agent_type=constants.AGENT_TYPE_MACVTAP, - binary='neutron-macvtap-agent', + binary=constants.AGENT_PROCESS_MACVTAP, interface_mappings=None, plugin=None): agent = _get_l2_agent_dict(host, agent_type, binary, interface_mappings=interface_mappings) @@ -198,7 +198,7 @@ def register_macvtap_agent(host=HOST, def register_sriovnicswitch_agent(host=HOST, agent_type=constants.AGENT_TYPE_NIC_SWITCH, - binary='neutron-sriov-nic-agent', + binary=constants.AGENT_PROCESS_NIC_SWITCH, device_mappings=None, plugin=None): agent = _get_l2_agent_dict(host, agent_type, binary, device_mappings=device_mappings) diff --git a/neutron/tests/fullstack/resources/process.py b/neutron/tests/fullstack/resources/process.py index 4f575413a05..3ef5b5954bf 100644 --- a/neutron/tests/fullstack/resources/process.py +++ b/neutron/tests/fullstack/resources/process.py @@ -19,6 +19,7 @@ import re import signal import fixtures +from neutron_lib import constants from neutronclient.common import exceptions as nc_exc from neutronclient.v2_0 import client from oslo_log import log as logging @@ -182,8 +183,6 @@ class NeutronServerFixture(ServiceFixture): class OVSAgentFixture(ServiceFixture): - NEUTRON_OVS_AGENT = "neutron-openvswitch-agent" - def __init__(self, env_desc, host_desc, test_name, neutron_cfg_fixture, agent_cfg_fixture): super(OVSAgentFixture, self).__init__() @@ -205,7 +204,7 @@ class OVSAgentFixture(ServiceFixture): self.process_fixture = self.useFixture(ProcessFixture( test_name=self.test_name, - process_name=self.NEUTRON_OVS_AGENT, + process_name=constants.AGENT_PROCESS_OVS, exec_name=spawn.find_executable( 'ovs_agent.py', path=os.path.join(fullstack_base.ROOTDIR, CMD_FOLDER)), @@ -237,8 +236,6 @@ class PlacementFixture(fixtures.Fixture): class SRIOVAgentFixture(ServiceFixture): - NEUTRON_SRIOV_AGENT = "neutron-sriov-nic-agent" - def __init__(self, env_desc, host_desc, test_name, neutron_cfg_fixture, agent_cfg_fixture): super(SRIOVAgentFixture, self).__init__() @@ -255,16 +252,14 @@ class SRIOVAgentFixture(ServiceFixture): self.agent_cfg_fixture.filename] self.process_fixture = self.useFixture(ProcessFixture( test_name=self.test_name, - process_name=self.NEUTRON_SRIOV_AGENT, - exec_name=self.NEUTRON_SRIOV_AGENT, + process_name=constants.AGENT_PROCESS_NIC_SWITCH, + exec_name=constants.AGENT_PROCESS_NIC_SWITCH, config_filenames=config_filenames, kill_signal=signal.SIGTERM)) class LinuxBridgeAgentFixture(ServiceFixture): - NEUTRON_LINUXBRIDGE_AGENT = "neutron-linuxbridge-agent" - def __init__(self, env_desc, host_desc, test_name, neutron_cfg_fixture, agent_cfg_fixture, namespace=None): @@ -285,8 +280,8 @@ class LinuxBridgeAgentFixture(ServiceFixture): self.process_fixture = self.useFixture( ProcessFixture( test_name=self.test_name, - process_name=self.NEUTRON_LINUXBRIDGE_AGENT, - exec_name=self.NEUTRON_LINUXBRIDGE_AGENT, + process_name=constants.AGENT_PROCESS_LINUXBRIDGE, + exec_name=constants.AGENT_PROCESS_LINUXBRIDGE, config_filenames=config_filenames, namespace=self.namespace ) @@ -295,8 +290,6 @@ class LinuxBridgeAgentFixture(ServiceFixture): class L3AgentFixture(ServiceFixture): - NEUTRON_L3_AGENT = "neutron-l3-agent" - def __init__(self, env_desc, host_desc, test_name, neutron_cfg_fixture, l3_agent_cfg_fixture, namespace=None): @@ -326,7 +319,7 @@ class L3AgentFixture(ServiceFixture): self.process_fixture = self.useFixture( ProcessFixture( test_name=self.test_name, - process_name=self.NEUTRON_L3_AGENT, + process_name=constants.AGENT_PROCESS_L3, exec_name=exec_name, config_filenames=config_filenames, namespace=self.namespace @@ -339,8 +332,6 @@ class L3AgentFixture(ServiceFixture): class DhcpAgentFixture(fixtures.Fixture): - NEUTRON_DHCP_AGENT = "neutron-dhcp-agent" - def __init__(self, env_desc, host_desc, test_name, neutron_cfg_fixture, agent_cfg_fixture, namespace=None): super(DhcpAgentFixture, self).__init__() @@ -369,7 +360,7 @@ class DhcpAgentFixture(fixtures.Fixture): self.process_fixture = self.useFixture( ProcessFixture( test_name=self.test_name, - process_name=self.NEUTRON_DHCP_AGENT, + process_name=constants.AGENT_PROCESS_DHCP, exec_name=exec_name, config_filenames=config_filenames, namespace=self.namespace diff --git a/neutron/tests/unit/agent/metadata/test_agent.py b/neutron/tests/unit/agent/metadata/test_agent.py index 8824999cf05..e28f4ab7634 100644 --- a/neutron/tests/unit/agent/metadata/test_agent.py +++ b/neutron/tests/unit/agent/metadata/test_agent.py @@ -507,7 +507,7 @@ class TestUnixDomainMetadataProxy(base.BaseTestCase): ensure_dir.assert_called_once_with('/the', mode=0o755) server.assert_has_calls([ - mock.call('neutron-metadata-agent'), + mock.call(n_const.AGENT_PROCESS_METADATA), mock.call().start(handler.return_value, '/the/path', workers=0, backlog=128, mode=0o644), diff --git a/neutron/tests/unit/db/test_agents_db.py b/neutron/tests/unit/db/test_agents_db.py index c46d6b8d724..6bcf258979e 100644 --- a/neutron/tests/unit/db/test_agents_db.py +++ b/neutron/tests/unit/db/test_agents_db.py @@ -45,8 +45,8 @@ load_tests = testscenarios.load_tests_apply_scenarios TEST_RESOURCE_VERSIONS = {"A": "1.0"} -AGENT_STATUS = {'agent_type': 'Open vSwitch agent', - 'binary': 'neutron-openvswitch-agent', +AGENT_STATUS = {'agent_type': constants.AGENT_TYPE_OVS, + 'binary': constants.AGENT_PROCESS_OVS, 'host': 'overcloud-notcompute', 'topic': 'N/A', 'resource_versions': TEST_RESOURCE_VERSIONS} diff --git a/neutron/tests/unit/extensions/test_agent.py b/neutron/tests/unit/extensions/test_agent.py index 1d247cda1cf..d6c50062e60 100644 --- a/neutron/tests/unit/extensions/test_agent.py +++ b/neutron/tests/unit/extensions/test_agent.py @@ -122,15 +122,16 @@ class AgentDBTestCase(AgentDBTestMixIn, def test_show_agent(self): self._register_agent_states() agents = self._list_agents( - query_string='binary=neutron-l3-agent') + query_string='binary=' + constants.AGENT_PROCESS_L3) self.assertEqual(2, len(agents['agents'])) agent = self._show('agents', agents['agents'][0]['id']) - self.assertEqual('neutron-l3-agent', agent['agent']['binary']) + self.assertEqual(constants.AGENT_PROCESS_L3, agent['agent']['binary']) def test_update_agent(self): self._register_agent_states() agents = self._list_agents( - query_string='binary=neutron-l3-agent&host=' + L3_HOSTB) + query_string=('binary=' + constants.AGENT_PROCESS_L3 + + '&host=' + L3_HOSTB)) self.assertEqual(1, len(agents['agents'])) com_id = agents['agents'][0]['id'] agent = self._show('agents', com_id) @@ -148,5 +149,6 @@ class AgentDBTestCase(AgentDBTestMixIn, self._register_agent_states() time.sleep(1.5) agents = self._list_agents( - query_string='binary=neutron-l3-agent&host=' + L3_HOSTB) + query_string=('binary=' + constants.AGENT_PROCESS_L3 + + '&host=' + L3_HOSTB)) self.assertFalse(agents['agents'][0]['alive']) diff --git a/neutron/tests/unit/plugins/ml2/drivers/macvtap/agent/test_macvtap_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/macvtap/agent/test_macvtap_neutron_agent.py index 1a8cff86ae1..99ae164cd00 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/macvtap/agent/test_macvtap_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/macvtap/agent/test_macvtap_neutron_agent.py @@ -19,6 +19,7 @@ import sys from unittest import mock from neutron_lib.agent import topics +from neutron_lib import constants from neutron_lib.utils import helpers from oslo_config import cfg from oslo_service import service @@ -252,7 +253,7 @@ class TestMacvtapMain(base.BaseTestCase): self.assertTrue(mock_pim.called) mock_manager.assert_called_with(INTERFACE_MAPPINGS) mock_loop.assert_called_with(mock_manager_return, 2, 1, - 'Macvtap agent', - 'neutron-macvtap-agent') + constants.AGENT_TYPE_MACVTAP, + constants.AGENT_PROCESS_MACVTAP) self.assertTrue(mock_launch.called) self.assertTrue(mock_launch_return.wait.called) diff --git a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py index 44073e91875..5e8055228aa 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mech_sriov/mech_driver/test_mech_sriov_nic_switch.py @@ -90,7 +90,7 @@ class SriovSwitchMechGenericTestCase(SriovNicSwitchMechanismBaseTestCase, def test_driver_responsible_for_ports_allocation(self): agents = [ - {'agent_type': 'NIC Switch agent', + {'agent_type': constants.AGENT_TYPE_NIC_SWITCH, 'configurations': {'resource_provider_bandwidths': {'eth0': {}}}, 'host': 'host', 'id': '1'} diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py index 86f9576c1d4..81dd73e4cb7 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/mech_driver/test_mech_openvswitch.py @@ -173,7 +173,7 @@ class OpenvswitchMechanismGenericTestCase(OpenvswitchMechanismBaseTestCase, base.AgentMechanismGenericTestCase): def test_driver_responsible_for_ports_allocation(self): agents = [ - {'agent_type': 'Open vSwitch agent', + {'agent_type': constants.AGENT_TYPE_OVS, 'configurations': {'resource_provider_bandwidths': {'eth0': {}}}, 'id': '1', 'host': 'host'} diff --git a/releasenotes/notes/setproctitle_agents-47d7957688f0365d.yaml b/releasenotes/notes/setproctitle_agents-47d7957688f0365d.yaml new file mode 100644 index 00000000000..124da577e54 --- /dev/null +++ b/releasenotes/notes/setproctitle_agents-47d7957688f0365d.yaml @@ -0,0 +1,16 @@ +--- +features: + - | + A previous change to set neutron-server child process names also modified + neutron agent ones. This can impact monitoring systems relying on + /proc/PID/environ formatting or `ps -e` output. Now neutron agents all have + process names formatted this way (showing both an old style process name + and full process name visible in recent releases) + ``neutron-agent-name`` (``original process name including interpreter``) + + See bug `1881297 `_ + for more details. +upgrade: + - | + Monitoring tools relying on exact process names should be checked after + upgrade, and modified if needed.