Ignore:
Timestamp:
Feb 8, 2007, 12:10:16 AM (17 years ago)
Author:
Bruno Cornec
Message:

log_msg => mr_msg for main files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/mondorestore/mondo-prep.c

    r1103 r1108  
    8686                    drivelist->el[lino].device, MONDO_WAS_HERE);
    8787            if (!run_program_and_log_output(command, 1)) {
    88                 log_msg(1, "Found MONDO_WAS_HERE marker on drive#%d (%s)",
     88                mr_msg(1, "Found MONDO_WAS_HERE marker on drive#%d (%s)",
    8989                        lino, drivelist->el[lino].device);
    9090                break;
     
    108108                fout = fopen(drivelist->el[lino].device, "w+");
    109109                if (!fout) {
    110                     log_msg(1, "Unable to open+wipe %s",
     110                    mr_msg(1, "Unable to open+wipe %s",
    111111                            drivelist->el[lino].device);
    112112                } else {
    113113                    if (1 != fwrite(buf, blocksize, 1, fout)) {
    114                         log_msg(1, "Failed to wipe %s",
     114                        mr_msg(1, "Failed to wipe %s",
    115115                                drivelist->el[lino].device);
    116116                    } else {
    117                         log_msg(1, "Successfully wiped %s",
     117                        mr_msg(1, "Successfully wiped %s",
    118118                                drivelist->el[lino].device);
    119119                    }
     
    132132    mr_free(command);
    133133    mr_free(tmp);
    134     log_msg(1, "Cool. I didn't have to wipe anything.");
     134    mr_msg(1, "Cool. I didn't have to wipe anything.");
    135135}
    136136
     
    148148        return (-1);
    149149    }
    150     log_msg(5, "Writing string '%s', one char at a time", str);
     150    mr_msg(5, "Writing string '%s', one char at a time", str);
    151151    j = strlen(str);
    152152    for (i = 0; i < j; i++) {
    153         log_msg(6, "Writing %d ('%c')", str[i], str[i]);
     153        mr_msg(6, "Writing %d ('%c')", str[i], str[i]);
    154154        if ((fq = fopen(FDISK_LOG, "a+"))) {
    155155            fputc(str[i], fq);
     
    163163        }
    164164    }
    165     log_msg(5, "Returning");
     165    mr_msg(5, "Returning");
    166166
    167167    return (i);
     
    244244//  do_this_last[0] = '\0';
    245245    iamhere("STARTING");
    246     log_msg(1, "OK, opened i-want-my-lvm. Shutting down LVM volumes...");
     246    mr_msg(1, "OK, opened i-want-my-lvm. Shutting down LVM volumes...");
    247247    if (find_home_of_exe("lvm"))    // found it :) cool
    248248    {
     
    274274    if (just_erase_existing_volumes) {
    275275        paranoid_fclose(fin);
    276         log_msg(1, "Closed i-want-my-lvm. Finished erasing LVMs.");
     276        mr_msg(1, "Closed i-want-my-lvm. Finished erasing LVMs.");
    277277        retval = 0;
    278278        goto end_of_i_want_my_lvm;
    279279    }
    280280
    281     log_msg(1, "OK, rewound i-want-my-lvm. Doing funky stuff...");
     281    mr_msg(1, "OK, rewound i-want-my-lvm. Doing funky stuff...");
    282282    rewind(fin);
    283283    for (fgets(incoming, 512, fin); !feof(fin); fgets(incoming, 512, fin)) {
     
    311311            for (q = tmp; *q > 32; q++);
    312312            *q = '\0';
    313             log_msg(1, "Deleting old entries at /dev/%s", tmp);
     313            mr_msg(1, "Deleting old entries at /dev/%s", tmp);
    314314//             sprintf(command, "%s -f %s", vgremove_sz, tmp);
    315315//             run_program_and_log_output(command, 1);
     
    318318            run_program_and_log_output(vgscan_sz, 1);
    319319            run_program_and_log_output(pvscan_sz, 1);
    320             log_msg(3,
     320            mr_msg(3,
    321321                    "After working around potentially broken i-want-my-lvm, incoming[] is now '%s'",
    322322                    incoming);
     
    332332            res = run_program_and_log_output(command, 5);
    333333        }
    334         log_msg(0, "%s --> %d", command, res);
     334        mr_msg(0, "%s --> %d", command, res);
    335335        if (res > 0) {
    336336            res = 1;
     
    350350            for (p = tmp; *p != '\0' && !isdigit(*p); p++);
    351351            extents = atol(p);
    352             log_msg(5, "p='%s' --> extents=%ld", p, extents);
     352            mr_msg(5, "p='%s' --> extents=%ld", p, extents);
    353353            p = strstr(command, "-L");
    354354            if (!p) {
    355                 log_msg(0, "Fiddlesticks. '%s' returned %d", command, res);
     355                mr_msg(0, "Fiddlesticks. '%s' returned %d", command, res);
    356356            } else {
    357357                if (lvmversion == 2) {
     
    376376                    *(p + i) = ' ';
    377377                }
    378                 log_msg(5, "Retrying with '%s'", command);
     378                mr_msg(5, "Retrying with '%s'", command);
    379379                res = run_program_and_log_output(command, 5);
    380380                if (res > 0) {
     
    384384                    fprintf(g_fprep, "%s\n", command);
    385385                }
    386                 log_msg(0, "%s --> %d", command, res);
     386                mr_msg(0, "%s --> %d", command, res);
    387387                if (!res) {
    388                     log_msg(5, "YAY! This time, it succeeded.");
     388                    mr_msg(5, "YAY! This time, it succeeded.");
    389389                }
    390390            }
    391391        }
    392392        if (strstr(command, "vgcreate")) {
    393             log_msg(0, "In case you're interested...");
     393            mr_msg(0, "In case you're interested...");
    394394            run_program_and_log_output(vgscan_sz, 1);
    395395            run_program_and_log_output(pvscan_sz, 1);
     
    403403    }
    404404    paranoid_fclose(fin);
    405     log_msg(1, "Closed i-want-my-lvm. Finished doing funky stuff.");
     405    mr_msg(1, "Closed i-want-my-lvm. Finished doing funky stuff.");
    406406  end_of_i_want_my_lvm:
    407407    mr_free(tmp);
     
    422422    iamhere("ENDING");
    423423    if (retval > 2) {
    424         log_msg(1, "%d errors. I'm reporting this.", retval);
     424        mr_msg(1, "%d errors. I'm reporting this.", retval);
    425425        return (retval);
    426426    } else {
    427         log_msg(1, "Not many errors. Returning 0.");
     427        mr_msg(1, "Not many errors. Returning 0.");
    428428        return (0);
    429429    }
     
    572572  // leave straight away if raidlist is initial or has no entries
    573573  if (!raidlist || raidlist->entries == 0) {
    574     log_msg(1, "No RAID arrays found.");
     574    mr_msg(1, "No RAID arrays found.");
    575575    return 1;
    576576  } else {
    577     log_msg(1, "%d RAID arrays found.", raidlist->entries);
     577    mr_msg(1, "%d RAID arrays found.", raidlist->entries);
    578578  }
    579579  // find raidlist entry for requested device
     
    583583  // check whether RAID device was found in raidlist
    584584  if (i == raidlist->entries) {
    585     log_msg(1, "RAID device %s not found in list.", device);
     585    mr_msg(1, "RAID device %s not found in list.", device);
    586586    return 1;
    587587  }
     
    809809        }
    810810
    811         log_msg(1, "Making %s", device);
     811        mr_msg(1, "Making %s", device);
    812812        // use mkraid if it exists, otherwise use mdadm
    813813        if (run_program_and_log_output("which mkraid", FALSE)) {
    814814            res = create_raid_device_via_mdadm(raidlist, device);
    815             log_msg(1, "Creating RAID device %s via mdadm returned %d", device, res);
     815            mr_msg(1, "Creating RAID device %s via mdadm returned %d", device, res);
    816816        } else {
    817817            sprintf(program, "mkraid --really-force %s", device);
    818818            res = run_program_and_log_output(program, 1);
    819             log_msg(1, "%s returned %d", program, res);
     819            mr_msg(1, "%s returned %d", program, res);
    820820            system("sync");
    821821            sleep(3);
     
    830830//      sprintf(program, "raidstart %s", device);
    831831//      res = run_program_and_log_output(program, 1);
    832 //      log_msg(1, "%s returned %d", program, res);
     832//      mr_msg(1, "%s returned %d", program, res);
    833833//      system("sync"); sleep(1);
    834834#endif
     
    841841
    842842    if (!strcmp(format, "lvm")) {
    843         log_msg(1, "Don't format %s - it's part of an lvm volume", device);
     843        mr_msg(1, "Don't format %s - it's part of an lvm volume", device);
    844844        mr_free(program);
    845845        mr_free(tmp);
     
    938938// start soft-raids now (because LVM might depend on them)
    939939// ...and for simplicity's sake, let's format them at the same time :)
    940     log_msg(1, "Stopping all RAID devices");
     940    mr_msg(1, "Stopping all RAID devices");
    941941    stop_all_raid_devices(mountlist);
    942942    system("sync");
     
    944944    system("sync");
    945945    sleep(2);
    946     log_msg(1, "Prepare soft-RAIDs");   // prep and format too
     946    mr_msg(1, "Prepare soft-RAIDs");    // prep and format too
    947947    for (lino = 0; lino < mountlist->entries; lino++) {
    948948        me = &mountlist->el[lino];  // the current mountlist entry
    949         log_msg(2, "Examining %s", me->device);
     949        mr_msg(2, "Examining %s", me->device);
    950950        if (!strncmp(me->device, "/dev/md", 7)) {
    951951            if (interactively) {
     
    974974//  sleep(5);
    975975// do LVMs now
    976     log_msg(1, "Creating LVMs");
     976    mr_msg(1, "Creating LVMs");
    977977    if (does_file_exist("/tmp/i-want-my-lvm")) {
    978978        wait_until_software_raids_are_prepped("/proc/mdstat", 100);
     
    991991          }
    992992        if (res) {
    993             log_msg(1, "Vacuum-packing...");
     993            mr_msg(1, "Vacuum-packing...");
    994994*/
    995995        res = do_my_funky_lvm_stuff(FALSE, TRUE);
     
    10131013// do regulars at last
    10141014    sleep(2);                   // woo!
    1015     log_msg(1, "Formatting regulars");
     1015    mr_msg(1, "Formatting regulars");
    10161016    for (lino = 0; lino < mountlist->entries; lino++) {
    10171017        me = &mountlist->el[lino];  // the current mountlist entry
     
    16681668        system("sync");
    16691669        paranoid_pclose(pout_to_fdisk);
    1670         log_msg(0,
     1670        mr_msg(0,
    16711671                "------------------- fdisk.log looks like this ------------------");
    16721672        sprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
    16731673        system(tmp);
    1674         log_msg(0,
     1674        mr_msg(0,
    16751675                "------------------- end of fdisk.log... word! ------------------");
    16761676        sprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
     
    18091809    if (partsize > 0) {
    18101810        if (!strcmp(format, "7")) {
    1811             log_msg(1, "Adding 512K, just in case");
     1811            mr_msg(1, "Adding 512K, just in case");
    18121812            partsize += 512;
    18131813        }
     
    18291829
    18301830    if (pout_to_fdisk) {
    1831         log_msg(1, "Doing the new all-in-one fdisk thing");
    1832         log_msg(1, "output = '%s'", output);
     1831        mr_msg(1, "Doing the new all-in-one fdisk thing");
     1832        mr_msg(1, "output = '%s'", output);
    18331833        fput_string_one_char_at_a_time(pout_to_fdisk, output);
    18341834        fput_string_one_char_at_a_time(pout_to_fdisk, "\n\np\n");
    18351835        strcpy(tmp, last_line_of_file(FDISK_LOG));
    18361836        if (strstr(tmp, " (m ")) {
    1837             log_msg(1, "Successfully created %s%d", drive, partno);
     1837            mr_msg(1, "Successfully created %s%d", drive, partno);
    18381838        } else {
    1839             log_msg(1, "last line = %s", tmp);
    1840             log_msg(1, "Failed to create %s%d; sending 'Enter'...", drive,
     1839            mr_msg(1, "last line = %s", tmp);
     1840            mr_msg(1, "Failed to create %s%d; sending 'Enter'...", drive,
    18411841                    partno);
    18421842        }
    18431843        if (!retval) {
    1844             log_msg(1, "Trying to set %s%d's partition type now", drive,
     1844            mr_msg(1, "Trying to set %s%d's partition type now", drive,
    18451845                    partno);
    18461846            retval =
     
    18481848                                   partsize);
    18491849            if (retval) {
    1850                 log_msg(1, "Failed. Trying again...");
     1850                mr_msg(1, "Failed. Trying again...");
    18511851                retval =
    18521852                    set_partition_type(pout_to_fdisk, drive, partno,
     
    18551855        }
    18561856        if (retval) {
    1857             log_msg(1, "...but failed to set type");
     1857            mr_msg(1, "...but failed to set type");
    18581858        }
    18591859    } else {
     
    19521952        /*      mountlist=&new_mtlist; */
    19531953        /*      extrapolate_mountlist_to_include_raid_partitions(mountlist,orig_mtlist); */
    1954         log_msg(0,
     1954        mr_msg(0,
    19551955                "Mountlist, including the partitions incorporated in RAID devices:-");
    19561956        for (i = 0; i < mountlist->entries; i++) {
    19571957            log_it(mountlist->el[i].device);
    19581958        }
    1959         log_msg(0, "End of mountlist.");
    1960     }
    1961     log_msg(0, "Stopping all LVMs, just in case");
     1959        mr_msg(0, "End of mountlist.");
     1960    }
     1961    mr_msg(0, "Stopping all LVMs, just in case");
    19621962    if (!g_text_mode) {
    19631963        newtSuspend();
     
    19671967        newtResume();
    19681968    }
    1969     log_msg(0, "Stopping all software RAID devices, just in case");
     1969    mr_msg(0, "Stopping all software RAID devices, just in case");
    19701970    stop_all_raid_devices(mountlist);
    1971     log_msg(0, "Done.");
     1971    mr_msg(0, "Done.");
    19721972
    19731973/* 
     
    20932093    sprintf(tmp, "Setting %s's type to %s (%s)", partition, format,
    20942094            partcode);
    2095     log_msg(1, tmp);
     2095    mr_msg(1, tmp);
    20962096    if (partcode[0] != '\0' && strcmp(partcode, "83")) {    /* no need to set type if 83: 83 is default */
    20972097
     
    21012101            if (partno > 1
    21022102                || strstr(last_line_of_file(FDISK_LOG), " (1-4)")) {
    2103                 log_msg(5, "Specifying partno (%d) - yay", partno);
     2103                mr_msg(5, "Specifying partno (%d) - yay", partno);
    21042104                sprintf(tmp, "%d\n", partno);
    21052105                fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    2106                 log_msg(5, "A - last line = '%s'",
     2106                mr_msg(5, "A - last line = '%s'",
    21072107                        last_line_of_file(FDISK_LOG));
    21082108            }
     
    21102110            sprintf(tmp, "%s\n", partcode);
    21112111            fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    2112             log_msg(5, "B - last line = '%s'",
     2112            mr_msg(5, "B - last line = '%s'",
    21132113                    last_line_of_file(FDISK_LOG));
    21142114            fput_string_one_char_at_a_time(pout_to_fdisk, "\n");
    2115             log_msg(5, "C - last line = '%s'",
     2115            mr_msg(5, "C - last line = '%s'",
    21162116                    last_line_of_file(FDISK_LOG));
    21172117
    21182118            strcpy(tmp, last_line_of_file(FDISK_LOG));
    21192119            if (!strstr(tmp, " (m ")) {
    2120                 log_msg(1, "last line = '%s'; part type set failed", tmp);
     2120                mr_msg(1, "last line = '%s'; part type set failed", tmp);
    21212121                res++;
    21222122                fput_string_one_char_at_a_time(pout_to_fdisk, "\n");
     
    21282128            sprintf(command, "parted2fdisk %s >> %s 2>> %s", drive,
    21292129                    MONDO_LOGFILE, MONDO_LOGFILE);
    2130             log_msg(5, "output = '%s'", output);
    2131             log_msg(5, "partno=%d; partcode=%s", partno, partcode);
    2132             log_msg(5, "command = '%s'", command);
     2130            mr_msg(5, "output = '%s'", output);
     2131            mr_msg(5, "partno=%d; partcode=%s", partno, partcode);
     2132            mr_msg(5, "command = '%s'", command);
    21332133            fout = popen(command, "w");
    21342134            if (!fout) {
     
    21802180    sprintf(program, "raidstart %s", raid_device);
    21812181#endif
    2182     log_msg(1, "program = %s", program);
     2182    mr_msg(1, "program = %s", program);
    21832183    res = run_program_and_log_output(program, 1);
    21842184    if (g_fprep) {
     
    21862186    }
    21872187    if (res) {
    2188         log_msg(1, "Warning - failed to start RAID device %s",
     2188        mr_msg(1, "Warning - failed to start RAID device %s",
    21892189                raid_device);
    21902190    }
     
    22292229    }
    22302230#endif
    2231     log_msg(1, "program = %s", program);
     2231    mr_msg(1, "program = %s", program);
    22322232    res = run_program_and_log_output(program, 1);
    22332233    if (g_fprep) {
     
    22352235    }
    22362236    if (res) {
    2237         log_msg(1, "Warning - failed to stop RAID device %s", raid_device);
     2237        mr_msg(1, "Warning - failed to stop RAID device %s", raid_device);
    22382238    }
    22392239    retval += res;
     
    22522252            (mountlist->el[i].device, RAID_DEVICE_STUB,
    22532253             strlen(RAID_DEVICE_STUB))) {
    2254             log_msg(1, "Starting %s", mountlist->el[i].device);
     2254            mr_msg(1, "Starting %s", mountlist->el[i].device);
    22552255            res = start_raid_device(mountlist->el[i].device);
    22562256            retval += res;
     
    22582258    }
    22592259    if (retval) {
    2260         log_msg(1, "Started all s/w raid devices OK");
     2260        mr_msg(1, "Started all s/w raid devices OK");
    22612261    } else {
    2262         log_msg(1, "Failed to start some/all s/w raid devices");
     2262        mr_msg(1, "Failed to start some/all s/w raid devices");
    22632263    }
    22642264    return (retval);
     
    23362336    paranoid_fclose(fin);
    23372337    if (retval) {
    2338         log_msg(1, "Warning - unable to stop some RAID devices");
     2338        mr_msg(1, "Warning - unable to stop some RAID devices");
    23392339    }
    23402340    mr_free(dev);
     
    25502550
    25512551        if (!strcmp(drivemntlist->el[partno]->mountpoint, "image")) {
    2552             log_msg(1, "Skipping %s (%s) because it's an image",
     2552            mr_msg(1, "Skipping %s (%s) because it's an image",
    25532553                    drivemntlist->el[partno]->device,
    25542554                    drivemntlist->el[partno]->mountpoint);
     
    26272627    assert(drivemntlist != NULL);
    26282628
    2629     log_msg(1, "Creating list of partitions for drive %s", drive_name);
     2629    mr_msg(1, "Creating list of partitions for drive %s", drive_name);
    26302630
    26312631    tmp_drive_name = strdup(drive_name);
Note: See TracChangeset for help on using the changeset viewer.