Example #1
0
void show_versioning(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    *pChar = 0;

    if (argv[1] == NULL) {
      sprintf(pChar,"export versioning is %s\n",(common_config.export_versioning==1)?"enabled":"disabled");
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }

    if (strcmp(argv[1],"enable")==0) {
        common_config.export_versioning = 1;
	pChar += sprintf(pChar,"versioning is now enabled\n");
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;	 
    }
    if (strcmp(argv[1],"disable")==0) {
        common_config.export_versioning = 0;
	pChar += sprintf(pChar,"versioning is now disable\n");
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;	 
    }
      	    
    show_versioning_help(pChar);	
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
}
Example #2
0
void display_detailed_counters (char * argv[], uint32_t tcpRef, void *bufRef) {
  char          * p = uma_dbg_get_buffer();
  int             i;
  int             start_read,stop_read;
  int             start_write,stop_write;
  
  if (argv[1] != NULL) {
    if (strcmp(argv[1],"reset")==0) {
      reset_detailed_counters();
      uma_dbg_send(tcpRef,bufRef,TRUE,"Reset Done");
      return;
    }
    p = display_detailed_counters_help(p);
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
    return;    
  }  
  
  start_read = start_write = 0;
  stop_read  = STORIO_DETAILED_READ_SLICE;
  stop_write  = STORIO_DETAILED_WRITE_SLICE;

  p += sprintf(p, "    READ                                 WRITE\n");  
  for (i=0; i<=STORIO_DETAILED_COUNTER_MAX; i++) {
  
    p += sprintf(p, "%4d..%4d : %-16"PRIu64"        %4d..%4d : %-16"PRIu64"\n", 
                start_read,stop_read,storio_detailed_counters.read[i],
                start_write,stop_write,storio_detailed_counters.write[i]); 

    start_read = stop_read;
    stop_read += STORIO_DETAILED_READ_SLICE; 
    start_write = stop_write;
    stop_write += STORIO_DETAILED_WRITE_SLICE;       
  }
  uma_dbg_send(tcpRef,bufRef,TRUE,uma_dbg_get_buffer());    
}
Example #3
0
void show_dirent_cache(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    pChar = dirent_cache_display(pChar);
    pChar = dirent_disk_display_stats(pChar);
    pChar = dirent_wbcache_display_stats(pChar);
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
}
Example #4
0
/**
*   Storage,Volumes, EID statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_vfstat(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pbuf = uma_dbg_get_buffer();
    int i, j;

    for (i = 0; i < gprofiler.nb_volumes; i++) {
        pbuf+=sprintf(pbuf, "Volume: %d  Bsize: %d Blocks: %"PRIu64" Bfree: %"PRIu64" PercentFree: %d\n",
                gprofiler.vstats[i].vid, gprofiler.vstats[i].bsize,gprofiler.vstats[i].blocks, gprofiler.vstats[i].bfree,
                (int)((gprofiler.vstats[i].blocks==0)? 0:gprofiler.vstats[i].bfree*100/gprofiler.vstats[i].blocks));
        pbuf+=sprintf(pbuf, "\n%-6s | %-6s | %-20s | %-20s |\n", "Sid", "Status", "Capacity(B)","Free(B)");
        pbuf+=sprintf(pbuf, "-------+--------+----------------------+----------------------+\n");
        for (j = 0; j < gprofiler.vstats[i].nb_storages; j++) {
            pbuf+=sprintf(pbuf, "%6d | %-6s | %20"PRIu64" | %20"PRIu64" |\n", gprofiler.vstats[i].sstats[j].sid,
                    (gprofiler.vstats[i].sstats[j].status==1)?"UP":"DOWN", gprofiler.vstats[i].sstats[j].size,
                    gprofiler.vstats[i].sstats[j].free);
        }
        pbuf += sprintf(pbuf, "\n%-6s | %-6s | %-20s | %-20s | %-12s | %-12s |\n", "Eid", "Bsize", "Blocks", "Bfree", "Files", "Ffree");
        pbuf += sprintf(pbuf, "-------+--------+----------------------+----------------------+--------------+--------------+\n");


        for (j = 0; j < gprofiler.nb_exports; j++) {

            if (gprofiler.estats[j].vid == gprofiler.vstats[i].vid)
                pbuf += sprintf(pbuf, "%6d | %6d | %20"PRIu64" | %20"PRIu64" | %12"PRIu64" | %12"PRIu64" |\n", gprofiler.estats[j].eid,
                    gprofiler.estats[j].bsize, gprofiler.estats[j].blocks, gprofiler.estats[j].bfree,
                    gprofiler.estats[j].files, gprofiler.estats[j].ffree);
        }
        pbuf += sprintf(pbuf, "\n");
    }

    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #5
0
/**
*   Storage,Volumes, EID statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_distrib(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pbuf = uma_dbg_get_buffer();
  int   vid;
  volume_t * volume;

  if (argv[1] == NULL) {
    pbuf+=sprintf(pbuf, "Missing volume id\n");
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
    return;
  }  

  if (sscanf(argv[1],"%d", &vid) != 1) {
    pbuf+=sprintf(pbuf, "Bad vid format\n");
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
    return;
  }  
  
  volume = volumes_lookup_volume(vid);
  if (volume == NULL) {
    pbuf+=sprintf(pbuf, "No such volume\n");
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
    return;
  }  
  
  pbuf += volume_distrib_display(pbuf,volume);
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
} 
Example #6
0
void af_inet_tcp_short_debug_show(uint32_t tcpRef, void *bufRef) {
    char *buffer = uma_dbg_get_buffer();
    char ipbuf[128];
    MY_TCP_INFO_T * myp;
    int siocinq_value;
    int siocoutq_value;
    struct tcp_info * p;
    af_unix_ctx_generic_t *sock_p;
    ruc_obj_desc_t *pnext;
    buffer += sprintf(buffer, "  State      | Avail.|  sock  |   rto   | snd_mss | rcv_mss |   rtt   |  Recv-Q |  Send-Q |      IP:port source    |   IP:port destination  |  SNDBUF |  RCVBUF |\n");
    buffer += sprintf(buffer, "-------------+-------+--------+---------+---------+---------+---------+---------+---------+------------------------+------------------------+---------+---------+\n");

    pnext = (ruc_obj_desc_t*) NULL;
    while ((sock_p = (af_unix_ctx_generic_t*) ruc_objGetNext((ruc_obj_desc_t*) & af_unix_context_activeListHead,
            &pnext))
            != (af_unix_ctx_generic_t*) NULL) {

        if (sock_p->af_family == AF_UNIX) continue;
        myp = af_inet_tcp_get_tcp_info(sock_p->socketRef);
	p = &myp->tcp_info;
        if (p == NULL) continue;

        buffer += sprintf(buffer, " %s |", af_inet_get_tcp_state(p->tcpi_state));
        buffer += sprintf(buffer, " %5s |", (sock_p->cnx_availability_state == AF_UNIX_CNX_AVAILABLE) ? "YES" : "NO");
        buffer += sprintf(buffer, " %6d |", sock_p->socketRef);
        buffer += sprintf(buffer, " %7d |", p->tcpi_rto);
        buffer += sprintf(buffer, " %7d |", p->tcpi_snd_mss);
        buffer += sprintf(buffer, " %7d |", p->tcpi_rcv_mss);
        buffer += sprintf(buffer, " %7d |", p->tcpi_rtt);
	siocinq_value = 0;
	siocoutq_value = 0;
	if (sock_p->socketRef)
	{
	  ioctl(sock_p->socketRef,SIOCINQ,&siocinq_value);
	  ioctl(sock_p->socketRef,SIOCOUTQ,&siocoutq_value);
	}
	buffer += sprintf(buffer, " %7d |",  siocinq_value);
	buffer += sprintf(buffer, " %7d |",siocoutq_value);
	af_tcp_display_address(ipbuf,sock_p,1);
	buffer += sprintf(buffer, " %22s |",ipbuf);
	af_tcp_display_address(ipbuf,sock_p,0);
	buffer += sprintf(buffer, " %22s |",ipbuf);
	{
	    int sendsize = 0;
	    int rcvsize = 0;
	    int optionsize=sizeof(sendsize);

	    if (sock_p->socketRef > 0) {
	    getsockopt(sock_p->socketRef,SOL_SOCKET,SO_SNDBUF,(char*)&sendsize,(socklen_t*)&optionsize);
	    getsockopt(sock_p->socketRef,SOL_SOCKET,SO_RCVBUF,(char*)&rcvsize,(socklen_t*)&optionsize);
	    }
	    buffer += sprintf(buffer, " %7d |",sendsize);
	    buffer += sprintf(buffer, " %7d |",rcvsize);
	    buffer += sprintf(buffer, "\n");	
       }

    }
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());

}
void show_repair2(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();

  if (argv[1] != NULL) {
    if (strcasecmp(argv[1],"on")==0) {
      storcli_storage_supports_repair2 = 1;
    }
    else if (strcasecmp(argv[1],"off")==0) {
      storcli_storage_supports_repair2 = 0;
    }
    else {
	  pChar += sprintf(pChar,"repair2 [on|off]\n");
	}
  }

  switch(storcli_storage_supports_repair2) {
    case 0:
	  pChar += sprintf(pChar,"storages DO NOT support REPAIR2\n");    	 
	  break;
	case 1:
	  pChar += sprintf(pChar,"storages SHOULD support REPAIR2\n");    	 
 	  break;
	default:   
	  pChar += sprintf(pChar,"storages DO support REPAIR2\n");
  }
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #8
0
/*
*_______________________________________________________________________
*
*  show exportd configuration path
*/
void show_conf_path(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();

  sprintf(pChar,"%s\n",export_get_config_file_path());
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
  return;
}
Example #9
0
/*-----------------------------------------------------------------------------
**
**  MAIN file mover
**
**----------------------------------------------------------------------------
*/
int main(int argc, char *argv[]) {
  list_t jobs;     
  int    i;
  char   name[128];

  /*
  ** Get utility name and record it for syslog
  */
  utility_name = basename(argv[0]);   
  uma_dbg_record_syslog_name(utility_name);

  /*
  ** Set a signal handler
  */
  rozofs_signals_declare(utility_name, 1); 
  
  rozofs_mover_init();
  
  list_init(&jobs);
  
  for (i=1;i<11; i++) {
    rozofs_mover_job_t * job;
    
    job = malloc(sizeof(rozofs_mover_job_t));
    memset(job,0,sizeof(rozofs_mover_job_t));
    
    job->cid    = 2;
    job->sid[0] = 8;
    job->sid[1] = 7;
    job->sid[2] = 3;
    job->sid[3] = 4;
    job->sid[4] = 5;
    job->sid[5] = 6;
    job->sid[6] = 1;
    job->sid[7] = 2;
    
    sprintf(name,"@rozofs_uuid@00000000-0000-4000-0000-000000000018/f%d",i);
    job->name = strdup(name);
    
    list_init(&job->list);
    list_push_back(&jobs,&job->list);    
  }

  rozofs_do_move_one_export("localhost", 
                            "/home/jean-pierre/rozoClients/develop/tests/SIMU/export_1", 
			    10 /* 10 MB/s */,
			    &jobs);
			    
  /*
  ** Display statistics
  */
  rozofs_mover_print_stat(uma_dbg_get_buffer());
  printf("%s",uma_dbg_get_buffer()); 
  return 0;
}
Example #10
0
/**
*   Volumes statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_vfstat_vol(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pbuf = uma_dbg_get_buffer();
    int i;

    for (i = 0; i < gprofiler.nb_volumes; i++) {
        pbuf+=sprintf(pbuf, "Volume: %d  Bsize: %d Blocks: %"PRIu64" Bfree: %"PRIu64" PercentFree: %d\n",
                gprofiler.vstats[i].vid, gprofiler.vstats[i].bsize,gprofiler.vstats[i].blocks, gprofiler.vstats[i].bfree,
               (int)((gprofiler.vstats[i].blocks==0)? 0:gprofiler.vstats[i].bfree*100/gprofiler.vstats[i].blocks));

        pbuf+=sprintf(pbuf, "\n");
    }

    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #11
0
void show_trash(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    int limit;
    int ret;

    if (argv[1] == NULL) {
      export_rm_bins_stats(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }
    
    if (strcmp(argv[1],"json")==0) {
      export_rm_bins_stats_json(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;  
    }
    
    if (strcmp(argv[1],"rate")==0) {

      if (argv[2] == NULL) {
        export_limit_rm_files = RM_FILES_MAX;
	sprintf(pChar," revert to default (%d) \n",RM_FILES_MAX);
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;	 
      }
      	     
      ret = sscanf(argv[2], "%d", &limit);
      if (ret != 1) {
        show_trash_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;   
      }
      export_limit_rm_files = limit;
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }

    if (strcmp(argv[1],"limit")==0) {

      if (argv[2] == NULL) {
        show_trash_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;	 
      }
      	     
      ret = sscanf(argv[2], "%d", &limit);
      if (ret != 1) {
        show_trash_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;   
      }
      export_rm_bins_threshold_high = limit;
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }
    show_trash_help(pChar);	
    uma_dbg_send(tcpRef, bufRef, TRUE,uma_dbg_get_buffer());
}
Example #12
0
/*__________________________________________________________________________
  Trace level debug function
  ==========================================================================
  PARAMETERS: 
  - 
  RETURN: none
  ==========================================================================*/
void geo_proc_debug_show(uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();

    pChar += sprintf(pChar, "number of transaction contexts (initial/allocated) : %u/%u\n", geo_proc_context_count, geo_proc_context_allocated);
    pChar += sprintf(pChar, "context size (bytes)                               : %u\n", (unsigned int) sizeof (geo_proc_ctx_t));
    ;
    pChar += sprintf(pChar, "Total memory size (bytes)                          : %u\n", (unsigned int) sizeof (geo_proc_ctx_t) * geo_proc_context_count);
    ;
    pChar += sprintf(pChar, "Statistics\n");
    pChar += sprintf(pChar, "TIMEOUT        : %10llu\n", (unsigned long long int) geo_proc_stats[GEO_CTX_TIMEOUT]);
    pChar += sprintf(pChar, "CTX_MISMATCH   : %10llu\n", (unsigned long long int) geo_proc_stats[GEO_CTX_CTX_MISMATCH]);
    pChar += sprintf(pChar, "NO_CTX_ERROR   : %10llu\n", (unsigned long long int) geo_proc_stats[GEO_CTX_NO_CTX_ERROR]);
    pChar += sprintf(pChar, "\n");
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());

}
Example #13
0
void af_unix_debug(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();
   
  if (argv[1] == NULL) {
    af_unix_debug_show_no_param(pChar);    
  }
  else if (strcmp(argv[1],"first")==0) {
    af_unix_debug_show_first(pChar);        
  }
  else if (strcmp(argv[1],"next")==0) {
    af_unix_debug_show_next(pChar);
  }
  else {
    af_unix_debug_show_name(pChar, argv[1]);      
  }  
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #14
0
/**
*   EID statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_vfstat_eid(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pbuf = uma_dbg_get_buffer();
    int j;

        pbuf+=sprintf(pbuf, "\n%-6s | %-6s | %-6s | %-20s | %-20s | %-12s | %-12s |\n", "Eid","Vid", "Bsize","Blocks", "Bfree", "Files", "Ffree");
        pbuf+=sprintf(pbuf, "-------+--------+--------+----------------------+----------------------+--------------+--------------+\n");


        for (j = 0; j < gprofiler.nb_exports; j++) {

                pbuf+=sprintf(pbuf, "%6d | %6d | %6d | %20"PRIu64" | %20"PRIu64" | %12"PRIu64" | %12"PRIu64" |\n", gprofiler.estats[j].eid,
                    gprofiler.estats[j].vid,
                    gprofiler.estats[j].bsize, gprofiler.estats[j].blocks, gprofiler.estats[j].bfree,
                    gprofiler.estats[j].files, gprofiler.estats[j].ffree);
        }
        pbuf+=sprintf(pbuf, "\n");

    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #15
0
void show_geo_current_files(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();
  geo_fid_entry_t *info_p;
  int i;
     if (geocli_ctx_p == NULL)
     {
       sprintf(pChar,"No synchronization context available\n");
       uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer()); 
       return;  	  
     } 
     info_p = (geo_fid_entry_t*)geocli_ctx_p->data_record;
     pChar+=sprintf(pChar,"layout |           fid                        | off start |  off end  | cid|  file distribution (sids)\n");
     pChar+=sprintf(pChar,"-------+--------------------------------------+-----------+-----------+----+--------------------------\n");
     for (i = 0; i < geocli_ctx_p->nb_records;i++,info_p++)
     {
      pChar = geocli_display_one_file_info(pChar,info_p);     
     } 
     uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
}
Example #16
0
void dbg_set_tmr_default(char * argv[], uint32_t tcpRef, void *bufRef)
{
    char           *pChar=uma_dbg_get_buffer();


    int timer_id;

    if (argv[1] ==NULL)
    {
        pChar = dbg_set_tmr_default_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    if (strcmp("all",argv[1]) ==0)
    {
        rozofs_tmr_init_configuration();
        uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");
        return;
    }
    /* Check 1rst a string name */
    timer_id = rozofs_tmr_get_idx_from_name(argv[1]);
    /* Check for an index */
    if (timer_id < 0) {
        errno = 0;
        timer_id = (int) strtol(argv[1], (char **) NULL, 10);
        if (errno != 0) {
            pChar = dbg_set_tmr_default_help(pChar);
            uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
            return;
        }
    }
    if (timer_id >= TMR_MAX_ENTRY)
    {
        pChar += sprintf(pChar,"invalid timer index (max %d)\n",(TMR_MAX_ENTRY-1));
        pChar = dbg_set_tmr_default_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    rozofs_tmr_set_to_default(timer_id);
    uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");
    return;
}
Example #17
0
void show_synchro_ctx(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();
  
  if (geocli_ctx_p == NULL)
  {
    sprintf(pChar,"No synchronization context available\n");
    goto out;
  }
  pChar+=sprintf(pChar,"%-25s = %u ms\n","Fast Polling",geocli_fast_polling_count*GEO_DEF_PERIO_MS);
  pChar+=sprintf(pChar,"%-25s = %u ms\n","Slow Polling",geocli_slow_polling_count*GEO_DEF_PERIO_MS);
  pChar+=sprintf(pChar,"%-25s = %u ms\n","Curr Polling",geocli_current_count*GEO_DEF_PERIO_MS);
  pChar+=sprintf(pChar,"%-25s = %u ms\n","Curr delay",geocli_current_delay*GEO_DEF_PERIO_MS);
  DISPLAY_UINT32_CONFIG(eid);
  DISPLAY_UINT32_CONFIG(site_id);
  DISPLAY_UINT32_CONFIG(first_record);  
  DISPLAY_UINT32_CONFIG(nb_records);
  DISPLAY_UINT32_CONFIG(cur_record);
out:
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}  
Example #18
0
void show_geo_profiler(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();

     if (geocli_ctx_p == NULL)
     {
       sprintf(pChar,"No synchronization context available\n");
       uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer()); 
       return;  	  
     }
    if (argv[1] == NULL) {
      pChar +=sprintf(pChar,"syslog is %s for geo-replication errors\n",(geo_replica_log_enable==1)?"enabled":"disabled");
      pChar = show_geo_profiler_display(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }

    if (strcmp(argv[1],"reset")==0) {

	memset(&geocli_ctx_p->profiler,0,sizeof(geo_cli_profiler_t));
        memset(&rzcp_profiler,0,sizeof(rzcp_profiler_t));
	uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   
	return;	 
    }
    if (strcmp(argv[1],"log")==0) {
      geo_replica_log_enable = 1;
      rzcp_log_enable = 1;
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }

    if (strcmp(argv[1],"no_log")==0) {
      geo_replica_log_enable = 0;
      rzcp_log_enable = 0;
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }
      	     
    show_geo_profiler_help(pChar);
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
}
Example #19
0
void show_geo_profiler(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    uint32_t eid;
    int ret;

    if (argv[1] == NULL) {
      for (eid=0; eid <= EXPGW_EID_MAX_IDX; eid++) 
        pChar = show_geo_profiler_one(pChar,eid);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }

    if (strcmp(argv[1],"reset")==0) {

      if (argv[2] == NULL) {
	geo_profiler_reset_all();
	uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   
	return;	 
      }
      	     
      ret = sscanf(argv[2], "%d", &eid);
      if (ret != 1) {
        show_geo_profiler_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;   
      }
      geo_profiler_reset_one(eid);
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }

    ret = sscanf(argv[1], "%d", &eid);
    if (ret != 1) {
      show_geo_profiler_help(pChar);	
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
      return;   
    }
    pChar = show_geo_profiler_one(pChar,eid);
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
}
Example #20
0
/**
* display the configuration of the shared memories associated with the storcli
*/
void rozofs_shared_mem_display(char * argv[], uint32_t tcpRef, void *bufRef)
{
    char *pChar = uma_dbg_get_buffer();
    int i;


    pChar += sprintf(pChar, "   pool     |     key     |  size    | count |    address     |      stats     |\n");
    pChar += sprintf(pChar, "------------+-------------+----------+-------+----------------+----------------+\n");
    for (i = 0; i < SHAREMEM_PER_FSMOUNT; i ++)
    {
      pChar +=sprintf(pChar," %10s | %8.8d  | %8.8d |%4d   | %p |%15llu |\n",(i==0)?"Read":"Write",
                      rozofs_storcli_shared_mem[i].key,
                      rozofs_storcli_shared_mem[i].buf_sz,
                      rozofs_storcli_shared_mem[i].buf_count,
                      rozofs_storcli_shared_mem[i].data_p,
                      (long long unsigned int)rozofs_storcli_shared_mem[i].read_stats);    
    
    }
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());

}
Example #21
0
/**
* Parse and display a RozoFS FID
*/
void uma_dbg_split_fid(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();

  if (argv[1] == NULL) {
    rozofs_string_append(pChar, "Missing FID parameter");   	      
  }  
  else {
    uuid_t fid;
    if (rozofs_uuid_parse(argv[1], fid)<0) {
      *pChar ++ = '"';
      pChar += rozofs_string_append(pChar, argv[1]);   	
      *pChar ++ =  '"';                   
      rozofs_string_append(pChar, " is not a FID");   	          
    }
    else {
      pChar = fid2string(fid,pChar);
      pChar += rozofs_eol(pChar);   	
    }  
  }  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
}
Example #22
0
/**
*  Rozodiag CLI to restart georeplication from scratch
   
   @retval 0 on success
   @retval -1 on error 
*/
void geo_rep_restart_from_scratch_dbg(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();
  int   site=-1;
  int   eid;
  

  /* 
  ** Parse command
  */
  if (argv[1] == NULL) {
    sprintf(pChar,"Missing site number\n");
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
  }
  if (sscanf(argv[1],"%d", &site) != 1) {
    sprintf(pChar,"Unexpected site number %s\n",argv[1]);  
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
  }  
  if ((site!=0)&&(site!=1)){
    sprintf(pChar,"Bad number %d\n",site);    
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());  
    return;
  }
  
  /*
  ** Try each eid
  */
  for (eid=0; eid<EXPGW_EID_MAX_IDX; eid++) {
    if (geo_rep_srv_ctx_table[site][eid] != NULL) {
      if (geo_rep_restart_from_scratch_launch_thread(site,eid)==0) {
        pChar += sprintf(pChar,"eid %d started\n",eid);
      }
      else {
        pChar += sprintf(pChar,"Failed to start eid %d\n",eid);       	
      }
    }
  }
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());    
}
Example #23
0
/*
**_______________________________________________________________
*/
void show_wbcache_quota_thread(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    int ret;
    int period;
    
    
    if (argv[1] == NULL) {
      show_wbcache_quota_thread_stats_display(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer()); 
      return;  	  
    }

    if (strcmp(argv[1],"reset")==0) {
      pChar = show_wbcache_quota_thread_stats_display(pChar);
      pChar +=sprintf(pChar,"\nStatistics have been cleared\n");
      quota_wbcache_poll_stats[0] = 0;
      quota_wbcache_poll_stats[1] = 0;
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());  
      return;   
    }
    if (strcmp(argv[1],"period")==0) {   
	if (argv[2] == NULL) {
	show_wbcache_thread_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;  	  
      }
      ret = sscanf(argv[2], "%d", &period);
      if (ret != 1) {
	show_wbcache_thread_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;   
      }
      /*
      ** change the period of the thread
      */
      if (period == 0)
      {
        uma_dbg_send(tcpRef, bufRef, TRUE, "value not supported\n");
        return;
      }
      
      quota_wbcache_thread_period_count = period;
      uma_dbg_send(tcpRef, bufRef, TRUE, "Done\n");   	  
      return;
    }
    if (strcmp(argv[1],"disable")==0) {   
	quota_wbcache_cache_enable = 0;
	uma_dbg_send(tcpRef, bufRef, TRUE,"dirent writeback cache is disabled");   
	return;   
    }
    if (strcmp(argv[1],"enable")==0) {   
	quota_wbcache_cache_enable = 1;
	uma_dbg_send(tcpRef, bufRef, TRUE,"dirent writeback cache is enabled");   
	return;   
    }
    show_wbcache_thread_help(pChar);	
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());    
    return;
}
Example #24
0
/**
*   Storage statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_vfstat_stor(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pbuf = uma_dbg_get_buffer();
    int i,j;

    for (i = 0; i < gprofiler.nb_volumes; i++) {
 
        pbuf+=sprintf(pbuf, "\n%-6s | %-6s | %-6s | %-6s | %-20s | %-20s | %-8s |\n","Vid", "Cid", "Sid", "Status", "Capacity(B)","Free(B)","Free(%)");
        pbuf+=sprintf(pbuf, "-------+--------+--------+--------+----------------------+----------------------+----------+\n");
        for (j = 0; j < gprofiler.vstats[i].nb_storages; j++) {
            pbuf+=sprintf(pbuf, "%6d | %6d | %6d | %-6s | %20"PRIu64" | %20"PRIu64" | %8d |\n",
                   gprofiler.vstats[i].vid,gprofiler.vstats[i].sstats[j].cid,
                   gprofiler.vstats[i].sstats[j].sid,
                   (gprofiler.vstats[i].sstats[j].status==1)?"UP":"DOWN", 
                   gprofiler.vstats[i].sstats[j].size,
                   gprofiler.vstats[i].sstats[j].free,
                   (int)((gprofiler.vstats[i].sstats[j].size==0)? 0:gprofiler.vstats[i].sstats[j].free*100/gprofiler.vstats[i].sstats[j].size));
        }
        pbuf+=sprintf(pbuf, "\n");
    }

    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}
Example #25
0
void af_inet_tcp_debug_show(uint32_t tcpRef, void *bufRef) {
    char *buffer = uma_dbg_get_buffer();
    MY_TCP_INFO_T * myp;
    struct tcp_info * p;
    af_unix_ctx_generic_t *sock_p;
    ruc_obj_desc_t *pnext;
    buffer += sprintf(buffer, "  State      | Avail.|sock      |  retrans | probes   |  rto     | snd_mss  |  rcv_mss | unacked  |  lost    | retrans  |last_sent |   rtt    |\n");
    buffer += sprintf(buffer, "-------------+-------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+\n");

    pnext = (ruc_obj_desc_t*) NULL;
    while ((sock_p = (af_unix_ctx_generic_t*) ruc_objGetNext((ruc_obj_desc_t*) & af_unix_context_activeListHead,
            &pnext))
            != (af_unix_ctx_generic_t*) NULL) {

        if (sock_p->af_family == AF_UNIX) continue;
        myp = af_inet_tcp_get_tcp_info(sock_p->socketRef);
	p = &myp->tcp_info;
        if (p == NULL) continue;

        buffer += sprintf(buffer, " %s |", af_inet_get_tcp_state(p->tcpi_state));
        buffer += sprintf(buffer, " %5s |", (sock_p->cnx_availability_state == AF_UNIX_CNX_AVAILABLE) ? "YES" : "NO");
        buffer += sprintf(buffer, " %8d |", sock_p->socketRef);
        buffer += sprintf(buffer, " %8d |", myp->tcpi_total_retrans);
        buffer += sprintf(buffer, " %8d |", p->tcpi_probes);
        buffer += sprintf(buffer, " %8d |", p->tcpi_rto);
        buffer += sprintf(buffer, " %8d |", p->tcpi_snd_mss);
        buffer += sprintf(buffer, " %8d |", p->tcpi_rcv_mss);
        buffer += sprintf(buffer, " %8d |", p->tcpi_unacked);
        buffer += sprintf(buffer, " %8d |", p->tcpi_lost);
        buffer += sprintf(buffer, " %8d |", p->tcpi_retrans);
        buffer += sprintf(buffer, " %8d |", p->tcpi_last_data_sent);
        buffer += sprintf(buffer, " %8d |\n", p->tcpi_rtt);


    }
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());

}
Example #26
0
/*
*_______________________________________________________________________
*
*  synchro  diagnostic
*/
void show_synchro(char * argv[], uint32_t tcpRef, void *bufRef) {
  char *pChar = uma_dbg_get_buffer();
  int   fd;

  if ((argv[1] == NULL) || (strcmp(argv[1],"drbd")==0)){
    fd = open("/proc/drbd", O_RDONLY);
    if (fd >= 0) {
      pChar += read(fd,pChar, uma_dbg_get_buffer_len());
      pChar += sprintf(pChar,"\n\n");
      close(fd);
    }
  }  
  
  if ((argv[1] == NULL) || (strcmp(argv[1],"crm")==0)){
    char   cmd[128];

    sprintf(cmd,"crm_mon --one-shot");
    pChar += uma_dbg_run_system_cmd(cmd, pChar, uma_dbg_get_buffer_len());
    
  }  
  
  uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
  return;
}
Example #27
0
void show_profiler(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pChar = uma_dbg_get_buffer();
    uint32_t eid;
    int ret;
    *pChar = 0;

    if (argv[1] == NULL) {
      pChar = show_profiler_all(pChar);
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }

    if (strcmp(argv[1],"reset")==0) {

      if (argv[2] == NULL) {
        pChar = show_profiler_all(pChar);
	export_profiler_reset_all();
	pChar += sprintf(pChar,"Reset done\n");
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;	 
      }
      	     
      ret = sscanf(argv[2], "%d", &eid);
      if (ret != 1) {
        show_profiler_help(pChar);	
	uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
	return;   
      }
      pChar = show_profiler_one(pChar,eid);
      export_profiler_reset_one(eid);
      pChar += sprintf(pChar,"Reset done\n");
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
      return;
    }

    ret = sscanf(argv[1], "%d", &eid);
    if (ret != 1) {
      show_profiler_help(pChar);	
      uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   
      return;   
    }
    pChar = show_profiler_one(pChar,eid);
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());   	  
    return;
}
Example #28
0
void dbg_set_tmr(char * argv[], uint32_t tcpRef, void *bufRef)
{
    char           *pChar=uma_dbg_get_buffer();

    int timer_id,val;

    if (argv[2] ==NULL)
    {
        pChar = dbg_set_tmr_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    /* Check 1rst a string name */
    timer_id = rozofs_tmr_get_idx_from_name(argv[1]);
    /* Check for an index */
    if (timer_id < 0) {
        errno = 0;
        timer_id = (int) strtol(argv[1], (char **) NULL, 10);
        if (errno != 0) {
            pChar = dbg_set_tmr_help(pChar);
            uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
            return;
        }
    }
    if (timer_id >= TMR_MAX_ENTRY)
    {
        pChar += sprintf(pChar,"invalid timer index (max %d)\n",(TMR_MAX_ENTRY-1));
        pChar = dbg_set_tmr_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    errno = 0;
    val = (int) strtol(argv[2], (char **) NULL, 10);
    if (errno != 0) {
        pChar += sprintf(pChar,"bad value %s\n",argv[2]);
        pChar = dbg_set_tmr_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    if (rozofs_tmr_configure(timer_id,val) < 0)
    {
        pChar += sprintf(pChar,"timer value out of range\n");
        pChar = dbg_set_tmr_help(pChar);
        uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
        return;
    }
    uma_dbg_send(tcpRef, bufRef, TRUE, "Success\n");
}
Example #29
0
/**
*   Storage statistics

  @param argv : standard argv[] params of debug callback
  @param tcpRef : reference of the TCP debug connection
  @param bufRef : reference of an output buffer 
  
  @retval none
*/
void show_vfstat_stor(char * argv[], uint32_t tcpRef, void *bufRef) {
    char *pbuf = uma_dbg_get_buffer();
    int i,j;

    pbuf = show_file_distibution_rule(pbuf);

    for (i = 0; i < gprofiler->nb_volumes; i++) {
 
        pbuf+=sprintf(pbuf, "\n%-6s | %-6s | %-6s | %-6s | %-20s | %-20s | %-8s | %-10s |\n","Vid", "Cid", "Sid", "Status", "Capacity(B)","Free(B)","Free(%)","Admin");
        pbuf+=sprintf(pbuf, "-------+--------+--------+--------+----------------------+----------------------+----------+------------+\n");
        for (j = 0; j < gprofiler->vstats[i].nb_storages; j++) {
            pbuf+=sprintf(pbuf, "%6d | %6d | %6d | %-6s | %20"PRIu64" | %20"PRIu64" | %8d | %-10s |\n",
                   gprofiler->vstats[i].vid,gprofiler->vstats[i].sstats[j].cid,
                   gprofiler->vstats[i].sstats[j].sid,
                   (gprofiler->vstats[i].sstats[j].status & 0x1)?"UP":"DOWN", 
                   gprofiler->vstats[i].sstats[j].size,
                   gprofiler->vstats[i].sstats[j].free,
                   (int)((gprofiler->vstats[i].sstats[j].size==0)? 0:gprofiler->vstats[i].sstats[j].free*100/gprofiler->vstats[i].sstats[j].size),
                   rozofs_cluster_admin_status_e2String(gprofiler->vstats[i].sstats[j].status>>4));
        }
	if (gprofiler->vstats[i].georep)
	{
        pbuf+=sprintf(pbuf, "-------+--------+--------+--------+----------------------+----------------------+----------+\n");
	  int k = gprofiler->vstats[i].nb_storages;
          for (j = 0; j < gprofiler->vstats[i].nb_storages; j++) {
            pbuf+=sprintf(pbuf, "%6d | %6d | %6d | %-6s | %20"PRIu64" | %20"PRIu64" | %8d | %-10s |\n",
                   gprofiler->vstats[i].vid,gprofiler->vstats[i].sstats[j+k].cid,
                   gprofiler->vstats[i].sstats[j+k].sid,
                   (gprofiler->vstats[i].sstats[j+k].status & 0x1)?"UP":"DOWN", 
                   gprofiler->vstats[i].sstats[j+k].size,
                   gprofiler->vstats[i].sstats[j+k].free,
                   (int)((gprofiler->vstats[i].sstats[j+k].size==0)? 0:gprofiler->vstats[i].sstats[j+k].free*100/gprofiler->vstats[i].sstats[j+k].size),
                   rozofs_cluster_admin_status_e2String(gprofiler->vstats[i].sstats[j].status>>4));

          }
	}
        pbuf+=sprintf(pbuf, "\n");
    }
Example #30
0
void dbg_show_tmr(char * argv[], uint32_t tcpRef, void *bufRef)
{

    rozofs_tmr_display(uma_dbg_get_buffer());
    uma_dbg_send(tcpRef, bufRef, TRUE, uma_dbg_get_buffer());
}