]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Mon Jun 25 09:19:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 25 Jun 2007 08:23:10 +0000 (08:23 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 25 Jun 2007 08:23:10 +0000 (08:23 +0000)
* 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.

ChangeLog
qemud/remote.c
src/libvirt.c
src/remote_internal.c
src/xen_unified.c

index 5fd45c52fb5023d3d26d6ccd1fb8eccdf3a95f91..bf25aaec7ef797321b9be7b3ed4d2a4d8119f05e 100644 (file)
--- a/ChangeLog
+++ b/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:
index acd72a2b50a5a42e6c8d5e72f0a719c8ff0961e5..f204326bb935f08e0f2e6df299e10d795b443375 100644 (file)
@@ -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;
index 2dde3913e1e1fb7aa80e31c9c0f93c89730c68ab..4e1d885b3e21d2da80bcb7775b1726afc494caca 100644 (file)
@@ -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);
     }
index 1ef81b4f416db87853d0ceaf6c773bdad088ad14..8a0d9682211af020b11264371b0970be9329b4a5 100644 (file)
@@ -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;
index 0d10f6b64df166369af9bce577dbccbe3ea8197d..cc10a4fe5e2e66112efd44f58e2753514d8c7b82 100644 (file)
@@ -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,