[DRBD-cvs] user by phil; * drbdadm adjust now handles to setup a ...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Thu, 8 Apr 2004 15:58:59 +0200 (CEST)


DRBD CVS committal

Author  : phil
Project : drbd
Module  : user

Dir     : drbd/user


Modified Files:
      Tag: rel-0_7-branch
	drbdadm_adjust.c 


Log Message:
* drbdadm adjust now handles to setup a completely unconfigured device.
* drbdadm adjust now handles the optional syntax of internal meta-data.


===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm_adjust.c,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -3 -r1.1.2.12 -r1.1.2.13
--- drbdadm_adjust.c	30 Mar 2004 10:01:10 -0000	1.1.2.12
+++ drbdadm_adjust.c	8 Apr 2004 13:58:54 -0000	1.1.2.13
@@ -214,6 +214,14 @@
 
   in=m_popen(&pid,argv);
 
+  rv=fscanf(in,"%[Not] configured",str1);
+  if(rv==1 && !strcmp("Not",str1) ) {
+    do_attach=1;
+    do_connect=1;
+    do_syncer=1;
+    goto do_up;
+  }
+
   rv=m_fscanf(in,"Lower device: %*02d:%*02d   (%[^)])\n",str1);
   if( (rv!=1) || strcmp(str1,res->me->disk)) {
     do_attach=1;
@@ -222,7 +230,8 @@
   rv=m_fscanf(in,"Meta device: %s   (%[^)])\n",str1,str2);
   if(rv==1) {
     if(strcmp("internal",str1)==0) {
-      if(strcmp("internal",res->me->meta_disk)) do_attach=1;
+      if(strcmp("internal",res->me->meta_disk) && 
+	 strcmp(res->me->disk,res->me->meta_disk)) do_attach=1;
     } 
   }
   if(rv==2) {
@@ -292,11 +301,12 @@
     do_syncer |= check_opt_b(in,"skip-sync",res->sync_options);
     do_syncer |= check_opt_b(in,"use-csums",res->sync_options);
     do_syncer |= complete(res->sync_options);
-  }
+  } else do_syncer=1;
 
   fclose(in);
   waitpid(pid,0,0);
 
+ do_up:
   if(do_attach) {
     if( (rv=adm_attach(res,0)) ) return rv;
     do_resize=0;