* proxmox-truenas storage plugin api2 issue
@ 2026-04-15 21:59 Lorne Guse
2026-04-16 6:03 ` Arthur Bied-Charreton
0 siblings, 1 reply; 4+ messages in thread
From: Lorne Guse @ 2026-04-15 21:59 UTC (permalink / raw)
To: m.carrara, Proxmox VE development discussion
One of my users ran across an issue I could use some help with. https://github.com/boomshankerx/proxmox-truenas/issues/133
When trying to use Veeam with my custom storage plugin, the output of /api2/json/nodes/NODE/storage shows the active field as string "1" instead of int 1. This is causing tools like Veeam to fail.
Is this a problem with my plugin or something further up the stack?
# OUTPUT JSON
{
"data": [
{
"shared": 0,
"storage": "local",
"content": "iso,vztmpl,backup",
"used": 131072,
"type": "dir",
"enabled": 1,
"avail": 236805029888,
"used_fraction": 5.53501450173799e-7,
"active": 1,
"total": 236805160960
},
{
"shared": 1,
"content": "images",
"storage": "nas.proxmox",
"used": 0,
"type": "nfs",
"enabled": 1,
"avail": 7313282826240,
"used_fraction": 0,
"active": 1,
"total": 7313282826240
},
{
"shared": 1,
"storage": "nas",
"content": "images",
"used": 443571322880,
"type": "truenas",
"enabled": 1,
"used_fraction": 0.0571844359724994,
"avail": 7313282711552,
"active": "1",
"total": 7756854034432
},
]
}
--
BooMShanꓘerX
(Lorne Guse)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: proxmox-truenas storage plugin api2 issue 2026-04-15 21:59 proxmox-truenas storage plugin api2 issue Lorne Guse @ 2026-04-16 6:03 ` Arthur Bied-Charreton 2026-04-16 6:20 ` Arthur Bied-Charreton 0 siblings, 1 reply; 4+ messages in thread From: Arthur Bied-Charreton @ 2026-04-16 6:03 UTC (permalink / raw) To: Lorne Guse; +Cc: Proxmox VE development discussion On Wed, Apr 15, 2026 at 09:59:20PM +0000, Lorne Guse wrote: > One of my users ran across an issue I could use some help with. https://github.com/boomshankerx/proxmox-truenas/issues/133 > When trying to use Veeam with my custom storage plugin, the output of /api2/json/nodes/NODE/storage shows the active field as string "1" instead of int 1. This is causing tools like Veeam to fail. > > Is this a problem with my plugin or something further up the stack? > > # OUTPUT JSON > > { > "data": [ > { > "shared": 0, > "storage": "local", > "content": "iso,vztmpl,backup", > "used": 131072, > "type": "dir", > "enabled": 1, > "avail": 236805029888, > "used_fraction": 5.53501450173799e-7, > "active": 1, > "total": 236805160960 > }, > { > "shared": 1, > "content": "images", > "storage": "nas.proxmox", > "used": 0, > "type": "nfs", > "enabled": 1, > "avail": 7313282826240, > "used_fraction": 0, > "active": 1, > "total": 7313282826240 > }, > { > "shared": 1, > "storage": "nas", > "content": "images", > "used": 443571322880, > "type": "truenas", > "enabled": 1, > "used_fraction": 0.0571844359724994, > "avail": 7313282711552, > "active": "1", > "total": 7756854034432 > }, > > ] > } > > -- > BooMShanꓘerX > (Lorne Guse) Hey Lorne, Dietmar and I investigated this: in your code [0], you string-interpolate $active for logging before returning it. This sets the pPOK flag, leading to the JSON encoder interpreting it as a string. This is not an issue for $total, $available, and $used because we cast those to int on our side [1]. I did not look very deeply into this, but my guess as to why we do not cast $active as well is to allow other truthy values like 'yes', 'true', etc - maybe someone who knows can chime in here? Anyway, you should be able to fix this on your side by forcing $active into a numeric value, with int($active) or by adding 0 to it before returning it. [0] https://github.com/boomshankerx/proxmox-truenas/blob/b4e73456e2de3c9ba1f589349ce5c87cd6199251/perl5/PVE/Storage/Custom/TrueNASPlugin.pm#L462 [1] https://git.proxmox.com/?p=pve-storage.git;a=blob;f=src/PVE/Storage.pm;h=6e87bac36edf277a02a6fb5c9e600ef8281b34ad;hb=refs/heads/master#l1523 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: proxmox-truenas storage plugin api2 issue 2026-04-16 6:03 ` Arthur Bied-Charreton @ 2026-04-16 6:20 ` Arthur Bied-Charreton 2026-04-16 16:59 ` Lorne Guse 0 siblings, 1 reply; 4+ messages in thread From: Arthur Bied-Charreton @ 2026-04-16 6:20 UTC (permalink / raw) To: Lorne Guse; +Cc: Proxmox VE development discussion On Thu, Apr 16, 2026 at 08:03:25AM +0200, Arthur Bied-Charreton wrote: > On Wed, Apr 15, 2026 at 09:59:20PM +0000, Lorne Guse wrote: > > One of my users ran across an issue I could use some help with. https://github.com/boomshankerx/proxmox-truenas/issues/133 > > When trying to use Veeam with my custom storage plugin, the output of /api2/json/nodes/NODE/storage shows the active field as string "1" instead of int 1. This is causing tools like Veeam to fail. > > > > Is this a problem with my plugin or something further up the stack? > > > > # OUTPUT JSON > > > > { > > "data": [ > > { > > "shared": 0, > > "storage": "local", > > "content": "iso,vztmpl,backup", > > "used": 131072, > > "type": "dir", > > "enabled": 1, > > "avail": 236805029888, > > "used_fraction": 5.53501450173799e-7, > > "active": 1, > > "total": 236805160960 > > }, > > { > > "shared": 1, > > "content": "images", > > "storage": "nas.proxmox", > > "used": 0, > > "type": "nfs", > > "enabled": 1, > > "avail": 7313282826240, > > "used_fraction": 0, > > "active": 1, > > "total": 7313282826240 > > }, > > { > > "shared": 1, > > "storage": "nas", > > "content": "images", > > "used": 443571322880, > > "type": "truenas", > > "enabled": 1, > > "used_fraction": 0.0571844359724994, > > "avail": 7313282711552, > > "active": "1", > > "total": 7756854034432 > > }, > > > > ] > > } > > > > -- > > BooMShanꓘerX > > (Lorne Guse) > Hey Lorne, > > Dietmar and I investigated this: in your code [0], you > string-interpolate $active for logging before returning it. This sets > the pPOK flag, leading to the JSON encoder interpreting it as a string. > This is not an issue for $total, $available, and $used because we cast > those to int on our side [1]. > > I did not look very deeply into this, but my guess as to why we do not > cast $active as well is to allow other truthy values like 'yes', 'true', > etc - maybe someone who knows can chime in here? > > Anyway, you should be able to fix this on your side by forcing $active > into a numeric value, with int($active) or by adding 0 to it before > returning it. > > [0] https://github.com/boomshankerx/proxmox-truenas/blob/b4e73456e2de3c9ba1f589349ce5c87cd6199251/perl5/PVE/Storage/Custom/TrueNASPlugin.pm#L462 > [1] https://git.proxmox.com/?p=pve-storage.git;a=blob;f=src/PVE/Storage.pm;h=6e87bac36edf277a02a6fb5c9e600ef8281b34ad;hb=refs/heads/master#l1523 > You can run the script below to try it out for yourself ``` use strict; use warnings; use Devel::Peek; use JSON; my $json = JSON->new->canonical; print "not interpolated:\n"; { my $active = 0; my $data = { active => $active }; Dump($active); print "data: ", $json->encode($data), "\n"; } print "\ninterpolated:\n"; { my $active = 0; my $msg = "active=$active"; my $data = { active => $active}; Dump($active); print "data: ", $json->encode($data), "\n"; } ``` ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: proxmox-truenas storage plugin api2 issue 2026-04-16 6:20 ` Arthur Bied-Charreton @ 2026-04-16 16:59 ` Lorne Guse 0 siblings, 0 replies; 4+ messages in thread From: Lorne Guse @ 2026-04-16 16:59 UTC (permalink / raw) To: Arthur Bied-Charreton; +Cc: Proxmox VE development discussion Thank you! That did the trick. Perl isn't my native language so I learned something today. -- BooMShanꓘerX (Lorne Guse) ________________________________ From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com> Sent: Thursday, April 16, 2026 12:20 AM To: Lorne Guse <boomshankerx@hotmail.com> Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Subject: Re: proxmox-truenas storage plugin api2 issue On Thu, Apr 16, 2026 at 08:03:25AM +0200, Arthur Bied-Charreton wrote: > On Wed, Apr 15, 2026 at 09:59:20PM +0000, Lorne Guse wrote: > > One of my users ran across an issue I could use some help with. https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fboomshankerx%2Fproxmox-truenas%2Fissues%2F133&data=05%7C02%7C%7Ce6156e101c434db219d308de9b803481%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C639119172101582237%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=mdqGqkgQprIQY47RVYDK4Lmp4pOdi2S61RCNMPgQULM%3D&reserved=0<https://github.com/boomshankerx/proxmox-truenas/issues/133> > > When trying to use Veeam with my custom storage plugin, the output of /api2/json/nodes/NODE/storage shows the active field as string "1" instead of int 1. This is causing tools like Veeam to fail. > > > > Is this a problem with my plugin or something further up the stack? > > > > # OUTPUT JSON > > > > { > > "data": [ > > { > > "shared": 0, > > "storage": "local", > > "content": "iso,vztmpl,backup", > > "used": 131072, > > "type": "dir", > > "enabled": 1, > > "avail": 236805029888, > > "used_fraction": 5.53501450173799e-7, > > "active": 1, > > "total": 236805160960 > > }, > > { > > "shared": 1, > > "content": "images", > > "storage": "nas.proxmox", > > "used": 0, > > "type": "nfs", > > "enabled": 1, > > "avail": 7313282826240, > > "used_fraction": 0, > > "active": 1, > > "total": 7313282826240 > > }, > > { > > "shared": 1, > > "storage": "nas", > > "content": "images", > > "used": 443571322880, > > "type": "truenas", > > "enabled": 1, > > "used_fraction": 0.0571844359724994, > > "avail": 7313282711552, > > "active": "1", > > "total": 7756854034432 > > }, > > > > ] > > } > > > > -- > > BooMShanꓘerX > > (Lorne Guse) > Hey Lorne, > > Dietmar and I investigated this: in your code [0], you > string-interpolate $active for logging before returning it. This sets > the pPOK flag, leading to the JSON encoder interpreting it as a string. > This is not an issue for $total, $available, and $used because we cast > those to int on our side [1]. > > I did not look very deeply into this, but my guess as to why we do not > cast $active as well is to allow other truthy values like 'yes', 'true', > etc - maybe someone who knows can chime in here? > > Anyway, you should be able to fix this on your side by forcing $active > into a numeric value, with int($active) or by adding 0 to it before > returning it. > > [0] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fboomshankerx%2Fproxmox-truenas%2Fblob%2Fb4e73456e2de3c9ba1f589349ce5c87cd6199251%2Fperl5%2FPVE%2FStorage%2FCustom%2FTrueNASPlugin.pm%23L462&data=05%7C02%7C%7Ce6156e101c434db219d308de9b803481%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C639119172101609726%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=01%2FMcbJ1cBVFWaqd86qGLZlbyBLgyL4MQfr1inKLl%2F0%3D&reserved=0<https://github.com/boomshankerx/proxmox-truenas/blob/b4e73456e2de3c9ba1f589349ce5c87cd6199251/perl5/PVE/Storage/Custom/TrueNASPlugin.pm#L462> > [1] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.proxmox.com%2F%3Fp%3Dpve-storage.git%3Ba%3Dblob%3Bf%3Dsrc%2FPVE%2FStorage.pm%3Bh%3D6e87bac36edf277a02a6fb5c9e600ef8281b34ad%3Bhb%3Drefs%2Fheads%2Fmaster%23l1523&data=05%7C02%7C%7Ce6156e101c434db219d308de9b803481%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C639119172101628958%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HgQHEC95UQ64hjR5FkZQV3oCrPZGyks3zAM3%2Bv%2Ffir0%3D&reserved=0<https://git.proxmox.com/?p=pve-storage.git;a=blob;f=src/PVE/Storage.pm;h=6e87bac36edf277a02a6fb5c9e600ef8281b34ad;hb=refs/heads/master#l1523> > You can run the script below to try it out for yourself ``` use strict; use warnings; use Devel::Peek; use JSON; my $json = JSON->new->canonical; print "not interpolated:\n"; { my $active = 0; my $data = { active => $active }; Dump($active); print "data: ", $json->encode($data), "\n"; } print "\ninterpolated:\n"; { my $active = 0; my $msg = "active=$active"; my $data = { active => $active}; Dump($active); print "data: ", $json->encode($data), "\n"; } ``` ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-16 16:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-04-15 21:59 proxmox-truenas storage plugin api2 issue Lorne Guse 2026-04-16 6:03 ` Arthur Bied-Charreton 2026-04-16 6:20 ` Arthur Bied-Charreton 2026-04-16 16:59 ` Lorne Guse
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox