mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Uses a simpler test for UUID change.
This commit is contained in:
parent
1973c32f30
commit
2a9430e439
1 changed files with 10 additions and 10 deletions
20
state.c
20
state.c
|
|
@ -710,25 +710,25 @@ static void state_map(struct snapraid_state* state)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (map->uuid[0] != 0) {
|
||||
if (strcmp(uuid, map->uuid) != 0) {
|
||||
/* if the uuid is changed */
|
||||
if (strcmp(uuid, map->uuid) != 0) {
|
||||
/* if the previous uuid is available */
|
||||
if (map->uuid[0] != 0) {
|
||||
/* count the number of uuid change */
|
||||
++uuid_mismatch;
|
||||
fprintf(stderr, "UUID change for disk '%s' from '%s' to '%s'\n", disk->name, map->uuid, uuid);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(uuid, map->uuid) != 0) {
|
||||
/* rewrite if the uuid changes */
|
||||
/* update the uuid in the mapping, */
|
||||
pathcpy(map->uuid, sizeof(map->uuid), uuid);
|
||||
|
||||
/* write the new state with the new uuid */
|
||||
state->need_write = 1;
|
||||
}
|
||||
|
||||
/* update the uuid in the mapping, */
|
||||
/* even if it's already present because it may be changed */
|
||||
pathcpy(map->uuid, sizeof(map->uuid), uuid);
|
||||
}
|
||||
|
||||
if (!state->force_uuid && uuid_mismatch > state->level) {
|
||||
fprintf(stderr, "Some disks have UUID changed from the latest 'sync'.\n");
|
||||
fprintf(stderr, "Too many disks have UUID changed from the latest 'sync'.\n");
|
||||
fprintf(stderr, "If this happens because you really replaced them,\n");
|
||||
fprintf(stderr, "you can '%s' anyway, using 'snapraid --force-uuid %s'.\n", state->command, state->command);
|
||||
fprintf(stderr, "Instead, it's possible that you messed up the disk mount points,\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue