31,34c31,34
< #   _read_partition_info_and_prepare_soft_raid_devs -AR-  
< #   _read_partition_info_and_prepare_pvcreate_commands -AR- -MC-
< #   _write_lvm_groups_commands -AR- -MC-
< #   _write_lvm_volumes_commands -AR- -MC-
---
> #   _read_partition_info_and_prepare_soft_raid_devs -AR- 
> #   _read_partition_info_and_prepare_pvcreate_commands -AR-
> #   _write_lvm_groups_commands -AR-
> #   _write_lvm_volumes_commands -AR-
943,949c943
<                                     
<                                     # If recreate attribute eq "no" in any LV, Don't Touch PV ! -MC-
<                                     my $donotrecreate=0;					
<                                     foreach my $lv (@{$lvm_group_name->{lv}}) {
<                                         my $lv_recreate = $lv->{recreate} if defined $lv->{recreate};
< 					$donotrecreate=1 if ((defined($lv_recreate))&&($lv_recreate eq "no"));
<                                     }                                    
---
> 
951,965c945,946
< 				    
<                                     if ($donotrecreate) {	
<                                         my $precmd = "pvdisplay -c $part >/dev/null 2>&1"; 
< 
<                                         my $cond = "if [ \$? -gt 0 ];then ";
<                                         $cmd=$cond.$cmd.";fi"; 
< 					
< 					$cmd="$precmd;$cmd";
<                                         print $out qq(logmsg "$cmd"\n);
<                                         print $out "$cmd\n";
<                                     } else {
<                                     
<                                         print $out qq(logmsg "$cmd"\n);
<                                         print $out "$cmd\n";
<                                     }
---
>                                     print $out qq(logmsg "$cmd"\n);
>                                     print $out "$cmd\n";
994,1000d974
< 
<                     # If recreate attribute eq "no" in any LV, Don't Touch PV ! -MC-
<                     my $donotrecreate=0;
<                     foreach my $lv (@{$lvm_group_name->{lv}}) {
<                         my $lv_recreate = $lv->{recreate} if defined $lv->{recreate};
<                         $donotrecreate=1 if ((defined($lv_recreate))&&($lv_recreate eq "no"));
<                     }
1002,1016c976,977
< 
<                     if ($donotrecreate) {
<                         my $precmd = "pvdisplay -c $md >/dev/null 2>&1";
< 
<                         my $cond = "if [ \$? -gt 0 ];then ";
<                         $cmd=$cond.$cmd.";fi";
< 
< 			$cmd="$precmd;$cmd";
<                         print $out qq(logmsg "$cmd"\n);
<                         print $out "$cmd\n";
<                     } else {
<                                     
<                         print $out qq(logmsg "$cmd"\n);
<                         print $out "$cmd\n";
<                     }
---
>                     print $out qq(logmsg "$cmd"\n);
>                     print $out "$cmd\n";
1112,1142c1073
<                 #$cmd = "lvremove -f /dev/${group_name} >/dev/null 2>&1 && vgremove $group_name >/dev/null 2>&1";
< 
<                 #Remove only LV with recreate ne "no" -MC-
< 
<                 # If recreate attribute eq "no" in any LV, Don't Touch LV ! -MC-
<                 # else remove it
<                 foreach my $lv (@{$lvm->{lvm_group}->{$group_name}->{lv}}) {
< 		    my $lv_name = $lv->{name};
<                     my $lv_recreate = $lv->{recreate};
<                     unless ((defined($lv_recreate))&&($lv_recreate eq "no")) {
<                         $cmd = "lvremove -f /dev/${group_name}/${lv_name} &> /dev/null || shellout";
<                         my $precmd = "lvdisplay -c /dev/${group_name}/${lv_name} >/dev/null 2>&1";
< 
< 
<                         my $cond = "if [ \$? -eq 0 ];then ";
<                         $cmd = $cond.$cmd.";fi";
< 
< 			$cmd="$precmd;$cmd";
<                         print $out qq(logmsg "$cmd"\n);
<                         print $out "$cmd\n"; 							
<                     }
<                 }
< 		#remove VG if it exists and it's empty
<                 $cmd = "vgremove $group_name >/dev/null 2>&1 || shellout";
< 		my $precmd = "lvdisplay -c /dev/${group_name} >/dev/null 2>&1 && ! ( lvdisplay -c /dev/${group_name} | grep -c /dev/${group_name} >/dev/null 2>&1 )";
< 
< 
<                 my $cond = "if [ \$? -eq 0 ];then ";
<                 $cmd = $cond.$cmd.";fi";
<  
< 		$cmd="$precmd;$cmd";
---
>                 $cmd = "lvremove -f /dev/${group_name} >/dev/null 2>&1 && vgremove $group_name >/dev/null 2>&1";
1144,1146c1075,1076
<                 print $out "$cmd\n"; 							
< 		
<                 # Write the command to create the volume group if not exists -MC-
---
>                 print $out "$cmd\n";
>                 # Write the command to create the volume group -AR-
1148,1154d1077
<                 $precmd = "lvdisplay -c /dev/${group_name} >/dev/null 2>&1";
< 
< 
<                 $cond = "if [ \$? -ne 0 ];then ";
<                 $cmd = $cond."sleep 10;".$cmd.";fi";
< 
< 		$cmd="$precmd;$cmd";
1205,1211c1128,1131
<             # Check Recreate Option -MC-
<             my $lv_recreate = $lv->{recreate};
<             unless (defined($lv_recreate)&&($lv_recreate eq "no")) { 
<                 # Create the logical volume -AR-
<                 $cmd = "lvcreate $lv_options $lv_size -n $lv_name $group_name || shellout";
<                 print $out qq(logmsg "$cmd"\n);
<                 print $out "$cmd\n";
---
>             # Create the logical volume -AR-
>             $cmd = "lvcreate $lv_options $lv_size -n $lv_name $group_name || shellout";
>             print $out qq(logmsg "$cmd"\n);
>             print $out "$cmd\n";
1213,1233c1133,1136
<                 # Enable the logical volume -AR-
<                 $cmd = "lvscan > /dev/null; lvchange -a y /dev/$group_name/$lv_name || shellout";
<                 print $out qq(logmsg "$cmd"\n);
<                 print $out "$cmd\n";
<             } else {
<                 $cmd = "lvcreate $lv_options $lv_size -n $lv_name $group_name || shellout";
< 		my $precmd = "lvdisplay -c /dev/${group_name}/${lv_name} >/dev/null 2>&1";
< 
< 
<                 my $cond = "if [ \$? -ne 0 ];then ";
<                 $cmd = $cond.$cmd.";fi";
< 
< 		$cmd="$precmd;$cmd";
<                 print $out qq(logmsg "$cmd"\n);
<                 print $out "$cmd\n";
< 
<                 # Enable the logical volume -AR-
<                 $cmd = "lvscan > /dev/null; lvchange -a y /dev/$group_name/$lv_name || shellout";
<                 print $out qq(logmsg "$cmd"\n);
<                 print $out "$cmd\n";
<             }
---
>             # Enable the logical volume -AR-
>             $cmd = "lvscan > /dev/null; lvchange -a y /dev/$group_name/$lv_name || shellout";
>             print $out qq(logmsg "$cmd"\n);
>             print $out "$cmd\n";
