francie | Good morning gouthamr | 09:23 |
---|---|---|
francie | Hello vkmc | 14:52 |
francie | Good afternoon | 14:52 |
vkmc | hi francie! | 14:53 |
vkmc | afternoon | 14:53 |
francie | I needed your guide on the unit test | 14:53 |
francie | I was searching for test_do_allow_access function but could not find | 14:53 |
francie | Does this mean it does not exist and I need to create one? | 14:54 |
francie | Reason: I do not want to duplicate? | 14:54 |
vkmc | that means that test doesn't exist | 14:54 |
vkmc | but let's analyze things a bit | 14:55 |
francie | okay | 14:55 |
francie | I am listening | 14:56 |
vkmc | have you tried the command you need to tweak? | 14:57 |
vkmc | I mean, have you executed that? | 14:57 |
vkmc | I don't remmeber if you have a development environment set up or not | 14:57 |
francie | We tried to setup the dev environment but not completing | 14:58 |
vkmc | ok | 14:58 |
francie | I ran it again this morning but failed | 14:58 |
vkmc | ok ok | 14:58 |
francie | let me run it again | 14:58 |
vkmc | do you mind sharing a tmate with me? | 14:58 |
vkmc | https://tmate.io/ | 14:59 |
francie | One moment | 14:59 |
vkmc | ok | 14:59 |
vkmc | deadline for application is next Friday | 14:59 |
vkmc | there is time to finish this | 14:59 |
francie | https://tmate.io/t/ro-ZCqc335CfZMJnkZSxcE5wywrL | 15:01 |
francie | sure I know | 15:01 |
vkmc | cannot access it | 15:02 |
vkmc | do you have the non-read only ssh link? | 15:02 |
francie | not at all | 15:12 |
vkmc | so you have four links | 15:12 |
francie | yes | 15:12 |
vkmc | I need the ssh that is not read only | 15:13 |
francie | this is the browser version | 15:13 |
vkmc | yeah, I need the non browser | 15:13 |
francie | ssh ro-ZCqc335CfZMJnkZSxcE5wywrL@lon1.tmate.io | 15:13 |
vkmc | that's read only | 15:13 |
francie | hmmm | 15:13 |
francie | do I have to recreate it | 15:13 |
francie | becuase I started running stack.sh already | 15:14 |
francie | ? | 15:14 |
vkmc | ok | 15:14 |
vkmc | nevermind | 15:14 |
vkmc | just let's the script continue | 15:14 |
vkmc | and we can see the error there | 15:14 |
francie | okay | 15:15 |
vkmc | so, in the meantime | 15:15 |
francie | yeah | 15:15 |
vkmc | we can think about the issue you are fixing | 15:15 |
francie | sure | 15:15 |
vkmc | basically what we want to do is to add a flag, --wait, to the manila access-allow and access-deny operations | 15:16 |
vkmc | those operations are there for grant access to the created shares | 15:16 |
vkmc | so I say, manila access-allow my-test-share IP 10.10.10.1 | 15:16 |
vkmc | with that, I'm saying, that 10.10.10.1 has access to my share my-test-share | 15:16 |
vkmc | therefore I can mount the share from that IP | 15:17 |
francie | I get it now :) | 15:17 |
vkmc | not sure how familiar you are with those terms | 15:18 |
vkmc | but, no need to worry about those right now | 15:18 |
vkmc | one thing to note, though, is that we have "resources" | 15:18 |
vkmc | a share is a resource | 15:18 |
vkmc | a share snapshot is a resource | 15:18 |
vkmc | a share replica is a resource | 15:18 |
francie | making sense... | 15:18 |
vkmc | but, an access rule, is not represented as a resource in our abstraction | 15:18 |
vkmc | so | 15:18 |
vkmc | the way we need to fix this is a bit different | 15:19 |
vkmc | this is the function you are using | 15:19 |
vkmc | https://github.com/openstack/python-manilaclient/blob/master/manilaclient/v2/shell.py#L33 | 15:19 |
vkmc | if we see the implementation of it | 15:19 |
vkmc | this are the resources we are considering https://github.com/openstack/python-manilaclient/blob/master/manilaclient/v2/shell.py#L52-L60 | 15:19 |
francie | yeah | 15:20 |
vkmc | perhaps this is not the easiest bug for you to fix | 15:22 |
vkmc | because of this detail | 15:22 |
francie | I am understanding it | 15:22 |
vkmc | ok, let's continue with it then | 15:22 |
vkmc | so | 15:22 |
francie | yeah | 15:23 |
vkmc | when I apply an access rule | 15:23 |
vkmc | the output is as follows | 15:23 |
vkmc | https://paste.opendev.org/show/810282/ | 15:23 |
vkmc | the status is... "queued_to_apply" | 15:23 |
vkmc | and the prompt returns | 15:24 |
francie | okay | 15:24 |
vkmc | but it returns and we don't know if it was applied or not | 15:24 |
francie | ok | 15:24 |
vkmc | so, we would need to create a waiter function | 15:24 |
vkmc | that polls the access rules | 15:24 |
vkmc | and when the access rule is successfully applied | 15:24 |
vkmc | then, it returns | 15:24 |
francie | So my patch just uses a decorator which does not apply here right? | 15:25 |
francie | https://review.opendev.org/c/openstack/python-manilaclient/+/815157 | 15:26 |
francie | From the above, we need a _waiter function correct? or the decorator does the magic? | 15:27 |
vkmc | so... it's not a decorator | 15:27 |
vkmc | it's an auxiliary function we are using to wrap the "wait for status" | 15:27 |
vkmc | independently of the resource we are calling | 15:27 |
vkmc | we need to extend that function to include access_rules | 15:27 |
vkmc | going through the code a bit, share access rules are represented as resources as well | 15:28 |
vkmc | https://github.com/openstack/python-manilaclient/blob/master/manilaclient/v2/share_access_rules.py | 15:28 |
vkmc | so what we are missing, only, is the function to wait for the share access rule to be created | 15:28 |
vkmc | so you would need to add a function like this | 15:28 |
vkmc | https://github.com/openstack/python-manilaclient/blob/master/manilaclient/v2/shell.py#L246-L248 | 15:28 |
vkmc | _find_share_access_rule(cs, access_rule) | 15:29 |
vkmc | include that resource in the find_resource dict https://github.com/openstack/python-manilaclient/blob/master/manilaclient/v2/shell.py#L52-L60 | 15:29 |
vkmc | share_access_rule: _find_share_access_rule | 15:29 |
francie | Making sense... | 15:29 |
vkmc | and then, change the resource type when you call wait_for_resource_status, to be "share_access_rule" | 15:30 |
vkmc | that's one thing we need to fix | 15:30 |
vkmc | another thing is that, I believe we won't need to add this for the access-deny operation | 15:30 |
vkmc | since the removal is immediate | 15:31 |
francie | perfectlok | 15:31 |
vkmc | and last but not least | 15:31 |
vkmc | the unit test | 15:31 |
francie | am listening.. | 15:32 |
vkmc | so this fix is in v2/shell.py | 15:33 |
vkmc | so we need to add the unit test | 15:33 |
vkmc | under | 15:33 |
vkmc | v2/test_shell.py | 15:33 |
vkmc | each function has it test under the same path in the unit test structure | 15:34 |
vkmc | so we keep things clear and tidy | 15:34 |
vkmc | has it test or tests, because in several cases functions have more than a single unit test | 15:34 |
vkmc | https://github.com/openstack/python-manilaclient/blob/master/manilaclient/tests/unit/v2/test_shell.py#L2183-L2195 <- this is the place we want to add this test | 15:35 |
vkmc | as you see, I marked " def test_allow_access_with_metadata(self): " | 15:36 |
vkmc | that's only a test case for test_allow_access | 15:36 |
vkmc | the case in which the end user pass metadata | 15:36 |
vkmc | there are others | 15:36 |
vkmc | in the same section of the test file | 15:36 |
vkmc | we would need to add one like "test_allow_access_wait" | 15:36 |
vkmc | or something like that | 15:36 |
francie | yeah | 15:36 |
vkmc | that passes the --wait flag and we make sure that the waiter is being called | 15:36 |
vkmc | and that should be good enough | 15:37 |
vkmc | does this make sense? | 15:37 |
francie | perfectly! | 15:37 |
francie | This is wonderful! | 15:37 |
vkmc | cool! | 15:37 |
francie | Thank you very much | 15:37 |
vkmc | anytime | 15:37 |
vkmc | so there are three things you need to do | 15:37 |
vkmc | 1. add share_access_rule resource to the wait_for_status function | 15:38 |
francie | ok | 15:38 |
vkmc | 2. remove waiter for access-deny | 15:38 |
vkmc | 3. add unit test | 15:38 |
francie | understood | 15:39 |
vkmc | let me know if you hit any issue | 15:39 |
francie | Let me get to this asap | 15:39 |
francie | That is cool | 15:39 |
francie | Thank you very much for your time | 15:39 |
vkmc | maaritamm, hi, those are my conclusions about what it needs to be done for the access_allow/access_deny ` | 15:39 |
francie | The stack is still running | 15:39 |
vkmc | ^ | 15:39 |
vkmc | francie, anytime, sorry I didn't reply sooner | 15:40 |
vkmc | francie, yes, is fine, I'm watching | 15:40 |
francie | No worries | 15:40 |
francie | Cool! | 15:40 |
vkmc | ++ | 15:46 |
maaritamm | vkmc, cool, thanks for digging into it! :) | 16:55 |
Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!