提交 4916297b 编写于 作者: M Marcos Paulo de Souza 提交者: Michal Privoznik

libvirt.c: Return error when remoteOnly is set but server is empty

Some drivers require a server in order to work, so this flag removes the
burden of esach driver to check for an server by doing it in
virConnectOpenInternal.
Signed-off-by: NMarcos Paulo de Souza <marcos.souza.org@gmail.com>
上级 9a4c7559
......@@ -1029,6 +1029,13 @@ virConnectOpenInternal(const char *name,
VIR_DEBUG("Matching any URI scheme for '%s'", ret->uri ? ret->uri->scheme : "");
}
/* before starting the new connection, check if the driver only works
* with a server, and so return an error if the server is missing */
if (virConnectDriverTab[i]->remoteOnly && ret->uri && !ret->uri->server) {
virReportError(VIR_ERR_INVALID_ARG, "%s", _("URI is missing the server part"));
goto failed;
}
ret->driver = virConnectDriverTab[i]->hypervisorDriver;
ret->interfaceDriver = virConnectDriverTab[i]->interfaceDriver;
ret->networkDriver = virConnectDriverTab[i]->networkDriver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册