qemu: refactor 'qemuAgentGetInterfaces'

Add report_unsupported parameter to qemuAgentGetInterfaces

Signed-off-by: zhanglei <zhanglei@smartx.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
zhanglei 2021-10-15 18:07:49 +08:00 committed by Ján Tomko
parent c6d009620a
commit 85e4f3db7c
4 changed files with 10 additions and 6 deletions

View File

@ -2223,17 +2223,20 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
*/
int
qemuAgentGetInterfaces(qemuAgent *agent,
virDomainInterfacePtr **ifaces)
virDomainInterfacePtr **ifaces,
bool report_unsupported)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
virJSONValue *ret_array = NULL;
int rc;
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
return -1;
if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
return -1;
if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
report_unsupported)) < 0)
return rc;
if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",

View File

@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon,
bool sync);
int qemuAgentGetInterfaces(qemuAgent *mon,
virDomainInterfacePtr **ifaces);
virDomainInterfacePtr **ifaces,
bool report_unsupported);
int qemuAgentSetUserPassword(qemuAgent *mon,
const char *user,

View File

@ -19171,7 +19171,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
goto endjob;
agent = qemuDomainObjEnterAgent(vm);
ret = qemuAgentGetInterfaces(agent, ifaces);
ret = qemuAgentGetInterfaces(agent, ifaces, true);
qemuDomainObjExitAgent(vm, agent);
endjob:

View File

@ -907,7 +907,7 @@ testQemuAgentGetInterfaces(const void *data)
goto cleanup;
if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
&ifaces)) < 0)
&ifaces, true)) < 0)
goto cleanup;
if (ifaces_count != 4) {