Changeset 2984


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

r4607@localhost: bruno | 2012-03-29 16:54:35 +0200

  • Improves create_raid_device_via_mdadm by adding better test of error on conf params setup and also by systematically defining oldmd which wasn't the case for some GRUB cqses, especially when rub commqnd wasn't successful - qs it wasn't launchde chrooted
File:
1 edited

Legend:

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

    r2972 r2984  
    564564  char *program = NULL;
    565565  char *tmp = NULL;
     566  char *tmp1 = NULL;
    566567  char *oldmd = NULL;
    567568  char *bootdevice;
     
    586587    log_msg(1, "RAID device %s not found in list.", device);
    587588    return 1;
     589  } else {
     590    log_msg(1, "RAID device %s found in list (%d).", device, i);
    588591  }
     592
    589593  // create device list from normal disks followed by spare ones
    590594  mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device);
     
    612616  //   2) grub bootloader < v1 is used.
    613617  // Otherwise it won't boot which is bad.
    614     read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice);
    615     read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
     618    if (read_cfg_var(g_mondo_cfg_file, "bootloader.device", bootdevice) != 0) {
     619            log_msg(2, "Unable to find bootloader.device param in %s conf file\n", g_mondo_cfg_file);
     620    }
     621    if (read_cfg_var(g_mondo_cfg_file, "bootloader.name", name) != 0) {
     622            log_msg(2, "Unable to find bootloader.name param in %s conf file\n", g_mondo_cfg_file);
     623        strcpy(name,"NONE");
     624    }
    616625    if (strcmp(name,"GRUB") == 0) {
    617         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("grub --version"));
     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);
    618629        if ((strstr(tmp, "GRUB 0.9") != NULL) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
    619             mr_free(oldmd);
    620630            mr_asprintf(&oldmd, "-e 0.90");
    621631            log_it("Forcing old metadata 0.90 for md on %s for old GRUB", device);
     632        } else {
     633            mr_asprintf(&oldmd, "");
    622634        }
    623635    } else if ((strcmp(name,"LILO") == 0) && (strcmp(raidlist->el[i].raid_device,device) == 0)) {
    624         mr_free(oldmd);
    625636        mr_asprintf(&oldmd, "-e 0.90");
    626637        log_it("Forcing old metadata 0.90 for md on %s for LILO", device);
     
    640651        if (raidlist->el[i].additional_vars.el[v].value != NULL) {
    641652            // force its restoration in order to avoid modifying all conf files using it
     653            log_it("Managing previous UUID %s", raidlist->el[i].additional_vars.el[v].value);
    642654            mr_strcat(program, " --update=uuid --uuid %s",raidlist->el[i].additional_vars.el[v].value);
    643655            break;
     656        } else {
     657            log_it("Unable to manage previous NULL UUID");
    644658        }
    645659    }
     
    671685  }
    672686  mr_strcat(program, " %s", devices);
     687    log_msg(2, "RAID device re-created with the following command:\n%s\n", program);
    673688  res = run_program_and_log_output(program, 1);
    674689  // free memory
     
    814829        paranoid_free(tmp);
    815830
    816 // Shouldn't be necessary.
     831        // Shouldn't be necessary.
    817832        log_to_screen("Stopping %s", device);
    818833        stop_raid_device(device);
Note: See TracChangeset for help on using the changeset viewer.