mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
c6d009620a
commit
85e4f3db7c
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user