5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00

is_template : return 1 if template option == 1

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
This commit is contained in:
Alexandre Derumier 2013-04-18 17:05:30 +02:00 committed by Dietmar Maurer
parent 68eda3abc4
commit 96d695c08a

View File

@ -4476,24 +4476,7 @@ sub template_create {
sub is_template {
my ($conf) = @_;
my $baseimagecount = 0;
my $totalvolumecount = 0;
my $storecfg = PVE::Storage::config();
foreach_drive($conf, sub {
my ($ds, $drive) = @_;
return if drive_is_cdrom($drive);
$totalvolumecount++;
my $volid = $drive->{file};
if (PVE::Storage::volume_is_base($storecfg, $volid)){
$baseimagecount++;
}
});
return 0 if $baseimagecount == 0;
return 1 if $baseimagecount == $totalvolumecount; #full template
return 2 if $baseimagecount < $totalvolumecount; #semi-template
return 1 if defined $conf->{template} && $conf->{template} == 1;
}
1;