* [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports
@ 2011-02-14 18:58 Lon Hohberger
2011-02-14 18:58 ` [Cluster-devel] [PATCH 2/2] ccs: Update manual page for ccs_tool Lon Hohberger
2011-02-15 5:17 ` [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Fabio M. Di Nitto
0 siblings, 2 replies; 4+ messages in thread
From: Lon Hohberger @ 2011-02-14 18:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
Patch only for RHEL5 branch.
Resolves: rhbz#656427
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
ccs/ccs_tool/ccs_tool.c | 2 +-
ccs/ccs_tool/update.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++-
ccs/ccs_tool/update.h | 1 +
3 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/ccs/ccs_tool/ccs_tool.c b/ccs/ccs_tool/ccs_tool.c
index dc54146..5fcd667 100644
--- a/ccs/ccs_tool/ccs_tool.c
+++ b/ccs/ccs_tool/ccs_tool.c
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
"Try 'ccs_tool help' for help.\n");
exit(EXIT_FAILURE);
}
- if(update(argv[optind+1])){
+ if(update2(argc-1, argv+1)){
fprintf(stderr, "\nFailed to update config file.\n");
exit(EXIT_FAILURE);
}
diff --git a/ccs/ccs_tool/update.c b/ccs/ccs_tool/update.c
index 1defdaf..3af779b 100644
--- a/ccs/ccs_tool/update.c
+++ b/ccs/ccs_tool/update.c
@@ -113,11 +113,70 @@ fail:
}
-int update(char *location)
+static int parse_args(int argc, char **argv, char **loc)
+{
+ int c, error, ret;
+
+ while ((c = getopt(argc, argv, "P:")) != EOF) {
+ switch(c) {
+ case 'P':
+ if(optarg[1] != ':'){
+ fprintf(stderr, "Bad argument to '-P' option.\n"
+ "Try '-h' for help.\n");
+ error = -EINVAL;
+ goto fail;
+ }
+ switch(optarg[0]){
+ case 'b': /* backend port number */
+ /* Not used by ccs_tool */
+ break;
+ case 'c': /* cluster base port number */
+ ret = atoi(optarg+2);
+ if(ret < 1024){
+ fprintf(stderr, "Bad cluster base port number.\n");
+ error = -EINVAL;
+ goto fail;
+ }
+ cluster_base_port = ret;
+ printf("Set cluster base port to %d\n", cluster_base_port);
+ break;
+ case 'f': /* frontend port number */
+ /* Not used by ccs_tool */
+ break;
+ }
+ break;
+ default:
+ goto fail;
+ }
+ }
+
+ *loc = argv[optind];
+
+ return 0;
+fail:
+ return error;
+}
+
+int update(const char *location)
+{
+ char *args[3];
+ char **argv;
+
+ args[0] = "update";
+ args[1] = location;
+ args[2] = NULL;
+
+ argv = args;
+
+ return update2(2, argv);
+}
+
+int update2(int argc, char **argv)
{
int error = 0;
int i, fd;
int cluster_fd = -1;
+ char *location = NULL;
char true_location[256];
xmlDocPtr doc = NULL;
xmlChar *mem_doc;
@@ -132,6 +191,9 @@ int update(char *location)
struct timeval tv;
+ if (parse_args(argc, argv, &location))
+ return -1;
+
if (location[0] != '/') {
memset(true_location, 0, 256);
if (!getcwd(true_location, 256)) {
diff --git a/ccs/ccs_tool/update.h b/ccs/ccs_tool/update.h
index 19fd7cb..f706963 100644
--- a/ccs/ccs_tool/update.h
+++ b/ccs/ccs_tool/update.h
@@ -14,5 +14,6 @@
#define __UPDATE_DOT_H__
int update(char *location);
+int update2(int argc, char **argv);
#endif /* __UPDATE_DOT_H__ */
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 2/2] ccs: Update manual page for ccs_tool
2011-02-14 18:58 [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Lon Hohberger
@ 2011-02-14 18:58 ` Lon Hohberger
2011-02-15 5:17 ` [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Fabio M. Di Nitto
1 sibling, 0 replies; 4+ messages in thread
From: Lon Hohberger @ 2011-02-14 18:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
Patch only for RHEL5 branch.
Resolves: rhbz#656427
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
ccs/man/ccs_tool.8 | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/ccs/man/ccs_tool.8 b/ccs/man/ccs_tool.8
index e8869c0..0d82248 100644
--- a/ccs/man/ccs_tool.8
+++ b/ccs/man/ccs_tool.8
@@ -37,6 +37,13 @@ while the cman cluster is operational (i.e. online). Run this on a single
machine to update cluster.conf on all current cluster members. This also
notfies cman of the new config version.
+Note: If ccsd is run on a non-standard base port, you can specify this to
+a \fBccs_tool update\fP in the same manner as you would to \fBccsd\fP:
+
+For example:
+
+ ccs_tool update -P c:40003 /etc/cluster/cluster.conf
+
.TP
\fBupgrade\fP \fI<location>\fP
This command is used to upgrade an old CCS format archive to the new
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports
2011-02-14 18:58 [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Lon Hohberger
2011-02-14 18:58 ` [Cluster-devel] [PATCH 2/2] ccs: Update manual page for ccs_tool Lon Hohberger
@ 2011-02-15 5:17 ` Fabio M. Di Nitto
2011-02-15 16:00 ` Lon Hohberger
1 sibling, 1 reply; 4+ messages in thread
From: Fabio M. Di Nitto @ 2011-02-15 5:17 UTC (permalink / raw)
To: cluster-devel.redhat.com
Untested, looks sane to me, ACK.
Fabio
On 02/14/2011 07:58 PM, Lon Hohberger wrote:
> Patch only for RHEL5 branch.
>
> Resolves: rhbz#656427
>
> Signed-off-by: Lon Hohberger <lhh@redhat.com>
> ---
> ccs/ccs_tool/ccs_tool.c | 2 +-
> ccs/ccs_tool/update.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++-
> ccs/ccs_tool/update.h | 1 +
> 3 files changed, 65 insertions(+), 2 deletions(-)
>
> diff --git a/ccs/ccs_tool/ccs_tool.c b/ccs/ccs_tool/ccs_tool.c
> index dc54146..5fcd667 100644
> --- a/ccs/ccs_tool/ccs_tool.c
> +++ b/ccs/ccs_tool/ccs_tool.c
> @@ -36,7 +36,7 @@ int main(int argc, char *argv[])
> "Try 'ccs_tool help' for help.\n");
> exit(EXIT_FAILURE);
> }
> - if(update(argv[optind+1])){
> + if(update2(argc-1, argv+1)){
> fprintf(stderr, "\nFailed to update config file.\n");
> exit(EXIT_FAILURE);
> }
> diff --git a/ccs/ccs_tool/update.c b/ccs/ccs_tool/update.c
> index 1defdaf..3af779b 100644
> --- a/ccs/ccs_tool/update.c
> +++ b/ccs/ccs_tool/update.c
> @@ -113,11 +113,70 @@ fail:
> }
>
>
> -int update(char *location)
> +static int parse_args(int argc, char **argv, char **loc)
> +{
> + int c, error, ret;
> +
> + while ((c = getopt(argc, argv, "P:")) != EOF) {
> + switch(c) {
> + case 'P':
> + if(optarg[1] != ':'){
> + fprintf(stderr, "Bad argument to '-P' option.\n"
> + "Try '-h' for help.\n");
> + error = -EINVAL;
> + goto fail;
> + }
> + switch(optarg[0]){
> + case 'b': /* backend port number */
> + /* Not used by ccs_tool */
> + break;
> + case 'c': /* cluster base port number */
> + ret = atoi(optarg+2);
> + if(ret < 1024){
> + fprintf(stderr, "Bad cluster base port number.\n");
> + error = -EINVAL;
> + goto fail;
> + }
> + cluster_base_port = ret;
> + printf("Set cluster base port to %d\n", cluster_base_port);
> + break;
> + case 'f': /* frontend port number */
> + /* Not used by ccs_tool */
> + break;
> + }
> + break;
> + default:
> + goto fail;
> + }
> + }
> +
> + *loc = argv[optind];
> +
> + return 0;
> +fail:
> + return error;
> +}
> +
> +int update(const char *location)
> +{
> + char *args[3];
> + char **argv;
> +
> + args[0] = "update";
> + args[1] = location;
> + args[2] = NULL;
> +
> + argv = args;
> +
> + return update2(2, argv);
> +}
> +
> +int update2(int argc, char **argv)
> {
> int error = 0;
> int i, fd;
> int cluster_fd = -1;
> + char *location = NULL;
> char true_location[256];
> xmlDocPtr doc = NULL;
> xmlChar *mem_doc;
> @@ -132,6 +191,9 @@ int update(char *location)
>
> struct timeval tv;
>
> + if (parse_args(argc, argv, &location))
> + return -1;
> +
> if (location[0] != '/') {
> memset(true_location, 0, 256);
> if (!getcwd(true_location, 256)) {
> diff --git a/ccs/ccs_tool/update.h b/ccs/ccs_tool/update.h
> index 19fd7cb..f706963 100644
> --- a/ccs/ccs_tool/update.h
> +++ b/ccs/ccs_tool/update.h
> @@ -14,5 +14,6 @@
> #define __UPDATE_DOT_H__
>
> int update(char *location);
> +int update2(int argc, char **argv);
>
> #endif /* __UPDATE_DOT_H__ */
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports
2011-02-15 5:17 ` [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Fabio M. Di Nitto
@ 2011-02-15 16:00 ` Lon Hohberger
0 siblings, 0 replies; 4+ messages in thread
From: Lon Hohberger @ 2011-02-15 16:00 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Tue, 2011-02-15 at 06:17 +0100, Fabio M. Di Nitto wrote:
> Untested, looks sane to me, ACK.
>
> Fabio
Test results are here:
https://bugzilla.redhat.com/show_bug.cgi?id=656427#c8
-- Lon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-15 16:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-14 18:58 [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Lon Hohberger
2011-02-14 18:58 ` [Cluster-devel] [PATCH 2/2] ccs: Update manual page for ccs_tool Lon Hohberger
2011-02-15 5:17 ` [Cluster-devel] [PATCH 1/2] ccs: Allow ccs_tool to use alternate base ports Fabio M. Di Nitto
2011-02-15 16:00 ` Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).