mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
ch: implement domainInterfaceAddresses
Implement domainInterfaceAddresses for the Cloud Hypervisor driver. Support VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE and VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP sources. Implementation is similar to other drivers. Signed-off-by: Anirudh Rayabharam <anrayabh@linux.microsoft.com> Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a9c73ac255
commit
e797c3e3b3
@ -2298,6 +2298,47 @@ chConnectDomainEventDeregisterAny(virConnectPtr conn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
chDomainInterfaceAddresses(virDomain *dom,
|
||||
virDomainInterfacePtr **ifaces,
|
||||
unsigned int source,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainObj *vm = NULL;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (!(vm = virCHDomainObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def, source) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainObjCheckActive(vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
switch (source) {
|
||||
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
|
||||
ret = virDomainNetDHCPInterfaces(vm->def, ifaces);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
|
||||
ret = virDomainNetARPInterfaces(vm->def, ifaces);
|
||||
break;
|
||||
|
||||
default:
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
|
||||
_("Unsupported IP address data source %1$d"),
|
||||
source);
|
||||
break;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Function Tables */
|
||||
static virHypervisorDriver chHypervisorDriver = {
|
||||
@ -2359,6 +2400,7 @@ static virHypervisorDriver chHypervisorDriver = {
|
||||
.nodeGetMemoryStats = chNodeGetMemoryStats, /* 10.10.0 */
|
||||
.connectDomainEventRegisterAny = chConnectDomainEventRegisterAny, /* 10.10.0 */
|
||||
.connectDomainEventDeregisterAny = chConnectDomainEventDeregisterAny, /* 10.10.0 */
|
||||
.domainInterfaceAddresses = chDomainInterfaceAddresses, /* 11.0.0 */
|
||||
};
|
||||
|
||||
static virConnectDriver chConnectDriver = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user