summaryrefslogtreecommitdiffstats
path: root/installer/OpenSLX/OSExport/BlockDevice/AoE.pm
blob: 9a7450f5260fa027ba6ea1cbe6d9f2a875bf8935 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 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 initialize
{
	my $self   = shift;
	my $engine = shift;
	my $fs     = shift;    

	$self->{'engine'} = $engine;
	$self->{'fs'}     = $fs;
	return;
}

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;