public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage 1/2] btrfs: avoid undef warnings with format
@ 2021-09-08 11:26 Fabian Ebner
  2021-09-08 11:26 ` [pve-devel] [PATCH storage 2/2] btrfs: style: add missing semicolon Fabian Ebner
  2021-09-08 12:27 ` [pve-devel] applied: [PATCH storage 1/2] btrfs: avoid undef warnings with format Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Fabian Ebner @ 2021-09-08 11:26 UTC (permalink / raw)
  To: pve-devel

which is only set by parse_volname when the volume is a VM or
container image, but not for other content types.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/BTRFSPlugin.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
index fe42082..a1e5b98 100644
--- a/PVE/Storage/BTRFSPlugin.pm
+++ b/PVE/Storage/BTRFSPlugin.pm
@@ -180,13 +180,13 @@ sub filesystem_path {
 
     $path .= "/$vmid" if $vtype eq 'images';
 
-    if ($format eq 'raw') {
+    if (defined($format) && $format eq 'raw') {
 	my $dir = raw_name_to_dir($name);
 	if ($snapname) {
 	    $dir .= "\@$snapname";
 	}
 	$path .= "/$dir/disk.raw";
-    } elsif ($format eq 'subvol') {
+    } elsif (defined($format) && $format eq 'subvol') {
 	$path .= "/$name";
 	if ($snapname) {
 	    $path .= "\@$snapname";
@@ -409,7 +409,7 @@ sub free_image {
     my (undef, undef, $vmid, undef, undef, undef, $format) =
 	$class->parse_volname($volname);
 
-    if ($format ne 'subvol' && $format ne 'raw') {
+    if (!defined($format) || ($format ne 'subvol' && $format ne 'raw')) {
 	return PVE::Storage::DirPlugin->free_image($storeid, $scfg, $volname, $isBase, $_format);
     }
 
@@ -465,7 +465,7 @@ sub volume_size_info {
 
     my $format = ($class->parse_volname($volname))[6];
 
-    if ($format eq 'subvol') {
+    if (defined($format) && $format eq 'subvol') {
 	my $ctime = (stat($path))[10];
 	my ($used, $size) = (0, 0);
 	#my ($used, $size) = btrfs_subvol_quota($class, $path); # uses wantarray
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH storage 2/2] btrfs: style: add missing semicolon
  2021-09-08 11:26 [pve-devel] [PATCH storage 1/2] btrfs: avoid undef warnings with format Fabian Ebner
@ 2021-09-08 11:26 ` Fabian Ebner
  2021-09-08 12:28   ` [pve-devel] applied: " Thomas Lamprecht
  2021-09-08 12:27 ` [pve-devel] applied: [PATCH storage 1/2] btrfs: avoid undef warnings with format Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Fabian Ebner @ 2021-09-08 11:26 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/BTRFSPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
index a1e5b98..dbc1244 100644
--- a/PVE/Storage/BTRFSPlugin.pm
+++ b/PVE/Storage/BTRFSPlugin.pm
@@ -309,7 +309,7 @@ sub alloc_image {
     my ($class, $storeid, $scfg, $vmid, $fmt, $name, $size) = @_;
 
     if ($fmt ne 'raw' && $fmt ne 'subvol') {
-	return $class->SUPER::alloc_image($storeid, $scfg, $vmid, $fmt, $name, $size)
+	return $class->SUPER::alloc_image($storeid, $scfg, $vmid, $fmt, $name, $size);
     }
 
     # From Plugin.pm:
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH storage 1/2] btrfs: avoid undef warnings with format
  2021-09-08 11:26 [pve-devel] [PATCH storage 1/2] btrfs: avoid undef warnings with format Fabian Ebner
  2021-09-08 11:26 ` [pve-devel] [PATCH storage 2/2] btrfs: style: add missing semicolon Fabian Ebner
@ 2021-09-08 12:27 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-09-08 12:27 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

On 08.09.21 13:26, Fabian Ebner wrote:
> which is only set by parse_volname when the volume is a VM or
> container image, but not for other content types.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  PVE/Storage/BTRFSPlugin.pm | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH storage 2/2] btrfs: style: add missing semicolon
  2021-09-08 11:26 ` [pve-devel] [PATCH storage 2/2] btrfs: style: add missing semicolon Fabian Ebner
@ 2021-09-08 12:28   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-09-08 12:28 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

On 08.09.21 13:26, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  PVE/Storage/BTRFSPlugin.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-08 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 11:26 [pve-devel] [PATCH storage 1/2] btrfs: avoid undef warnings with format Fabian Ebner
2021-09-08 11:26 ` [pve-devel] [PATCH storage 2/2] btrfs: style: add missing semicolon Fabian Ebner
2021-09-08 12:28   ` [pve-devel] applied: " Thomas Lamprecht
2021-09-08 12:27 ` [pve-devel] applied: [PATCH storage 1/2] btrfs: avoid undef warnings with format Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal