mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
driver: declare supported URI schemes in virConnectDriver struct
Declare what URI schemes a driver supports in its virConnectDriver struct. This allows us to skip trying to open the driver entirely if the URI scheme doesn't match. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3714cc952d
commit
8e4f9a2773
@ -202,9 +202,6 @@ bhyveConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (!conn->uri->scheme || STRNEQ(conn->uri->scheme, "bhyve"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
|
if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unexpected bhyve URI path '%s', try bhyve:///system"),
|
_("Unexpected bhyve URI path '%s', try bhyve:///system"),
|
||||||
@ -1736,6 +1733,7 @@ static virHypervisorDriver bhyveHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver bhyveConnectDriver = {
|
static virConnectDriver bhyveConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "bhyve", NULL },
|
||||||
.hypervisorDriver = &bhyveHypervisorDriver,
|
.hypervisorDriver = &bhyveHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,6 +81,12 @@ typedef virConnectDriver *virConnectDriverPtr;
|
|||||||
struct _virConnectDriver {
|
struct _virConnectDriver {
|
||||||
/* Wether driver permits a server in the URI */
|
/* Wether driver permits a server in the URI */
|
||||||
bool localOnly;
|
bool localOnly;
|
||||||
|
/*
|
||||||
|
* NULL terminated list of supported URI schemes.
|
||||||
|
* - Single element { NULL } list indicates no supported schemes
|
||||||
|
* - NULL list indicates wildcard supportnig all schemes
|
||||||
|
*/
|
||||||
|
const char **uriSchemes;
|
||||||
virHypervisorDriverPtr hypervisorDriver;
|
virHypervisorDriverPtr hypervisorDriver;
|
||||||
virInterfaceDriverPtr interfaceDriver;
|
virInterfaceDriverPtr interfaceDriver;
|
||||||
virNetworkDriverPtr networkDriver;
|
virNetworkDriverPtr networkDriver;
|
||||||
|
@ -845,7 +845,6 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
||||||
char *plus;
|
|
||||||
esxPrivate *priv = NULL;
|
esxPrivate *priv = NULL;
|
||||||
char *potentialVCenterIPAddress = NULL;
|
char *potentialVCenterIPAddress = NULL;
|
||||||
char vCenterIPAddress[NI_MAXHOST] = "";
|
char vCenterIPAddress[NI_MAXHOST] = "";
|
||||||
@ -853,32 +852,9 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
/* Decline if the URI is NULL or the scheme is NULL */
|
/* Decline if the URI is NULL or the scheme is NULL */
|
||||||
if (!conn->uri || !conn->uri->scheme)
|
if (!conn->uri)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
/* Decline if the scheme is not one of {vpx|esx|gsx} */
|
|
||||||
plus = strchr(conn->uri->scheme, '+');
|
|
||||||
|
|
||||||
if (!plus) {
|
|
||||||
if (STRCASENEQ(conn->uri->scheme, "vpx") &&
|
|
||||||
STRCASENEQ(conn->uri->scheme, "esx") &&
|
|
||||||
STRCASENEQ(conn->uri->scheme, "gsx")) {
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (plus - conn->uri->scheme != 3 ||
|
|
||||||
(STRCASENEQLEN(conn->uri->scheme, "vpx", 3) &&
|
|
||||||
STRCASENEQLEN(conn->uri->scheme, "esx", 3) &&
|
|
||||||
STRCASENEQLEN(conn->uri->scheme, "gsx", 3))) {
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
|
||||||
_("Transport '%s' in URI scheme is not supported, try again "
|
|
||||||
"without the transport part"), plus + 1);
|
|
||||||
return VIR_DRV_OPEN_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (STRCASENEQ(conn->uri->scheme, "vpx") &&
|
if (STRCASENEQ(conn->uri->scheme, "vpx") &&
|
||||||
conn->uri->path && STRNEQ(conn->uri->path, "/")) {
|
conn->uri->path && STRNEQ(conn->uri->path, "/")) {
|
||||||
VIR_WARN("Ignoring unexpected path '%s' for non-vpx scheme '%s'",
|
VIR_WARN("Ignoring unexpected path '%s' for non-vpx scheme '%s'",
|
||||||
@ -5262,6 +5238,7 @@ static virHypervisorDriver esxHypervisorDriver = {
|
|||||||
|
|
||||||
|
|
||||||
static virConnectDriver esxConnectDriver = {
|
static virConnectDriver esxConnectDriver = {
|
||||||
|
.uriSchemes = (const char *[]){ "vpx", "esx", "gsx", NULL },
|
||||||
.hypervisorDriver = &esxHypervisorDriver,
|
.hypervisorDriver = &esxHypervisorDriver,
|
||||||
.interfaceDriver = &esxInterfaceDriver,
|
.interfaceDriver = &esxInterfaceDriver,
|
||||||
.networkDriver = &esxNetworkDriver,
|
.networkDriver = &esxNetworkDriver,
|
||||||
|
@ -122,7 +122,6 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
||||||
char *plus;
|
|
||||||
hypervPrivate *priv = NULL;
|
hypervPrivate *priv = NULL;
|
||||||
char *username = NULL;
|
char *username = NULL;
|
||||||
char *password = NULL;
|
char *password = NULL;
|
||||||
@ -130,27 +129,9 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
/* Decline if the URI is NULL or the scheme is NULL */
|
/* Decline if the URI is NULL or the scheme is NULL */
|
||||||
if (conn->uri == NULL || conn->uri->scheme == NULL)
|
if (conn->uri == NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
/* Decline if the scheme is not hyperv */
|
|
||||||
plus = strchr(conn->uri->scheme, '+');
|
|
||||||
|
|
||||||
if (plus == NULL) {
|
|
||||||
if (STRCASENEQ(conn->uri->scheme, "hyperv"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
} else {
|
|
||||||
if (plus - conn->uri->scheme != 6 ||
|
|
||||||
STRCASENEQLEN(conn->uri->scheme, "hyperv", 6)) {
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
|
||||||
_("Transport '%s' in URI scheme is not supported, try again "
|
|
||||||
"without the transport part"), plus + 1);
|
|
||||||
return VIR_DRV_OPEN_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Require server part */
|
/* Require server part */
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
@ -1685,6 +1666,7 @@ hypervDebugHandler(const char *message, debug_level_e level,
|
|||||||
|
|
||||||
|
|
||||||
static virConnectDriver hypervConnectDriver = {
|
static virConnectDriver hypervConnectDriver = {
|
||||||
|
.uriSchemes = (const char *[]){ "hyperv", NULL },
|
||||||
.hypervisorDriver = &hypervHypervisorDriver,
|
.hypervisorDriver = &hypervHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,9 +164,6 @@ netcfConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "interface"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("interface state driver is not active"));
|
_("interface state driver is not active"));
|
||||||
@ -1221,6 +1218,7 @@ static virHypervisorDriver interfaceHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver interfaceConnectDriver = {
|
static virConnectDriver interfaceConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "interface", NULL },
|
||||||
.hypervisorDriver = &interfaceHypervisorDriver,
|
.hypervisorDriver = &interfaceHypervisorDriver,
|
||||||
.interfaceDriver = &interfaceDriver,
|
.interfaceDriver = &interfaceDriver,
|
||||||
};
|
};
|
||||||
|
@ -1208,9 +1208,6 @@ udevConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "interface"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("interface state driver is not active"));
|
_("interface state driver is not active"));
|
||||||
@ -1292,6 +1289,7 @@ static virHypervisorDriver udevHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver udevConnectDriver = {
|
static virConnectDriver udevConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "interface", NULL },
|
||||||
.hypervisorDriver = &udevHypervisorDriver,
|
.hypervisorDriver = &udevHypervisorDriver,
|
||||||
.interfaceDriver = &udevIfaceDriver,
|
.interfaceDriver = &udevIfaceDriver,
|
||||||
};
|
};
|
||||||
|
@ -1073,6 +1073,30 @@ virConnectOpenInternal(const char *name,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Filter drivers based on declared URI schemes */
|
||||||
|
if (virConnectDriverTab[i]->uriSchemes && ret->uri) {
|
||||||
|
bool matchScheme = false;
|
||||||
|
size_t s;
|
||||||
|
if (!ret->uri->scheme) {
|
||||||
|
VIR_DEBUG("No URI scheme, skipping driver with URI whitelist");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
VIR_DEBUG("Checking for supported URI schemes");
|
||||||
|
for (s = 0; virConnectDriverTab[i]->uriSchemes[s] != NULL; s++) {
|
||||||
|
if (STREQ(ret->uri->scheme, virConnectDriverTab[i]->uriSchemes[s])) {
|
||||||
|
VIR_DEBUG("Matched URI scheme '%s'", ret->uri->scheme);
|
||||||
|
matchScheme = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!matchScheme) {
|
||||||
|
VIR_DEBUG("No matching URI scheme");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
VIR_DEBUG("Matching any URI scheme for '%s'", ret->uri ? ret->uri->scheme : "");
|
||||||
|
}
|
||||||
|
|
||||||
ret->driver = virConnectDriverTab[i]->hypervisorDriver;
|
ret->driver = virConnectDriverTab[i]->hypervisorDriver;
|
||||||
ret->interfaceDriver = virConnectDriverTab[i]->interfaceDriver;
|
ret->interfaceDriver = virConnectDriverTab[i]->interfaceDriver;
|
||||||
ret->networkDriver = virConnectDriverTab[i]->networkDriver;
|
ret->networkDriver = virConnectDriverTab[i]->networkDriver;
|
||||||
|
@ -848,10 +848,6 @@ libxlConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
/* Only xen scheme */
|
|
||||||
if (conn->uri->scheme == NULL || STRNEQ(conn->uri->scheme, "xen"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* Error if xen or libxl scheme specified but driver not started. */
|
/* Error if xen or libxl scheme specified but driver not started. */
|
||||||
if (libxl_driver == NULL) {
|
if (libxl_driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -6579,6 +6575,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver libxlConnectDriver = {
|
static virConnectDriver libxlConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "xen", NULL },
|
||||||
.hypervisorDriver = &libxlHypervisorDriver,
|
.hypervisorDriver = &libxlHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -173,10 +173,6 @@ static virDrvOpenStatus lxcConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "lxc"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* If path isn't '/' then they typoed, tell them correct path */
|
/* If path isn't '/' then they typoed, tell them correct path */
|
||||||
if (conn->uri->path != NULL &&
|
if (conn->uri->path != NULL &&
|
||||||
STRNEQ(conn->uri->path, "/") &&
|
STRNEQ(conn->uri->path, "/") &&
|
||||||
@ -5634,6 +5630,7 @@ static virHypervisorDriver lxcHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver lxcConnectDriver = {
|
static virConnectDriver lxcConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "lxc", NULL },
|
||||||
.hypervisorDriver = &lxcHypervisorDriver,
|
.hypervisorDriver = &lxcHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -883,9 +883,6 @@ networkConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "network"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (network_driver == NULL) {
|
if (network_driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("network state driver is not active"));
|
_("network state driver is not active"));
|
||||||
@ -5613,6 +5610,7 @@ static virHypervisorDriver networkHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver networkConnectDriver = {
|
static virConnectDriver networkConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "network", NULL },
|
||||||
.hypervisorDriver = &networkHypervisorDriver,
|
.hypervisorDriver = &networkHypervisorDriver,
|
||||||
.networkDriver = &networkDriver,
|
.networkDriver = &networkDriver,
|
||||||
};
|
};
|
||||||
|
@ -59,9 +59,6 @@ nodeConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "nodedev"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("nodedev state driver is not active"));
|
_("nodedev state driver is not active"));
|
||||||
|
@ -784,6 +784,7 @@ static virHypervisorDriver halHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver halConnectDriver = {
|
static virConnectDriver halConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "nodedev", NULL },
|
||||||
.hypervisorDriver = &halHypervisorDriver,
|
.hypervisorDriver = &halHypervisorDriver,
|
||||||
.nodeDeviceDriver = &halNodeDeviceDriver,
|
.nodeDeviceDriver = &halNodeDeviceDriver,
|
||||||
};
|
};
|
||||||
|
@ -1958,6 +1958,7 @@ static virHypervisorDriver udevHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver udevConnectDriver = {
|
static virConnectDriver udevConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "nodedev", NULL },
|
||||||
.hypervisorDriver = &udevHypervisorDriver,
|
.hypervisorDriver = &udevHypervisorDriver,
|
||||||
.nodeDeviceDriver = &udevNodeDeviceDriver,
|
.nodeDeviceDriver = &udevNodeDeviceDriver,
|
||||||
};
|
};
|
||||||
|
@ -376,9 +376,6 @@ nwfilterConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "nwfilter"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("nwfilter state driver is not active"));
|
_("nwfilter state driver is not active"));
|
||||||
@ -709,6 +706,7 @@ static virHypervisorDriver nwfilterHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver nwfilterConnectDriver = {
|
static virConnectDriver nwfilterConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "nwfilter", NULL },
|
||||||
.hypervisorDriver = &nwfilterHypervisorDriver,
|
.hypervisorDriver = &nwfilterHypervisorDriver,
|
||||||
.nwfilterDriver = &nwfilterDriver,
|
.nwfilterDriver = &nwfilterDriver,
|
||||||
};
|
};
|
||||||
|
@ -1357,11 +1357,6 @@ static virDrvOpenStatus openvzConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
/* If scheme isn't 'openvz', then its for another driver */
|
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "openvz"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* If path isn't /system, then they typoed, so tell them correct path */
|
/* If path isn't /system, then they typoed, so tell them correct path */
|
||||||
if (conn->uri->path == NULL ||
|
if (conn->uri->path == NULL ||
|
||||||
STRNEQ(conn->uri->path, "/system")) {
|
STRNEQ(conn->uri->path, "/system")) {
|
||||||
@ -2521,6 +2516,7 @@ static virHypervisorDriver openvzHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver openvzConnectDriver = {
|
static virConnectDriver openvzConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "openvz", NULL },
|
||||||
.hypervisorDriver = &openvzHypervisorDriver,
|
.hypervisorDriver = &openvzHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1144,9 +1144,6 @@ phypConnectOpen(virConnectPtr conn,
|
|||||||
if (!conn || !conn->uri)
|
if (!conn || !conn->uri)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (conn->uri->scheme == NULL || STRNEQ(conn->uri->scheme, "phyp"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Missing server name in phyp:// URI"));
|
"%s", _("Missing server name in phyp:// URI"));
|
||||||
@ -3766,6 +3763,7 @@ static virInterfaceDriver phypInterfaceDriver = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static virConnectDriver phypConnectDriver = {
|
static virConnectDriver phypConnectDriver = {
|
||||||
|
.uriSchemes = (const char *[]){ "phyp", NULL },
|
||||||
.hypervisorDriver = &phypHypervisorDriver,
|
.hypervisorDriver = &phypHypervisorDriver,
|
||||||
.interfaceDriver = &phypInterfaceDriver,
|
.interfaceDriver = &phypInterfaceDriver,
|
||||||
.storageDriver = &phypStorageDriver,
|
.storageDriver = &phypStorageDriver,
|
||||||
|
@ -1146,13 +1146,6 @@ static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
/* If URI isn't 'qemu' its definitely not for us */
|
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "qemu")) {
|
|
||||||
ret = VIR_DRV_OPEN_DECLINED;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemu_driver == NULL) {
|
if (qemu_driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("qemu state driver is not active"));
|
_("qemu state driver is not active"));
|
||||||
@ -21564,6 +21557,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver qemuConnectDriver = {
|
static virConnectDriver qemuConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "qemu", NULL },
|
||||||
.hypervisorDriver = &qemuHypervisorDriver,
|
.hypervisorDriver = &qemuHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -529,9 +529,6 @@ secretConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "secret"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("secret state driver is not active"));
|
_("secret state driver is not active"));
|
||||||
@ -659,6 +656,7 @@ static virHypervisorDriver secretHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver secretConnectDriver = {
|
static virConnectDriver secretConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "secret", NULL },
|
||||||
.hypervisorDriver = &secretHypervisorDriver,
|
.hypervisorDriver = &secretHypervisorDriver,
|
||||||
.secretDriver = &secretDriver,
|
.secretDriver = &secretDriver,
|
||||||
};
|
};
|
||||||
|
@ -389,9 +389,6 @@ storageConnectOpen(virConnectPtr conn,
|
|||||||
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
/* Only hypervisor drivers are permitted to auto-open on NULL uri */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (STRNEQ_NULLABLE(conn->uri->scheme, "storage"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("storage state driver is not active"));
|
_("storage state driver is not active"));
|
||||||
@ -2852,6 +2849,7 @@ static virHypervisorDriver storageHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver storageConnectDriver = {
|
static virConnectDriver storageConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "storage", NULL },
|
||||||
.hypervisorDriver = &storageHypervisorDriver,
|
.hypervisorDriver = &storageHypervisorDriver,
|
||||||
.storageDriver = &storageDriver,
|
.storageDriver = &storageDriver,
|
||||||
};
|
};
|
||||||
|
@ -1457,9 +1457,6 @@ testConnectOpen(virConnectPtr conn,
|
|||||||
if (!conn->uri)
|
if (!conn->uri)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (!conn->uri->scheme || STRNEQ(conn->uri->scheme, "test"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* From this point on, the connection is for us. */
|
/* From this point on, the connection is for us. */
|
||||||
if (!conn->uri->path
|
if (!conn->uri->path
|
||||||
|| conn->uri->path[0] == '\0'
|
|| conn->uri->path[0] == '\0'
|
||||||
@ -7062,6 +7059,7 @@ static virNodeDeviceDriver testNodeDeviceDriver = {
|
|||||||
|
|
||||||
static virConnectDriver testConnectDriver = {
|
static virConnectDriver testConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "test", NULL },
|
||||||
.hypervisorDriver = &testHypervisorDriver,
|
.hypervisorDriver = &testHypervisorDriver,
|
||||||
.interfaceDriver = &testInterfaceDriver,
|
.interfaceDriver = &testInterfaceDriver,
|
||||||
.networkDriver = &testNetworkDriver,
|
.networkDriver = &testNetworkDriver,
|
||||||
|
@ -1206,10 +1206,6 @@ static virDrvOpenStatus umlConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL) {
|
if (conn->uri == NULL) {
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "uml"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* Check path and tell them correct path if they made a mistake */
|
/* Check path and tell them correct path if they made a mistake */
|
||||||
if (uml_driver->privileged) {
|
if (uml_driver->privileged) {
|
||||||
if (STRNEQ(conn->uri->path, "/system") &&
|
if (STRNEQ(conn->uri->path, "/system") &&
|
||||||
@ -3014,6 +3010,7 @@ static virHypervisorDriver umlHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver umlConnectDriver = {
|
static virConnectDriver umlConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "uml", NULL },
|
||||||
.hypervisorDriver = ¨HypervisorDriver,
|
.hypervisorDriver = ¨HypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -520,10 +520,6 @@ vboxConnectOpen(virConnectPtr conn,
|
|||||||
if (conn->uri == NULL)
|
if (conn->uri == NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "vbox"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
|
if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("no VirtualBox driver path specified (try vbox:///session)"));
|
_("no VirtualBox driver path specified (try vbox:///session)"));
|
||||||
|
@ -58,9 +58,7 @@ static virDrvOpenStatus dummyConnectOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->uri == NULL ||
|
if (conn->uri == NULL)
|
||||||
conn->uri->scheme == NULL ||
|
|
||||||
STRNEQ(conn->uri->scheme, "vbox"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
|
if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
|
||||||
@ -96,6 +94,7 @@ static virHypervisorDriver vboxDriverDummy = {
|
|||||||
|
|
||||||
static virConnectDriver vboxConnectDriver = {
|
static virConnectDriver vboxConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "vbox", NULL },
|
||||||
.hypervisorDriver = NULL,
|
.hypervisorDriver = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,12 +134,6 @@ vmwareConnectOpen(virConnectPtr conn,
|
|||||||
/* @TODO accept */
|
/* @TODO accept */
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
} else {
|
} else {
|
||||||
if (conn->uri->scheme == NULL ||
|
|
||||||
(STRNEQ(conn->uri->scheme, "vmwareplayer") &&
|
|
||||||
STRNEQ(conn->uri->scheme, "vmwarews") &&
|
|
||||||
STRNEQ(conn->uri->scheme, "vmwarefusion")))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* If path isn't /session, then they typoed, so tell them correct path */
|
/* If path isn't /session, then they typoed, so tell them correct path */
|
||||||
if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) {
|
if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1268,6 +1262,7 @@ static virHypervisorDriver vmwareHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver vmwareConnectDriver = {
|
static virConnectDriver vmwareConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "vmwareplayer", "vmwarews", "vmwarefusion", NULL },
|
||||||
.hypervisorDriver = &vmwareHypervisorDriver,
|
.hypervisorDriver = &vmwareHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -361,19 +361,6 @@ vzConnectOpen(virConnectPtr conn,
|
|||||||
if (!conn->uri)
|
if (!conn->uri)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
|
||||||
if (!conn->uri->scheme)
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (STRNEQ(conn->uri->scheme, "vz") &&
|
|
||||||
STRNEQ(conn->uri->scheme, "parallels"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (STREQ(conn->uri->scheme, "vz") && STRNEQ(conn->driver->name, "vz"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
if (STREQ(conn->uri->scheme, "parallels") && STRNEQ(conn->driver->name, "Parallels"))
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
|
||||||
|
|
||||||
/* From this point on, the connection is for us. */
|
/* From this point on, the connection is for us. */
|
||||||
if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
|
if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -4140,6 +4127,7 @@ static virHypervisorDriver vzHypervisorDriver = {
|
|||||||
|
|
||||||
static virConnectDriver vzConnectDriver = {
|
static virConnectDriver vzConnectDriver = {
|
||||||
.localOnly = true,
|
.localOnly = true,
|
||||||
|
.uriSchemes = (const char *[]){ "vz", NULL },
|
||||||
.hypervisorDriver = &vzHypervisorDriver,
|
.hypervisorDriver = &vzHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4209,6 +4197,7 @@ vzRegister(void)
|
|||||||
parallelsHypervisorDriver.name = "Parallels";
|
parallelsHypervisorDriver.name = "Parallels";
|
||||||
parallelsConnectDriver = vzConnectDriver;
|
parallelsConnectDriver = vzConnectDriver;
|
||||||
parallelsConnectDriver.hypervisorDriver = ¶llelsHypervisorDriver;
|
parallelsConnectDriver.hypervisorDriver = ¶llelsHypervisorDriver;
|
||||||
|
parallelsConnectDriver.uriSchemes = (const char *[]){ "parallels", NULL },
|
||||||
if (virRegisterConnectDriver(¶llelsConnectDriver, true) < 0)
|
if (virRegisterConnectDriver(¶llelsConnectDriver, true) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -146,10 +146,8 @@ xenapiConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->uri == NULL || conn->uri->scheme == NULL ||
|
if (conn->uri == NULL)
|
||||||
STRCASENEQ(conn->uri->scheme, "XenAPI")) {
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
|
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
|
||||||
@ -2075,6 +2073,7 @@ static virHypervisorDriver xenapiHypervisorDriver = {
|
|||||||
|
|
||||||
|
|
||||||
static virConnectDriver xenapiConnectDriver = {
|
static virConnectDriver xenapiConnectDriver = {
|
||||||
|
.uriSchemes = (const char *[]){ "xenapi", NULL },
|
||||||
.hypervisorDriver = &xenapiHypervisorDriver,
|
.hypervisorDriver = &xenapiHypervisorDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user