mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
xen: Remove virConnectPtr from virXenError/virXenErrorFunc
This commit is contained in:
parent
f2192637b0
commit
68d5d96bce
@ -804,16 +804,15 @@ struct xenUnifiedDriver xenHypervisorDriver = {
|
||||
};
|
||||
#endif /* !PROXY */
|
||||
|
||||
#define virXenError(conn, code, ...) \
|
||||
#define virXenError(code, ...) \
|
||||
if (in_init == 0) \
|
||||
virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
|
||||
virReportErrorHelper(NULL, VIR_FROM_XEN, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#ifndef PROXY
|
||||
|
||||
/**
|
||||
* virXenErrorFunc:
|
||||
* @conn: connection, if known
|
||||
* @error: the error number
|
||||
* @func: the function failing
|
||||
* @info: extra information string
|
||||
@ -822,8 +821,7 @@ struct xenUnifiedDriver xenHypervisorDriver = {
|
||||
* Handle an error at the xend daemon interface
|
||||
*/
|
||||
static void
|
||||
virXenErrorFunc(virConnectPtr conn,
|
||||
virErrorNumber error, const char *func, const char *info,
|
||||
virXenErrorFunc(virErrorNumber error, const char *func, const char *info,
|
||||
int value)
|
||||
{
|
||||
char fullinfo[1000];
|
||||
@ -837,11 +835,11 @@ virXenErrorFunc(virConnectPtr conn,
|
||||
if (func != NULL) {
|
||||
snprintf(fullinfo, 999, "%s: %s", func, info);
|
||||
fullinfo[999] = 0;
|
||||
virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
|
||||
virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
|
||||
errmsg, fullinfo, NULL, value, 0, errmsg, fullinfo,
|
||||
value);
|
||||
} else {
|
||||
virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
|
||||
virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
|
||||
errmsg, info, NULL, value, 0, errmsg, info,
|
||||
value);
|
||||
}
|
||||
@ -871,18 +869,18 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
|
||||
hc.arg[0] = (unsigned long) op;
|
||||
|
||||
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
|
||||
if (ret < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
xen_ioctl_hypercall_cmd);
|
||||
}
|
||||
|
||||
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
|
||||
virXenError(VIR_ERR_XEN_CALL, " releasing");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
@ -913,18 +911,18 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
|
||||
hc.arg[0] = (unsigned long) op;
|
||||
|
||||
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
|
||||
if (ret < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
xen_ioctl_hypercall_cmd);
|
||||
}
|
||||
|
||||
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
|
||||
virXenError(VIR_ERR_XEN_CALL, " releasing");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
@ -956,18 +954,18 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
|
||||
hc.arg[0] = (unsigned long) op;
|
||||
|
||||
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
|
||||
if (ret < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " sys ioctl %d",
|
||||
virXenError(VIR_ERR_XEN_CALL, " sys ioctl %d",
|
||||
xen_ioctl_hypercall_cmd);
|
||||
}
|
||||
|
||||
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
|
||||
virXenError(VIR_ERR_XEN_CALL, " releasing");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
@ -999,18 +997,18 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
|
||||
hc.arg[0] = (unsigned long) op;
|
||||
|
||||
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
|
||||
if (ret < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
|
||||
xen_ioctl_hypercall_cmd);
|
||||
}
|
||||
|
||||
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " releasing");
|
||||
virXenError(VIR_ERR_XEN_CALL, " releasing");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
@ -1039,7 +1037,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
|
||||
|
||||
if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
|
||||
XEN_GETDOMAININFO_SIZE * maxids) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
if (hypervisor_version > 1) {
|
||||
@ -1094,7 +1092,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
|
||||
}
|
||||
if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
|
||||
XEN_GETDOMAININFO_SIZE * maxids) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " release");
|
||||
virXenError(VIR_ERR_XEN_CALL, " release");
|
||||
ret = -1;
|
||||
}
|
||||
return(ret);
|
||||
@ -1132,19 +1130,19 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
|
||||
xenUnifiedPrivatePtr priv;
|
||||
|
||||
if (domain->conn == NULL) {
|
||||
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"domain or conn is NULL", 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
if (priv->handle < 0) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"priv->handle invalid", 0);
|
||||
return NULL;
|
||||
}
|
||||
if (domain->id < 0) {
|
||||
virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
|
||||
virXenError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
return NULL;
|
||||
}
|
||||
@ -1155,7 +1153,7 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
|
||||
* TODO: check on Xen 3.0.3
|
||||
*/
|
||||
if (dom_interface_version < 5) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
"unsupported in dom interface < 5", 0);
|
||||
return NULL;
|
||||
}
|
||||
@ -1216,19 +1214,19 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
||||
xenUnifiedPrivatePtr priv;
|
||||
|
||||
if (domain->conn == NULL) {
|
||||
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"domain or conn is NULL", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
if (priv->handle < 0) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"priv->handle invalid", 0);
|
||||
return -1;
|
||||
}
|
||||
if (domain->id < 0) {
|
||||
virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
|
||||
virXenError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
return -1;
|
||||
}
|
||||
@ -1239,7 +1237,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
||||
* TODO: check on Xen 3.0.3
|
||||
*/
|
||||
if (dom_interface_version < 5) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
"unsupported in dom interface < 5", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -1273,16 +1271,16 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
||||
return(-1);
|
||||
|
||||
if (virStrcpyStatic(params[0].field, str_weight) == NULL) {
|
||||
virXenError (domain->conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"Weight %s too big for destination", str_weight);
|
||||
virXenError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Weight %s too big for destination", str_weight);
|
||||
return -1;
|
||||
}
|
||||
params[0].type = VIR_DOMAIN_SCHED_FIELD_UINT;
|
||||
params[0].value.ui = op_dom.u.getschedinfo.u.credit.weight;
|
||||
|
||||
if (virStrcpyStatic(params[1].field, str_cap) == NULL) {
|
||||
virXenError (domain->conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"Cap %s too big for destination", str_cap);
|
||||
virXenError(VIR_ERR_INTERNAL_ERROR,
|
||||
"Cap %s too big for destination", str_cap);
|
||||
return -1;
|
||||
}
|
||||
params[1].type = VIR_DOMAIN_SCHED_FIELD_UINT;
|
||||
@ -1291,7 +1289,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
||||
*nparams = 2;
|
||||
break;
|
||||
default:
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Unknown scheduler", op_sys.u.getschedulerid.sched_id);
|
||||
return -1;
|
||||
}
|
||||
@ -1319,25 +1317,25 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
char buf[256];
|
||||
|
||||
if (domain->conn == NULL) {
|
||||
virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"domain or conn is NULL", 0);
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"domain or conn is NULL", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((nparams == 0) || (params == NULL)) {
|
||||
virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Noparameters given", 0);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Noparameters given", 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
if (priv->handle < 0) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"priv->handle invalid", 0);
|
||||
return -1;
|
||||
}
|
||||
if (domain->id < 0) {
|
||||
virXenError(domain->conn, VIR_ERR_OPERATION_INVALID,
|
||||
virXenError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
return -1;
|
||||
}
|
||||
@ -1348,7 +1346,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
* TODO: check on Xen 3.0.3
|
||||
*/
|
||||
if (dom_interface_version < 5) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
|
||||
"unsupported in dom interface < 5", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -1389,7 +1387,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
val = params[i].value.ui;
|
||||
if ((val < 1) || (val > USHRT_MAX)) {
|
||||
snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val);
|
||||
virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
|
||||
return(-1);
|
||||
}
|
||||
op_dom.u.getschedinfo.u.credit.weight = val;
|
||||
@ -1398,14 +1396,14 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
val = params[i].value.ui;
|
||||
if (val > USHRT_MAX) {
|
||||
snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
|
||||
virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
|
||||
return(-1);
|
||||
}
|
||||
op_dom.u.getschedinfo.u.credit.cap = val;
|
||||
} else {
|
||||
virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Credit scheduler accepts 'cap' and 'weight' integer parameters",
|
||||
0);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Credit scheduler accepts 'cap' and 'weight' integer parameters",
|
||||
0);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
@ -1416,7 +1414,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
break;
|
||||
}
|
||||
default:
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"Unknown scheduler", op_sys.u.getschedulerid.sched_id);
|
||||
return -1;
|
||||
}
|
||||
@ -1442,9 +1440,9 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
|
||||
xenUnifiedUnlock(priv);
|
||||
return ret;
|
||||
# else
|
||||
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||
"block statistics not supported on this platform",
|
||||
dom->id);
|
||||
virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||
"block statistics not supported on this platform",
|
||||
dom->id);
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
@ -1468,20 +1466,20 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
|
||||
* domain.
|
||||
*/
|
||||
if (sscanf (path, "vif%d.%d", &rqdomid, &device) != 2) {
|
||||
virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid path, should be vif<domid>.<n>.", 0);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid path, should be vif<domid>.<n>.", 0);
|
||||
return -1;
|
||||
}
|
||||
if (rqdomid != dom->id) {
|
||||
virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid path, vif<domid> should match this domain ID", 0);
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid path, vif<domid> should match this domain ID", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return linuxDomainInterfaceStats(path, stats);
|
||||
# else
|
||||
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||
"/proc/net/dev: Interface not found", 0);
|
||||
virXenErrorFunc(VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||
"/proc/net/dev: Interface not found", 0);
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
@ -1717,7 +1715,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
|
||||
xen_op_v2_dom op;
|
||||
|
||||
if (lock_pages(cpumap, maplen) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
memset(&op, 0, sizeof(op));
|
||||
@ -1752,7 +1750,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
|
||||
VIR_FREE(new);
|
||||
|
||||
if (unlock_pages(cpumap, maplen) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " release");
|
||||
virXenError(VIR_ERR_XEN_CALL, " release");
|
||||
ret = -1;
|
||||
}
|
||||
} else {
|
||||
@ -1849,7 +1847,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
|
||||
}
|
||||
if ((cpumap != NULL) && (maplen > 0)) {
|
||||
if (lock_pages(cpumap, maplen) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " locking");
|
||||
virXenError(VIR_ERR_XEN_CALL, " locking");
|
||||
return (-1);
|
||||
}
|
||||
memset(cpumap, 0, maplen);
|
||||
@ -1867,7 +1865,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
|
||||
}
|
||||
ret = xenHypervisorDoV2Dom(handle, &op);
|
||||
if (unlock_pages(cpumap, maplen) < 0) {
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " release");
|
||||
virXenError(VIR_ERR_XEN_CALL, " release");
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
@ -1963,7 +1961,7 @@ xenHypervisorInit(void)
|
||||
char error[100];
|
||||
regerror (errcode, &flags_hvm_rec, error, sizeof error);
|
||||
regfree (&flags_hvm_rec);
|
||||
virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
in_init = 0;
|
||||
return -1;
|
||||
}
|
||||
@ -1973,7 +1971,7 @@ xenHypervisorInit(void)
|
||||
regerror (errcode, &flags_pae_rec, error, sizeof error);
|
||||
regfree (&flags_pae_rec);
|
||||
regfree (&flags_hvm_rec);
|
||||
virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
in_init = 0;
|
||||
return -1;
|
||||
}
|
||||
@ -1984,7 +1982,7 @@ xenHypervisorInit(void)
|
||||
regfree (&xen_cap_rec);
|
||||
regfree (&flags_pae_rec);
|
||||
regfree (&flags_hvm_rec);
|
||||
virXenError (NULL, VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
in_init = 0;
|
||||
return -1;
|
||||
}
|
||||
@ -2038,7 +2036,7 @@ xenHypervisorInit(void)
|
||||
*/
|
||||
|
||||
hypervisor_version = -1;
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %lu",
|
||||
virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
|
||||
(unsigned long) IOCTL_PRIVCMD_HYPERCALL);
|
||||
close(fd);
|
||||
in_init = 0;
|
||||
@ -2124,7 +2122,7 @@ xenHypervisorInit(void)
|
||||
|
||||
DEBUG0("Failed to find any Xen hypervisor method");
|
||||
hypervisor_version = -1;
|
||||
virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl %lu",
|
||||
virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
|
||||
(unsigned long)IOCTL_PRIVCMD_HYPERCALL);
|
||||
close(fd);
|
||||
in_init = 0;
|
||||
@ -2164,7 +2162,7 @@ xenHypervisorOpen(virConnectPtr conn,
|
||||
|
||||
ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
|
||||
if (ret < 0) {
|
||||
virXenError(conn, VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
|
||||
virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -2830,7 +2828,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
|
||||
|
||||
priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
|
||||
if (priv->handle < 0) {
|
||||
virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("domain shut off or invalid"), 0);
|
||||
return (NULL);
|
||||
}
|
||||
@ -2838,7 +2836,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
|
||||
/* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/
|
||||
if (hypervisor_version < 2 ||
|
||||
dom_interface_version < 4) {
|
||||
virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("unsupported in dom interface < 4"), 0);
|
||||
return (NULL);
|
||||
}
|
||||
@ -2846,13 +2844,13 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
|
||||
XEN_GETDOMAININFO_CLEAR(dominfo);
|
||||
|
||||
if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) {
|
||||
virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("cannot get domain details"), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) {
|
||||
virXenErrorFunc(dom->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("cannot get domain details"), 0);
|
||||
return (NULL);
|
||||
}
|
||||
@ -3218,7 +3216,7 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
|
||||
xenUnifiedPrivatePtr priv;
|
||||
|
||||
if (conn == NULL) {
|
||||
virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid argument", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3226,13 +3224,13 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
|
||||
priv = conn->privateData;
|
||||
|
||||
if (priv->nbNodeCells < 0) {
|
||||
virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
|
||||
"cannot determine actual number of cells",0);
|
||||
virXenErrorFunc(VIR_ERR_XEN_CALL, __FUNCTION__,
|
||||
"cannot determine actual number of cells",0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) {
|
||||
virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid argument", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3241,13 +3239,13 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
|
||||
* Support only sys_interface_version >=4
|
||||
*/
|
||||
if (sys_interface_version < SYS_IFACE_MIN_VERS_NUMA) {
|
||||
virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_XEN_CALL, __FUNCTION__,
|
||||
"unsupported in sys interface < 4", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (priv->handle < 0) {
|
||||
virXenErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"priv->handle invalid", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3485,12 +3483,12 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
if (priv->handle < 0 || (domain->id < 0) ||
|
||||
(info == NULL) || (maxinfo < 1) ||
|
||||
(sizeof(cpumap_t) & 7)) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("domain shut off or invalid"), 0);
|
||||
return (-1);
|
||||
}
|
||||
if ((cpumaps != NULL) && (maplen < 1)) {
|
||||
virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||
"invalid argument", 0);
|
||||
return -1;
|
||||
}
|
||||
@ -3500,7 +3498,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
&dominfo);
|
||||
|
||||
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("cannot get domain details"), 0);
|
||||
return (-1);
|
||||
}
|
||||
@ -3517,7 +3515,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
(unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i),
|
||||
maplen);
|
||||
if (ret < 0) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("cannot get VCPUs info"), 0);
|
||||
return(-1);
|
||||
}
|
||||
@ -3525,7 +3523,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
|
||||
ipt, NULL, 0);
|
||||
if (ret < 0) {
|
||||
virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
_("cannot get VCPUs info"), 0);
|
||||
return(-1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user