return "$path/$subdir";
}
-sub path {
+sub filesystem_path {
my ($class, $scfg, $volname, $storeid) = @_;
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
return wantarray ? ($path, $vmid, $vtype) : $path;
}
+sub path {
+ my ($class, $scfg, $volname, $storeid) = @_;
+
+ return $class->filesystem_path($scfg, $volname, $storeid);
+}
+
sub create_base {
my ($class, $storeid, $scfg, $volname) = @_;
die "create_base not possible with base image\n" if $isBase;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
my ($size, $format, $used, $parent) = file_size_info($path);
die "file_size_info on '$volname' failed\n" if !($format && $size);
my $newvolname = $basename ? "$basevmid/$basename/$vmid/$newname" :
"$vmid/$newname";
- my $newpath = $class->path($scfg, $newvolname);
+ my $newpath = $class->filesystem_path($scfg, $newvolname);
die "file '$newpath' already exists\n" if -f $newpath;
my $newvol = "$basevmid/$basename/$vmid/$name";
- my $path = $class->path($scfg, $newvol);
+ my $path = $class->filesystem_path($scfg, $newvol);
# Note: we use relative paths, so we need to call chdir before qemu-img
eval {
sub free_image {
my ($class, $storeid, $scfg, $volname, $isBase) = @_;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
if (! -f $path) {
warn "disk image '$path' does not exists\n";
sub volume_size_info {
my ($class, $scfg, $storeid, $volname, $timeout) = @_;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
return file_size_info($path, $timeout);
}
return 1 if $running;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
my $cmd = ['/usr/bin/qemu-img', 'resize', $path , $size];
return 1 if $running;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
my $cmd = ['/usr/bin/qemu-img', 'snapshot','-c', $snap, $path];
die "can't rollback snapshot this image format" if $volname !~ m/\.(qcow2|qed)$/;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
my $cmd = ['/usr/bin/qemu-img', 'snapshot','-a', $snap, $path];
return 1 if $running;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
my $cmd = ['/usr/bin/qemu-img', 'snapshot','-d', $snap, $path];
sub activate_volume {
my ($class, $storeid, $scfg, $volname, $exclusive, $cache) = @_;
- my $path = $class->path($scfg, $volname);
+ my $path = $class->filesystem_path($scfg, $volname);
# check is volume exists
if ($scfg->{path}) {