+Mon Jun 25 09:19:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
+
+ * qemud/remote.c, src/remote_internal.c: Fix virDomainGetVcpus
+ in the remote case.
+ * src/libvirt.c: Allow virConnectListDomains,
+ virConnectListDefinedDomains, virConnectListNetworks and
+ virConnectListDefinedNetworks to work in the case where
+ they are called with maxids/maxnames == 0.
+ * src/remote_internal.c: Fix virDomainGetMaxVcpus in remote
+ case so that it copies sufficient data.
+ * src/xen_unified.c: Remove autostart functions.
+
Fri Jun 22 14:15:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* qemud/remote.c, qemud/remote_protocol.x, src/remote_internal.c:
return -2;
}
- if (args->maplen > REMOTE_CPUMAPS_MAX) {
- remoteDispatchError (client, req, "maplen > REMOTE_CPUMAPS_MAX");
+ if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
+ remoteDispatchError (client, req, "maxinfo * maplen > REMOTE_CPUMAPS_MAX");
return -2;
}
/* Allocate buffers to take the results. */
info = calloc (args->maxinfo, sizeof (virVcpuInfo));
- cpumaps = calloc (args->maplen, sizeof (unsigned char));
+ cpumaps = calloc (args->maxinfo * args->maplen, sizeof (unsigned char));
info_len = virDomainGetVcpus (dom,
info, args->maxinfo,
* assumption that unsigned char and char are the same size.
* Note that remoteDispatchClientRequest will free.
*/
- ret->cpumaps.cpumaps_len = args->maplen;
+ ret->cpumaps.cpumaps_len = args->maxinfo * args->maplen;
ret->cpumaps.cpumaps_val = (char *) cpumaps;
return 0;
return (-1);
}
- if ((ids == NULL) || (maxids <= 0)) {
+ if ((ids == NULL) || (maxids < 0)) {
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
return (-1);
}
- if ((names == NULL) || (maxnames <= 0)) {
+ if ((names == NULL) || (maxnames < 0)) {
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
return (-1);
}
- if ((names == NULL) || (maxnames <= 0)) {
+ if ((names == NULL) || (maxnames < 0)) {
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
return (-1);
}
- if ((names == NULL) || (maxnames <= 0)) {
+ if ((names == NULL) || (maxnames < 0)) {
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
error (domain->conn, VIR_ERR_RPC, "maxinfo > REMOTE_VCPUINFO_MAX");
return -1;
}
- if (maplen > REMOTE_CPUMAPS_MAX) {
- error (domain->conn, VIR_ERR_RPC, "maplen > REMOTE_CPUMAPS_MAX");
+ if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
+ error (domain->conn, VIR_ERR_RPC, "maxinfo * maplen > REMOTE_CPUMAPS_MAX");
return -1;
}
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
- if (ret.cpumaps.cpumaps_len > maplen) {
- error (domain->conn, VIR_ERR_RPC, "ret.cpumaps.cpumaps_len > maplen");
+ if (ret.cpumaps.cpumaps_len > maxinfo * maplen) {
+ error (domain->conn, VIR_ERR_RPC, "ret.cpumaps.cpumaps_len > maxinfo * maplen");
xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret);
return -1;
}
+ memset (info, 0, sizeof (virVcpuInfo) * maxinfo);
+ memset (cpumaps, 0, maxinfo * maplen);
+
for (i = 0; i < ret.info.info_len; ++i) {
info[i].number = ret.info.info_val[i].number;
info[i].state = ret.info.info_val[i].state;
make_nonnull_domain (&args.dom, domain);
memset (&ret, 0, sizeof ret);
- if (call (domain->conn, priv, 0, REMOTE_PROC_GET_MAX_VCPUS,
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MAX_VCPUS,
(xdrproc_t) xdr_remote_domain_get_max_vcpus_args, (char *) &args,
(xdrproc_t) xdr_remote_domain_get_max_vcpus_ret, (char *) &ret) == -1)
return -1;
return -1;
}
-static int
-xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart)
-{
- GET_PRIVATE(dom->conn);
- int i;
-
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
- if (priv->opened[i] && drivers[i]->domainGetAutostart &&
- drivers[i]->domainGetAutostart (dom, autostart) == 0)
- return 0;
-
- return -1;
-}
-
-static int
-xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart)
-{
- GET_PRIVATE(dom->conn);
- int i;
-
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
- if (priv->opened[i] && drivers[i]->domainSetAutostart &&
- drivers[i]->domainSetAutostart (dom, autostart) == 0)
- return 0;
-
- return -1;
-}
-
static char *
xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams)
{
.domainUndefine = xenUnifiedDomainUndefine,
.domainAttachDevice = xenUnifiedDomainAttachDevice,
.domainDetachDevice = xenUnifiedDomainDetachDevice,
- .domainGetAutostart = xenUnifiedDomainGetAutostart,
- .domainSetAutostart = xenUnifiedDomainSetAutostart,
.domainGetSchedulerType = xenUnifiedDomainGetSchedulerType,
.domainGetSchedulerParameters = xenUnifiedDomainGetSchedulerParameters,
.domainSetSchedulerParameters = xenUnifiedDomainSetSchedulerParameters,