domain_qemu_agent_command($domain,$cmd,$timeout,$flags)

Should there be a way to suppress errors using the flags? error : qemuDomainAgentAvailable:8411 : Guest agent is not responding: QEMU guest agent is not connected Or is there a libvirt function to check connection status or another way?

On 10/25/22 20:04, Simon Fairweather wrote:
Should there be a way to suppress errors using the flags?
error : qemuDomainAgentAvailable:8411 : Guest agent is not responding: QEMU guest agent is not connected
Or is there a libvirt function to check connection status or another way?
This error message is "harmless" in a sense that there is no split brain of states between libvirt and QEMU. But yeah, your API is going to fail. You can check for the agent status in the domain XML, for instance with the following (rewrite in your favorite language): virsh dumpxml fedora | xpath -e "string(//channel/target[@name='org.qemu.guest_agent.0']/@state)" Michal

Thanks Michal, php version I used. $xml = new SimpleXMLElement($lv->domain_get_xml($res)) ; $data = $xml->xpath('//channel/target[@name="org.qemu.guest_agent.0"]/@state') ; On Wed, Oct 26, 2022 at 8:21 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 10/25/22 20:04, Simon Fairweather wrote:
Should there be a way to suppress errors using the flags?
error : qemuDomainAgentAvailable:8411 : Guest agent is not responding: QEMU guest agent is not connected
Or is there a libvirt function to check connection status or another way?
This error message is "harmless" in a sense that there is no split brain of states between libvirt and QEMU. But yeah, your API is going to fail.
You can check for the agent status in the domain XML, for instance with the following (rewrite in your favorite language):
virsh dumpxml fedora | xpath -e "string(//channel/target[@name='org.qemu.guest_agent.0']/@state)"
Michal

Hi Michal, Can you advise why the following warning is logged for this command: domain_qemu_agent_command($res, '{"execute":"guest-network-get-interfaces"}', 10, 0) ; warning : qemuDomainObjTaintMsg:6464 : Domain id=1 name='HA' uuid=ffbc955e-9a51-f1d1-2501-b4cbdac5dd4c is tainted: custom-ga-command Regards On Wed, Oct 26, 2022 at 8:21 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 10/25/22 20:04, Simon Fairweather wrote:
Should there be a way to suppress errors using the flags?
error : qemuDomainAgentAvailable:8411 : Guest agent is not responding: QEMU guest agent is not connected
Or is there a libvirt function to check connection status or another way?
This error message is "harmless" in a sense that there is no split brain of states between libvirt and QEMU. But yeah, your API is going to fail.
You can check for the agent status in the domain XML, for instance with the following (rewrite in your favorite language):
virsh dumpxml fedora | xpath -e "string(//channel/target[@name='org.qemu.guest_agent.0']/@state)"
Michal

On 11/15/22 14:44, Simon Fairweather wrote:
Hi Michal,
Can you advise why the following warning is logged for this command: domain_qemu_agent_command($res, '{"execute":"guest-network-get-interfaces"}', 10, 0) ;
warning : qemuDomainObjTaintMsg:6464 : Domain id=1 name='HA' uuid=ffbc955e-9a51-f1d1-2501-b4cbdac5dd4c is tainted: custom-ga-command
Because using qemu-ga can change the state behind libvirt's back. So far we've ignored tainted flag but the idea is to be similar to kernel and its tainting. In this specific case - libvirt offers a this particular command as an API: libvirt_domain_interface_addresses() in PHP, or virDomainInterfaceAddresses() in C. Michal

libvirt_domain_interface_addresses() this doesn't seem to be in the php api reference. On Tue, Nov 15, 2022 at 1:47 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 11/15/22 14:44, Simon Fairweather wrote:
Hi Michal,
Can you advise why the following warning is logged for this command: domain_qemu_agent_command($res, '{"execute":"guest-network-get-interfaces"}', 10, 0) ;
warning : qemuDomainObjTaintMsg:6464 : Domain id=1 name='HA' uuid=ffbc955e-9a51-f1d1-2501-b4cbdac5dd4c is tainted: custom-ga-command
Because using qemu-ga can change the state behind libvirt's back. So far we've ignored tainted flag but the idea is to be similar to kernel and its tainting.
In this specific case - libvirt offers a this particular command as an API:
libvirt_domain_interface_addresses() in PHP, or virDomainInterfaceAddresses() in C.
Michal

On 11/15/22 18:21, Simon Fairweather wrote:
libvirt_domain_interface_addresses() this doesn't seem to be in the php api reference.
I'm not sure what you mean. It was added ~3 years ago: https://gitlab.com/libvirt/libvirt-php/-/commit/97a86d8428b5d189a0dd09c86be8... It's in libvirt-php-0.5.5. Michal

Thanks, But is is not in the list here. https://libvirt.org/php/api-reference.html On Wed, Nov 16, 2022 at 8:03 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 11/15/22 18:21, Simon Fairweather wrote:
libvirt_domain_interface_addresses() this doesn't seem to be in the php api reference.
I'm not sure what you mean. It was added ~3 years ago:
https://gitlab.com/libvirt/libvirt-php/-/commit/97a86d8428b5d189a0dd09c86be8...
It's in libvirt-php-0.5.5.
Michal

On 11/16/22 09:07, Simon Fairweather wrote:
Thanks, But is is not in the list here.
https://libvirt.org/php/api-reference.html <https://libvirt.org/php/api-reference.html>
Ah, fixed now. Thanks for the report. Michal
participants (2)
-
Michal Prívozník
-
Simon Fairweather