All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: "Pang, LongtaoX" <longtaox.pang@intel.com>
Cc: "Hu, Robert" <robert.hu@intel.com>,
	"Ian.Jackson@eu.citrix.com" <Ian.Jackson@eu.citrix.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [OSSTEST Nested PATCH v8 5/7] Add new script to customize nested test configuration
Date: Tue, 28 Apr 2015 08:39:16 +0100	[thread overview]
Message-ID: <1430206756.12403.112.camel@citrix.com> (raw)
In-Reply-To: <86C3224E41A7434B904EC364302132D80E49A4DF@SHSMSX101.ccr.corp.intel.com>

On Fri, 2015-04-24 at 08:45 +0000, Pang, LongtaoX wrote:
> 
> 
> > -----Original Message-----
> > From: Ian Campbell [mailto:ian.campbell@citrix.com]
> > Sent: Thursday, April 23, 2015 7:30 PM
> > To: Hu, Robert
> > Cc: Pang, LongtaoX; xen-devel@lists.xen.org; Ian.Jackson@eu.citrix.com;
> > wei.liu2@citrix.com
> > Subject: Re: [OSSTEST Nested PATCH v8 5/7] Add new script to customize nested
> > test configuration
> > 
> > On Thu, 2015-04-23 at 17:38 +0800, Robert Hu wrote:
> > > > > As mentioned in [0000 Patch], 'nested_l1' is ident for L1 guest VM,
> > > > > 'nestedl1' is hostname for L1 guest VM.
> > > > > ' store_runvar('nested_l1',$l1->{Guest});' is used to store L1's ident
> > > > > and L1's hostname to database, that will be used for 'selecthost()'
> > > > > function in later script.
> > > >
> > > > Having a runvar with the bare ident as a name doesn't seem right.
> > > > Perhaps you want to be writing to $r{"${ident}_hostname"} or some such?
> > > >
> > > > What do you actually need the hostname for anyway?
> > > Look at selecthost()
> > > sub selecthost ($) {
> > >     my ($ident) = @_;
> > >     # must be run outside transaction
> > >     my $name;
> > >     if ($ident =~ m/=/) {
> > >         $ident= $`;
> > >         $name= $'; #'
> > >         $r{$ident}= $name;
> > >     } else {
> > >         $name= $r{$ident};
> > >         die "no specified $ident" unless defined $name;
> > >     }
> > > ...
> > >
> > > When in L1 iteration invocation of ts-debian-hvm-install(), the ident
> > > passed in is L1 ident ("nested_l1"). Here the 'else' branch will need
> > > $r{$ident}, whose value shall be L1's name. Therefore we prepare this
> > > runvar in advance.
> > 
> > Ah I see, today usually the ident is "host" or "dst_host" or "src_host"
> > so I got confused by it just being "nested_l1" here.
> > 
> > In the normal case today the ident runvars are set by ts-hosts-allocate.
> > That can't apply to the nested case since it is allocating a guest and
> > not a host, so your ts-nested-setup seems like a reasonable enough place
> > to do it.
> > 
> > However, I don't think there is any reason for the indent, hostname and
> > guest name to differ, and I think perhaps it would be clearer to write
> > this as:
> >         our $l1_ident = $gho->{Guest};
> >         store_runvar($l1_ident, $gho->{Guest});
> > So that it is clear to the reader that this runvar is an ident. I
> > suppose a code comment would work as well (or in addition perhaps).
> > 
> > > >
> > > > > > Most places you seem to use nestedl1, not nested_l1. I think you ended
> > > > > > up with this due to not using guest_var and the various hardcoding
> > > > > > you've done elsewhere. I suspect with all that fixed and make-flight
> > > > > > updated accordingly you won't need this var any more.
> > > > > >
> > > > > I think I should define L1 ident with " my $l1_ident = 'nested_l1' in
> > 'ts-nested-setup'
> > > >
> > > > Hardcoding anything like that in ts-nested-setup seems wrong to me.
> > > >
> > > > The ident should come from the script's parameters (i.e. be part of the
> > > > sg-run-job invocation of the script).
> > > >
> > > > Imagine a hypothetical nested-virt migration test, in that scenario you
> > > > would want to run ts-nested-setup on two hosts, both nestedl1src and
> > > > nestedl2dst in order to configure things. That's why we don't hardcode
> > > > such things.
> > > >
> > > so to summarize, ts-nested-setup will be invoked with parameters of
> > > $l0_ident, $l1_ident and $l1_name?
> > > or only parameters of $l0_ident and $l1_ident, if we have setup
> > > $l1_ident->$l1_name mapping in runvar when in l0's iteration of
> > > ts-debian-hvm-install.
> > > which would you prefer?
> > 
> > $l1_ident and $l1_name should be the same, I think. Semantically the
> > script should be taking $l0_ident and $l1_ident, where $l0 here is a
> > host and $l1 here is a guest, so infact isn't $l1_nae just $l1->{Guest}?
> > 
> > (Things get confusing because $l1 can be a Guest or a Host depending on
> > which test script we are in)
> > 
> > > > > > > +store_runvar("$l1->{Guest}_ip",$l1->{Ip});
> > > > > > > +
> > > > > > > +my $l2_disk_mb = 20000;
> > > > > > > +my $l2_lv_name = 'nestedl2-disk';
> > > > > > > +my $vgname = $l0->{Name};
> > > > > > > +$vgname .= ".$c{TestHostDomain}" if ($l0->{Suite} =~ m/lenny/);
> > > > > > > +target_cmd_root($l0, <<END);
> > > > > > > +    lvremove -f /dev/${vgname}/${l2_lv_name} ||:
> > > > > > > +    lvcreate -L ${l2_disk_mb}M -n $l2_lv_name $vgname
> > > > > > > +    dd if=/dev/zero of=/dev/${vgname}/${l2_lv_name} count=10
> > > > > >
> > > > > > I think you can do all of this by passing a suitable l2 $gho to
> > > > > > prepareguest_part_lvmdisk, can't you?
> > > > > >
> > > > > > I think you can get that by my $l2 = selectguest($ARGV[????], $l1).
> > > > > >
> > > > > I think I could try it, that means I will add more parameters for
> > > > > 'ts-nested-setup' script, not just 'host' and 'nestedl1'.
> > > I think we can pass in 3 parameters: $l0_ident, $l1_ident, and
> > > $l2_ident, as long as we in advance setup their $ident-->$name mappings
> > > in runvar. Here we have 2 options:
> > > 1. setup such mapping in first iteration (l0 interation) of
> > > ts-debian-hvm-install
> > > 2. setup this in make flight
> > > I prefer 2. since such mapping can be fixed from beginning and shall not
> > > be changed in run time.
> > 
> > The issue we are coming across here is that we are trying to talk about
> > the l2 guest before it really exists, since that happens later when
> > prepareguest is called in the l1 context and here we are really in l0
> > context where the concept of a specific l2 guest doesn't really exist.
> > So my suggestion to use prepareguest_part_lvmdisk doesn't really hold
> > together.
> >
> So, is it means that will not use ' prepareguest_part_lvmdisk' to
> create lv storage disk inside L0 host, which used for installing L2
> guest, right?

Right. It might be nice to refactor some of prepareguest_part_lvmdisk
into a more generic helper which can be called to create an arbitrary
LVM LV though.

> > IOW the naming would be based on the l1 ident and some suffix, e.g.
> > "_guest_storage". So, given $l1_ident from above, you would do:
> > 
> > $guest_storage_lv_name = "${l1_ident}_guest_storage"
> > # make the LV
> > store_runvar("${l1_ident}_guest_storage_lv", $guest_storage_lv_name)
> > store_runvar("${l1_ident}_guest_storage_vdev", "xvde")
> > 
> Could you please make it clear, what's it used for that store above two runvars?

Those were just two random examples of properties of the second device
which I thought other code _might_ be interested in which I picked to
illustrate what I was talking about, they might not be needed in
reality.

Ian.

  reply	other threads:[~2015-04-28  7:39 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 21:19 [OSSTEST Nested PATCH v8 0/7] Introduction of netsted HVM test job longtao.pang
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 1/7] parsing grub which has 'submenu' primitive longtao.pang
2015-04-21 10:12   ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 2/7] Changes to support '/boot' leading paths of kernel, xen, in grub longtao.pang
2015-04-21 10:13   ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 3/7] Edit some APIs in TestSupport.pm for nested test longtao.pang
2015-04-21 10:19   ` Ian Campbell
2015-04-21 12:33     ` Ian Jackson
2015-04-21 12:53       ` Ian Campbell
2015-04-21 13:28         ` Ian Jackson
2015-04-21 13:41           ` Ian Campbell
2015-04-21 14:30             ` Ian Jackson
2015-04-21 14:43               ` Ian Campbell
2015-04-22  8:25                 ` Pang, LongtaoX
2015-04-22  9:48                   ` Ian Campbell
2015-04-22 12:50                     ` Ian Jackson
2015-04-23  0:34                       ` Hu, Robert
2015-04-27  9:36                         ` Robert Hu
2015-04-28  7:41                           ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 4/7] Changes on test step of Debian hvm guest install longtao.pang
2015-04-21 10:28   ` Ian Campbell
2015-04-23  5:59     ` Robert Hu
2015-04-23  6:52       ` Ian Campbell
2015-04-23 10:43         ` Hu, Robert
2015-04-23 12:04           ` Ian Campbell
2015-04-23 11:07         ` Ian Jackson
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 5/7] Add new script to customize nested test configuration longtao.pang
2015-04-21 10:40   ` Ian Campbell
2015-04-22  8:35     ` Pang, LongtaoX
2015-04-22  9:56       ` Ian Campbell
2015-04-23  9:38         ` Robert Hu
2015-04-23 11:30           ` Ian Campbell
2015-04-23 13:05             ` Ian Campbell
2015-04-24  8:45             ` Pang, LongtaoX
2015-04-28  7:39               ` Ian Campbell [this message]
2015-04-23  7:27     ` Pang, LongtaoX
2015-04-23 11:35       ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 6/7] Compose the main recipe of nested test job longtao.pang
2015-04-21 10:48   ` Ian Campbell
2015-04-22  8:38     ` Pang, LongtaoX
2015-04-22 11:04       ` Ian Campbell
2015-04-22 11:23         ` Ian Campbell
2015-04-23  8:08           ` Pang, LongtaoX
2015-04-23 11:05             ` Ian Jackson
2015-04-24  6:31               ` Robert Hu
2015-04-23 10:49           ` Robert Hu
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 7/7] Add test job for nest test case longtao.pang
2015-04-21 10:51   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430206756.12403.112.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=longtaox.pang@intel.com \
    --cc=robert.hu@intel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.