1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

parallels: cleanup parallelsOpen and fix error message

Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace
a lot of checks.

Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same
as in other drivers.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
This commit is contained in:
Dmitry Guryanov 2012-08-13 19:50:13 +04:00 committed by Daniel Veillard
parent 4aaa5a723d
commit 9fbefc540d

View File

@ -664,21 +664,14 @@ parallelsOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
/* From this point on, the connection is for us. */ /* From this point on, the connection is for us. */
if ( if (!STREQ_NULLABLE(conn->uri->path, "/system")) {
conn->uri->path[0] == '\0' || virReportError(VIR_ERR_INTERNAL_ERROR,
(conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { _("Unexpected Parallels URI path '%s', try parallels:///system"),
virReportError(VIR_ERR_INVALID_ARG, "%s", conn->uri->path);
_("parallelsOpen: supply a path or use "
"parallels:///system"));
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
if (STREQ(conn->uri->path, "/system")) if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS)
ret = parallelsOpenDefault(conn);
else
return VIR_DRV_OPEN_DECLINED;
if (ret != VIR_DRV_OPEN_SUCCESS)
return ret; return ret;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;