/[vz-tools]/trunk/vz-create.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/vz-create.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 44 by dpavlin, Sat Feb 9 00:28:10 2008 UTC revision 58 by dpavlin, Mon Feb 2 12:35:22 2009 UTC
# Line 8  use IO::Prompt; Line 8  use IO::Prompt;
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';
# Line 15  my $dist = 'etch'; Line 16  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';  GetOptions(
26  $arh = 'amd64';          'dist=s'        => \$dist,
27            'arh=s'         => \$arh,
28            'mirror=s'      => \$debian_mirror_uri,
29            'split=i'       => \$split,
30    );
31    
32  check_root;  check_root;
33    
# Line 70  my @ip_split = split(/\./,$ip); Line 75  my @ip_split = split(/\./,$ip);
75    
76  my $ve_id = sprintf('%d%03d', $ip_split[2], $ip_split[3]);  my $ve_id = sprintf('%d%03d', $ip_split[2], $ip_split[3]);
77    
78    if ( $ve_id < 101 ) {
79            $ve_id += 100;
80            warn "# VEID moved to $ve_id because 0 .. 100 are reserved\n";
81    }
82    
83  print "VEID: $ve_id hostname: $hostname ip: $ip\n";  print "VEID: $ve_id hostname: $hostname ip: $ip\n";
84    
85  warn ">> creating directories\n";  warn ">> creating directories\n";
# Line 94  warn ">> creating configuration file $co Line 104  warn ">> creating configuration file $co
104  if (-e $conf_path) {  if (-e $conf_path) {
105          warn "$conf_path allready exists, not touching it\n";          warn "$conf_path allready exists, not touching it\n";
106  } else {  } else {
107          vzsplit('-n', $ve_total, '-s', $swap_size * 1024, '>', $conf_path);          vzsplit('-n', $split, '-s', $swap_size * 1024, '>', $conf_path);
108    
109          die "configuration file not created" unless -e $conf_path;          die "configuration file not created" unless -e $conf_path;
110    
# Line 139  if ($login) { Line 149  if ($login) {
149          vzctl('set', $ve_id, '--userpasswd', "$login:$passwd" );          vzctl('set', $ve_id, '--userpasswd', "$login:$passwd" );
150  }  }
151    
152    runscript( $ve_id, 'custom/50-hypertable.sh' );
153  print "OK: $ve_id created\n";  print "OK: $ve_id created\n";

Legend:
Removed from v.44  
changed lines
  Added in v.58

  ViewVC Help
Powered by ViewVC 1.1.26