--- trunk/vz-create.pl 2008/02/08 21:46:09 39 +++ trunk/vz-create.pl 2008/02/08 23:02:25 40 @@ -44,7 +44,7 @@ if ($arg =~ m/$RE{net}{IPv4}/) { $ip = $arg; - if ( my $h = hostname2ip($arg) ) { + if ( my $h = ip2hostname($ip) ) { $hostname = $h; } } elsif ($arg) { @@ -66,10 +66,6 @@ my $ve_id = sprintf('%d%03d', $ip_split[2], $ip_split[3]); -my $vz_root = '/vz'; - -die "need to know vz_root, and $vz_root doesn't exist: $!\n" unless (-e $vz_root); - print "VEID: $ve_id hostname: $hostname ip: $ip\n"; warn ">> creating directories\n"; @@ -88,13 +84,7 @@ warn "Debian allready installed in $vz_root/private/$ve_id\n"; } -sub vzctl { - my @args = @_; - warn "## vzctl ", join(" ",@args), "\n"; - system "vzctl", @args; -} - -my $conf_path = "/etc/vz/conf/${ve_id}.conf"; +my $conf_path = "$vz_conf/${ve_id}.conf"; warn ">> creating configuration file $conf_path\n"; if (-e $conf_path) { @@ -201,3 +191,5 @@ vzctl('exec', $ve_id, "useradd --create-home $login"); vzctl('set', $ve_id, '--userpasswd', "$login:$passwd" ); } + +print "OK: $ve_id created\n";