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

control/cli: add ip requirement for listener #128

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

CongMinYin
Copy link
Contributor

discovert controller need a specific ip/port.

fixes: #87

@CongMinYin
Copy link
Contributor Author

CongMinYin commented May 10, 2023

Hi @trociny and @sdpeters , please take a look. It is for #127.

Copy link
Contributor

@trociny trociny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing just CLI part is not enough. We need to make sure the gateway has this requirement too. Theoretically one may talk to the gateway directly, not using cli. On the cli side it is needed just to catch an invalid input earlier and provide more meaningful error message.

control/cli.py Outdated Show resolved Hide resolved
Copy link
Contributor

@trociny trociny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to update tests/test_cli.py.

And although the gateway and the address are required on cli part, it seems like we don't have any check the gateway name is not empty on the server side and the server may store omap with empty gateway name, which will never be used. This may be out of scope of this PR though, because we also do not check that the gateway name is valid (belongs to an existing gateway), so we may store omap with invalid names, which will never be used too, and this does not differ much from storing omap with the empty name.

@CongMinYin CongMinYin force-pushed the listener-require-ip branch from bef4abe to 4725d2a Compare May 15, 2023 02:38
@CongMinYin
Copy link
Contributor Author

You also need to update tests/test_cli.py.

updated

And although the gateway and the address are required on cli part, it seems like we don't have any check the gateway name is not empty on the server side and the server may store omap with empty gateway name, which will never be used. This may be out of scope of this PR though, because we also do not check that the gateway name is valid (belongs to an existing gateway), so we may store omap with invalid names, which will never be used too, and this does not differ much from storing omap with the empty name.

gateway name can not be empty on server side. If gateway name is empty in conf, it will be assigned a value of hostname.

self.gateway_name = socket.gethostname()

@trociny
Copy link
Contributor

trociny commented May 15, 2023

gateway name can not be empty on server side. If gateway name is empty in conf, it will be assigned a value of hostname.

I mean the empty gateway name in the request. If such a requests comes to the gateway it will store it in omap (although it will not be used).

tests/test_cli.py Outdated Show resolved Hide resolved
@CongMinYin CongMinYin force-pushed the listener-require-ip branch 2 times, most recently from b893ed8 to 52c1d3e Compare May 15, 2023 08:22
@CongMinYin
Copy link
Contributor Author

I mean the empty gateway name in the request. If such a requests comes to the gateway it will store it in omap (although it will not be used).

Get your point. So I moved the judgment of gateway_name to the beginning, please check if this handling is appropriate.

@CongMinYin
Copy link
Contributor Author

But there is still a problem with this. The error information will be output to the server's gateway daemon, and the client can only receive an error message and cannot know why it went wrong. If this method is possible, is there a better way to report errors.

error on server side:

INFO:control.grpc:Received request to create ceph TCP listener for nqn.2016-06.io.spdk:cnode1 at 10.239.241.113:5007.
ERROR:control.grpc:gateway name mismatch.
ERROR:grpc._common:Exception serializing message!
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/grpc/_common.py", line 90, in _transform
    return transformer(message)
TypeError: descriptor 'SerializeToString' for 'google._upb._message.Message' objects doesn't apply to a 'bool' object

client side:

oot@cephs:~/git/ceph-nvmeof# python3 -m control.cli create_listener -n nqn.2016-06.io.spdk:cnode1 -g ceph -a 10.239.241.113 -s 5007
ERROR:__main__:Failed to create listener: 
 <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.INTERNAL
	details = "Failed to serialize response!"
	debug_error_string = "UNKNOWN:Error received from peer ipv4:10.239.241.113:5500 {grpc_message:"Failed to serialize response!", grpc_status:13, created_time:"2023-05-15T16:22:01.938484478+08:00"}"
>

control/grpc.py Outdated Show resolved Hide resolved
@CongMinYin CongMinYin force-pushed the listener-require-ip branch from 52c1d3e to 0499879 Compare May 16, 2023 03:23
tests/test_cli.py Outdated Show resolved Hide resolved
@CongMinYin CongMinYin force-pushed the listener-require-ip branch from 0499879 to 6b00c3d Compare May 17, 2023 07:35
Copy link

@PepperJo PepperJo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CongMinYin LGTM

@idryomov
Copy link
Contributor

idryomov commented Aug 1, 2023

@CongMinYin This needs to be rebased.

@CongMinYin CongMinYin force-pushed the listener-require-ip branch 2 times, most recently from f77bbec to e5dd2a6 Compare August 3, 2023 09:57
@CongMinYin
Copy link
Contributor Author

CongMinYin commented Aug 3, 2023

Hello everyone, rebased. could you please help check it.

mk/demo.mk Outdated Show resolved Hide resolved
@CongMinYin CongMinYin force-pushed the listener-require-ip branch 4 times, most recently from fac36f6 to 8cfaed5 Compare August 4, 2023 03:28
discovert controller need a specific ip/port.

fixes: ceph#87

Signed-off-by: Yin Congmin <[email protected]>
@CongMinYin CongMinYin force-pushed the listener-require-ip branch from 8cfaed5 to 585c66c Compare August 4, 2023 03:38
@caroav
Copy link
Collaborator

caroav commented Aug 7, 2023

@CongMinYin I believe that this PR can be merged. Why do you think that there is an issue? The testing pass. For a single GW I see no issues.

@CongMinYin
Copy link
Contributor Author

@CongMinYin I believe that this PR can be merged. Why do you think that there is an issue? The testing pass. For a single GW I see no issues.

Hi, it's about automated demo testing considerations. I added a variable to define the hostname (=gateway name) of the test server, which I get by checking the logs.
NVMEOF_HOSTNAME="nvmeof"
Now it is correct. If you agree to merge, I have no objection. But if the testing environment changes in the future, such as changing to a new testing server and hostname changed. Demo testing may encounter problems. It is best to get the hostname/gateway name through commands or define the gateway name in configure file.

@baum
Copy link
Collaborator

baum commented Aug 8, 2023

... Now it is correct. ... if the testing environment changes in the future, such as changing to a new testing server and hostname changed. Demo testing may encounter problems. It is best to get the hostname/gateway name through commands or define the gateway name in configure file.

@CongMinYin how are you? It is reasonable to assume that the tests would need to be updated as the codebase evolves, to keep them in sync. WDYT?

@idryomov
Copy link
Contributor

idryomov commented Aug 8, 2023

But if the testing environment changes in the future, such as changing to a new testing server and hostname changed. Demo testing may encounter problems.

It's not about the testing server but about what socket.gethostname() returns in the container.

It would be more reliable to define gateway names in ceph-nvmeof.conf file but everyone seems to be in agreement that that can be deferred until the demo shows off multiple gateways (or something breaks).

@idryomov idryomov merged commit 1fd85ec into ceph:devel Aug 8, 2023
@caroav
Copy link
Collaborator

caroav commented Aug 8, 2023

I think its OK to merge it @CongMinYin. I think that in general we might have another issue as discussed in #154, but this is not related to this PR.

@CongMinYin
Copy link
Contributor Author

Make sense. Thank you all. At this stage, there is no need to dwell on this small detail. We can consider this when testing changes in the future. @trociny also discussed the #154 with me in the previous part of this PR, and I will pay attention to it. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

The listener object of omap does not have ip/traddr by default
8 participants