[pve-devel] [PATCH 1/3] add volid_path

Dietmar Maurer dietmar at proxmox.com
Fri Aug 21 10:03:03 CEST 2015


applied, but I wonder if we should add a check here if krbd flag is set
for rbd storage?

On 08/21/2015 05:14 AM, Alexandre Derumier wrote:
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>   src/PVE/LXC.pm | 36 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 36 insertions(+)
>
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index 3ba8d51..fb54069 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -1867,4 +1867,40 @@ sub check_ct_modify_config_perm {
>       return 1;
>   }
>   
> +
> +sub volid_path {
> +    my ($volid, $ms, $storage_cfg, $loopdevs) = @_;
> +
> +        my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
> +        my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
> +        my $path = PVE::Storage::path($storage_cfg, $volid);
> +
> +        my ($vtype, undef, undef, undef, undef, $isBase, $format) =
> +            PVE::Storage::parse_volname($storage_cfg, $volid);
> +
> +        die "unable to use template as mountpoint\n" if $isBase;
> +
> +        if ($format eq 'subvol') {
> +	    #do nothing
> +        } elsif ($format eq 'raw') {
> +
> +            if ($scfg->{path}) {
> +		if ($ms eq 'rootfs') {
> +		    $path = "loop:$path\n" if $ms eq 'rootfs';
> +		} elsif ($loopdevs) {
> +		    $path = PVE::LXC::find_loopdev($loopdevs, $path) if $loopdevs;
> +		}
> +		
> +            } elsif ($scfg->{type} eq 'drbd' || $scfg->{type} eq 'rbd') {
> +		#do nothing
> +            } else {
> +                die "unsupported storage type '$scfg->{type}'\n";
> +            }
> +        } else {
> +            die "unsupported image format '$format'\n";
> +        }
> +
> +	return $path;
> +
> +}
>   1;





More information about the pve-devel mailing list