corretly set ostemplate

This commit is contained in:
Dietmar Maurer 2011-10-24 08:36:27 +02:00
parent 343b69827f
commit 3736f16ba4

View File

@ -240,6 +240,8 @@ __PACKAGE__->register_method({
if ($ostemplate eq '-') { if ($ostemplate eq '-') {
die "pipe requires cli environment\n" die "pipe requires cli environment\n"
if $rpcenv->{type} ne 'cli'; if $rpcenv->{type} ne 'cli';
die "pipe can only be used with restore tasks\n"
if !$param->{restore};
$archive = '-'; $archive = '-';
} else { } else {
if (PVE::Storage::parse_volume_id($ostemplate, 1)) { if (PVE::Storage::parse_volume_id($ostemplate, 1)) {
@ -268,7 +270,12 @@ __PACKAGE__->register_method({
$param->{nameserver} = join(' ', @ns) if scalar(@ns); $param->{nameserver} = join(' ', @ns) if scalar(@ns);
} }
PVE::OpenVZ::update_ovz_config($conf, $param); PVE::OpenVZ::update_ovz_config($vmid, $conf, $param);
if (!$param->{restore}) {
$conf->{ostemplate}->{value} = $archive;
$conf->{ostemplate}->{value} =~ s|^.*/||;
$conf->{ostemplate}->{value} =~ s/\.tar\.(gz|bz2)$//;
}
my $rawconf = PVE::OpenVZ::generate_raw_config($pve_base_ovz_config, $conf); my $rawconf = PVE::OpenVZ::generate_raw_config($pve_base_ovz_config, $conf);
@ -335,7 +342,7 @@ __PACKAGE__->register_method({
die "checksum missmatch (file change by other user?)\n" die "checksum missmatch (file change by other user?)\n"
if $digest && $digest ne $conf->{digest}; if $digest && $digest ne $conf->{digest};
my $changes = PVE::OpenVZ::update_ovz_config($conf, $param); my $changes = PVE::OpenVZ::update_ovz_config($vmid, $conf, $param);
return if scalar (@$changes) <= 0; return if scalar (@$changes) <= 0;