[pve-devel] [PATCH manager 1/2] pvesh: use different rpcenvironment when proxying

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 27 17:46:05 CET 2018


Fix #1922.
When proxying to another node, pvesh uses ssh and runs the command on the other
node with the parameter --output-format json, relying on receiving json from the
remote node.
Some API-calls, when invoked via CLI, do also output the plain text log
(e.g. when running with fork_worker, and not backgrounded), as part of their
output, which is not valid json anymore.

By chaning the rpcenvironment type to 'pub' instead of 'cli' for the
proxy invocations, fork_worker does not output the log, but only the result
(an upid in case of vm_migrate).

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/CLI/pvesh.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
index 41e27a00..56f7b70b 100755
--- a/PVE/CLI/pvesh.pm
+++ b/PVE/CLI/pvesh.pm
@@ -41,7 +41,8 @@ do {
 } while ($optmatch);
 
 sub setup_environment {
-    PVE::RPCEnvironment->setup_default_cli_env();
+    my $envtype = $disable_proxy ? 'pub' : 'cli';
+    PVE::RPCEnvironment->setup_default_env(undef, $envtype);
 }
 
 sub complete_api_path {
-- 
2.11.0





More information about the pve-devel mailing list