[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V4 21/24] xl: update domain configuration when running mem-set and mem-max



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 <wei.liu2@xxxxxxxxxx>
> > ---
> >  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.
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.