From: Ian Campbell Subject: Re: [PATCH V4 21/24] xl: update domain configuration when running mem-set and mem-max Date: Tue, 6 May 2014 15:30:56 +0100 Message-ID: <1399386656.3014.176.camel@kazak.uk.xensource.com> References: <1398949101-23320-1-git-send-email-wei.liu2@citrix.com> <1398949101-23320-22-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398949101-23320-22-git-send-email-wei.liu2@citrix.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: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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"? > 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? Ian.