Changeset 2985


Ignore:
Timestamp:
Mar 30, 2012, 2:43:48 AM (8 years ago)
Author:
bruno
Message:

r4608@localhost: bruno | 2012-03-29 20:28:19 +0200

  • Manages grub version at backup time and in the conf file
  • Add traces to debug the mdadm UUID issue
Location:
branches/3.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/mindi

    r2983 r2985  
    10041004    AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.DEVICE bootloader.device $outfile
    10051005    AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.NAME   bootloader.name   $outfile
     1006    AddFileToCfgIfExists $MINDI_TMP/BOOTLOADER.VER    bootloader.ver   $outfile
    10061007    AddFileToCfgIfExists $MINDI_TMP/KEYMAP-LIVES-HERE keymap-lives-here $outfile
    10071008    AddFileToCfgIfExists $MINDI_TMP/TAPEDEV-HAS-DATA-DISKS tapedev-has-data-disks $outfile
  • branches/3.0/mondo/src/common/libmondo-archive.c

    r2971 r2985  
    517517    char *use_star_sz = NULL;
    518518    char *bootldr_str = NULL;
     519    char *bootldr_ver = NULL;
    519520    char *tape_device = NULL;
    520521    char *last_filelist_number = NULL;
     
    705706                ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
    706707        }
     708        mr_asprintf(&bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));
    707709    } else if (bkpinfo->boot_loader == 'E') {
    708710        mr_asprintf(&bootldr_str, "ELILO");
     
    754756    log_to_screen(tmp);
    755757    mr_free(tmp);
     758    if (bootldr_ver != NULL) {
     759        mr_asprintf(&tmp, "Boot loader version string: %s", bootldr_ver);
     760        log_to_screen(tmp);
     761        mr_free(tmp);
     762    }
    756763
    757764    mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
     
    814821    }
    815822    mr_free(bootldr_str);
     823    mr_free(tmp);
     824
     825    mr_asprintf(&tmp, "%s/BOOTLOADER.VER", bkpinfo->tmpdir);
     826    if (write_one_liner_data_file(tmp, bootldr_ver)) {
     827        res++;
     828        log_msg(1, "%ld: Unable to write one-liner bootloader.ver",
     829                __LINE__);
     830    }
     831    mr_free(bootldr_ver);
    816832    mr_free(tmp);
    817833
  • branches/3.0/mondo/src/mondorestore/mondo-prep.c

    r2984 r2985  
    568568  char *bootdevice;
    569569  char *name;
     570  char *ver;
    570571
    571572  malloc_string(bootdevice);
    572573  malloc_string(name);
     574  malloc_string(ver);
    573575 
    574576  // leave straight away if raidlist is initial or has no entries
     
    592594
    593595  // create device list from normal disks followed by spare ones
    594   mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device);
     596  if (raidlist->el[i].data_disks.el[0].device != NULL) {
     597    mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device);
     598        log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device);
     599  } else {
     600    log_msg(1, "Strange, there are entries but no device");
     601  }
    595602  for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    596603    mr_strcat(devices, " %s", raidlist->el[i].data_disks.el[j].device);
     604    log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[j].device);
    597605  }
    598606  for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    599607    mr_strcat(devices, " %s", raidlist->el[i].spare_disks.el[j].device);
     608    log_msg(4, "Adding spare device %s to list", raidlist->el[i].spare_disks.el[j].device);
    600609  }
     610    log_msg(4, "RAID devices: %s", devices);
    601611  // translate RAID level
    602612  if (raidlist->el[i].raid_level == -2) {
     
    623633        strcpy(name,"NONE");
    624634    }
     635    if (read_cfg_var(g_mondo_cfg_file, "bootloader.ver", ver) != 0) {
     636            log_msg(2, "No bootloader.ver param in %s conf file\n", g_mondo_cfg_file);
     637        strcpy(ver,"NONE");
     638    }
    625639    if (strcmp(name,"GRUB") == 0) {
    626         mr_asprintf(&tmp1, "chroot %s grub --version", MNT_RESTORING);
    627         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(tmp1));
    628         mr_free(tmp1);
    629         if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
     640        if ((strstr(ver, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
    630641            mr_asprintf(&oldmd, "-e 0.90");
    631642            log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device);
     
    641652    mr_free(device);
    642653    mr_free(name);
     654    mr_free(ver);
     655        log_msg(4, "RAID oldmd: %s", oldmd);
    643656
    644657  mr_asprintf(&program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd);
    645658  mr_free(oldmd);
    646659  mr_free(level);
     660        log_msg(4, "cmd built: %s", program);
    647661  // Restoring the UUID stored at backup time of present
    648662  for (v = 0; v++ ; v <= raidlist->el[i].additional_vars.entries) {
     
    659673    }
    660674  }
     675        log_msg(4, "cmd built: %s", program);
    661676  if (raidlist->el[i].parity != -1) {
    662677    switch(raidlist->el[i].parity) {
     
    678693    }
    679694  }
     695        log_msg(4, "cmd built: %s", program);
    680696  if (raidlist->el[i].chunk_size != -1) {
    681697    mr_strcat(program, " --chunk=%d", raidlist->el[i].chunk_size);
     
    684700    mr_strcat(program, " --spare-devices=%d", raidlist->el[i].spare_disks.entries);
    685701  }
     702        log_msg(4, "cmd built: %s", program);
    686703  mr_strcat(program, " %s", devices);
    687704    log_msg(2, "RAID device re-created with the following command:\n%s\n", program);
Note: See TracChangeset for help on using the changeset viewer.