提交 b290e48c 编写于 作者: M Matthias Bolte

xen: Remove virConnectPtr from xenUnifiedError

上级 6c175fa3
...@@ -72,8 +72,8 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = { ...@@ -72,8 +72,8 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
static int inside_daemon; static int inside_daemon;
#define xenUnifiedError(conn, code, ...) \ #define xenUnifiedError(code, ...) \
virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \ virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__) __FUNCTION__, __LINE__, __VA_ARGS__)
/** /**
...@@ -261,7 +261,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) ...@@ -261,7 +261,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
if (conn->uri->path && if (conn->uri->path &&
STRNEQ(conn->uri->path, "") && STRNEQ(conn->uri->path, "") &&
STRNEQ(conn->uri->path, "/")) { STRNEQ(conn->uri->path, "/")) {
xenUnifiedError(NULL, VIR_ERR_INTERNAL_ERROR, xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
_("unexpected Xen URI path '%s', try xen:///"), _("unexpected Xen URI path '%s', try xen:///"),
conn->uri->path); conn->uri->path);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
...@@ -279,7 +279,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) ...@@ -279,7 +279,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
* error unless path is absolute * error unless path is absolute
*/ */
if (!conn->uri->path || conn->uri->path[0] != '/') { if (!conn->uri->path || conn->uri->path[0] != '/') {
xenUnifiedError(NULL, VIR_ERR_INTERNAL_ERROR, xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
_("unexpected Xen URI path '%s', try ///var/lib/xen/xend-socket"), _("unexpected Xen URI path '%s', try ///var/lib/xen/xend-socket"),
NULLSTR(conn->uri->path)); NULLSTR(conn->uri->path));
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
...@@ -296,7 +296,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags) ...@@ -296,7 +296,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags)
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
if (virMutexInit(&priv->lock) < 0) { if (virMutexInit(&priv->lock) < 0) {
xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR, xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot initialise mutex")); "%s", _("cannot initialise mutex"));
VIR_FREE(priv); VIR_FREE(priv);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
...@@ -512,14 +512,14 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type) ...@@ -512,14 +512,14 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
GET_PRIVATE(conn); GET_PRIVATE(conn);
if (type && STRCASENEQ (type, "Xen")) { if (type && STRCASENEQ (type, "Xen")) {
xenUnifiedError (conn, VIR_ERR_INVALID_ARG, __FUNCTION__); xenUnifiedError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1; return -1;
} }
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorGetMaxVcpus (conn, type); return xenHypervisorGetMaxVcpus (conn, type);
else { else {
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
} }
...@@ -672,7 +672,7 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id) ...@@ -672,7 +672,7 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id)
} }
/* Not found. */ /* Not found. */
xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL; return NULL;
} }
...@@ -717,7 +717,7 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn, ...@@ -717,7 +717,7 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn,
} }
/* Not found. */ /* Not found. */
xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL; return NULL;
} }
...@@ -762,7 +762,7 @@ xenUnifiedDomainLookupByName (virConnectPtr conn, ...@@ -762,7 +762,7 @@ xenUnifiedDomainLookupByName (virConnectPtr conn,
} }
/* Not found. */ /* Not found. */
xenUnifiedError (conn, VIR_ERR_NO_DOMAIN, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
return NULL; return NULL;
} }
...@@ -1160,7 +1160,7 @@ xenUnifiedDomainDumpXML (virDomainPtr dom, int flags) ...@@ -1160,7 +1160,7 @@ xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
return xenProxyDomainDumpXML(dom, flags); return xenProxyDomainDumpXML(dom, flags);
} }
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return NULL; return NULL;
} }
...@@ -1178,7 +1178,7 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn, ...@@ -1178,7 +1178,7 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn,
if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) && if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) { STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
xenUnifiedError(conn, VIR_ERR_INVALID_ARG, xenUnifiedError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), format); _("unsupported config type %s"), format);
return NULL; return NULL;
} }
...@@ -1219,7 +1219,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn, ...@@ -1219,7 +1219,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn,
if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) && if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) { STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
xenUnifiedError(conn, VIR_ERR_INVALID_ARG, xenUnifiedError(VIR_ERR_INVALID_ARG,
_("unsupported config type %s"), format); _("unsupported config type %s"), format);
goto cleanup; goto cleanup;
} }
...@@ -1273,7 +1273,7 @@ xenUnifiedDomainMigratePrepare (virConnectPtr dconn, ...@@ -1273,7 +1273,7 @@ xenUnifiedDomainMigratePrepare (virConnectPtr dconn,
uri_in, uri_out, uri_in, uri_out,
flags, dname, resource); flags, dname, resource);
xenUnifiedError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1292,7 +1292,7 @@ xenUnifiedDomainMigratePerform (virDomainPtr dom, ...@@ -1292,7 +1292,7 @@ xenUnifiedDomainMigratePerform (virDomainPtr dom,
return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri, return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri,
flags, dname, resource); flags, dname, resource);
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1316,14 +1316,14 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn, ...@@ -1316,14 +1316,14 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn,
if (flags & VIR_MIGRATE_PERSIST_DEST) { if (flags & VIR_MIGRATE_PERSIST_DEST) {
domain_xml = xenDaemonDomainDumpXML (dom, 0, NULL); domain_xml = xenDaemonDomainDumpXML (dom, 0, NULL);
if (! domain_xml) { if (! domain_xml) {
xenUnifiedError(dconn, VIR_ERR_MIGRATE_PERSIST_FAILED, xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to get XML representation of migrated domain")); "%s", _("failed to get XML representation of migrated domain"));
goto failure; goto failure;
} }
dom_new = xenDaemonDomainDefineXML (dconn, domain_xml); dom_new = xenDaemonDomainDefineXML (dconn, domain_xml);
if (! dom_new) { if (! dom_new) {
xenUnifiedError(dconn, VIR_ERR_MIGRATE_PERSIST_FAILED, xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
"%s", _("failed to define domain on destination host")); "%s", _("failed to define domain on destination host"));
goto failure; goto failure;
} }
...@@ -1516,7 +1516,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart) ...@@ -1516,7 +1516,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart)
return xenDaemonDomainGetAutostart(dom, autostart); return xenDaemonDomainGetAutostart(dom, autostart);
} }
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1533,7 +1533,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart) ...@@ -1533,7 +1533,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart)
return xenDaemonDomainSetAutostart(dom, autostart); return xenDaemonDomainSetAutostart(dom, autostart);
} }
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1598,7 +1598,7 @@ xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path, ...@@ -1598,7 +1598,7 @@ xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path,
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorDomainBlockStats (dom, path, stats); return xenHypervisorDomainBlockStats (dom, path, stats);
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1611,7 +1611,7 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path, ...@@ -1611,7 +1611,7 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path,
if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
return xenHypervisorDomainInterfaceStats (dom, path, stats); return xenHypervisorDomainInterfaceStats (dom, path, stats);
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1634,7 +1634,7 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path, ...@@ -1634,7 +1634,7 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path,
return 0; return 0;
} }
xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1648,7 +1648,7 @@ xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMe ...@@ -1648,7 +1648,7 @@ xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMe
return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems, return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems,
startCell, maxCells); startCell, maxCells);
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1; return -1;
} }
...@@ -1667,7 +1667,7 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn) ...@@ -1667,7 +1667,7 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn)
return(freeMem); return(freeMem);
} }
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return(0); return(0);
} }
...@@ -1684,7 +1684,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn, ...@@ -1684,7 +1684,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn,
xenUnifiedLock(priv); xenUnifiedLock(priv);
if (priv->xsWatch == -1) { if (priv->xsWatch == -1) {
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv); xenUnifiedUnlock(priv);
return -1; return -1;
} }
...@@ -1706,7 +1706,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn, ...@@ -1706,7 +1706,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn,
xenUnifiedLock(priv); xenUnifiedLock(priv);
if (priv->xsWatch == -1) { if (priv->xsWatch == -1) {
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv); xenUnifiedUnlock(priv);
return -1; return -1;
} }
...@@ -1737,7 +1737,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn, ...@@ -1737,7 +1737,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn,
xenUnifiedLock(priv); xenUnifiedLock(priv);
if (priv->xsWatch == -1) { if (priv->xsWatch == -1) {
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv); xenUnifiedUnlock(priv);
return -1; return -1;
} }
...@@ -1759,7 +1759,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn, ...@@ -1759,7 +1759,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn,
xenUnifiedLock(priv); xenUnifiedLock(priv);
if (priv->xsWatch == -1) { if (priv->xsWatch == -1) {
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
xenUnifiedUnlock(priv); xenUnifiedUnlock(priv);
return -1; return -1;
} }
...@@ -1810,7 +1810,7 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev, ...@@ -1810,7 +1810,7 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev,
} }
if (!cap) { if (!cap) {
xenUnifiedError(dev->conn, VIR_ERR_INVALID_ARG, xenUnifiedError(VIR_ERR_INVALID_ARG,
_("device %s is not a PCI device"), dev->name); _("device %s is not a PCI device"), dev->name);
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册