Skip to content

Commit bd2b556

Browse files
anirudhrbpraveen-pk
authored andcommitted
ch_driver: 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 <[email protected]>
1 parent d9170c1 commit bd2b556

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/ch/ch_driver.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,47 @@ static int chDomainGetAutostart(virDomainPtr dom,
19981998
return ret;
19991999
};
20002000

2001+
static int
2002+
chDomainInterfaceAddresses(virDomainPtr dom,
2003+
virDomainInterfacePtr **ifaces,
2004+
unsigned int source,
2005+
unsigned int flags)
2006+
{
2007+
virDomainObjPtr vm = NULL;
2008+
int ret = -1;
2009+
2010+
virCheckFlags(0, -1);
2011+
2012+
if (!(vm = chDomObjFromDomain(dom)))
2013+
goto cleanup;
2014+
2015+
if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
2016+
goto cleanup;
2017+
2018+
if (virDomainObjCheckActive(vm) < 0)
2019+
goto cleanup;
2020+
2021+
switch (source) {
2022+
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
2023+
ret = virDomainNetDHCPInterfaces(vm->def, ifaces);
2024+
break;
2025+
2026+
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP:
2027+
ret = virDomainNetARPInterfaces(vm->def, ifaces);
2028+
break;
2029+
2030+
default:
2031+
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
2032+
_("Unknown IP address data source %d"),
2033+
source);
2034+
break;
2035+
}
2036+
2037+
cleanup:
2038+
virDomainObjEndAPI(&vm);
2039+
return ret;
2040+
}
2041+
20012042

20022043
/* Function Tables */
20032044
static virHypervisorDriver chHypervisorDriver = {
@@ -2051,6 +2092,7 @@ static virHypervisorDriver chHypervisorDriver = {
20512092
.domainGetAutostart = chDomainGetAutostart, /* 6.7.0 */
20522093
.domainSetAutostart = chDomainSetAutostart, /* 6.7.0 */
20532094
.domainSetVcpus = chDomainSetVcpus, /* 6.7.0 */
2095+
.domainInterfaceAddresses = chDomainInterfaceAddresses, /* 6.7.0 */
20542096
};
20552097

20562098
static virConnectDriver chConnectDriver = {

0 commit comments

Comments
 (0)