Re: [Xen-devel] [PATCH 03/27] Guest setup: allow the amount of RAM to be a runvar

2014-12-11 Thread Wei Liu
On Thu, Dec 11, 2014 at 01:57:59PM +0100, Dario Faggioli wrote:
> On Thu, 2014-12-11 at 12:05 +, Wei Liu wrote:
> > On Wed, Dec 10, 2014 at 07:09:18PM +0100, Dario Faggioli wrote:
> > > diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> > > index a3b6936..cdff8d5 100644
> > > --- a/Osstest/TestSupport.pm
> > > +++ b/Osstest/TestSupport.pm
> > > @@ -1460,11 +1460,12 @@ sub prepareguest_part_xencfg ($) {
> > >  my ($ho, $gho, $ram_mb, $xopts, $cfgrest) = @_;
> > >  my $onreboot= $xopts->{OnReboot} || 'restart';
> > >  my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
> > > +my $memory= guest_var($gho, 'memory', $xopts->{DefMem} || $ram_mb);
> > >  my $xoptcfg= $xopts->{ExtraConfig};
> > >  $xoptcfg='' unless defined $xoptcfg;
> > >  my $xencfg= < > >  name= '$gho->{Name}'
> > > -memory = ${ram_mb}
> > > +memory = ${memory}
> > 
> > You made ram_mb redundant.
> >
> Did I? My idea was to use it as default, if the runvar is not defined...
> That is what I though this line does (and I'm quite sure I tested it
> actually does that):
> 
> my $memory= guest_var($gho, 'memory', $xopts->{DefMem} || $ram_mb);
> 
> But, perhaps, I'm not getting what you mean by "redundant"...

Sorry, I missed the "|| $ram_mb".

In any case, having two way of specifying guest memory and one might
shadow the other is a bit subtle to me. One might be affected by a
guest runvar stored in other places and confusingly find out $ram_mb
doesn't work in his / her own script...

> 
> >  And this seems to be deep in the call chain
> > which has subtle knock on effect.
> > 
> Sorry, I don't get what you mean here.
> 

prepareguest_part_xencfg is not exported to guest and user might not
have a good idea why $ram_mb he / she specifies doesn't work.

Wei.


> Thanks and Regards,
> Dario
> 
> -- 
> <> (Raistlin Majere)
> -
> Dario Faggioli, Ph.D, http://about.me/dario.faggioli
> Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
> 



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


Re: [Xen-devel] [PATCH 03/27] Guest setup: allow the amount of RAM to be a runvar

2014-12-11 Thread Dario Faggioli
On Thu, 2014-12-11 at 12:05 +, Wei Liu wrote:
> On Wed, Dec 10, 2014 at 07:09:18PM +0100, Dario Faggioli wrote:
> > diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> > index a3b6936..cdff8d5 100644
> > --- a/Osstest/TestSupport.pm
> > +++ b/Osstest/TestSupport.pm
> > @@ -1460,11 +1460,12 @@ sub prepareguest_part_xencfg ($) {
> >  my ($ho, $gho, $ram_mb, $xopts, $cfgrest) = @_;
> >  my $onreboot= $xopts->{OnReboot} || 'restart';
> >  my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
> > +my $memory= guest_var($gho, 'memory', $xopts->{DefMem} || $ram_mb);
> >  my $xoptcfg= $xopts->{ExtraConfig};
> >  $xoptcfg='' unless defined $xoptcfg;
> >  my $xencfg= < >  name= '$gho->{Name}'
> > -memory = ${ram_mb}
> > +memory = ${memory}
> 
> You made ram_mb redundant.
>
Did I? My idea was to use it as default, if the runvar is not defined...
That is what I though this line does (and I'm quite sure I tested it
actually does that):

my $memory= guest_var($gho, 'memory', $xopts->{DefMem} || $ram_mb);

But, perhaps, I'm not getting what you mean by "redundant"...

>  And this seems to be deep in the call chain
> which has subtle knock on effect.
> 
Sorry, I don't get what you mean here.

Thanks and Regards,
Dario

-- 
<> (Raistlin Majere)
-
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)



signature.asc
Description: This is a digitally signed message part
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 03/27] Guest setup: allow the amount of RAM to be a runvar

2014-12-11 Thread Wei Liu
On Wed, Dec 10, 2014 at 07:09:18PM +0100, Dario Faggioli wrote:
> From: Dario Faggioli 
> 
> the value of which can be retrieved via guest_var('memory');.
> 
> This works for both PV and HVM Debian guests.
> 
> Signed-off-by: Dario Faggioli 
> Cc: Wei Liu 
> Cc: Ian Campbell 
> Cc: Ian Jackson 
> ---
>  Osstest/TestSupport.pm |3 ++-
>  ts-debian-fixup|3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> index a3b6936..cdff8d5 100644
> --- a/Osstest/TestSupport.pm
> +++ b/Osstest/TestSupport.pm
> @@ -1460,11 +1460,12 @@ sub prepareguest_part_xencfg ($) {
>  my ($ho, $gho, $ram_mb, $xopts, $cfgrest) = @_;
>  my $onreboot= $xopts->{OnReboot} || 'restart';
>  my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
> +my $memory= guest_var($gho, 'memory', $xopts->{DefMem} || $ram_mb);
>  my $xoptcfg= $xopts->{ExtraConfig};
>  $xoptcfg='' unless defined $xoptcfg;
>  my $xencfg= <  name= '$gho->{Name}'
> -memory = ${ram_mb}
> +memory = ${memory}

You made ram_mb redundant. And this seems to be deep in the call chain
which has subtle knock on effect.

Wei.

>  vif = [ 'type=ioemu,mac=$gho->{Ether}' ]
>  #
>  on_poweroff = 'destroy'
> diff --git a/ts-debian-fixup b/ts-debian-fixup
> index f001418..f85b06d 100755
> --- a/ts-debian-fixup
> +++ b/ts-debian-fixup
> @@ -113,10 +113,13 @@ sub setcfg ($$) {
>  
>  sub otherfixupcfg () {
>  my $vcpus= guest_var($gho,'vcpus',1);
> +my $ram_mb= guest_var($gho,'memory',512);
>  $cfg =~ s/^dhcp/#$&/mg;
>  $cfg =~ s/^on_crash.*/on_crash='preserve'/mg;
>  $cfg =~ s/^vcpus.*//mg;
>  $cfg .= "\nvcpus = $vcpus\n";
> +$cfg =~ s/^memory.*//mg;
> +$cfg .= "\nmemory = $ram_mb\n";
>  
>  # PCI passthrough
>  # Look for runvars   _pcipassthrough_=
> 
> 
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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