btrfs: die early for broken subvolume resize
In the BTRFS plugin, resize_volume() for a subovlume currently fails with "failed to get btrfs subvolume ID from: ". This is because the btrfs 'subvol show' command is invoked with '-q', so there is no output. As btrfs quotas are currently not implemented, die early with a clean error instead and comment out the unused code for now. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Link: https://lore.proxmox.com/20250303092445.13873-6-f.ebner@proxmox.com
This commit is contained in:
committed by
Thomas Lamprecht
parent
0426aa3165
commit
5a73bac343
@ -233,14 +233,15 @@ sub btrfs_cmd {
|
|||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub btrfs_get_subvol_id {
|
# NOTE: this function is currently boken, because btrfs_cmd uses '-q' so there will be no output.
|
||||||
my ($class, $path) = @_;
|
#sub btrfs_get_subvol_id {
|
||||||
my $info = $class->btrfs_cmd(['subvolume', 'show', '--', $path]);
|
# my ($class, $path) = @_;
|
||||||
if ($info !~ /^\s*(?:Object|Subvolume) ID:\s*(\d+)$/m) {
|
# my $info = $class->btrfs_cmd(['subvolume', 'show', '--', $path]);
|
||||||
die "failed to get btrfs subvolume ID from: $info\n";
|
# if ($info !~ /^\s*(?:Object|Subvolume) ID:\s*(\d+)$/m) {
|
||||||
}
|
# die "failed to get btrfs subvolume ID from: $info\n";
|
||||||
return $1;
|
# }
|
||||||
}
|
# return $1;
|
||||||
|
#}
|
||||||
|
|
||||||
my sub chattr : prototype($$$) {
|
my sub chattr : prototype($$$) {
|
||||||
my ($fh, $mask, $xor) = @_;
|
my ($fh, $mask, $xor) = @_;
|
||||||
@ -498,10 +499,13 @@ sub volume_resize {
|
|||||||
|
|
||||||
my $format = ($class->parse_volname($volname))[6];
|
my $format = ($class->parse_volname($volname))[6];
|
||||||
if ($format eq 'subvol') {
|
if ($format eq 'subvol') {
|
||||||
my $path = $class->filesystem_path($scfg, $volname);
|
# NOTE: `btrfs send/recv` actually drops quota information so supporting subvolumes with
|
||||||
my $id = '0/' . $class->btrfs_get_subvol_id($path);
|
# quotas doesn't play nice with send/recv.
|
||||||
$class->btrfs_cmd(['qgroup', 'limit', '--', "${size}k", "0/$id", $path]);
|
die "cannot resize subvolume - btrfs quotas are currently not supported\n";
|
||||||
return undef;
|
# my $path = $class->filesystem_path($scfg, $volname);
|
||||||
|
# my $id = '0/' . $class->btrfs_get_subvol_id($path);
|
||||||
|
# $class->btrfs_cmd(['qgroup', 'limit', '--', "${size}k", "0/$id", $path]);
|
||||||
|
# return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PVE::Storage::Plugin::volume_resize(@_);
|
return PVE::Storage::Plugin::volume_resize(@_);
|
||||||
|
|||||||
Reference in New Issue
Block a user