mgr/volumes/nfs: Add cluster show info command#35743
Conversation
|
jenkins retest this please |
src/pybind/mgr/volumes/fs/nfs.py
Outdated
| """ | ||
| result = {'IP': [ip[4][0] for ip in socket.getaddrinfo(cluster.hostname, 2049, | ||
| flags=socket.AI_CANONNAME, type=socket.SOCK_STREAM)], | ||
| 'port': 2049 # Default ganesha port |
There was a problem hiding this comment.
Does this work right when ganesha is running on a different port?
There was a problem hiding this comment.
Currently cephadm does not deploy ganesha on non-standard port.
There was a problem hiding this comment.
Let's think about this. Cephadm doesn't (and hopefully never will) need the raw IP address. On the other hand. in case we want to do enhance cephadm, there is another option:
- Add a new property
ipor something similar to
- Enhance
ceph/src/pybind/mgr/cephadm/module.py
Line 1123 in af0d8af
to run also getaddrinfo for the host. (Do it here, to be able to return the current IP of a host)
- update the IP in the inventory, similar to
ceph/src/pybind/mgr/cephadm/inventory.py
Lines 55 to 58 in 7c2ed2a
-
let
ceph orch host lsalso return this attribute -
change this code here to also call
self.mgr.get_hosts()
This way, everyone would benefit from this information.
But I'm perfectly happy with keeping this code here in show_nfs_cluster_info
There was a problem hiding this comment.
Let's think about this. Cephadm doesn't (and hopefully never will) need the raw IP address.
I imagine what cephadm has for a hostname is just whatever gets passed to getaddrinfo (in ssh or elsewhere). Whether that "hostname" is also just a numeric one (i.e. an IP address) is irrelevant to it. (Edit:) Actually, I think it did matter because what I ended up doing in ceph-linode was lookup the FQDN for each VM:
https://github.com/batrick/ceph-linode/blob/cephadm/cephadm.yml#L63-L69
Which does not thrill me. I do think cephadm should be willing to take an IP address for the host so it works with private LANs. IMO, there really should not be any requirement that the cluster have hostnames which can be looked up via DNS.
There was a problem hiding this comment.
Let's think about this. Cephadm doesn't (and hopefully never will) need the raw IP address.
I imagine what cephadm has for a hostname is just whatever gets passed to
getaddrinfo(in ssh or elsewhere). Whether that "hostname" is also just a numeric one (i.e. an IP address) is irrelevant to it. (Edit:) Actually, I think it did matter because what I ended up doing in ceph-linode was lookup the FQDN for each VM:https://github.com/batrick/ceph-linode/blob/cephadm/cephadm.yml#L63-L69
Which does not thrill me. I do think cephadm should be willing to take an IP address for the host so it works with private LANs.
you can do that already:
ceph orch host add <name> <addr>
# e.g.
ceph orch host add myhostname 1.2.3.4
# or
ceph orch host add myhostname myhostname.domain.tldcephadm will then use the addr to connect to the host.
IMO, there really should not be any requirement that the cluster have hostnames which can be looked up via DNS.
yup. that was the reason we added the addr field
There was a problem hiding this comment.
I would prefer moving this to cephadm and do name resolution only if ip is not specified.
|
jenkins test docs |
27912a4 to
c017bd2
Compare
c017bd2 to
c3d4565
Compare
|
@sebastian-philipp @mgfritch Is there a way to list hosts for only nfs service type ? |
c3d4565 to
ceb2a98
Compare
|
As per conversation with @sebastian-philipp hostname resolution in cephadm |
|
jenkins retest this please |
|
jenkins retest this please |
Test Passed: http://pulpito.ceph.com/varsha-2020-07-01_15:28:24-rados-wip-nfs-cluster-show-info-distro-basic-smithi/5194589/ |
ceb2a98 to
93fcb21
Compare
93fcb21 to
2483c57
Compare
|
Rebased |
src/pybind/mgr/volumes/fs/nfs.py
Outdated
| return (0, json.dumps(host_ip, indent=4), '') | ||
| except socket.gaierror: | ||
| continue | ||
| return 0, "", "" |
There was a problem hiding this comment.
Return an empty dictionary if there are no NFS clusters?
{}and if the NFS cluster is defined, but no daemons are running?
{
"ganesha-foo": {}
}There was a problem hiding this comment.
Return an empty dictionary if there are no NFS clusters?
{}
Done.
and if the NFS cluster is defined, but no daemons are running?
{ "ganesha-foo": {} }
I prefer not listing it if no daemons are present.
2483c57 to
63e6d7d
Compare
mgfritch
left a comment
There was a problem hiding this comment.
minor nits, but generally looks good 👍
| "Port": 2049 # Default ganesha port | ||
| } | ||
| except socket.gaierror: | ||
| continue |
There was a problem hiding this comment.
maybe still report the daemon exists, but set the IP to a NoneType?
There was a problem hiding this comment.
Let's not add daemon if we cannot resolve its hostname.
src/pybind/mgr/volumes/fs/nfs.py
Outdated
| ('2404:6800:4009:80d::200e', 2049, 0, 0))] | ||
| """ | ||
| try: | ||
| host_ip[cluster.daemon_id] = { |
There was a problem hiding this comment.
on second thought, is the daemon_id useful in this context? maybe return a List instead?
There was a problem hiding this comment.
Right daemon_id is not instead I have added cluster_id
{
"vstart": [
{
"hostname": "varsha",
"IP": [
"::1",
"127.0.0.1"
],
"Port": 2049
}
]
}
8af6d68 to
e365dd5
Compare
|
Rebased |
Fixes: https://tracker.ceph.com/issues/45743 Signed-off-by: Varsha Rao <varao@redhat.com>
Signed-off-by: Varsha Rao <varao@redhat.com>
e365dd5 to
93aa5e4
Compare
Fixes: https://tracker.ceph.com/issues/45743
Signed-off-by: Varsha Rao varao@redhat.com
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox