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

Remove monitas code from tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.