diff options
Diffstat (limited to 'src/installer/OpenSLX/OSExport/BlockDevice')
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/AoE.pm | 95 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/Base.pm | 77 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm | 91 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/LBD.pm | 76 | ||||
-rw-r--r-- | src/installer/OpenSLX/OSExport/BlockDevice/NBD.pm | 87 |
5 files changed, 426 insertions, 0 deletions
diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/AoE.pm b/src/installer/OpenSLX/OSExport/BlockDevice/AoE.pm new file mode 100644 index 00000000..cc7866b5 --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/AoE.pm @@ -0,0 +1,95 @@ +# 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/ +# ----------------------------------------------------------------------------- +# AoE.pm +# - provides ATA-over-Ethernet specific overrides of the +# OpenSLX::OSExport::BlockDevice API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::BlockDevice::AoE; + +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; + +# +# +# N.B.: currently this is just a stub +# +# + +################################################################################ +### interface methods +################################################################################ +sub new +{ + my $class = shift; + my $self = {'name' => 'aoe',}; + 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 "aoe://$server"; +} + +sub requiredBlockDeviceModules +{ + my $self = shift; + + return qw( aoe ); +} + +sub requiredBlockDeviceTools +{ + my $self = shift; + + # TODO: is there any such tool? + + return; +} + +sub showExportConfigInfo +{ + my $self = shift; + my $export = shift; + + print(('#' x 80) . "\n"); + print _tr( + "Please make sure you start a corresponding aoe-server:\n\t%s\n", + "... (don't know how this is done yet)" + ); + print(('#' x 80) . "\n"); + return; +} + +1; diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/Base.pm b/src/installer/OpenSLX/OSExport/BlockDevice/Base.pm new file mode 100644 index 00000000..6469c2f4 --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/Base.pm @@ -0,0 +1,77 @@ +# 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/ +# ----------------------------------------------------------------------------- +# Base.pm +# - provides empty base of the OpenSLX OSExport::BlockDevice API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::BlockDevice::Base; + +use strict; +use warnings; + +our $VERSION = 1.01; # API-version . implementation-version + +use Scalar::Util qw( weaken ); + +use OpenSLX::Basics; + +################################################################################ +### interface methods +################################################################################ +sub new +{ + confess "Creating OpenSLX::OSExport::BlockDevice::Base-objects directly makes no sense!"; +} + +sub initialize +{ + my $self = shift; + my $engine = shift; + my $fs = shift; + + $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between block-device and its engine + + $self->{'fs'} = $fs; + weaken($self->{'fs'}); + # avoid circular reference between block-device and its file-system +} + +sub getExportPort +{ +} + +sub generateExportURI +{ +} + +sub requiredBlockDeviceModules +{ +} + +sub requiredBlockDeviceTools +{ +} + +sub showExportConfigInfo +{ +} + +1; +################################################################################ + +=pod + +=head1 NAME + +OpenSLX::OSExport::BlockDevice::Base - the base class for all OSExport::BlockDevices + +=cut diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm b/src/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm new file mode 100644 index 00000000..25e112ee --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm @@ -0,0 +1,91 @@ +# 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::DNBD2; + +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' => 'dnbd2',}; + 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 "dnbd2://$server"; +} + +sub requiredBlockDeviceModules +{ + my $self = shift; + + return qw( dnbd2 ); +} + +sub requiredBlockDeviceTools +{ + my $self = shift; + + return qw( ); +} + +sub showExportConfigInfo +{ + my $self = shift; + my $export = shift; + + print '#' x 80 , "\n", + _tr( + "Please make sure you start a corresponding dnbd2-server:\n\t%s\n", + "dnbd2-server /etc/dnbd2/server.conf\n" + ), + "Create or modify a config file like /etc/dnbd2/server.conf, looking like:", + "\n# dnbd2 server configuration\n<server>\n", + "$export->{port}\n", + "$self->{fs}->{'export-path'}\n\n", + '#' x 80, "\n"; + return; +} + +1; diff --git a/src/installer/OpenSLX/OSExport/BlockDevice/LBD.pm b/src/installer/OpenSLX/OSExport/BlockDevice/LBD.pm new file mode 100644 index 00000000..e8df1b04 --- /dev/null +++ b/src/installer/OpenSLX/OSExport/BlockDevice/LBD.pm @@ -0,0 +1,76 @@ +# Copyright (c) 2009 - 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/ +# ----------------------------------------------------------------------------- +# LBD.pm +# - provides the local block devices with Squashfs container specific +# overrides of the OpenSLX::OSExport::BlockDevice API. +# ----------------------------------------------------------------------------- +package OpenSLX::OSExport::BlockDevice::LBD; + +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' => 'LBD',}; + return bless $self, $class; +} + +sub generateExportURI +{ + my $self = shift; + + return "lbd://sda1/squashfs"; +} + +sub requiredBlockDeviceModules +{ + my $self = shift; + + return qw( ehci_hcd usb_storage scsi_mod sd_mod loop ext3 ); +} + +sub requiredBlockDeviceTools +{ + my $self = shift; + + return qw( ); +} + +sub showExportConfigInfo +{ + my $self = shift; + my $export = shift; + + print '#' x 80 , "\n", + _tr( + "Please make sure you copy all corresponding files to your boot\n", + "device you wish to deploy (e.g. bootable USB stick)\n" + ), + "Make your device bootable using syslinux for (v)fat or extlinux for\n", + "ext2/3 partitions. Cat HPA syslinux' mbr to the device very beginning\n", + "and set the boot flag to the partion you made bootable\n\n", + '#' x 80, "\n"; + return; +} + +1; 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; |