Listing backups via api for a specific vmid not working.

ms0x4f

New Member
Sep 6, 2019
2
0
1
Hi.

I have a problem with listing current backups for a specific vmid via api.
For example, vmid 101 it has 2 backup files in local storage.

Request:
GET /api2/json/nodes/node1/storage/local/content?content=backup&vmid=101

Response:
{"data":[]}

But in syslog i have following error:
Use of uninitialized value $1 in concatenation (.) or string at /usr/share/perl5/PVE/Storage/Plugin.pm line 931

Thank you.

Code:
pveversion -v
proxmox-ve: 6.0-2 (running kernel: 5.0.21-1-pve)
pve-manager: 6.0-7 (running version: 6.0-7/28984024)
pve-kernel-5.0: 6.0-7
pve-kernel-helper: 6.0-7
pve-kernel-5.0.21-1-pve: 5.0.21-2
pve-kernel-5.0.18-1-pve: 5.0.18-3
pve-kernel-5.0.15-1-pve: 5.0.15-1
ceph-fuse: 12.2.11+dfsg1-2.1
corosync: 3.0.2-pve2
criu: 3.11-3
glusterfs-client: 5.5-3
ksm-control-daemon: 1.3-1
libjs-extjs: 6.0.1-10
libknet1: 1.11-pve1
libpve-access-control: 6.0-2
libpve-apiclient-perl: 3.0-2
libpve-common-perl: 6.0-4
libpve-guest-common-perl: 3.0-1
libpve-http-server-perl: 3.0-2
libpve-storage-perl: 6.0-8
libqb0: 1.0.5-1
lvm2: 2.03.02-pve3
lxc-pve: 3.1.0-64
lxcfs: 3.0.3-pve60
novnc-pve: 1.0.0-60
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.0-7
pve-cluster: 6.0-7
pve-container: 3.0-7
pve-docs: 6.0-4
pve-edk2-firmware: 2.20190614-1
pve-firewall: 4.0-7
pve-firmware: 3.0-2
pve-ha-manager: 3.0-2
pve-i18n: 2.0-3
pve-qemu-kvm: 4.0.0-5
pve-xtermjs: 3.13.2-1
qemu-server: 6.0-7
smartmontools: 7.0-pve2
spiceterm: 3.1-1
vncterm: 1.6-1
zfsutils-linux: 0.8.1-pve2
 
Thank you, i applied fix and works. Now i'm wait for official update.


Kind regards,
Marcin
 
I'm having the same issue, no errors in syslog however.

Data returned is:

JSON:
{
    "data": []
}

PVE 7.3-4.
 
Hi, this thread is quite old and deals with a bug that was fixed in 2019, so the issue you're describing probably doesn't have the same cause. Could you please create a new thread including some more information, such as the output of pveversion -v and the concrete API request you're sending? Does the request succeed use pvesh?
 
Hi, this thread is quite old and deals with a bug that was fixed in 2019, so the issue you're describing probably doesn't have the same cause. Could you please create a new thread including some more information, such as the output of pveversion -v and the concrete API request you're sending? Does the request succeed use pvesh?

Hi, why would I create another separate thread for the same issue? I won't even mention the fact that most of them are not replied to.

Nevertheless, to answer your question:

Bash:
proxmox-ve: 7.3-1 (running kernel: 5.15.83-1-pve)
pve-manager: 7.3-4 (running version: 7.3-4/d69b70d4)
pve-kernel-5.15: 7.3-1
pve-kernel-helper: 7.3-1
pve-kernel-5.15.83-1-pve: 5.15.83-1
pve-kernel-5.15.74-1-pve: 5.15.74-1
ceph-fuse: 14.2.21-1
corosync: 3.1.7-pve1
criu: 3.15-1+pve-1
glusterfs-client: 9.2-1
ifupdown2: 3.1.0-1+pmx3
libjs-extjs: 7.0.0-1
libknet1: 1.24-pve2
libproxmox-acme-perl: 1.4.3
libproxmox-backup-qemu0: 1.3.1-1
libpve-access-control: 7.3-1
libpve-apiclient-perl: 3.2-1
libpve-common-perl: 7.3-1
libpve-guest-common-perl: 4.2-3
libpve-http-server-perl: 4.1-5
libpve-storage-perl: 7.3-1
libspice-server1: 0.14.3-2.1
lvm2: 2.03.11-2.1
lxc-pve: 5.0.0-3
lxcfs: 4.0.12-pve1
novnc-pve: 1.3.0-3
proxmox-backup-client: 2.3.2-1
proxmox-backup-file-restore: 2.3.2-1
proxmox-mini-journalreader: 1.3-1
proxmox-offline-mirror-helper: 0.5.0-1
proxmox-widget-toolkit: 3.5.3
pve-cluster: 7.3-1
pve-container: 4.4-2
pve-docs: 7.3-1
pve-edk2-firmware: 3.20220526-1
pve-firewall: 4.2-7
pve-firmware: 3.6-2
pve-ha-manager: 3.5.1
pve-i18n: 2.8-1
pve-qemu-kvm: 7.1.0-4
pve-xtermjs: 4.16.0-1
qemu-server: 7.3-2
smartmontools: 7.2-pve3
spiceterm: 3.2-2
swtpm: 0.8.0~bpo11+2
vncterm: 1.7-1
zfsutils-linux: 2.1.7-pve2

The "concrete api call" is: /api2/json/nodes/.../storage/backups/content?content=backup&vmid=101

And yes, if I call pvesh get /nodes/.../storage/backups/content -content backup -vmid 101 I can see the backups.

So again, same issue but without syslog errors.
 
Since the original post mentions a syslog error, and you do not see a syslog error, it's probably a different issue -- hence the suggestion to create a new thread.

As pvesh (as root, I guess?) shows the backups while the API does not, this might be a permissions issue. Can you post the permissions of the user/token used for the API request, in particular the Datastore. permissions?
 
Since the original post mentions a syslog error, and you do not see a syslog error, it's probably a different issue -- hence the suggestion to create a new thread.

As pvesh (as root, I guess?) shows the backups while the API does not, this might be a permissions issue. Can you post the permissions of the user/token used for the API request, in particular the Datastore. permissions?

I use the correct permissions as specified here: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/storage/{storage}/content

Pretty sure I know what I'm doing...
 
Hi, I get the same behavior you're seeing (the empty data list in the response) if I only grant the Datastore.AllocateSpace privilege. In order to actually see the backup, I also need to grant VM.Backup on the owning VM. See this mailing list post for some more details. Maybe this could be the problem?
 
Hi, I get the same behavior you're seeing (the empty data list in the response) if I only grant the Datastore.AllocateSpace privilege. In order to actually see the backup, I also need to grant VM.Backup on the owning VM. See this mailing list post for some more details. Maybe this could be the problem?

Hayia.... I never thought of adding this permission because I trust and follow the documentation. Once again I was wrong to do so.

Next time when I see someone adding links and insisting on docs I will get frustrated....

Thanks for the solution.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!