]> git.proxmox.com Git - pve-container.git/commitdiff
mountpoint: add support for host /dev/xxx block device passthrough
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 18 Aug 2015 08:24:24 +0000 (10:24 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 19 Aug 2015 04:40:11 +0000 (06:40 +0200)
example:
mp0: volume=/dev/sda,mp=/home/

Fix this request:
http://forum.proxmox.com/threads/23256-LXC-Cannot-assign-a-block-device-to-container

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
src/PVE/LXC.pm
src/lxc-pve-mount-hook
src/lxc-pve-prestart-hook

index bedf98bea99c9d06418d3b66f392f04a2e037aa8..8ed2bdbe6c451bb2dd029fa2dbe1c7cce43bb3a9 100644 (file)
@@ -996,7 +996,7 @@ sub update_lxc_config {
        my ($ms, $mountpoint) = @_;
 
        my $volid = $mountpoint->{volume};
-       return if !$volid;
+       return if !$volid || $volid =~ m|^/dev/.+|;
 
        my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
 
index 11aeb015747503c209b3bc83cfc112588ed58ef5..cae4eaab58aa52fd48c485d45820ee859c1b86d1 100755 (executable)
@@ -94,6 +94,11 @@ __PACKAGE__->register_method ({
            my $volid = $mountpoint->{volume};
            return if !$volid;
 
+           if ($volid =~ m|^/dev/.+| && $mountpoint->{mp} && $ms ne 'rootfs') {
+               PVE::Tools::run_command(['mount', $volid, "$rootdir$mountpoint->{mp}"]);
+               return;
+           }
+
            my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);
 
            my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
index 6f8a775a9e829e4c719356d7c862e06d876d3f1f..312a5d1b92e4c75791620747f14e31e7c2a8b08e 100755 (executable)
@@ -83,6 +83,8 @@ __PACKAGE__->register_method ({
            my ($ms, $mountpoint) = @_;
 
            my $volid = $mountpoint->{volume};
+           return if !$volid || $volid =~ m|^/dev/.+|;
+
            PVE::Storage::activate_volumes($storage_cfg, [$volid]);
 
            my ($storage, $volname) = PVE::Storage::parse_volume_id($volid);