Doesn't warn about changed UUID for new disks.

This commit is contained in:
Andrea Mazzoleni 2014-01-04 17:42:45 +01:00
parent d7ba004e30
commit a59d2e969e
5 changed files with 13 additions and 1 deletions

View file

@ -1,6 +1,10 @@
SnapRAID HISTORY
================
5.3 2014/1 (BETA)
=================
* Don't warn about UUID changed if it's for an empty disk.
5.2 2013/12
===========
* If a disk changes UUID, automatically disable the inode

1
elem.c
View file

@ -533,6 +533,7 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
disk->has_volatile_inodes = 0;
disk->has_unreliable_physical = 0;
disk->has_different_uuid = 0;
disk->had_empty_uuid = 0;
disk->mapping = -1;
tommy_list_init(&disk->filelist);
tommy_list_init(&disk->deletedlist);

1
elem.h
View file

@ -284,6 +284,7 @@ struct snapraid_disk {
int has_volatile_inodes; /**< If the underline filesystem has not persistent inodes. */
int has_unreliable_physical; /**< If the physical offset of files has duplicates. */
int has_different_uuid; /**< If the disk has a different UUID, meaning that it is not the same filesystem. */
int had_empty_uuid; /**< If the disk had an empty UUID, meaning that it's a new disk. */
int mapping; /**< Index in the mapping vector. Used only as buffer when writing the content file. */
/**<

6
scan.c
View file

@ -1297,7 +1297,11 @@ void state_scan(struct snapraid_state* state, int output)
for(i=state->disklist;i!=0;i=i->next) {
struct snapraid_disk* disk = i->data;
if (disk->has_different_uuid) {
/* don't print the message if the UUID changed because before */
/* if was no set. */
/* this is the normal condition for an empty disk because it */
/* isn't stored */
if (disk->has_different_uuid && !disk->had_empty_uuid) {
if (!done) {
done = 1;
fprintf(stderr, "WARNING! UUID is changed for disks: '%s'", disk->name);

View file

@ -864,6 +864,8 @@ static void state_map(struct snapraid_state* state)
/* 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);
} else {
disk->had_empty_uuid = 1;
}
/* update the uuid in the mapping, */