Skip to content

Commit ff024eb

Browse files
authored
Merge pull request ceph#61887 from ShwetaBhosale1/fix_issue_70060_port_4721_is_not_opened_while_deploying_agent
mgr/cephadm: Open port 4721 while deployling cephadm agent Reviewed-by: Adam King <[email protected]> Reviewed-by: Redouane Kachach <[email protected]>
2 parents a789613 + d5e900f commit ff024eb

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/pybind/mgr/cephadm/services/cephadmservice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ def get_dependencies(cls, mgr: "CephadmOrchestrator",
14541454
def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonDeploySpec:
14551455
assert self.TYPE == daemon_spec.daemon_type
14561456
daemon_id, host = daemon_spec.daemon_id, daemon_spec.host
1457+
daemon_spec.ports = [self.mgr.agent_starting_port]
14571458

14581459
if not self.mgr.http_server.agent:
14591460
raise OrchestratorError('Cannot deploy agent before creating cephadm endpoint')

src/pybind/mgr/cephadm/tests/test_services.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3637,6 +3637,48 @@ def test_jaeger_agent(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
36373637
)
36383638

36393639

3640+
class TestAgent:
3641+
@patch('cephadm.cert_mgr.CertMgr.get_root_ca', lambda instance: cephadm_root_ca)
3642+
@patch('cephadm.cert_mgr.CertMgr.generate_cert',
3643+
lambda instance, test, ip: (ceph_generated_cert, ceph_generated_key))
3644+
@patch("cephadm.serve.CephadmServe._run_cephadm")
3645+
def test_deploy_cephadm_agent(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
3646+
_run_cephadm.side_effect = async_side_effect(('{}', '', 0))
3647+
agent_spec = ServiceSpec(service_type="agent", placement=PlacementSpec(count=1))
3648+
agent_config = {"agent.json": "{\"target_ip\": \"::1\", \"target_port\": 7150, \"refresh_period\": 20, \"listener_port\": 4721, \"host\": \"test\", \"device_enhanced_scan\": \"False\"}", "keyring": "[client.agent.test]\nkey = None\n", "root_cert.pem": f"{cephadm_root_ca}", "listener.crt": f"{ceph_generated_cert}", "listener.key": f"{ceph_generated_key}"}
3649+
3650+
with with_host(cephadm_module, 'test'):
3651+
with with_service(cephadm_module, agent_spec):
3652+
_run_cephadm.assert_called_with(
3653+
"test",
3654+
"agent.test",
3655+
['_orch', 'deploy'],
3656+
[],
3657+
stdin=json.dumps({
3658+
"fsid": "fsid",
3659+
"name": 'agent.test',
3660+
"image": '',
3661+
"deploy_arguments": [],
3662+
"params": {
3663+
'tcp_ports': [4721],
3664+
},
3665+
"meta": {
3666+
'service_name': 'agent',
3667+
'ports': [4721],
3668+
'ip': None,
3669+
'deployed_by': [],
3670+
'rank': None,
3671+
'rank_generation': None,
3672+
'extra_container_args': None,
3673+
'extra_entrypoint_args': None,
3674+
},
3675+
"config_blobs": agent_config,
3676+
}),
3677+
error_ok=True,
3678+
use_current_daemon_image=False,
3679+
)
3680+
3681+
36403682
class TestCustomContainer:
36413683
@patch("cephadm.serve.CephadmServe._run_cephadm")
36423684
def test_deploy_custom_container(

0 commit comments

Comments
 (0)