The remote driver has had a long term hack to deal with the fact
that the old Xen driver worked outside libvirtd, but the rest
of the drivers worked inside. So you could have a local hypervisor
driver but everything else go via the remote driver. The Xen driver
long ago moved inside libvirtd, so this hack is no longer needed.
Thus we should open use the remote driver for secondary drivers
if the primary driver is already the remote driver.
---
src/remote/remote_driver.c | 85 ++++++++++++----------------------------------
1 file changed, 21 insertions(+), 64 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 067f2d0..19a70a1 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1124,33 +1124,6 @@ remoteAllocPrivateData(void)
return priv;
}
-static int
-remoteOpenSecondaryDriver(virConnectPtr conn,
- virConnectAuthPtr auth,
- unsigned int flags,
- struct private_data **priv)
-{
- int ret;
- int rflags = 0;
-
- if (!((*priv) = remoteAllocPrivateData()))
- return VIR_DRV_OPEN_ERROR;
-
- if (flags & VIR_CONNECT_RO)
- rflags |= VIR_DRV_OPEN_REMOTE_RO;
-
- ret = doRemoteOpen(conn, *priv, auth, rflags);
- if (ret != VIR_DRV_OPEN_SUCCESS) {
- remoteDriverUnlock(*priv);
- VIR_FREE(*priv);
- } else {
- (*priv)->localUses = 1;
- remoteDriverUnlock(*priv);
- }
-
- return ret;
-}
-
static virDrvOpenStatus
remoteConnectOpen(virConnectPtr conn,
virConnectAuthPtr auth,
@@ -3554,8 +3527,7 @@ remoteConnectListAllSecrets(virConnectPtr conn,
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags, void **genericPrivateData)
+remoteGenericOpen(virConnectPtr conn, void **genericPrivateData)
{
if (inside_daemon)
return VIR_DRV_OPEN_DECLINED;
@@ -3573,24 +3545,9 @@ remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth,
*genericPrivateData = priv;
remoteDriverUnlock(priv);
return VIR_DRV_OPEN_SUCCESS;
- } else if (conn->networkDriver &&
- STREQ(conn->networkDriver->name, "remote")) {
- struct private_data *priv = conn->networkPrivateData;
- remoteDriverLock(priv);
- *genericPrivateData = priv;
- priv->localUses++;
- remoteDriverUnlock(priv);
- return VIR_DRV_OPEN_SUCCESS;
- } else {
- /* Using a non-remote driver, so we need to open a
- * new connection for network APIs, forcing it to
- * use the UNIX transport. This handles Xen driver
- * which doesn't have its own impl of the network APIs. */
- struct private_data *priv;
- int ret = remoteOpenSecondaryDriver(conn, auth, flags, &priv);
- *genericPrivateData = priv;
- return ret;
}
+
+ return VIR_DRV_OPEN_DECLINED;
}
static int
@@ -3614,10 +3571,10 @@ remoteGenericClose(virConnectPtr conn, void **genericPrivateData)
}
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteNetworkOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteNetworkOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->networkPrivateData);
+ return remoteGenericOpen(conn, &conn->networkPrivateData);
}
static int
@@ -3629,10 +3586,10 @@ remoteNetworkClose(virConnectPtr conn)
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteInterfaceOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteInterfaceOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->interfacePrivateData);
+ return remoteGenericOpen(conn, &conn->interfacePrivateData);
}
static int
@@ -3644,10 +3601,10 @@ remoteInterfaceClose(virConnectPtr conn)
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteStorageOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteStorageOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->storagePrivateData);
+ return remoteGenericOpen(conn, &conn->storagePrivateData);
}
static int
@@ -3826,10 +3783,10 @@ remoteStoragePoolListAllVolumes(virStoragePoolPtr pool,
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteNodeDeviceOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteNodeDeviceOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->nodeDevicePrivateData);
+ return remoteGenericOpen(conn, &conn->nodeDevicePrivateData);
}
static int
@@ -3947,10 +3904,10 @@ remoteNodeDeviceReset(virNodeDevicePtr dev)
/* ------------------------------------------------------------- */
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteNWFilterOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteNWFilterOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->nwfilterPrivateData);
+ return remoteGenericOpen(conn, &conn->nwfilterPrivateData);
}
static int
@@ -5603,10 +5560,10 @@ remoteDomainBuildQemuMonitorEvent(virNetClientProgramPtr prog
ATTRIBUTE_UNUSED,
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth,
- unsigned int flags)
+remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, auth, flags, &conn->secretPrivateData);
+ return remoteGenericOpen(conn, &conn->secretPrivateData);
}
static int
--
2.1.0