From 416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Thu, 2 Sep 2010 17:50:49 +0200 Subject: change dir structure --- src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm | 87 +++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm (limited to 'src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm') diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm b/src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm new file mode 100644 index 00000000..58378751 --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm @@ -0,0 +1,87 @@ +# Copyright (c) 2006, 2007 - 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/ +# ----------------------------------------------------------------------------- +# NBD.pm +# - provides NBD+Squashfs-specific overrides of the +# OpenSLX::OSExport::BlockDevice API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::BlockDevice::NBD; + +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; + +################################################################################ +### interface methods +################################################################################ +sub new +{ + my $class = shift; + my $self = {'name' => 'nbd',}; + return bless $self, $class; +} + +sub getExportPort +{ + my $self = shift; + my $openslxDB = shift; + + return $openslxDB->incrementGlobalCounter('next-nbd-server-port'); +} + +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}); + + return "nbd://$server"; +} + +sub requiredBlockDeviceModules +{ + my $self = shift; + + return qw( nbd ); +} + +sub requiredBlockDeviceTools +{ + my $self = shift; + + return qw( nbd-client ); +} + +sub showExportConfigInfo +{ + my $self = shift; + my $export = shift; + + print(('#' x 80) . "\n"); + print _tr( + "Please make sure you start a corresponding nbd-server:\n\t%s\n", + "nbd-server $export->{port} $self->{fs}->{'export-path'} -r" + ); + print(('#' x 80) . "\n"); + return; +} + +1; -- cgit v1.2.3-55-g7522