From: Wei Liu Subject: Re: [PATCH V4 21/24] xl: update domain configuration when running mem-set and mem-max Date: Tue, 6 May 2014 15:56:10 +0100 Message-ID: <20140506145610.GP17067@zion.uk.xensource.com> References: <1398949101-23320-1-git-send-email-wei.liu2@citrix.com> <1398949101-23320-22-git-send-email-wei.liu2@citrix.com> <1399386656.3014.176.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1399386656.3014.176.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, May 06, 2014 at 03:30:56PM +0100, Ian Campbell wrote: > On Thu, 2014-05-01 at 13:58 +0100, Wei Liu wrote: > > Wouldn't doing this in set_memory_max mean you need to patch less places > and keep the places to change to a minimum by keeping this code "near > the action"? > No, main_memset calls a different function. > > Signed-off-by: Wei Liu > > --- > > tools/libxl/xl_cmdimpl.c | 55 +++++++++++++++++++++++++++++++++++++++++++--- > > 1 file changed, 52 insertions(+), 3 deletions(-) > > > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > > index f891ab5..83f058e 100644 > > --- a/tools/libxl/xl_cmdimpl.c > > +++ b/tools/libxl/xl_cmdimpl.c > > @@ -2745,6 +2745,7 @@ int main_memmax(int argc, char **argv) > > int opt = 0; > > char *mem; > > int rc; > > + libxl_domain_config d_config; > > > > SWITCH_FOREACH_OPT(opt, "", NULL, "mem-max", 2) { > > /* No options */ > > @@ -2756,10 +2757,34 @@ int main_memmax(int argc, char **argv) > > rc = set_memory_max(domid, mem); > > if (rc) { > > fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem); > > - return 1; > > + rc = 1; > > + goto out; > > } > > > > - return 0; > > + libxl_domain_config_init(&d_config); > > + if (load_domain_config(domid, &d_config)) { > > + fprintf(stderr, "cannot load domain configuration from userdata store, " > > + "not updating configuration\n"); > > I expect this is going to get repeated a lot for the different loaders > -- so move it into the helper? Possibly make it exit() itself to avoid > needing to propagate too many errors. > > Perhaps even a helper to load, call a callback and save? > I've done this for devices with two macros, but forgot to do so for memory targets. I plan to wrap the repeative in two macros in my next version. Wei. > Ian. >