pvesh error

elurex

Active Member
Oct 28, 2015
204
13
38
Taiwan
I keep getting pvesh error complaining json malformat
/usr/share/perl5/PVE/CLI/pvesh.pm @ line 125

Code:
sub proxy_handler {
    my ($node, $remip, $path, $cmd, $param) = @_;

    my $args = [];
    foreach my $key (keys %$param) {
        next if $key eq 'quiet' || $key eq 'output-format'; # just to  be sure
        push @$args, "--$key", $param->{$key};
    }

    my $remcmd = ['ssh', '-o', 'BatchMode=yes', "root\@$remip",
                  'pvesh', '--noproxy', $cmd, $path,
                  '--output-format', 'json'];

    if (scalar(@$args)) {
        my $cmdargs = [String::ShellQuote::shell_quote(@$args)];
        push @$remcmd, @$cmdargs;
    }

    my $json = '';
    PVE::Tools::run_command($remcmd, errmsg => "proxy handler failed",
                            outfunc => sub { $json .= shift });

    return decode_json($json);
}

my command send to PVE API is

Code:
pvesh set /nodes/pve1/qemu/810/config --scsi0 "rbd:vm-810-disk-1,cache=writeback,discard=on,iops_rd=8000,iops_wr=8000,mbps_rd=400,mbps_wr=400,size=60G" --scsi1 "rbd:vm-810-disk-2,cache=writeback,discard=on,iops_rd=8000,iops_wr=8000,mbps_rd=400,mbps_wr=400,size=200G --hostpci0 "04:00,pcie=1,x-vga=1" --net0 "virtio=7A:83:E0:CB:92:58,bridge=vmbr0"
 
can you try to execute that command on the 'pve1' node and post the complete output ?
 
JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this) at /usr/share/perl5/PVE/CLI/pvesh.pm line 125
 
JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this) at /usr/share/perl5/PVE/CLI/pvesh.pm line 125
then you did not execute it on node 'pve1' since it still tries to proxy it
please execute it on the node where you want the information from and post the output
 
Hi,

I have the same problem. I want to run this command to create an snapshot of the VM ID=157:

Code:
sudo pvesh create /nodes/pmx-smb-3/qemu/157/snapshot -snapname test123

If I run this command in the node `pmx-smb-3`, I have this output:

Code:
UPID:pmx-smb-3:000722EE:03B1FA8E:5E2787AA:qmsnapshot:157:root@pam:

* the exit code of the command is 0,
* and the snapshot is well created.

Now, if I execute exactly the same command in `pmx-smb-1`, I have this output:

Code:
JSON text must be an object or array (but found number, string, true, false or null, use allow_nonref to allow this) at /usr/share/perl5/PVE/CLI/pvesh.pm line 125.

* the exit code of the command is 255,
* and the snapshot is well created (despite the non null exit code).

Here is some info about my cluster (all nodes are identical) :

Code:
$ lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:    buster

$ sudo pveversion
pve-manager/6.1-5/9bf06119 (running kernel: 5.3.13-1-pve)

$ dpkg -S /usr/bin/pvesh
pve-manager: /usr/bin/pvesh

$ dpkg -l pve-manager
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-============================================
ii  pve-manager    6.1-5        amd64        Proxmox Virtual Environment Management Tools

Thx for your help.
 

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!