Changeset 2048


Ignore:
Timestamp:
Oct 22, 2008, 6:53:57 PM (12 years ago)
Author:
Bruno Cornec
Message:

Remove monitas code from tree

Location:
branches/2.2.8
Files:
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.8/mondo/src/common/libmondo-files.c

    r1836 r2048  
    793793    paranoid_fclose(fin);
    794794    return (matches);
    795 }
    796 
    797 
    798 
    799 
    800 /**
    801  * Register our PID in a file in /var/run.
    802  * The PID will be put in /var/run/monitas-<tt>name_str</tt>.pid.
    803  * @param pid 0 to remove file, anything else to create it.
    804  * @param name_str The basename of the PID file (e.g. "mondo" or "server")
    805  * @note This function does not provide support against multiple instances, unless you check for that yourself.
    806  */
    807 void register_pid(pid_t pid, char *name_str)
    808 {
    809     char tmp[MAX_STR_LEN + 1], lockfile_fname[MAX_STR_LEN + 1];
    810     int res;
    811     FILE *fin;
    812 
    813     sprintf(lockfile_fname, "/var/run/monitas-%s.pid", name_str);
    814     if (!pid) {
    815         log_it("Unregistering PID");
    816         if (unlink(lockfile_fname)) {
    817             log_it("Error unregistering PID");
    818         }
    819         return;
    820     }
    821     if (does_file_exist(lockfile_fname)) {
    822         tmp[0] = '\0';
    823         if ((fin = fopen(lockfile_fname, "r"))) {
    824             (void) fgets(tmp, MAX_STR_LEN, fin);
    825             paranoid_fclose(fin);
    826         } else {
    827             log_OS_error("Unable to openin lockfile_fname");
    828         }
    829         pid = (pid_t) atol(tmp);
    830         sprintf(tmp, "ps %ld > /dev/null 2> /dev/null", (long int) pid);
    831         res = system(tmp);
    832         if (!res) {
    833             log_it
    834                 ("I believe the daemon is already running. If it isn't, please delete %s and try again.",
    835                  lockfile_fname);
    836         }
    837     }
    838     sprintf(tmp, "echo %ld > %s 2> /dev/null", (long int) getpid(),
    839             lockfile_fname);
    840     if (system(tmp)) {
    841         fatal_error("Cannot register PID");
    842     }
    843795}
    844796
  • branches/2.2.8/mondo/src/mondorestore/mondo-restore-EXT.h

    r1931 r2048  
    6363                                            struct s_node *);
    6464extern int restore_everything(struct s_node *);
    65 extern int restore_live_from_monitas_server(char *,
    66                                             char *, char *);
    6765extern int restore_to_live_filesystem();
    6866extern void swap_mountlist_entries(struct mountlist_itself *, int, int);
  • branches/2.2.8/mondo/src/mondorestore/mondo-restore.h

    r1647 r2048  
    3737int restore_all_tarballs_from_stream(struct s_node *);
    3838int restore_everything(struct s_node *);
    39 int restore_live_from_monitas_server(char *, char *,
    40                                      char *);
    4139int restore_to_live_filesystem();
    4240void swap_mountlist_entries(struct mountlist_itself *, int, int);
  • branches/2.2.8/mondo/src/mondorestore/mondorestore.c

    r2030 r2048  
    27262726
    27272727
    2728 
    2729 /**
    2730  * @brief Haha. You wish! (This function is not implemented :-)
    2731  */
    2732 int
    2733 restore_live_from_monitas_server(char *monitas_device,
    2734                                  char *restore_this_directory,
    2735                                  char *restore_here)
    2736      /* NB: bkpinfo hasn't been populated yet, except for ->tmp which is "/tmp" */
    2737 {
    2738     FILE *fout;
    2739     int retval = 0;
    2740     int i;
    2741     int j;
    2742     struct mountlist_itself the_mountlist;
    2743     static struct raidlist_itself the_raidlist;
    2744   /** malloc **/
    2745     char tmp[MAX_STR_LEN + 1];
    2746     char command[MAX_STR_LEN + 1];
    2747     char datablock[256 * 1024];
    2748     char datadisks_fname[MAX_STR_LEN + 1];
    2749     long k;
    2750     long length;
    2751     long long llt;
    2752     struct s_node *filelist = NULL;
    2753     assert(bkpinfo != NULL);
    2754     assert_string_is_neither_NULL_nor_zerolength(monitas_device);
    2755     assert(restore_this_directory != NULL);
    2756     assert(restore_here != NULL);
    2757 
    2758     sprintf(tmp, "restore_here = '%s'", restore_here);
    2759 
    2760     log_msg(2, tmp);
    2761 
    2762     log_msg(2, "restore_live_from_monitas_server() - starting");
    2763     unlink("/tmp/mountlist.txt");
    2764     unlink("/tmp/filelist.full");
    2765     unlink("/tmp/biggielist.txt");
    2766     if (restore_here[0] == '\0') {
    2767         strcpy(bkpinfo->restore_path, MNT_RESTORING);
    2768     } else {
    2769         strcpy(bkpinfo->restore_path, restore_here);
    2770     }
    2771     log_msg(3, "FYI FYI FYI FYI FYI FYI FYI FYI FYI FYI FYI");
    2772     sprintf(tmp, "FYI - data will be restored to %s",
    2773             bkpinfo->restore_path);
    2774     log_msg(3, tmp);
    2775     log_msg(3, "FYI FYI FYI FYI FYI FYI FYI FYI FYI FYI FYI");
    2776     sprintf(datadisks_fname, "/tmp/mondorestore.datadisks.%d",
    2777             (int) (random() % 32768));
    2778     chdir(bkpinfo->tmpdir);
    2779 
    2780     sprintf(command, "cat %s", monitas_device);
    2781     g_tape_stream = popen(command, "r");    // for compatibility with openin_tape()
    2782     if (!(fout = fopen(datadisks_fname, "w"))) {
    2783         log_OS_error(datadisks_fname);
    2784         return (1);
    2785     }
    2786     for (i = 0; i < 32; i++) {
    2787         for (j = 0; j < 4; j++) {
    2788             for (length = k = 0; length < 256 * 1024; length += k) {
    2789                 k = fread(datablock + length, 1, 256 * 1024 - length,
    2790                           g_tape_stream);
    2791             }
    2792             fwrite(datablock, 1, length, fout);
    2793             g_tape_posK += length;
    2794         }
    2795     }
    2796     paranoid_fclose(fout);
    2797     sprintf(command,
    2798             "tar -zxvf %s ./tmp/mondo-restore.cfg ./tmp/mountlist.txt ./tmp/filelist.full ./tmp/biggielist.txt",
    2799             datadisks_fname);
    2800     run_program_and_log_output(command, 4);
    2801     read_header_block_from_stream(&llt, tmp, &i);
    2802     read_header_block_from_stream(&llt, tmp, &i);
    2803 
    2804     unlink(datadisks_fname);
    2805     read_cfg_file_into_bkpinfo(g_mondo_cfg_file);
    2806     retval = load_mountlist(&the_mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo   strcpy(bkpinfo->media_device, monitas_device);
    2807 
    2808 
    2809     load_raidtab_into_raidlist(&the_raidlist, RAIDTAB_FNAME);
    2810     iamhere("FIXME");
    2811     fatal_error("This will fail");
    2812     sprintf(command,
    2813             "grep -E '^%s.*$' %s > %s",
    2814             restore_this_directory, g_filelist_full, g_filelist_full);
    2815     if (system(command)) {
    2816         retval++;
    2817         log_to_screen
    2818             ("Error(s) occurred while processing filelist and wildcard");
    2819     }
    2820     iamhere("FIXME");
    2821     fatal_error("This will fail");
    2822     sprintf(command,
    2823             "grep -E '^%s.*$' %s > %s",
    2824             restore_this_directory, g_biggielist_txt, g_biggielist_txt);
    2825     if (system(command)) {
    2826         log_msg(1,
    2827                 "Error(s) occurred while processing biggielist and wildcard");
    2828     }
    2829     sprintf(command, "touch %s", g_biggielist_txt);
    2830     run_program_and_log_output(command, FALSE);
    2831 //  filelist = load_filelist(g_filelist_restthese);  // FIXME --- this probably doesn't work because it doesn't include the biggiefiles
    2832     retval += restore_everything(filelist);
    2833     free_filelist(filelist);
    2834     log_msg(2, "--------End of restore_live_from_monitas_server--------");
    2835     return (retval);
    2836 }
    2837 
    2838 /**************************************************************************
    2839  *END_RESTORE_LIVE_FROM_MONITAS_SERVER                                    *
    2840  **************************************************************************/
    2841 
    2842 
    2843 
    2844 
    28452728extern void wait_until_software_raids_are_prepped(char *, int);
    28462729
     
    31843067            g_restoring_live_from_nfs = TRUE;
    31853068        }
    3186         if (argc == 5 && strcmp(argv[1], "--monitas-live") == 0) {
    3187             retval =
    3188                 restore_live_from_monitas_server(argv[2],
    3189                                                 argv[3], argv[4]);
    3190         } else {
    3191             log_msg(2, "Calling restore_to_live_filesystem()");
    3192             retval = restore_to_live_filesystem();
    3193         }
     3069        log_msg(2, "Calling restore_to_live_filesystem()");
     3070        retval = restore_to_live_filesystem();
     3071
    31943072        log_msg(2, "Still here. Yay.");
    31953073        if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) {
Note: See TracChangeset for help on using the changeset viewer.