diff mbox

[Xen-devel,OSSTEST,v2,07/15] TestSupport: allow caller of prepareguest_part_xencfg to specify viftype

Message ID 1398681696-2773-7-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell April 28, 2014, 10:41 a.m. UTC
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/TestSupport.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ian Jackson May 2, 2014, 11:28 a.m. UTC | #1
Ian Campbell writes ("[PATCH OSSTEST v2 07/15] TestSupport: allow caller of prepareguest_part_xencfg to specify viftype"):
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  Osstest/TestSupport.pm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> index 132e8e9..9d5762f 100644
> --- a/Osstest/TestSupport.pm
> +++ b/Osstest/TestSupport.pm
> @@ -1419,12 +1419,13 @@ sub prepareguest_part_xencfg ($$$$$) {
>      my $onpoweroff= $xopts->{OnPowerOff} || 'destroy';
>      my $oncrash= $xopts->{OnCrash} || 'preserve';
>      my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
> +    my $viftype= "type=$xopts->{viftype}," if $xopts->{DefVcpus};

Why is this conditional on DefVcpus ?

> +    $xopts{'viftype'} ||= "ioemu";

The other xopts have CamelCase names.  And you don't need to quote it
there.

Ian.
Ian Campbell May 2, 2014, 12:21 p.m. UTC | #2
On Fri, 2014-05-02 at 12:28 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST v2 07/15] TestSupport: allow caller of prepareguest_part_xencfg to specify viftype"):
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> >  Osstest/TestSupport.pm | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
> > index 132e8e9..9d5762f 100644
> > --- a/Osstest/TestSupport.pm
> > +++ b/Osstest/TestSupport.pm
> > @@ -1419,12 +1419,13 @@ sub prepareguest_part_xencfg ($$$$$) {
> >      my $onpoweroff= $xopts->{OnPowerOff} || 'destroy';
> >      my $oncrash= $xopts->{OnCrash} || 'preserve';
> >      my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
> > +    my $viftype= "type=$xopts->{viftype}," if $xopts->{DefVcpus};
> 
> Why is this conditional on DefVcpus ?

I think I wasn't concentrating and read the line above... It should have
been viftype to match the line bellow.

> > +    $xopts{'viftype'} ||= "ioemu";
> 
> The other xopts have CamelCase names.  And you don't need to quote it
> there.

Ack.
diff mbox

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 132e8e9..9d5762f 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1419,12 +1419,13 @@  sub prepareguest_part_xencfg ($$$$$) {
     my $onpoweroff= $xopts->{OnPowerOff} || 'destroy';
     my $oncrash= $xopts->{OnCrash} || 'preserve';
     my $vcpus= guest_var($gho, 'vcpus', $xopts->{DefVcpus} || 2);
+    my $viftype= "type=$xopts->{viftype}," if $xopts->{DefVcpus};
     my $xoptcfg= $xopts->{ExtraConfig};
     $xoptcfg='' unless defined $xoptcfg;
     my $xencfg= <<END;
 name        = '$gho->{Name}'
 memory = ${ram_mb}
-vif         = [ 'type=ioemu,mac=$gho->{Ether}' ]
+vif         = [ '${viftype}mac=$gho->{Ether}' ]
 #
 on_poweroff = '$onpoweroff'
 on_reboot   = '$onreboot'
@@ -1519,6 +1520,7 @@  END
         $cfg .= "bios='$bios'\n";
     }
 
+    $xopts{'viftype'} ||= "ioemu";
     my $cfgpath= prepareguest_part_xencfg($ho, $gho, $ram_mb, \%xopts, $cfg);
     target_cmd_root($ho, <<END);
         (echo $passwd; echo $passwd) | vncpasswd $gho->{Guest}.vncpw