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

CP-23093: Implement toggle of IGMP snooping on xcp-networkd #107

Merged
merged 1 commit into from
Aug 1, 2017

Conversation

fillzero
Copy link
Contributor

@fillzero fillzero commented Jul 7, 2017

Signed-off-by: Liang Dai liang.dai1@citrix.com

@fillzero
Copy link
Contributor Author

fillzero commented Jul 7, 2017

@robhoes -- Would you please review this PR?
Based on the multicast feature design, we need to implement a toggle of IGMP Snooping.

We also need to add a field igmp_snooping for type bridge_config_t and a new RPC message named set_ovs_igmp_snooping in repo xcp-idl. Please help to create a new branch for development.

@fillzero
Copy link
Contributor Author

This PR depends on xapi-project/xcp-idl#164

update_config bridge_name c;
exec (fun () ->
create () dbg ?vlan ?mac:bridge_mac ~other_config ~name:bridge_name ();
create () dbg ?vlan ?mac:bridge_mac ?igmp_snooping:igmp_snooping ~other_config ~name:bridge_name ();
Copy link
Member

Choose a reason for hiding this comment

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

use ~igmp_snooping better than ?igmp_snooping:igmp_snooping

Copy link
Member

Choose a reason for hiding this comment

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

?igmp_snooping probably.

@@ -949,6 +949,12 @@ module Bridge = struct
update_config name {(get_config name) with persistent_b = value}
) ()

let set_ovs_igmp_snooping _ dbg ~name ~value =
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this function, because we can just call create even if the bridge already exists. All functions in the interface, including make_config and create are idempotent, which means that you can safely call them multiple times. The job of Bridge.make_config is to update the current configuration of the bridge based on the new configuration that is given, and only do something when (part of) the configuration has changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robhoes Thanks for your comments, updated PR accordingly

Debug.with_thread_associated dbg (fun () ->
debug "Creating bridge %s%s" name (match vlan with
| None -> ""
| Some (parent, vlan) -> Printf.sprintf " (VLAN %d on bridge %s)" vlan parent
);
Stdext.Opt.iter (destroy_existing_vlan_bridge name) vlan;
update_config name {(get_config name) with vlan; bridge_mac=mac; other_config};
update_config name {(get_config name) with vlan; bridge_mac=mac; igmp_snooping=igmp_snooping; other_config};
Copy link
Member

Choose a reason for hiding this comment

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

This can be just igmp_snooping (because the parameter has the same name).

| Some igmp_snooping ->
if vlan = None then
["--"; "set"; "bridge"; name; "mcast_snooping_enable=" ^ (string_of_bool igmp_snooping)]
else
[]
Copy link
Member

Choose a reason for hiding this comment

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

One more tab needed.

Copy link
Member

Choose a reason for hiding this comment

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

In fact, we can easily combine the match and if:

match igmp_snooping, vlan with
| Some x, None -> ["--"; "set"; "bridge"; name; "mcast_snooping_enable=" ^ (string_of_bool x)]
| _ -> []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Updated accordingly.

Copy link
Member

@robhoes robhoes left a comment

Choose a reason for hiding this comment

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

Just a few small comments, but otherwise it is fine.

Signed-off-by: Liang Dai <liang.dai1@citrix.com>
@robhoes
Copy link
Member

robhoes commented Jul 26, 2017

This is fine now, but we can't merge it without the matching change in xcp-idl, and we can't merge that without a change to xen-api, for which there is no PR yet.

@fillzero
Copy link
Contributor Author

Thanks @robhoes . Regarding the xen-api change, @YarsinCitrix will send PR later.

Also copy @huizh to be aware.

@robhoes
Copy link
Member

robhoes commented Jul 26, 2017

@fillzero @huizh For the xen-api change, I would suggest to first have a PR to just fill in the new field in the network_config with a default value, so that these changes can go in quickly. We can have a separate PR for the API changes, for which we are still discussing the design.

@robhoes
Copy link
Member

robhoes commented Jul 26, 2017

I'll close this for now. When the xen-api patch is ready, I'll reopen and merge this PR.

@robhoes robhoes closed this Jul 26, 2017
@huizh
Copy link

huizh commented Jul 26, 2017

Hi @robhoes, thanks for the review and the suggestion. Very helpful. Will follow up your suggestion to raise a XenAPI PR so that to get this and xapi-project/xcp-idl#164 merged.

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

Successfully merging this pull request may close these issues.

None yet

4 participants