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

Alexandre DERUMIER aderumier at odiso.com
Sat Aug 15 15:30:51 CEST 2015


>>why do you use the raw lxc config here (instead of pve $conf)? 

I don't known why, but I have problems to read/parse storage.cfg  from the hook.

It's return half of the datas.

----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Vendredi 14 Août 2015 16:43:19
Objet: Re: [pve-devel] [PATCH 8/8] add setup_blockdev_mounts to pve-mount hook

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