Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph-rest-api: when port=0 use the DEFAULT_PORT instead #17443

Merged
merged 1 commit into from Nov 22, 2017
Merged

ceph-rest-api: when port=0 use the DEFAULT_PORT instead #17443

merged 1 commit into from Nov 22, 2017

Conversation

JiYou
Copy link
Contributor

@JiYou JiYou commented Sep 4, 2017

When /etc/ceph/ceph.conf with below settings:

[global]
public_addr = 10.153.55.135

in this case, port for ceph-rest-api would get a random port for rest service. Take public_addr = 10.153.55.135 as an example, the original code would get a random port for rest-api service.

    addr = app.ceph_cluster.conf_get('public_addr') or DEFAULT_ADDR  # <-- addr = 10.153.55.135:0/0

    if addr == '-':
        addr = None
        port = None
    else:
        # remove the type prefix from the conf value if any
        for t in ('legacy:', 'msgr2:'):
            if addr.startswith(t):
                addr = addr[len(t):]
                break
        # remove any nonce from the conf value
        addr = addr.split('/')[0]
        addr, port = addr.rsplit(':', 1)   # addr = 10.153.55.135, port = '0'
    addr = addr or DEFAULT_ADDR
    port = port or DEFAULT_PORT  # <-- if port == '0', the port would be 0, ceph-rest-api would get a random port instead of 5000.
    port = int(port)

This patch mainly wants to use the default port 5000 for this case.

Signed-off-by: You Ji youji@ebay.com

…andom port

Signed-off-by: You Ji <youji@ebay.com>
@liewegas liewegas changed the title Fix: when ceph-rest-api port=0, may use the DEFAULT_PORT instead of r… ceph-rest-api: when port=0 use the DEFAULT_PORT instead Nov 17, 2017
@tchaikov tchaikov merged commit 5c7befb into ceph:master Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants