All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org, Ian.Campbell@citrix.com,
	ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com,
	wei.liu2@citrix.com
Cc: Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 1/3] libxl: remove the xl list limit of 1024 domains
Date: Mon,  4 Jan 2016 15:55:51 +0100	[thread overview]
Message-ID: <1451919353-11547-2-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1451919353-11547-1-git-send-email-jgross@suse.com>

xl list is currently limited to 1024 domains. Remove the limit.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libxl/libxl.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 9207621..86b08d9 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -649,31 +649,30 @@ static void xcinfo2xlinfo(libxl_ctx *ctx,
 
 libxl_dominfo * libxl_list_domain(libxl_ctx *ctx, int *nb_domain_out)
 {
-    libxl_dominfo *ptr;
+    libxl_dominfo *ptr = NULL;
     int i, ret;
     xc_domaininfo_t info[1024];
-    int size = 1024;
+    int size = 0;
+    uint32_t domid = 0;
     GC_INIT(ctx);
 
-    ptr = calloc(size, sizeof(libxl_dominfo));
-    if (!ptr) {
-        LOGE(ERROR, "allocating domain info");
-        GC_FREE;
-        return NULL;
+    while ((ret = xc_domain_getinfolist(ctx->xch, domid, 1024, info)) > 0) {
+        ptr = libxl__realloc(NOGC, ptr, (size + ret) * sizeof(libxl_dominfo));
+        for (i = 0; i < ret; i++) {
+            xcinfo2xlinfo(ctx, &info[i], &ptr[size + i]);
+        }
+        domid = info[ret - 1].domain + 1;
+        size += ret;
     }
 
-    ret = xc_domain_getinfolist(ctx->xch, 0, 1024, info);
-    if (ret<0) {
+    if (ret < 0) {
         LOGE(ERROR, "getting domain info list");
         free(ptr);
         GC_FREE;
         return NULL;
     }
 
-    for (i = 0; i < ret; i++) {
-        xcinfo2xlinfo(ctx, &info[i], &ptr[i]);
-    }
-    *nb_domain_out = ret;
+    *nb_domain_out = size;
     GC_FREE;
     return ptr;
 }
-- 
2.6.2

  reply	other threads:[~2016-01-04 14:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 14:55 [PATCH v2 0/3] tools: remove 1024 domain limit at some places Juergen Gross
2016-01-04 14:55 ` Juergen Gross [this message]
2016-01-04 16:38   ` [PATCH v2 1/3] libxl: remove the xl list limit of 1024 domains Wei Liu
2016-01-04 14:55 ` [PATCH v2 2/3] libxl: base libxl_list_vm() on libxl_list_domain() Juergen Gross
2016-01-04 16:38   ` Wei Liu
2016-01-04 14:55 ` [PATCH v2 3/3] xenstat: handle more than 1024 domains Juergen Gross
2016-01-04 16:38   ` Wei Liu
2016-01-15 15:35     ` Ian Campbell
2016-01-15 15:39       ` Juergen Gross
2016-01-15 15:03 ` [PATCH v2 0/3] tools: remove 1024 domain limit at some places Juergen Gross
2016-01-15 15:55 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451919353-11547-2-git-send-email-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.