cluster/fence agents/xvm/fence_xvmd.c agents/x ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: lhh at sourceware.org 2007-11-14 18:41:27
Modified files:
fence/agents/xvm: fence_xvmd.c options.c options.h
fence/man : fence_xvmd.8
Log message:
Fix #362351 - make fence_xvmd work in no-cluster mode
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvmd.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.7&r2=1.4.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/options.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/options.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/man/fence_xvmd.8.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2
fence/agents/xvm/fence_xvmd.c +43 -36
@@ -221,7 +221,7 @@ do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth, void *key, size_t key_len, virConnectPtr vp) { -int fd, ret =-1 ; +int fd =-1 , ret =-1 ;virDomainPtr vdp;char response =1 ;char *domain_desc, *domain_desc_sanitized;
@@ -534,10 +534,10 @@struct sockaddr_in sin;int len;int n; -int my_id; +int my_id =1 ;socklen_t slen;fence_req_t data; -virConnectPtr vp; +virConnectPtr vp =NULL ;virt_list_t *vl =NULL ;virt_state_t *dom =NULL ;
@@ -545,7 +545,9 @@if (!vp)perror ("virConnectOpen" ); -get_cman_ids (ch, &my_id,NULL ); +if (!(args->flags &F_NOCLUSTER )) +get_cman_ids (ch, &my_id,NULL ); +printf ("My Node ID = %d\n" , my_id);if (vp) {
@@ -585,11 +587,14 @@/* Update list of VMs from libvirt. */ virt_list_update (vp, &vl, my_id);vl_print (vl); +/* Store information here */ -if (args->flags &F_USE_UUID ) -store_domains_by_uuid (h, vl); -else -store_domains_by_name (h, vl); +if (!(args->flags &F_NOCLUSTER )) { +if (args->flags &F_USE_UUID ) +store_domains_by_uuid (h, vl); +else +store_domains_by_name (h, vl); + }/* * If no requests, we're done
@@ -631,7 +636,7 @@ dom =vl_find_uuid (vl, (char *)data.domain); else dom =vl_find_name (vl, (char *)data.domain); -if (!dom) { +if (!dom && !(args->flags &F_NOCLUSTER )) {handle_remote_domain (ch, h, &data, args->auth, key, key_len, my_id);continue ;
@@ -682,9 +687,9 @@int mc_sock;char key[4096 ];int key_len =0 , x; -char *my_options ="dfi:a:p:C:c:k:u?hV" ; -cman_handle_t ch; -void *h; +char *my_options ="dfi:a:p:C:c:k:u?hLXV" ; +cman_handle_t ch =NULL ; +void *h =NULL ;args_init (&args);args_get_getopt (argc, argv, my_options, &args);
@@ -745,32 +750,34 @@return 1 ; } -/* Wait for cman to start. */ - x =0 ; -while ((ch =cman_init (NULL )) ==NULL ) { -if (!x) { -printf ("Could not connect to CMAN; retrying...\n" ); - x =1 ; - } -sleep (3 ); - } -if (x) -printf ("Connected to CMAN\n" ); -/* Wait for quorum */ -while (!cman_is_quorate (ch)) -sleep (3 ); - -/* Wait for openais checkpointing to become available */ - x =0 ; -while ((h =ckpt_init ("vm_states" ,262144 ,4096 ,64 ,10 )) ==NULL ) { -if (!x) { -printf ("Could not initialize saCkPt; retrying...\n" ); - x =1 ; +if (!(args.flags &F_NOCLUSTER )) { +/* Wait for cman to start. */ + x =0 ; +while ((ch =cman_init (NULL )) ==NULL ) { +if (!x) { +printf ("Could not connect to CMAN; retrying...\n" ); + x =1 ; + } +sleep (3 ); + } +if (x) +printf ("Connected to CMAN\n" ); +/* Wait for quorum */ +while (!cman_is_quorate (ch)) +sleep (3 ); + +/* Wait for openais checkpointing to become available */ + x =0 ; +while ((h =ckpt_init ("vm_states" ,262144 ,4096 ,64 ,10 )) ==NULL ) { +if (!x) { +printf ("Could not initialize saCkPt; retrying...\n" ); + x =1 ; + } +sleep (3 ); } -sleep (3 ); +if (x) +printf ("Checkpoint initialized\n" ); } -if (x) -printf ("Checkpoint initialized\n" );if (args.family ==PF_INET ) mc_sock =ipv4_recv_sk (args.addr, args.port);
fence/agents/xvm/options.c +11 -0
@@ -253,6 +253,13 @@ } +static inline void +assign_nocluster (fence_xvm_args_t *args,struct arg_info *arg,char *value) +{ + args->flags |=F_NOCLUSTER ; +} + +/** ALL valid command line and stdin arguments for this fencing agent */ static struct arg_info _arg_info[] = { {'\xff' ,NULL ,"agent" ,
@@ -326,6 +333,10 @@ {'X' ,"-X" ,NULL ,"Do not connect to CCS for configuration" , assign_noccs }, + + { 'L', "-L", NULL, +"Local mode only (no cluster)" , + assign_nocluster }, { 'V', "-V", NULL, "Display version and exit",
fence/agents/xvm/options.h +2 -1
@@ -27,7 +27,8 @@F_USE_UUID =0x10 ,F_VERSION =0x20 ,F_CCSERR =0x40 , - F_CCSFAIL = 0x80 +F_CCSFAIL =0x80 , + F_NOCLUSTER = 0x100 } arg_flags_t;
fence/man/fence_xvmd.8 +7 -0
@@ -81,6 +81,13 @@ override a configuration option contained in CCS, you must specify this parameter. \fB-V\fP +.TP +\fB-L\fP +Local-only / non-cluster mode. When used with -X, this this option +prevents fence_xvmd from operating as a clustered service, obviating +the need to configure/run CMAN on the host domain. +.TP +\fB-V\fP Print out a version message, then exit. .SH CCS PARAMETERS