Thanks Wido!
Right now I can think in creating bash scripting like this to run specific
commands on VMs
#!/bin/bash
VM_NAME="i-xx-xxx-VM"
# Timeout
TIMEOUT=5
# JSON Command
COMMAND_JSON=$(cat <<EOF
{
"execute": "guest-exec",
"arguments": {
"path": "/tmp/echo_hello.sh",
"capture-output": true
}
}
EOF
)
result=$(virsh qemu-agent-command "$VM_NAME" "$COMMAND_JSON" --timeout $TIMEOUT)
echo "Result: $result"
But would be nice to have a module on Cloudstack like user-data but to send ops
commands on the running command, I will create the PR then.
Regards,
Ricardo Pertuz
On 15 Oct 2024 at 10:12 AM -0500, Wido den Hollander <[email protected]>,
wrote:
>
>
> Op 15/10/2024 om 14:49 schreef Ricardo Pertuz:
> > Haven’t found any relevant about the cloudstack-guest-tool, do you have any
> > reference I can follow? The qemu-guest-agent I have used it before but in
> > standard implementation of libvirt
> >
> See:
> https://github.com/apache/cloudstack/blob/main/agent/bindir/cloud-guest-tool.in
>
> I see there is no exec, but you can fetch information from the VM if you
> want through this tool.
>
> PR is welcome to add exec functionality!
>
> Wido
>
> >
> > Atte,
> >
> > Ricardo Pertuz
> >
> >
> > On 15 Oct 2024 at 1:52 AM -0500, Wido den Hollander
> > <[email protected]>, wrote:
> > >
> > > cloudstack-guest-tool
> >