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

Add clustering interface #195

Merged
merged 24 commits into from
Jan 30, 2018
Merged

Add clustering interface #195

merged 24 commits into from
Jan 30, 2018

Conversation

edwintorok
Copy link
Contributor

This adds a new xcp.cluster library for the new clustering interface and doesn't touch any of the existing interfaces:

git diff origin/master --stat
 cluster/cluster_client.ml    |  14 ++++++++++
 cluster/cluster_idl.ml       |   3 +++
 cluster/cluster_interface.ml | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cluster/jbuild               |  40 ++++++++++++++++++++++++++++
 4 files changed, 271 insertions(+)

The spec file doesn't require any changes.

The purpose of this PR is to reduce the diff against master to make merging feature/REQ477 easier.

The commit history here reflects the development, could consider squashing them if preferred.

jonludlam and others added 20 commits January 25, 2018 16:01
Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
This fits better with the naming of the enable and disable functions.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
This more accurately describes its meaning.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
The value of this field can be derived from membership of enabled_members, so
there's no need to try to maintain this field.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
This is needed in case of IP address changes while the node was disabled.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
This is needed in the case that all other nodes a node was aware of have changed
address.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
The modification to Remote.config adds a 'start' parameter.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Signed-off-by: Callum McIntyre <callum.mcintyre@citrix.com>
This is private to the implementation of xapi-clusterd

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
This should allow to find which XAPI task causes which xapi-clusterd RPC calls,
and also to track xapi-clusterd RPC calls across hosts.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
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.

Minor comments.

[@@deriving rpcty]

type address = IPv4 of string
[@doc ["An IP address"]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this say "An IP address a.b.c.d" or similar to indicate that this is IPv4 and not a hostname or IPv6?


let create = declare
"create"
["Creates the cluster. The call takes the initial config of";
Copy link
Contributor

Choose a reason for hiding this comment

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

When we concatenate these strings, we get something like ".. of;the ..". Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ; won't be part of the concatenation, it separates the strings in the ocaml list.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's right. So the concatenation would add a space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@coveralls
Copy link

coveralls commented Jan 25, 2018

Coverage Status

Coverage remained the same at 54.268% when pulling 0a49d87 on edwintorok:private/edvint/cluster into 0d8714a on xapi-project:master.

IPv6 support is not implemented yet.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
@mseri
Copy link
Collaborator

mseri commented Jan 30, 2018

Can this be merged?

let xml_path = "/var/xapi/cluster"

type debug_info = string
[@@doc ["An uninterpreted string associated with the operation."]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just for reference: now you can use actual docstrings here, and they will work as well

cluster/jbuild Outdated
(modules (:standard))
(flags (:standard -w -39 %s))
(libraries (xcp threads rpclib))
(wrapped false)
Copy link
Collaborator

@mseri mseri Jan 30, 2018

Choose a reason for hiding this comment

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

We should start wrapping xcp-idl libraries (this is not an issue or something to do now)

Copy link
Collaborator

@mseri mseri Jan 30, 2018

Choose a reason for hiding this comment

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

Please add the executable rules for cluster_client and call it cluster_cli in line with the other components. Do not add a public_name or an alias. If #198 is merged before this PR, please update the README

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll update the PR, you are right we can drop cluster_idl.ml in that case.

@lindig
Copy link
Contributor

lindig commented Jan 30, 2018

Do we want the history to be cleaned up? This is new code - so in my opinion this could be also squashed or we could have one commit per file.

cluster/jbuild Outdated
(library
((name xcp_cluster)
(public_name xcp.cluster)
(modules (:standard))
Copy link
Collaborator

@mseri mseri Jan 30, 2018

Choose a reason for hiding this comment

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

I think you should do (modules (:standard \ cluster_client)) and completely delete cluster_idl

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, an oversight. I meant to add a cluster_cli as with the other components. Then remove that from the modules list, and add the executable rules

@@ -0,0 +1,14 @@

open Xcp_client
Copy link
Collaborator

Choose a reason for hiding this comment

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

In line with comments in new clients, please don't open this globally, but add let open Xcp_client inside the rpc function body

Copy link
Collaborator

@mseri mseri left a comment

Choose a reason for hiding this comment

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

Please add the changes to make the structure close to the one of the other components, and before merging let's squash the commits. I think we can do that from github at merge time

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
A more complete CLI is available as part of the clustering daemon itself.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
@edwintorok
Copy link
Contributor Author

Pushed some cleanups, I agree that we should squash it all at merge time.
Note that I changed the API of the rpc function, it used to take a function for building the URL, the cluster daemon / xapi integration doesn't support anything other than message-switch at the moment, so I just made it similar to the other interfaces which take a url directly.

@edwintorok
Copy link
Contributor Author

The failure is the same on as in #198 due to coverage script

Copy link
Collaborator

@mseri mseri left a comment

Choose a reason for hiding this comment

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

Sorry, too much renaming. Client should still be called cluster_client.ml and interface called cluster_interface.ml. Then in the code using it we shouold use Cluster_client and Cluster_interface. This is what we do on all other idl components. I think this was due to lack of packing of the submodules, but at least the naming makes it clear where the modules are coming from and are consistent across the various interfaces.

@edwintorok
Copy link
Contributor Author

Isn't it a bit redundant to have Xcp_cluster.Cluster_interface? Thought that Xcp_cluster.Interface would be better now that I dropped the wrapping.

@mseri
Copy link
Collaborator

mseri commented Jan 30, 2018

It is, but I'd rather keep things consistent and we cannot change all the other interfaces for the moment

also explain why we call it LocalAPI
(because we also have a Remote API elsewhere).

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
@edwintorok
Copy link
Contributor Author

Ok, wrapping is back and renamed the files to have cluster_ prefix.

@mseri
Copy link
Collaborator

mseri commented Jan 30, 2018

Feel free to merge

@edwintorok edwintorok merged commit 51b6921 into xapi-project:master Jan 30, 2018
@edwintorok edwintorok deleted the private/edvint/cluster branch January 30, 2018 17:09
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.

None yet

6 participants