Skip to content

Conversation

thomasmck
Copy link

Signed-off-by: Thomas Mckelvey thomas.mckelvey@citrix.com

let xapi_clusterd_port = "8896"
let enable ~__context =
debug "Enabling and starting the clustering daemon";
maybe_call_script ~__context "/etc/xapi.d/plugins/firewall-port" ["open"; xapi_clusterd_port];
Copy link
Member

Choose a reason for hiding this comment

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

This path, and the other strings in here, should be defined in xapi_globs.ml, such that they can be set from the config file.

Copy link
Author

Choose a reason for hiding this comment

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

@robhoes Just to make sure I understand properly we should move the path, the port number and the "open"/"close" strings to xapi_globs.ml?

And then just call them here with Xapi_globs.xapi_clusterd_port?

Copy link
Member

Choose a reason for hiding this comment

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

I think that you can leave "open"/"close", and just do the path and port. Grep for e.g. nbd_firewall_config_script in xapi_globs.ml to see how to refine them and register them with the config file logic.

Copy link
Author

Choose a reason for hiding this comment

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

Should I actually update xapi_conf to include the port? looks like a look of ports are included but commented out. Thats what I've done atm.

Copy link
Member

Choose a reason for hiding this comment

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

That's handy yes. How about adding the other one as well?

Copy link
Member

Choose a reason for hiding this comment

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

Btw, they are commented out, with the default value filled in, as examples in the config file. That is common practice for such files. So you've done the right thing.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't see any of the other paths included in there but I can include the one I've added anyways. Seeing as it is commented out there is no harm.

@coveralls
Copy link

coveralls commented Mar 13, 2018

Coverage Status

Coverage increased (+6.0e-05%) to 18.835% when pulling 5825027 on thomasmck:private/thomasmc/firewall into 350db35 on xapi-project:feature/REQ477/master.

let service = "xapi-clusterd"
let enable ~__context =
debug "Enabling and starting the clustering daemon";
maybe_call_script ~__context !Xapi_globs.firewall_port_config_script ["open"; (string_of_int !Xapi_globs.xapi_clusterd_port)];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think using let would make this more readable and avoids overlong lines:

let enable ~__context =
  let port = string_of_int !Xapi_globs.xapi_clusterd_port in
  ...
  maybe_call_script ~__context !Xapi_globs.firewall_port_config_script ["open"; port];

Copy link
Author

Choose a reason for hiding this comment

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

Sounds reasonable, I will amend it.

@edwintorok edwintorok force-pushed the feature/REQ477/master branch from d088ba1 to 350db35 Compare March 14, 2018 18:26
Thomas Mckelvey added 3 commits March 15, 2018 11:34
Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
@robhoes
Copy link
Member

robhoes commented Mar 15, 2018

Looks like a rebase went wrong on this branch: the PR now contains a bunch of unrelated commits.

@thomasmck thomasmck force-pushed the private/thomasmc/firewall branch from b3ea901 to 5825027 Compare March 15, 2018 12:31
@thomasmck
Copy link
Author

Removed the other commits that got pulled in and made the other suggested changes.

| None -> ignore (Helpers.call_script script params)

let service = "xapi-clusterd"
let port = (string_of_int !Xapi_globs.xapi_clusterd_port)
Copy link
Contributor

@lindig lindig Mar 15, 2018

Choose a reason for hiding this comment

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

Careful: the port is defined by xapi startup and any changes to !Xapi_globs.xapi_clusterd_port over the lifetime of xapi will not be taken into account. You might want to put this inside enable() and disable() to read it again at the time of usage. You might even miss any changes from the command line because it is read before the changes take effect.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, port may evaluate before the config file read takes place.

Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
# xapi_clusterd_port = 8896

# Path for the firewall-port script
# firewall_port_config_script = /etc/xapi.d/plugins/firewall-port
Copy link
Member

Choose a reason for hiding this comment

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

firewall-port-config

Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
@thomasmck
Copy link
Author

Ok I think all comments have now been addressed. Let me know if there is anything I've missed.

Copy link
Contributor

@lindig lindig 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 the commits should be squashed before merging.

@thomasmck
Copy link
Author

I agree. Github has the ability to do that as part of the merge right? I do I need to do it myself and re-push?

@thomasmck
Copy link
Author

@lindig @robhoes Do I need to squash manually myself or can it be done through github when merging?

@mseri mseri merged commit 81b57ae into xapi-project:feature/REQ477/master Mar 19, 2018
edwintorok pushed a commit that referenced this pull request Mar 22, 2018
#3509)

* CA-280423: Open/close xapi-clusterd port when starting/stopping daemon

Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
jonludlam pushed a commit to jonludlam/xen-api that referenced this pull request Mar 29, 2018
xapi-project#3509)

* CA-280423: Open/close xapi-clusterd port when starting/stopping daemon

Signed-off-by: Thomas Mckelvey <thomas.mckelvey@citrix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants