mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-08-29 09:49:31 +03:00
path: corretly implement path to snapshots
This commit is contained in:
@ -140,7 +140,9 @@ sub parse_volname {
|
||||
}
|
||||
|
||||
sub filesystem_path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $snapname) = @_;
|
||||
|
||||
die "drbd snapshot is not implemented\n" if defined($snapname);
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
@ -191,9 +191,15 @@ my $find_free_diskname = sub {
|
||||
};
|
||||
|
||||
sub path {
|
||||
my ($class, $scfg, $volname, $storeid) = @_;
|
||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
my ($vtype, $name, $vmid, undef, undef, $isBase, $format) =
|
||||
$class->parse_volname($volname);
|
||||
|
||||
# Note: qcow2/qed has internal snapshot, so path is always
|
||||
# the same (with or without snapshot => same file).
|
||||
die "can't snapshot this image format\n"
|
||||
if defined($snapname) && $format !~ m/^(qcow2|qed)$/;
|
||||
|
||||
my $path = undef;
|
||||
if ($vtype eq 'images') {
|
||||
|
@ -85,7 +85,10 @@ sub parse_volname {
|
||||
}
|
||||
|
||||
sub path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||
|
||||
die "volume snapshot is not possible on iscsi device"
|
||||
if defined($snapname);
|
||||
|
||||
my ($vtype, $lun, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
@ -278,7 +278,9 @@ sub parse_volname {
|
||||
}
|
||||
|
||||
sub filesystem_path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $snapname) = @_;
|
||||
|
||||
die "snapshot is not possible on iscsi storage\n" if defined($snapname);
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
@ -228,7 +228,9 @@ sub parse_volname {
|
||||
}
|
||||
|
||||
sub filesystem_path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $snapname) = @_;
|
||||
|
||||
die "lvm snapshot is not implemented"if defined($snapname);
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
@ -403,9 +403,15 @@ sub get_subdir {
|
||||
}
|
||||
|
||||
sub filesystem_path {
|
||||
my ($class, $scfg, $volname, $storeid) = @_;
|
||||
my ($class, $scfg, $volname, $snapname) = @_;
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
my ($vtype, $name, $vmid, undef, undef, $isBase, $format) =
|
||||
$class->parse_volname($volname);
|
||||
|
||||
# Note: qcow2/qed has internal snapshot, so path is always
|
||||
# the same (with or without snapshot => same file).
|
||||
die "can't snapshot this image format\n"
|
||||
if defined($snapname) && $format !~ m/^(qcow2|qed)$/;
|
||||
|
||||
my $dir = $class->get_subdir($scfg, $vtype);
|
||||
|
||||
@ -417,9 +423,9 @@ sub filesystem_path {
|
||||
}
|
||||
|
||||
sub path {
|
||||
my ($class, $scfg, $volname, $storeid) = @_;
|
||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||
|
||||
return $class->filesystem_path($scfg, $volname, $storeid);
|
||||
return $class->filesystem_path($scfg, $volname, $snapname);
|
||||
}
|
||||
|
||||
sub create_base {
|
||||
|
@ -208,7 +208,10 @@ sub options {
|
||||
# Storage implementation
|
||||
|
||||
sub path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||
|
||||
die "direct access to snapshots not implemented"
|
||||
if defined($snapname);
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
|
@ -141,7 +141,7 @@ sub parse_volname {
|
||||
# virtual zfs methods (subclass can overwrite them)
|
||||
|
||||
sub path {
|
||||
my ($class, $scfg, $volname) = @_;
|
||||
my ($class, $scfg, $volname, $storeid, $snapname) = @_;
|
||||
|
||||
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
|
||||
|
||||
@ -154,6 +154,7 @@ sub path {
|
||||
} else {
|
||||
$path = "/dev/zvol/$scfg->{pool}/$volname";
|
||||
}
|
||||
$path .= "\@$snapname" if defined($snapname);
|
||||
} else {
|
||||
die "$vtype is not allowed in ZFSPool!";
|
||||
}
|
||||
|
Reference in New Issue
Block a user