8 |
use Regexp::Common qw/net/; |
use Regexp::Common qw/net/; |
9 |
use lib 'lib'; |
use lib 'lib'; |
10 |
use VZ; |
use VZ; |
11 |
|
use Getopt::Long; |
12 |
|
|
13 |
# default debian distribution |
# default debian distribution |
14 |
my $dist = 'etch'; |
my $dist = 'etch'; |
16 |
my $debian_mirror_uri = 'http://www.debian.org/debian'; |
my $debian_mirror_uri = 'http://www.debian.org/debian'; |
17 |
my $arh = 'i386'; |
my $arh = 'i386'; |
18 |
# split physicial machine in how meny virtual ones? |
# split physicial machine in how meny virtual ones? |
19 |
my $ve_total = 4; |
my $split = 4; |
20 |
# swap size (Mb) |
# swap size (Mb) |
21 |
my $swap_size = 512; |
my $swap_size = 512; |
22 |
# diskspace |
# diskspace |
23 |
my $diskspace = '2G:4G'; |
my $diskspace = '2G:4G'; |
24 |
|
|
25 |
$dist = 'testing'; |
$dist = 'lenny'; |
26 |
$arh = 'amd64'; |
$arh = 'amd64'; |
27 |
|
|
28 |
|
GetOptions( |
29 |
|
'dist=s' => \$dist, |
30 |
|
'arh=s' => \$arh, |
31 |
|
'mirror=s' => \$debian_mirror_uri, |
32 |
|
'split=i' => \$split, |
33 |
|
); |
34 |
|
|
35 |
check_root; |
check_root; |
36 |
|
|
37 |
my $config_file = $0; |
my $config_file = $0; |
102 |
if (-e $conf_path) { |
if (-e $conf_path) { |
103 |
warn "$conf_path allready exists, not touching it\n"; |
warn "$conf_path allready exists, not touching it\n"; |
104 |
} else { |
} else { |
105 |
vzsplit('-n', $ve_total, '-s', $swap_size * 1024, '>', $conf_path); |
vzsplit('-n', $split, '-s', $swap_size * 1024, '>', $conf_path); |
106 |
|
|
107 |
die "configuration file not created" unless -e $conf_path; |
die "configuration file not created" unless -e $conf_path; |
108 |
|
|
147 |
vzctl('set', $ve_id, '--userpasswd', "$login:$passwd" ); |
vzctl('set', $ve_id, '--userpasswd', "$login:$passwd" ); |
148 |
} |
} |
149 |
|
|
150 |
|
runscript( $ve_id, 'custom/50-hypertable.sh' ); |
151 |
print "OK: $ve_id created\n"; |
print "OK: $ve_id created\n"; |