[pve-devel] [PATCH 1/5] vm_start : attach loop devices for non rootfs mountpoint

Alexandre DERUMIER aderumier at odiso.com
Mon Aug 17 20:26:36 CEST 2015


>>So it is no longer possible to start such containers using lxc-start?

mmm, activate could be done could be done in a pre-start hook.

But I need to access real device devices path to configure lxc.cgroup.devices.allow, and lxc.mount.entry for subvol, so before lxc-start.


----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Lundi 17 Août 2015 16:42:49
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non rootfs mountpoint

So it is no longer possible to start such containers using lxc-start? 


> On August 17, 2015 at 3:18 PM Alexandre Derumier <aderumier at odiso.com> wrote: 
> 
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> --- 
> src/PVE/API2/LXC.pm | 14 +++++++++++++- 
> 1 file changed, 13 insertions(+), 1 deletion(-) 
> 
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm 
> index 7eb0afb..b395af3 100644 
> --- a/src/PVE/API2/LXC.pm 
> +++ b/src/PVE/API2/LXC.pm 
> @@ -1007,7 +1007,19 @@ __PACKAGE__->register_method({ 
> 
> PVE::LXC::foreach_mountpoint($conf, sub { 
> my ($ms, $mountpoint) = @_; 
> - PVE::Storage::activate_volumes($storage_cfg, [$mountpoint->{volume}]); 
> + 
> + my $volid = $mountpoint->{volume}; 
> + PVE::Storage::activate_volumes($storage_cfg, [$volid]); 
> + 
> + my ($storage, $volname) = PVE::Storage::parse_volume_id($volid); 
> + my $scfg = PVE::Storage::storage_config($storage_cfg, $storage); 
> + my ($vtype, undef, undef, undef, undef, $isBase, $format) = 
> + PVE::Storage::parse_volname($storage_cfg, $volid); 
> + 
> + if($ms ne 'rootfs' && $format ne 'subvol' && ($scfg->{type} eq 'dir' || 
> $scfg->{type} eq 'nfs')) { 
> + my $path = PVE::Storage::path($storage_cfg, $volid); 
> + PVE::Tools::run_command(['losetup', '--find', '--show', $path]); 
> + } 
> }); 
> 
> PVE::LXC::update_lxc_config($storage_cfg, $vmid, $conf); 



More information about the pve-devel mailing list