mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +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
|
int
|
||||||
qemuAgentGetInterfaces(qemuAgent *agent,
|
qemuAgentGetInterfaces(qemuAgent *agent,
|
||||||
virDomainInterfacePtr **ifaces)
|
virDomainInterfacePtr **ifaces,
|
||||||
|
bool report_unsupported)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) cmd = NULL;
|
g_autoptr(virJSONValue) cmd = NULL;
|
||||||
g_autoptr(virJSONValue) reply = NULL;
|
g_autoptr(virJSONValue) reply = NULL;
|
||||||
virJSONValue *ret_array = NULL;
|
virJSONValue *ret_array = NULL;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
|
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
|
if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout,
|
||||||
return -1;
|
report_unsupported)) < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
|
if (!(ret_array = virJSONValueObjectGetArray(reply, "return"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon,
|
|||||||
bool sync);
|
bool sync);
|
||||||
|
|
||||||
int qemuAgentGetInterfaces(qemuAgent *mon,
|
int qemuAgentGetInterfaces(qemuAgent *mon,
|
||||||
virDomainInterfacePtr **ifaces);
|
virDomainInterfacePtr **ifaces,
|
||||||
|
bool report_unsupported);
|
||||||
|
|
||||||
int qemuAgentSetUserPassword(qemuAgent *mon,
|
int qemuAgentSetUserPassword(qemuAgent *mon,
|
||||||
const char *user,
|
const char *user,
|
||||||
|
@ -19171,7 +19171,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
agent = qemuDomainObjEnterAgent(vm);
|
agent = qemuDomainObjEnterAgent(vm);
|
||||||
ret = qemuAgentGetInterfaces(agent, ifaces);
|
ret = qemuAgentGetInterfaces(agent, ifaces, true);
|
||||||
qemuDomainObjExitAgent(vm, agent);
|
qemuDomainObjExitAgent(vm, agent);
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
|
@ -907,7 +907,7 @@ testQemuAgentGetInterfaces(const void *data)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
|
if ((ifaces_count = qemuAgentGetInterfaces(qemuMonitorTestGetAgent(test),
|
||||||
&ifaces)) < 0)
|
&ifaces, true)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (ifaces_count != 4) {
|
if (ifaces_count != 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user