> -----Original Message----- > From: jandr...@gmail.com <jandr...@gmail.com> > Sent: 31 January 2020 17:23 > To: Durrant, Paul <pdurr...@amazon.co.uk> > Cc: xen-devel <xen-devel@lists.xenproject.org>; Ian Jackson > <ian.jack...@eu.citrix.com>; Wei Liu <w...@xen.org>; Anthony PERARD > <anthony.per...@citrix.com>; Andrew Cooper <andrew.coop...@citrix.com>; > George Dunlap <george.dun...@eu.citrix.com>; Jan Beulich > <jbeul...@suse.com>; Julien Grall <jul...@xen.org>; Konrad Rzeszutek Wilk > <konrad.w...@oracle.com>; Stefano Stabellini <sstabell...@kernel.org> > Subject: Re: [PATCH v5 5/7] libxl: allow creation of domains with a > specified or random domid > > On Fri, Jan 31, 2020 at 10:02 AM Paul Durrant <pdurr...@amazon.com> wrote: > > > > This patch adds a 'domid' field to libxl_domain_create_info and then > > modifies libxl__domain_make() to have Xen use that value if it is valid. > > If the domid value is invalid then Xen will choose the domid, as before, > > unless the value is the new special RANDOM_DOMID value added to the API. > > This value instructs libxl__domain_make() to choose a random domid value > > for Xen to use. > > > > If Xen determines that a domid specified to or chosen by > > libxl__domain_make() co-incides with an existing domain then the create > > operation will fail. In this case, if RANDOM_DOMID was specified to > > libxl__domain_make() then a new random value will be chosen and the > create > > operation will be re-tried, otherwise libxl__domain_make() will fail. > > > > After Xen has successfully created a new domain, libxl__domain_make() > will > > check whether its domid matches any recently used domid values. If it > does > > then the domain will be destroyed. If the domid used in creation was > > specified to libxl__domain_make() then it will fail at this point, > > otherwise the create operation will be re-tried with either a new random > > or Xen-selected domid value. > > > > NOTE: libxl__logv() is also modified to only log valid domid values in > > messages rather than any domid, valid or otherwise, that is not > > INVALID_DOMID. > > > > Signed-off-by: Paul Durrant <pdurr...@amazon.com> > > Looks good, with one suggestion below. > > Reviewed-by: Jason Andryuk <jandr...@gmail.com> >
Thanks. > <snip> > > > + > > + /* Try to destroy the domain again as we can't use it */ > > + ret = xc_domain_destroy(ctx->xch, *domid); > > + if (ret < 0) { > > + LOGED(ERROR, *domid, "domain destroy fail"); > > Maybe "destroy recently used domain id failed"? > Probably doesn't actually matter. A destroy failure during domain creation would be an unusual circumstance, but if I have to post a v6 I'll change the message while I'm at it. Paul > > + *domid = INVALID_DOMID; > > + rc = ERROR_FAIL; > > + goto out; > > + } > > } > > > > rc = libxl__arch_domain_save_config(gc, d_config, state, > &create); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel