From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13302 invoked by alias); 26 Jun 2008 15:32:51 -0000 Received: (qmail 13271 invoked by uid 9476); 26 Jun 2008 15:32:50 -0000 Date: Thu, 26 Jun 2008 15:32:00 -0000 Message-ID: <20080626153250.13253.qmail@sourceware.org> From: lhh@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.05-20-gbeeb207 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f0a2cb52271835a65abb00b9cf64ce82f6c3cf6e X-Git-Newrev: beeb2070953548ecf38751294e5371a668f73ee2 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00549.txt.bz2 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=beeb2070953548ecf38751294e5371a668f73ee2 The branch, master has been updated via beeb2070953548ecf38751294e5371a668f73ee2 (commit) from f0a2cb52271835a65abb00b9cf64ce82f6c3cf6e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit beeb2070953548ecf38751294e5371a668f73ee2 Author: root Date: Thu Jun 26 11:31:45 2008 -0400 [fence] fence_xvmd: Add KVM support; misc cleanups. * WARNING WARNING WARNING: Changes the default URI to KVM. You must specify uri="xen:///" in cluster.conf to use Xen now (or -U xen:/// on the command line) * fence_xvmd -h now displays appropriate cluster.conf related help information. ----------------------------------------------------------------------- Summary of changes: fence/agents/xvm/fence_xvm.c | 8 ++++++++ fence/agents/xvm/fence_xvmd.c | 15 +++++++++------ fence/agents/xvm/options.c | 36 +++++++++++++++++++++++++----------- fence/agents/xvm/options.h | 1 + fence/agents/xvm/xvm.h | 4 ++++ 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c index f2b714f..c991f36 100644 --- a/fence/agents/xvm/fence_xvm.c +++ b/fence/agents/xvm/fence_xvm.c @@ -314,6 +314,14 @@ main(int argc, char **argv) if (args.flags & F_HELP) { args_usage(argv[0], my_options, 0); + + printf("With no command line argument, arguments are " + "read from standard input.\n"); + printf("Arguments read from standard input take " + "the form of:\n\n"); + printf(" arg1=value1\n"); + printf(" arg2=value2\n\n"); + args_usage(argv[0], my_options, 1); exit(0); } diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c index c8b955b..c580c57 100644 --- a/fence/agents/xvm/fence_xvmd.c +++ b/fence/agents/xvm/fence_xvmd.c @@ -36,8 +36,6 @@ #include "libcman.h" #include "debug.h" -#define LIBVIRT_XEN_URI "xen:///" - static int running = 1; static int reload_key; @@ -551,7 +549,7 @@ xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args, virt_list_t *vl = NULL; virt_state_t *dom = NULL; - vp = virConnectOpen(LIBVIRT_XEN_URI); + vp = virConnectOpen(args->uri); if (!vp) perror("virConnectOpen"); @@ -608,7 +606,7 @@ xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args, continue; /* Request and/or timeout: open connection */ - vp = virConnectOpen(LIBVIRT_XEN_URI); + vp = virConnectOpen(args->uri); if (!vp) { printf("NOTICE: virConnectOpen(): %s; cannot fence!\n", strerror(errno)); @@ -723,7 +721,7 @@ main(int argc, char **argv) int mc_sock; char key[MAX_KEY_LEN]; int key_len = 0, x; - char *my_options = "dfi:a:p:C:c:k:u?hLXV"; + char *my_options = "dfi:a:p:C:U:c:k:u?hLXV"; cman_handle_t ch = NULL; void *h = NULL; @@ -741,12 +739,17 @@ main(int argc, char **argv) } if (args.flags & F_ERR) { - args_usage(argv[0], my_options, 0); return 1; } if (args.flags & F_HELP) { args_usage(argv[0], my_options, 0); + + printf("Arguments may be specified as part of the\n"); + printf("fence_xvmd tag in cluster.conf in the form of:\n"); + printf(" \n\n"); + + args_usage(argv[0], my_options, 1); return 0; } diff --git a/fence/agents/xvm/options.c b/fence/agents/xvm/options.c index 616b8db..f44a860 100644 --- a/fence/agents/xvm/options.c +++ b/fence/agents/xvm/options.c @@ -73,6 +73,8 @@ assign_family(fence_xvm_args_t *args, struct arg_info *arg, static inline void assign_address(fence_xvm_args_t *args, struct arg_info *arg, char *value) { + if (args->addr) + free(args->addr); args->addr = strdup(value); } @@ -149,6 +151,8 @@ assign_key(fence_xvm_args_t *args, struct arg_info *arg, char *value) { struct stat st; + if (args->key_file) + free(args->key_file); args->key_file = strdup(value); if (stat(value, &st) == -1) { @@ -253,6 +257,18 @@ assign_nocluster(fence_xvm_args_t *args, struct arg_info *arg, char *value) } +static inline void +assign_uri(fence_xvm_args_t *args, struct arg_info *arg, char *value) +{ + if (args->uri) + free(args->uri); + + /* XXX NO validation yet */ + args->uri = strdup(value); +} + + + /** ALL valid command line and stdin arguments for this fencing agent */ static struct arg_info _arg_info[] = { { '\xff', NULL, "agent", @@ -264,7 +280,7 @@ static struct arg_info _arg_info[] = { NULL }, { 'd', "-d", "debug", - "Enable debugging mode", + "Specify (CCS) / increment (command line) debug level", assign_debug }, { 'f', "-f", NULL, @@ -300,7 +316,7 @@ static struct arg_info _arg_info[] = { assign_auth }, { 'k', "-k ", "key_file", - "Shared key file (default=" DEFAULT_CONFIG_DIR "/fence_xvm.key)", + "Shared key file (default=" DEFAULT_KEY_FILE ")", assign_key }, { 'o', "-o ", "option", @@ -334,6 +350,10 @@ static struct arg_info _arg_info[] = { { 'L', "-L", NULL, "Local mode only (no cluster)", assign_nocluster }, + + { 'U', "-U", "uri", + "URI for Hypervisor (default: " DEFAULT_HYPERVISOR_URI ")", + assign_uri }, { 'V', "-V", NULL, "Display version and exit", @@ -386,7 +406,8 @@ args_init(fence_xvm_args_t *args) { args->addr = NULL; args->domain = NULL; - args->key_file = DEFAULT_KEY_FILE; + args->key_file = strdup(DEFAULT_KEY_FILE); + args->uri = strdup(DEFAULT_HYPERVISOR_URI); args->op = FENCE_REBOOT; args->hash = DEFAULT_HASH; args->auth = DEFAULT_AUTH; @@ -444,14 +465,7 @@ args_usage(char *progname, char *optstr, int print_stdin) int x; struct arg_info *arg; - if (print_stdin) { - printf("With no command line argument, arguments are " - "read from standard input.\n"); - printf("Arguments read from standard input take " - "the form of:\n\n"); - printf(" arg1=value1\n"); - printf(" arg2=value2\n\n"); - } else { + if (!print_stdin) { if (progname) { printf("usage: %s [args]\n", progname); } else { diff --git a/fence/agents/xvm/options.h b/fence/agents/xvm/options.h index 985f38d..7a2dcca 100644 --- a/fence/agents/xvm/options.h +++ b/fence/agents/xvm/options.h @@ -18,6 +18,7 @@ typedef struct { char *addr; char *domain; char *key_file; + char *uri; fence_cmd_t op; fence_hash_t hash; fence_auth_type_t auth; diff --git a/fence/agents/xvm/xvm.h b/fence/agents/xvm/xvm.h index 092ab1f..de89543 100644 --- a/fence/agents/xvm/xvm.h +++ b/fence/agents/xvm/xvm.h @@ -40,6 +40,10 @@ typedef enum { #define DEFAULT_TTL 4 +#ifndef DEFAULT_HYPERVISOR_URI +#define DEFAULT_HYPERVISOR_URI "qemu:///system" +#endif + #define MAX_HASH_LENGTH SHA512_LENGTH #define MAX_KEY_LEN 4096 hooks/post-receive -- Cluster Project