mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu_driver: Push qemuDomainInterfaceAddresses() a few lines down
If we place qemuDomainInterfaceAddresses() a few lines below the two functions its using then we can drop forward declarations of those functions. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
b036505279
commit
5910b180ca
@ -152,13 +152,6 @@ static int qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
|
|||||||
const char *path, int oflags,
|
const char *path, int oflags,
|
||||||
bool *needUnlink);
|
bool *needUnlink);
|
||||||
|
|
||||||
static int qemuGetDHCPInterfaces(virDomainPtr dom,
|
|
||||||
virDomainObjPtr vm,
|
|
||||||
virDomainInterfacePtr **ifaces);
|
|
||||||
|
|
||||||
static int qemuARPGetInterfaces(virDomainObjPtr vm,
|
|
||||||
virDomainInterfacePtr **ifaces);
|
|
||||||
|
|
||||||
static virQEMUDriverPtr qemu_driver;
|
static virQEMUDriverPtr qemu_driver;
|
||||||
|
|
||||||
/* Looks up the domain object from snapshot and unlocks the
|
/* Looks up the domain object from snapshot and unlocks the
|
||||||
@ -21723,64 +21716,6 @@ qemuDomainGetFSInfo(virDomainPtr dom,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
qemuDomainInterfaceAddresses(virDomainPtr dom,
|
|
||||||
virDomainInterfacePtr **ifaces,
|
|
||||||
unsigned int source,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
|
||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
|
||||||
virDomainObjPtr vm = NULL;
|
|
||||||
qemuAgentPtr agent;
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
|
||||||
|
|
||||||
if (!(vm = qemuDomainObjFromDomain(dom)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virDomainObjCheckActive(vm) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
switch (source) {
|
|
||||||
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
|
|
||||||
ret = qemuGetDHCPInterfaces(dom, vm, ifaces);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT:
|
|
||||||
if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!qemuDomainAgentAvailable(vm, true))
|
|
||||||
goto endjob;
|
|
||||||
|
|
||||||
agent = qemuDomainObjEnterAgent(vm);
|
|
||||||
ret = qemuAgentGetInterfaces(agent, ifaces);
|
|
||||||
qemuDomainObjExitAgent(vm, agent);
|
|
||||||
|
|
||||||
endjob:
|
|
||||||
qemuDomainObjEndAgentJob(vm);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
|
|
||||||
ret = qemuARPGetInterfaces(vm, ifaces);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
|
|
||||||
_("Unknown IP address data source %d"),
|
|
||||||
source);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virDomainObjEndAPI(&vm);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuGetDHCPInterfaces(virDomainPtr dom,
|
qemuGetDHCPInterfaces(virDomainPtr dom,
|
||||||
@ -21933,6 +21868,66 @@ qemuARPGetInterfaces(virDomainObjPtr vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainInterfaceAddresses(virDomainPtr dom,
|
||||||
|
virDomainInterfacePtr **ifaces,
|
||||||
|
unsigned int source,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr vm = NULL;
|
||||||
|
qemuAgentPtr agent;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
|
if (!(vm = qemuDomainObjFromDomain(dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainObjCheckActive(vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
switch (source) {
|
||||||
|
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
|
||||||
|
ret = qemuGetDHCPInterfaces(dom, vm, ifaces);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT:
|
||||||
|
if (qemuDomainObjBeginAgentJob(driver, vm, QEMU_AGENT_JOB_QUERY) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!qemuDomainAgentAvailable(vm, true))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
|
agent = qemuDomainObjEnterAgent(vm);
|
||||||
|
ret = qemuAgentGetInterfaces(agent, ifaces);
|
||||||
|
qemuDomainObjExitAgent(vm, agent);
|
||||||
|
|
||||||
|
endjob:
|
||||||
|
qemuDomainObjEndAgentJob(vm);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
|
||||||
|
ret = qemuARPGetInterfaces(vm, ifaces);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
|
||||||
|
_("Unknown IP address data source %d"),
|
||||||
|
source);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virDomainObjEndAPI(&vm);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainSetUserPassword(virDomainPtr dom,
|
qemuDomainSetUserPassword(virDomainPtr dom,
|
||||||
const char *user,
|
const char *user,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user