[pve-devel] [PATCH] Catch error from vgcreate.

Dietmar Maurer dietmar at proxmox.com
Wed Mar 2 17:11:50 CET 2016


comments inline:

> diff --git a/proxinstall b/proxinstall
> index ec15477..7a67623 100755
> --- a/proxinstall
> +++ b/proxinstall
> @@ -834,8 +834,11 @@ sub create_lvm_volumes {
>      # so pe_start is aligned on a 128k boundary (advantage for SSDs)
>      syscmd ("/sbin/pvcreate --metadatasize 250k -y -ff $lvmdev") == 0 ||
>  	die "unable to initialize physical volume $lvmdev";
> -    syscmd ("/sbin/vgcreate pve $lvmdev") == 0 ||

seems we use this pattern everywhere - but syscmd() return 
the output from stdout, not the exit code.

something is wrong with that?!

> -	die "unable to create volume group";
> +
> +    eval { syscmd ("/sbin/vgcreate pve $lvmdev") };
> +    if (my $err = $@) {
> +	die "unable to create volume group: $err";
> +    }
>  
>      my $hdgb = int($os_size/(1024*1024));
>      my $space = (($hdgb > 128) ? 16 : ($hdgb/8))*1024*1024;
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list