[pve-devel] [PATCH/RFC 0/2] Fix #1922 - run proxied pvesh calls as non-cli environment

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


This patchset addresses issue #1922, where pvesh calls for vm-migrations
yielded an error regarding invalid-json output, by creating a different
RESTEnvironment type ('pub' instead of 'cli') when pvesh is called via
ssh, with the --noproxy switch.

The invalid json output is the result of the tasklog (which combines
output of external commands, and internal prints), which gets output,
when a fork_worker call is called via a cli environment.

Issues for discussion:
* This way pvesh yields different output, when running an API call on the local
  node vs. one on the remote node. It would be more consistent to always run as
  a 'pub' environment, although it would yield fewer informations for the local
  calls
* I put the helper function in common, although its currently only used in pvesh
* In the longer run the issue will return, when/if we change our other CLI tools
  (qm, pct,...) to use the CLIFormatter. An idea I had (but wouldn't want to
  add before 5.3) would be to write the logoutput to stderr, and the result to
  stdout. The downside being that we still would join actual stderr output (from
  errors of external programs) with regular output of those programs and our
  logging. Would be grateful for other ideas.

Stoiko Ivanov (1):
  RESTEnvironment: add helper for other env-types

 src/PVE/RESTEnvironment.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Stoiko Ivanov (2):
  pvesh: use different rpcenvironment when proxying
  pvesh: allow_nonref while decoding proxied output.

 PVE/CLI/pvesh.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.11.0





More information about the pve-devel mailing list