A connection object is not required because autostarted domains are
never marked for autodestroy.
The comment about needing a connection for the network driver is
obsolete since we can auto-open a connection on demand.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/bhyve/bhyve_driver.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index ea5a9be4fb..f6b0417014 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -71,15 +71,14 @@ VIR_LOG_INIT("bhyve.bhyve_driver");
struct _bhyveConn *bhyve_driver = NULL;
static int
-bhyveAutostartDomain(virDomainObj *vm, void *opaque)
+bhyveAutostartDomain(virDomainObj *vm, void *opaque G_GNUC_UNUSED)
{
- const struct bhyveAutostartData *data = opaque;
int ret = 0;
VIR_LOCK_GUARD lock = virObjectLockGuard(vm);
if (vm->autostart && !virDomainObjIsActive(vm)) {
virResetLastError();
- ret = virBhyveProcessStart(bhyve_driver, data->conn, vm,
+ ret = virBhyveProcessStart(bhyve_driver, NULL, vm,
VIR_DOMAIN_RUNNING_BOOTED, 0);
if (ret < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -93,19 +92,7 @@ bhyveAutostartDomain(virDomainObj *vm, void *opaque)
static void
bhyveAutostartDomains(struct _bhyveConn *driver)
{
- /* XXX: Figure out a better way todo this. The domain
- * startup code needs a connection handle in order
- * to lookup the bridge associated with a virtual
- * network
- */
- virConnectPtr conn = virConnectOpen("bhyve:///system");
- /* Ignoring NULL conn which is mostly harmless here */
-
- struct bhyveAutostartData data = { driver, conn };
-
- virDomainObjListForEach(driver->domains, false, bhyveAutostartDomain, &data);
-
- virObjectUnref(conn);
+ virDomainObjListForEach(driver->domains, false, bhyveAutostartDomain, NULL);
}
/**
--
2.47.1