[pve-devel] [PATCH 8/8] add setup_blockdev_mounts to pve-mount hook

Dietmar Maurer dietmar at proxmox.com
Fri Aug 14 16:43:19 CEST 2015



On 08/14/2015 02:56 PM, Alexandre Derumier wrote:
> +sub setup_blockdev_mounts {
> +    my ($self, $vmid) = @_;
> +
> +    my $rootdir = $self->{rootdir};
> +
> +    my $config_filename = "/var/lib/lxc/$vmid/config";

why do you use the raw lxc config here (instead of pve $conf)?
> +    return undef if ! -f $config_filename;
> +    my $raw = PVE::Tools::file_get_contents($config_filename);
> +    my @lines = split(/\n/, $raw);
> +    foreach my $line (@lines) {
> +        if ($line =~ m/lxc\.mount\.entry = (\/dev\/\S+) (\S+)/) {
> +	   PVE::Tools::run_command(['mount', $1, $rootdir.$2]);
> +        }
> +    }
> +}
> +
>   sub setup_systemd_console {
>       my ($self, $conf) = @_;
>   
> @@ -399,6 +414,7 @@ sub pre_start_hook {
>   
>       $self->setup_init($conf);
>       $self->setup_blockdev($vmid);
> +    $self->setup_blockdev_mounts($vmid);
>       $self->setup_network($conf);
>       $self->set_hostname($conf);
>       $self->set_dns($conf);





More information about the pve-devel mailing list