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

2015-08-18 Thread Alexandre DERUMIER
I have re-tested with subvol, loop and rbd, seem to works fine. (and more clean)


- Mail original -
De: "dietmar" 
À: "aderumier" 
Cc: "pve-devel" 
Envoyé: Mardi 18 Août 2015 07:33:14
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint

> >>OK, I applied the patches - 

I am testing now, an try to apply cleanups when I think I can improve code. 
Please can you test if those patches works for you: 

https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=9459f07d921d224dd6ba059e3d08b29908f01eb6
 
https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=2914ad9b1d577baede7f9ea13f2a8e63f9f12dec
 

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Dietmar Maurer
> >>OK, I applied the patches -

I am testing now, an try to apply cleanups when I think I can improve code.
Please can you test if those patches works for you:

https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=9459f07d921d224dd6ba059e3d08b29908f01eb6
https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=2914ad9b1d577baede7f9ea13f2a8e63f9f12dec

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Alexandre DERUMIER
>>OK, I applied the patches -

Thanks! (and thanks for all your comments)

>> we need to implement all the rest now backup, snapshots, ...)

I'll work on it !


(I'll also add support for disk resize)

- Mail original -
De: "dietmar" 
À: "aderumier" 
Cc: "pve-devel" 
Envoyé: Mardi 18 Août 2015 07:03:38
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint

> I don't write it again in pre-start hook. (I only move activate 
volumes code to pre-start hook , and keep write lxc config in vm_start) 

OK, I applied the patches - we need to implement all the rest now 
(backup, snapshots, ...) 
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Dietmar Maurer
> I don't write it again in pre-start hook. (I only move activate 
volumes code to pre-start hook , and keep write lxc config in vm_start)


OK, I applied the patches - we need to implement all the rest now 
(backup, snapshots, ...)


___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Alexandre DERUMIER
>>AFAIK we write the LXC conf file at create time, and when we do 'pct start'.
>>So there is no real need to rewrite it again in pre-start hook?

I don't write it again in pre-start hook.
(I only move activate volumes code to pre-start hook , and keep write lxc 
config in vm_start) : (patch 4/5)



- Mail original -
De: "dietmar" 
À: "aderumier" 
Cc: "pve-devel" 
Envoyé: Mardi 18 Août 2015 06:32:20
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint

> I Think I can solve lxc.cgroup.devices.allow, by simply writing 
> /sys/fs/cgroup/devices/lxc/VMID/devices.list 
> in hook. 
> 
> So, I can move the activate part to pre_start hook. 

AFAIK we write the LXC conf file at create time, and when we do 'pct start'. 
So there is no real need to rewrite it again in pre-start hook? 
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Dietmar Maurer
> I Think I can solve lxc.cgroup.devices.allow, by simply writing
>  /sys/fs/cgroup/devices/lxc/VMID/devices.list 
> in hook.
> 
> So, I can move the activate part to pre_start hook.

AFAIK we write the LXC conf file at create time, and when we do 'pct start'.
So there is no real need to rewrite it again in pre-start hook?

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Alexandre DERUMIER
I Think I can solve lxc.cgroup.devices.allow, by simply writing  
/sys/fs/cgroup/devices/lxc/VMID/devices.list 
in hook.

So, I can move the activate part to pre_start hook.


I'll do tests today.

- Mail original -
De: "aderumier" 
À: "dietmar" 
Cc: "pve-devel" 
Envoyé: Lundi 17 Août 2015 21:01:18
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint

>> 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. 
>> 
>>That does not work in the pre-start hook? We can configure before, so that it 
>>is 
>>still possible to use lxc-start directly? 

Do you want to rewrite lxc.cgroup.devices.allow (to lxc conf) in pre-start hook 
? 

What is the advantage to use lxc-start ? 


It's still possible to use lxc-start, but you need to mount your 
storage/devices yourself, 
this is the same if you launch qemu manually. 


I think that user shouldn't use lxc-start at all, all custom config should be 
allow in pve conf. 
(something like args for qemu, allow to defined extra lxc keys). 




- Mail original - 
De: "dietmar"  
À: "aderumier"  
Cc: "pve-devel"  
Envoyé: Lundi 17 Août 2015 20:40:46 
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint 

> On August 17, 2015 at 8:26 PM Alexandre DERUMIER  wrote: 
> 
> 
> >>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. 

That does not work in the pre-start hook? We can configure before, so that it 
is 
still possible to use lxc-start directly? 
___ 
pve-devel mailing list 
pve-devel@pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Alexandre DERUMIER
>> 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. 
>>
>>That does not work in the pre-start hook? We can configure before, so that it 
>>is 
>>still possible to use lxc-start directly? 

Do you want to rewrite lxc.cgroup.devices.allow (to lxc conf) in pre-start hook 
?

What is the advantage to use lxc-start ?


It's still possible to use lxc-start, but you need to mount your 
storage/devices yourself,
this is the same if you launch qemu manually.


I think that user shouldn't use lxc-start at all, all custom config should be 
allow in pve conf.
(something like args for qemu, allow to defined extra lxc keys).




- Mail original -
De: "dietmar" 
À: "aderumier" 
Cc: "pve-devel" 
Envoyé: Lundi 17 Août 2015 20:40:46
Objet: Re: [pve-devel] [PATCH 1/5] vm_start : attach loop devices for non 
rootfs mountpoint

> On August 17, 2015 at 8:26 PM Alexandre DERUMIER  wrote: 
> 
> 
> >>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. 

That does not work in the pre-start hook? We can configure before, so that it 
is 
still possible to use lxc-start directly? 
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Dietmar Maurer


> On August 17, 2015 at 8:26 PM Alexandre DERUMIER  wrote:
> 
> 
> >>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.

That does not work in the pre-start hook? We can configure before, so that it is
still possible to use lxc-start directly?

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Alexandre DERUMIER
>>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" 
À: "aderumier" , "pve-devel" 
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  wrote: 
> 
> 
> Signed-off-by: Alexandre Derumier  
> --- 
> 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); 
___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

2015-08-17 Thread Dietmar Maurer
So it is no longer possible to start such containers using lxc-start?


> On August 17, 2015 at 3:18 PM Alexandre Derumier  wrote:
> 
> 
> Signed-off-by: Alexandre Derumier 
> ---
>  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);

___
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel