-
Notifications
You must be signed in to change notification settings - Fork 292
CP-25699 Network sriov create/destroy #3432
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
Conversation
Reviewable is really good at diffing, it automatically ignore the white space changes, so changes of |
The commit message of the first commit is not quite what I see in the patch:
Reviewed 5 of 6 files at r1. ocaml/idl/datamodel.ml, line 576 at r1 (raw file):
Some comments on this in the code below. ocaml/xapi/xapi_network_sriov.ml, line 15 at r1 (raw file):
As said before, prefer to not routinely ocaml/xapi/xapi_network_sriov.ml, line 26 at r1 (raw file):
Let's pass in the record, which you've already got from the DB below, to avoid all these additional DB calls. ocaml/xapi/xapi_network_sriov.ml, line 35 at r1 (raw file):
ocaml/xapi/xapi_network_sriov.ml, line 46 at r1 (raw file):
Why is this not part of ocaml/xapi/xapi_network_sriov_helpers.ml, line 66 at r1 (raw file):
Where are this function and the ones above used? It doesn't seem to be part of this patch, or something else is missing. And what does the function name mean? ocaml/xapi/xapi_network_sriov_helpers.ml, line 112 at r1 (raw file):
This deserves a comment that explains the checks and the logic behind them. ocaml/xapi/xapi_network_sriov_helpers.ml, line 118 at r1 (raw file):
That error code is used for something else. ocaml/xapi/xapi_network_sriov_helpers.ml, line 120 at r1 (raw file):
ocaml/xapi/xapi_network_sriov_helpers.ml, line 122 at r1 (raw file):
You can write The syntax Also, it's not only about the PCI vendor, but also the device type. I'd call it ocaml/xapi/xapi_pif_helpers.ml, line 127 at r1 (raw file):
These error codes occur in a variety of styles, and we have never had good naming guidelines. This one looks inconsistent with some of the ones below, but consistent with some others. Oh well... ocaml/xapi/xapi_vlan.ml, line 58 at r1 (raw file):
In future, please do this sort of "cleanup" in a separate commit. ocaml/xapi-consts/api_errors.ml, line 135 at r1 (raw file):
Comments from Reviewable |
Reviewed 1 of 6 files at r1, 1 of 2 files at r2. ocaml/xapi/nm.ml, line 317 at r2 (raw file):
Is it ever not just ocaml/xapi/nm.ml, line 329 at r2 (raw file):
Remove this line and call the one on top of this diff ocaml/xapi/nm.ml, line 485 at r2 (raw file):
Do we also disable SRIOV if there are still VLAN PIFs with ocaml/xapi/nm.ml, line 486 at r2 (raw file):
As above, I think we can simplify this match case. Comments from Reviewable |
I have reorganize the commits make it clearer for you to review the change. Review status: 6 of 14 files reviewed at latest revision, 17 unresolved discussions. ocaml/idl/datamodel.ml, line 576 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/nm.ml, line 317 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
That's because we have to consider the vlan on vlan scenario. ocaml/xapi/nm.ml, line 329 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/nm.ml, line 485 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
In case of unplugging sriov logical PIF which has vlan on top of it, we have to handle the scenario as unplugging tunnel transport PIF, so we should call unplug on vlan PIF. Besides, we have to handle the case when plugging the vlan PIF which on top of a sriov logical PIF, so we have to plug the sriov logical PIF before that. ocaml/xapi/nm.ml, line 486 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
See reply above ocaml/xapi/xapi_network_sriov.ml, line 15 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov.ml, line 26 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov.ml, line 35 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov.ml, line 46 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 66 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
This function is called in ocaml/xapi/xapi_network_sriov_helpers.ml, line 112 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 118 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
I will introduce a new error ocaml/xapi/xapi_network_sriov_helpers.ml, line 120 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 122 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, and I will update the ocaml/xapi/xapi_pif_helpers.ml, line 127 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
:-( ocaml/xapi/xapi_vlan.ml, line 58 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi-consts/api_errors.ml, line 135 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
👍 Comments from Reviewable |
21163f5
to
3f13491
Compare
Review status: 1 of 15 files reviewed at latest revision, 16 unresolved discussions. ocaml/xapi/nm.ml, line 485 at r2 (raw file): Previously, krizex (Yang Qian) wrote…
Code updated accordingly ^ Comments from Reviewable |
Reviewed 13 of 13 files at r7, 7 of 7 files at r8. ocaml/xapi/nm.ml, line 317 at r2 (raw file): Previously, krizex (Yang Qian) wrote…
But we can't do VLAN-on-VLAN-on-SRIOV right? ocaml/xapi/xapi_network_sriov.ml, line 56 at r8 (raw file):
This looks like ocaml/xapi/xapi_network_sriov_helpers.ml, line 27 at r8 (raw file):
...and the PIFs need to be identical PCI devices. ocaml/xapi/xapi_network_sriov_helpers.ml, line 31 at r8 (raw file):
Strictly speaking, this seems not fully reliable, because we don't block the network from being used by ocaml/xapi-consts/api_errors.ml, line 135 at r1 (raw file): Previously, krizex (Yang Qian) wrote…
Below as well ;) ocaml/xapi-consts/api_errors.ml, line 105 at r8 (raw file):
These strings really must match exactly (apart from upper- vs. lowercase), otherwise things get very confusing. Comments from Reviewable |
Reviewed 2 of 2 files at r9. ocaml/xapi/nm.ml, line 317 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
I mean: we shouldn't try to handle the VLAN-on-VLAN case for SRIOV. I'm not sure why it is there at all, but given that it is off by default and enabled by FIST point, it is most likely something for testing purposes. We should just block that case for SRIOV and simplify the code below. I have no idea how a VLAN inside a VLAN is supposed to work anyway. I've looked this up: the FIST thing was put in there 9 years ago, when fixing the bug that allowed one to put a VLAN on a VLAN. I can find any xenrt test code that uses it. So let's delete it and simply never allow VLANs on a VLAN (in a separate patch please ;). ocaml/xapi/nm.ml, line 486 at r2 (raw file): Previously, krizex (Yang Qian) wrote…
And mine :) ocaml/xapi/xapi_network_sriov_helpers.ml, line 28 at r9 (raw file):
I'm always nervous about ocaml/xapi/xapi_network_sriov_helpers.ml, line 37 at r9 (raw file):
You need to pass in a debug string from the context. Search for ocaml/xapi/xapi_network_sriov_helpers.ml, line 40 at r9 (raw file):
If SRIOV was already on, does then an error here still mean that it is now off? ocaml/xapi/xapi_network_sriov_helpers.ml, line 43 at r9 (raw file):
Is this from another patch again? ocaml/xapi/xapi_network_sriov_helpers.ml, line 47 at r9 (raw file):
Can you pass in the ocaml/xapi/xapi_network_sriov_helpers.ml, line 50 at r9 (raw file):
ocaml/xapi/xapi_network_sriov_helpers.ml, line 53 at r9 (raw file):
Again getting the ocaml/xapi/xapi_network_sriov_helpers.ml, line 79 at r9 (raw file):
Perhaps ocaml/xapi/xapi_network_sriov_helpers.ml, line 85 at r9 (raw file):
See above about ocaml/xapi/xapi_network_sriov_helpers.ml, line 91 at r9 (raw file):
See above about the Comments from Reviewable |
Review status: 8 of 15 files reviewed at latest revision, 17 unresolved discussions. ocaml/xapi/xapi_network_sriov_helpers.ml, line 24 at r10 (raw file):
Ah, there it is now :) Please add a comment on top to explain what this does. Is there any reason not to put this inside xapi_pci.ml, and do this stuff as part of Comments from Reviewable |
Reviewed 1 of 1 files at r10. Comments from Reviewable |
Review status: 9 of 15 files reviewed at latest revision, 18 unresolved discussions. ocaml/xapi/nm.ml, line 317 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
OK, I will update code accordingly, and create another PR to delete the ocaml/xapi/nm.ml, line 486 at r2 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov.ml, line 56 at r8 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, we can take some logic from ocaml/xapi/xapi_network_sriov_helpers.ml, line 27 at r8 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 31 at r8 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, if use create network linker object with XC, this code would not be a problem, but if with xe, anything could happen because we don't restrict that before. ocaml/xapi/xapi_network_sriov_helpers.ml, line 28 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, and actually we have met some problem caused by
ocaml/xapi/xapi_network_sriov_helpers.ml, line 37 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 40 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
yes ocaml/xapi/xapi_network_sriov_helpers.ml, line 43 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, when splitting the change I have noticed that but sorry I forget to add a hint here. ocaml/xapi/xapi_network_sriov_helpers.ml, line 47 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 50 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 53 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 79 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes it could, will update. ocaml/xapi/xapi_network_sriov_helpers.ml, line 85 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 91 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 24 at r10 (raw file): Previously, robhoes (Rob Hoes) wrote…
I will add comment for it. ocaml/xapi-consts/api_errors.ml, line 135 at r1 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi-consts/api_errors.ml, line 105 at r8 (raw file): Previously, robhoes (Rob Hoes) wrote…
Oh I forgot to update them simultaneously. Comments from Reviewable |
3f13491
to
e236b6e
Compare
ocaml/xapi/xapi_pif_helpers.ml, line 69 at r12 (raw file):
Here and in all the raise Api_errors.(Server_error (cannot_add_vlan_to_bond_slave, [Ref.string_of tagged_PIF])) Comments from Reviewable |
ocaml/xapi/xapi_network_sriov_helpers.ml, line 17 at r13 (raw file):
why not Comments from Reviewable |
ocaml/xapi/nm.ml, line 26 at r13 (raw file):
Can we avoid opening it in the toplevel and do local openings instead? Comments from Reviewable |
Reviewed 1 of 6 files at r11, 13 of 13 files at r12, 2 of 2 files at r13. ocaml/xapi/xapi_network_sriov_helpers.ml, line 28 at r9 (raw file): Previously, krizex (Yang Qian) wrote…
If the exception is marked with Comments from Reviewable |
ocaml/xapi/xapi_pif_helpers.ml, line 172 at r14 (raw file):
You don't need parentheses here nor in Comments from Reviewable |
Review status: 8 of 15 files reviewed at latest revision, 7 unresolved discussions. ocaml/xapi/nm.ml, line 322 at r15 (raw file):
This function needs to be reindented or is reviewable that is ignoring whitespaces? ocaml/xapi/test_bond.ml, line 1 at r15 (raw file): Why so many new lines here? ocaml/xapi-consts/api_errors.ml, line 100 at r15 (raw file):
It seems that this error is not used anywhere Comments from Reviewable |
Review status: 8 of 15 files reviewed at latest revision, 7 unresolved discussions. ocaml/xapi/nm.ml, line 26 at r13 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. ocaml/xapi/nm.ml, line 322 at r15 (raw file): Previously, mseri (Marcello Seri) wrote…
Good eye! ocaml/xapi/test_bond.ml, line 1 at r15 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 28 at r9 (raw file): Previously, robhoes (Rob Hoes) wrote…
Got it. ocaml/xapi/xapi_network_sriov_helpers.ml, line 17 at r13 (raw file): Previously, mseri (Marcello Seri) wrote…
Good suggestion, I will also do it to ocaml/xapi/xapi_pif_helpers.ml, line 69 at r12 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. ocaml/xapi/xapi_pif_helpers.ml, line 172 at r14 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. ocaml/xapi-consts/api_errors.ml, line 100 at r15 (raw file): Previously, mseri (Marcello Seri) wrote…
Yes. Comments from Reviewable |
ocaml/xapi/xapi_network_sriov.ml, line 15 at r16 (raw file):
We could use Comments from Reviewable |
Reviewed 1 of 6 files at r1, 1 of 7 files at r8, 2 of 13 files at r12, 1 of 6 files at r15, 4 of 6 files at r16. ocaml/xapi/xapi_pif.ml, line 805 at r16 (raw file):
Let's be stricter and use ocaml/xapi/xapi_pif_helpers.ml, line 172 at r14 (raw file): Previously, krizex (Yang Qian) wrote…
This is not important, but I just realised that we could write it more readably with pipes: vlans
|> List.map (fun self -> Db.VLAN.get_uuid ~__context ~self)
|> String.concat "; "
|> debug "PIF has associated VLANs: [ %s ]" Comments from Reviewable |
Review status: 9 of 15 files reviewed at latest revision, 3 unresolved discussions. ocaml/xapi/xapi_network_sriov.ml, line 15 at r16 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. So I will keep ocaml/xapi/xapi_pif.ml, line 805 at r16 (raw file): Previously, mseri (Marcello Seri) wrote…
Done. ocaml/xapi/xapi_pif_helpers.ml, line 172 at r14 (raw file): Previously, mseri (Marcello Seri) wrote…
Yes, that's clearer Comments from Reviewable |
df4004d
to
80d6820
Compare
Review status: 6 of 15 files reviewed at latest revision, 6 unresolved discussions. ocaml/xapi/xapi_network_sriov.ml, line 15 at r16 (raw file): Previously, mseri (Marcello Seri) wrote…
ocaml/xapi/xapi_network_sriov_helpers.ml, line 46 at r14 (raw file):
Do we really need to fail the API call here? In any case, it should be an ocaml/xapi/xapi_network_sriov_helpers.ml, line 54 at r14 (raw file):
This is very inefficient: it does ocaml/xapi/xapi_network_sriov_helpers.ml, line 60 at r14 (raw file):
Overall, I don't quite like this function, because of its inefficiency, and because it is essentially the same as (part of) Comments from Reviewable |
I am happy with this now, apart from the commit that updates the PCIs, which I think we should remove from this PR and do separately. Also, the last commit still needs to be squashed. We can merge it after both are done. Reviewed 1 of 1 files at r14, 6 of 6 files at r15, 3 of 6 files at r16, 4 of 4 files at r17. ocaml/xapi/test_vlan.ml, line 106 at r15 (raw file):
You didn't add this to Comments from Reviewable |
OK, will do Review status: all files reviewed at latest revision, 5 unresolved discussions. ocaml/xapi/test_vlan.ml, line 106 at r15 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov.ml, line 15 at r16 (raw file): Previously, robhoes (Rob Hoes) wrote…
Done. ocaml/xapi/xapi_network_sriov_helpers.ml, line 46 at r14 (raw file): Previously, robhoes (Rob Hoes) wrote…
ok ocaml/xapi/xapi_network_sriov_helpers.ml, line 54 at r14 (raw file): Previously, robhoes (Rob Hoes) wrote…
Exactly, I will update the DB access complexity to ocaml/xapi/xapi_network_sriov_helpers.ml, line 60 at r14 (raw file): Previously, robhoes (Rob Hoes) wrote…
Yes, will do. Comments from Reviewable |
1. remove redundant Api_errors 2. fix typo error 3. slightly refine xapi_vlan.ml Signed-off-by: Yang Qian <yang.qian@citrix.com>
1. implement Network sriov create/destroy 2. consider vlan on network sriov scenario when: + plug vlan pif on top of network sriov + unplug network sriov pif underneath vlan pif 3. check SRIOV compatibility before adding it to network Signed-off-by: Yang Qian <yang.qian@citrix.com>
1. call networkd to enable/disable sriov in bring_pif_up/bring_pif_down 2. when disabling sriov, only call networkd when all of PIFs that use same driver in the host has disabled sriov Signed-off-by: Yang Qian <yang.qian@citrix.com>
Signed-off-by: Yang Qian <yang.qian@citrix.com>
80d6820
to
9fdc3fa
Compare
Updated. Review status: 1 of 15 files reviewed at latest revision, 4 unresolved discussions. Comments from Reviewable |
Reviewed 14 of 14 files at r18, 7 of 7 files at r19, 2 of 2 files at r20, 6 of 6 files at r21. Comments from Reviewable |
driver in the host has disabled sriov.
Signed-off-by: Yang Qian yang.qian@citrix.com
This change is