The value of 'rover' is the value at which Xen will start searching for an
unused domid if none is specified. Currently it is only updated when a
domid is automatically chosen, rather than specified by the caller, which
makes it very hard to describe Xen's rationale in choosing domids in an
environment where some domain creations have specified domids and some
don't.
This patch always updates 'rover' after a successful creation, even in the
case that domid is specified by the caller. This ensures that, if Xen
automatically chooses a domid for a subsequent domain creation it will
always be the next available value after the domid of the most recently
created domain.

Signed-off-by: Paul Durrant <pdurr...@amazon.com>
---
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Cc: George Dunlap <george.dun...@eu.citrix.com>
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
Cc: Jan Beulich <jbeul...@suse.com>
Cc: Julien Grall <jul...@xen.org>
Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
Cc: Stefano Stabellini <sstabell...@kernel.org>
Cc: Wei Liu <w...@xen.org>
---
 xen/common/domctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 650310e874..5268f3967b 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -521,8 +521,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
             ret = -ENOMEM;
             if ( dom == rover )
                 break;
-
-            rover = dom;
         }
 
         d = domain_create(dom, &op->u.createdomain, false);
@@ -534,7 +532,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
u_domctl)
         }
 
         ret = 0;
-        op->domain = d->domain_id;
+        rover = op->domain = d->domain_id;
         copyback = 1;
         d = NULL;
         break;
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to