Joel Becker wrote:
On Thu, Jul 20, 2006 at 07:54:57PM +0200, Andre Brinkmann wrote:
  
Similar to OCFS2, XFS relies on the uniqueness of a serial number. But 
with XFS, I am able to change this uid with a user space admin tool. I 
hope to find (or implement) similar features in OCFS2 to be able to 
support snapshots. I think the possibility to change the uuid is import 
for most storage system. Even hardware RAIDs with integrated snapshots 
will have similar problems.
    

	I find it interesting that you use a modification of the uuid to
handle snapshotting.  Certainly would work for a snapshot of
OCFS2...however, it's also dangerous.  Two OCFS2 nodes absolutely rely
on the uuid to ensure they are heartbeating for the same thing.  So we
cannot safely change the uuid if there is any chance another node is
running on the filesystem (let alone our own node :-).
	Now, your snapshot won't be mounted anywhere, sure, but our
tools won't know a snapshot vs a live filesystem, and will need to make
sure.  That just requires some locking.
	So, I think it is something we can look into as a feature for
tunefs.ocfs2, but it isn't a one-liner and requires some correctness.
	Would you prefer to _set_ the uuid, or just generate a new one?
I'd personally go with the latter (all it needs to do is differ from the
non-snapshot volume), but I wanted to ask your opinion.

Joel

  
Hello Joel,

in my opinion, it is ok to let tunefs change the uuid of a volume. Normally this is done inside a script-chain and
the scripts should know what they are doing. Furthermore, it seems that the security mechanisms inside
tunefs ensure that changes to mounted devices are not possible, if the cluster is online.

I agree with you that it makes no sense to let the user guess a uuid and that tunefs should just generate a new
one. I have played around with your tools to get a better understanding of your tools and ocfs2 and I have created
a patch for the uuid. I have tried to program according to your coding style.

After applying the patches for the Makefile in tunefs.ocfs and for tunefs.c itself, you can generate a new uuid
by setting the -u or the --uuid-reset flag. The uuid is generated according to the method in mkfs.c .

After applying the patch, it has been possible to generate snapshots of ocfs2-volumes in a two node cluster
without any difficulties.

Best Regards

Andre


39c39
<       $(LINK) $(LIBOCFS2_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) 
$(COM_ERR_LIBS)
---
>       $(LINK) $(LIBOCFS2_LIBS) $(UUID_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) 
> $(COM_ERR_LIBS)
46a47
> #include <uuid/uuid.h>
72a74
>         int uuid;
87c89
<                       "\t[-J journal-options] [-S volume-size] [-qvV] "
---
>                       "\t[-J journal-options] [-S volume-size] [-qvuV] "
244a247
>                 { "uuid-reset", 0, 0, 'u'},
257c260
<               c = getopt_long(argc, argv, "L:N:J:S:vqVx", long_options, 
---
>               c = getopt_long(argc, argv, "L:N:J:S:vquVx", long_options, 
305a309,312
>                 case 'u':
>                         opts.uuid = 1;
>                         break;
> 
473a481,512
> 
> static void update_uuid (ocfs2_filesys *fs, int *changed)
> {
>         unsigned char *uuid = OCFS2_RAW_SB(fs->fs_super)->s_uuid;
>       size_t i, max = sizeof(OCFS2_RAW_SB(fs->fs_super)->s_uuid);
>         uuid_t uuid_new;
> 
>         /* print out old uuid of device */
>         printf ("Try to change uuid: \n");
>       for(i = 0; i < max; i++)
>               printf("%02x ", uuid[i]);
> 
>       printf("\n");
> 
>         /* generate new uuid */
>         uuid_generate(uuid_new);   
> 
>       memset (OCFS2_RAW_SB(fs->fs_super)->s_uuid, 0, OCFS2_VOL_UUID_LEN);
>       memcpy (OCFS2_RAW_SB(fs->fs_super)->s_uuid, uuid_new, 
> OCFS2_VOL_UUID_LEN);
>          
>         /* print out new uuid */
>         printf ("New uuid: \n");
>       for(i = 0; i < max; i++)
>               printf("%02x ", uuid[i]);
> 
>         printf("\n");
>        
>         *changed = 1;
> 
>       return ;
> }
> 
555a595
>         int upd_uuid = 0;
676a717,720
>         /* update unique serial number of device has been selected */
>         if (opts.uuid) 
>                 printf (" Change unique serial number of device \n ");
> 
692a737,743
>         /* update the unique serial number */
>         if (opts.uuid) {
>                 update_uuid (fs, &upd_uuid);
>                 if (upd_uuid)
>                         printf ("Changed volume uuid \n");
>         }
> 
729c780
<       if (upd_label || upd_slots || upd_vsize) {
---
>       if (upd_label || upd_slots || upd_vsize || upd_uuid) {
_______________________________________________
Ocfs2-users mailing list
Ocfs2-users@oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-users

Reply via email to