diff options
author | Sebastian Schmelzer | 2012-05-07 21:29:20 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2012-05-07 21:29:20 +0200 |
commit | 0b33859605e3db458beedb51e16063de0e9f8c7b (patch) | |
tree | 05e3a05c0523a6a68ad470805bf7cee369804047 /src | |
parent | fix error msgs with spaces in /etc/opt/openslx/settings values (diff) | |
download | core-0b33859605e3db458beedb51e16063de0e9f8c7b.tar.gz core-0b33859605e3db458beedb51e16063de0e9f8c7b.tar.xz core-0b33859605e3db458beedb51e16063de0e9f8c7b.zip |
initial commit: dnbd3 support
Diffstat (limited to 'src')
-rwxr-xr-x | src/initramfs/scripts/init | 12 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/DNBD3.pm | 96 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/Engine.pm | 2 |
3 files changed, 109 insertions, 1 deletions
diff --git a/src/initramfs/scripts/init b/src/initramfs/scripts/init index 08374e7c..b23337c6 100755 --- a/src/initramfs/scripts/init +++ b/src/initramfs/scripts/init @@ -270,7 +270,8 @@ line in $0\nnfsserver=\"${nfsserver}\"\nnfspath=\"${nfspath}\"" \ bldhost=$(uri_token $rootfs server) bldport=$(uri_token $rootfs port) bldrfst=$(uri_token $rootfs path) - bldrfst=${bldrfst#/*} + bldopt=${bldrfst%/*} + bldrfst=${bldrfst##*/} ;; aoe) echo "Not implemented yet" @@ -548,6 +549,15 @@ if [ -n "${bldmod}" ] ; then echo deadline > /sys/block/nbd0/queue/scheduler # echo "32" > /sys/block/nbd0/queue/read_ahead_kb ;; + # dnbd3 by Johann Latocha + dnbd3) + RDEV=/dev/dnbd0 + waitfor "${RDEV}" 20000 || error "$init_nbddev" + i=0 + vid=${${blkopt#/*}%%/*} + rid=${${${blkopt#/*}#*/}%%/*} + dnbd3-client -h $bldhost -p $bldport -d ${RDEV} -v $vid -r $rid + ;; # dnbd2 by Vito Di Leo dnbd2) RDEV=/dev/vnbd0 diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/DNBD3.pm b/src/installer/OpenSLX/OSExport/BlockDevice/DNBD3.pm new file mode 100644 index 00000000..5d8845f8 --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/DNBD3.pm @@ -0,0 +1,96 @@ +# Copyright (c) 2006, 2008 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# DNBD2.pm +# - provides DNBD2+Squashfs-specific overrides of the +# OpenSLX::OSExport::BlockDevice API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::BlockDevice::DNBD3; + +use strict; +use warnings; + +use base qw(OpenSLX::OSExport::BlockDevice::Base); + +use File::Basename; +use OpenSLX::Basics; +use OpenSLX::ConfigDB qw(:support); +use OpenSLX::OSExport::BlockDevice::Base 1; +use OpenSLX::Utils; + +use Data::Dumper; + +################################################################################ +### interface methods +################################################################################ +sub new +{ + my $class = shift; + my $self->{'name'} ='dnbd3'; + return bless $self, $class; +} + +sub generateExportURI +{ + my $self = shift; + my $export = shift; + + my $serverIP = $export->{server_ip} || ''; + my $server + = length($serverIP) ? $serverIP : generatePlaceholderFor('serverip'); + $server .= ":$export->{port}" if length($export->{port}); + + my $vid = $export->{'id'}; + my $rid = 0; + + return "dnbd3://$server/$vid/$rid"; +} + +sub requiredBlockDeviceModules +{ + my $self = shift; + + return qw( dnbd3 ); +} + +sub requiredBlockDeviceTools +{ + my $self = shift; + + #TODO: needs to be fixed!! function doesn't copy tool to initramfs + return qw( dnbd3-client ); +} + +sub showExportConfigInfo +{ + my $self = shift; + my $export = shift; + + print '#' x 80 , "\n", + _tr( + "Please make sure you reload your dnbd3-server after editing the config with:\n\t%s\n", + "dnbd3-server -r\n" + ), + _tr( + "If the dnbd3-server hasn't been started yet, you can start it with:\n\t%s\n", + "dnbd3-server\n" + ), + "Add the following export entry to your dnbd3-server config file\n(/etc/dnbd3-server.conf):\n", + "\n", + "[$self->{'engine'}->{'export-name'}]\n", + "filename=$self->{fs}->{'export-path'}\n", + "servers=\n", + "vid=$export->{'id'}\n", + "rid=1\n\n", + '#' x 80, "\n"; + return; +} + +1; diff --git a/src/installer/OpenSLX/OSExport/Engine.pm b/src/installer/OpenSLX/OSExport/Engine.pm index 5034baa3..d0c9c5d3 100644 --- a/src/installer/OpenSLX/OSExport/Engine.pm +++ b/src/installer/OpenSLX/OSExport/Engine.pm @@ -44,6 +44,7 @@ our ( %supportedExportBlockDevices = ( 'dnbd2' => 'DNBD2', + 'dnbd3' => 'DNBD3', 'nbd' => 'NBD', 'aoe' => 'AoE', ); @@ -52,6 +53,7 @@ our ( 'nfs', 'sqfs-aoe', 'sqfs-dnbd2', + 'sqfs-dnbd3', 'sqfs-nbd', ); |