about --pass-stdin <boolean> have support ?

haiwan

Well-Known Member
Apr 23, 2019
249
1
58
37
Hi, tks again pve engineer.
we read before old forum talking --pass-stdin <boolean> is no support .
qm guest exec
--pass-stdin <boolean> (default = 0)
When set, read STDIN until EOF and forward to guest agent via input-data (usually treated as STDIN to process launched by guest agent). Allows maximal 1 MiB.

we plan use this from pve host write a file <1M to vm inside .
eg: we use agent write a file auto configration ip address. same openstack nova use qemu-nbd .
tks. wish give me more guide.
 
if you want to write a file to a vm, i would suggest using the 'file-write' agent command
currently that is only available via the api or via pvesh:
Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "your file content"

if you want to give a file direct, you can use subshells like this:

Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "$(cat /path/to/host/file)"
 
if you want to write a file to a vm, i would suggest using the 'file-write' agent command
currently that is only available via the api or via pvesh:
Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "your file content"

if you want to give a file direct, you can use subshells like this:

Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "$(cat /path/to/host/file)"
tks, let me try
 
if you want to write a file to a vm, i would suggest using the 'file-write' agent command
currently that is only available via the api or via pvesh:
Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "your file content"

if you want to give a file direct, you can use subshells like this:

Code:
pvesh create /nodes/NODENAME/qemu/VMID/agent/file-write --file "/path/to/file" --content "$(cat /path/to/host/file)"
and we fount have eg use nbd + qemu-nbd write file, this have way guide ?
tks
 
sadly, i still do not understand where the question or problem is...
sorry, we dec no clear.
we just look for new way (outside cloud-init) use agent (default no change agent safe config) write a file info vm start auto config ip address. just this. tks. issue we develop a pve system manager, maybe next year push language(en) .
 
Hey, I was looking into transferring a file to a VM running the guest agent as well. It seems like the --content parameter from file-write only takes strings but I want to copy a binary file. Is there a way to accomplish this?
The qemu-guest-agent docs say it accepts a base64 encoded string, I guess you already encode the content of the content parameter and send that to the guest agent.
Is there a way to stop the api from encoding to base64 again and send your own base64 that gets written as a binary file?
 
Is there a way to stop the api from encoding to base64 again and send your own base64 that gets written as a binary file?
no, not currently, but you can open feature request on our bugtracker (https://bugzilla.proxmox.com)
make sense to have it as an option

we just look for new way (outside cloud-init) use agent (default no change agent safe config) write a file info vm start auto config ip address. just this. tks. issue we develop a pve system manager, maybe next year push language(en) .
ok i think i know what you want, but you did not actually post a question or a problem. what exactly does not work with the steps you linked?
 
no, not currently, but you can open feature request on our bugtracker (https://bugzilla.proxmox.com)
make sense to have it as an option


ok i think i know what you want, but you did not actually post a question or a problem. what exactly does not work with the steps you linked?
tks reply me, we just want no change agent safe config write a file(very small, is a ip config infomation )acitve vm started auto set static ip address.
 
Hey, I was looking into transferring a file to a VM running the guest agent as well. It seems like the --content parameter from file-write only takes strings but I want to copy a binary file. Is there a way to accomplish this?
The qemu-guest-agent docs say it accepts a base64 encoded string, I guess you already encode the content of the content parameter and send that to the guest agent.
Is there a way to stop the api from encoding to base64 again and send your own base64 that gets written as a binary file?

I wrote a little python script to do that. It uses qm guest exec together with cat, dd, stat and base64 inside the VM and it can transfers files above 1 MiB (in chunks).

It is still slow, 100-300 KB/s, but it works reliable:
https://github.com/mietzen/proxmox-qm-file
 
  • Like
Reactions: Cookiefamily