mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
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.
This commit is contained in:
parent
137847e55d
commit
56cd4140d4
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
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:
|
||||
|
@ -956,14 +956,14 @@ remoteDispatchDomainGetVcpus (struct qemud_client *client,
|
||||
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,
|
||||
@ -985,7 +985,7 @@ remoteDispatchDomainGetVcpus (struct qemud_client *client,
|
||||
* 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;
|
||||
|
@ -510,7 +510,7 @@ virConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ids == NULL) || (maxids <= 0)) {
|
||||
if ((ids == NULL) || (maxids < 0)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
@ -1682,7 +1682,7 @@ virConnectListDefinedDomains(virConnectPtr conn, char **const names,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((names == NULL) || (maxnames <= 0)) {
|
||||
if ((names == NULL) || (maxnames < 0)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
@ -2077,7 +2077,7 @@ virConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((names == NULL) || (maxnames <= 0)) {
|
||||
if ((names == NULL) || (maxnames < 0)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
@ -2131,7 +2131,7 @@ virConnectListDefinedNetworks(virConnectPtr conn, char **const names,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((names == NULL) || (maxnames <= 0)) {
|
||||
if ((names == NULL) || (maxnames < 0)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
|
@ -1472,8 +1472,8 @@ remoteDomainGetVcpus (virDomainPtr domain,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1492,12 +1492,15 @@ remoteDomainGetVcpus (virDomainPtr domain,
|
||||
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;
|
||||
@ -1522,7 +1525,7 @@ remoteDomainGetMaxVcpus (virDomainPtr domain)
|
||||
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;
|
||||
|
@ -783,34 +783,6 @@ xenUnifiedDomainDetachDevice (virDomainPtr dom, char *xml)
|
||||
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)
|
||||
{
|
||||
@ -912,8 +884,6 @@ static virDriver xenUnifiedDriver = {
|
||||
.domainUndefine = xenUnifiedDomainUndefine,
|
||||
.domainAttachDevice = xenUnifiedDomainAttachDevice,
|
||||
.domainDetachDevice = xenUnifiedDomainDetachDevice,
|
||||
.domainGetAutostart = xenUnifiedDomainGetAutostart,
|
||||
.domainSetAutostart = xenUnifiedDomainSetAutostart,
|
||||
.domainGetSchedulerType = xenUnifiedDomainGetSchedulerType,
|
||||
.domainGetSchedulerParameters = xenUnifiedDomainGetSchedulerParameters,
|
||||
.domainSetSchedulerParameters = xenUnifiedDomainSetSchedulerParameters,
|
||||
|
Loading…
Reference in New Issue
Block a user