summaryrefslogtreecommitdiffstats
path: root/src/installer/OpenSLX/OSExport/BlockDevice/DNBD3.pm
blob: e26cb800ca04427b2b67ad20e2f46c908bbe61fd (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
# 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",
    "file=$self->{fs}->{'export-path'}\n",
    "servers=\n",
    "vid=$export->{'id'}\n",
    "rid=1\n\n",
    '#' x 80, "\n";
    return;
}

1;