From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [XTF PATCH v2] xtf-runner: use xl create -Fc directly
Date: Mon, 8 Aug 2016 14:06:37 +0100 [thread overview]
Message-ID: <86aa4c33-61c8-0f3d-0b6b-9a3f285a44a5@citrix.com> (raw)
In-Reply-To: <1470655469-7893-1-git-send-email-wei.liu2@citrix.com>
On 08/08/16 12:24, Wei Liu wrote:
> Now that xl create -c is fixed in xen-unstable, there is no need to keep
> the hack to get guest console output anymore.
>
> Use xl create -Fc directly, then wait for the xl process to exit. Print
> any error as it occurs.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Sadly, now I think about this further, it does re-introduce the
serialisation problem I was trying specifically trying to avoid.
You need to run `xl create -F` so you can sensibly wait on the create
list to avoid tripping up the leak detection.
However, the guest.communicate() call will wait for the guest process to
terminate, which includes all output.
Therefore, I think we still need the `xl create -Fp`, `xl console`, `xl
unpause` dance, where the create process gets put on the create_list,
and it is the console process which gets communicated with.
This also has the advantage that it doesn't cause ./xtf-runner to break
against all non-staging trees.
> ---
> Rebased on top of master
> ---
> xtf-runner | 34 +++++++++++++++-------------------
> 1 file changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/xtf-runner b/xtf-runner
> index c063699..a87bde6 100755
> --- a/xtf-runner
> +++ b/xtf-runner
> @@ -425,30 +425,22 @@ def list_tests(opts):
> for sel in opts.selection:
> print sel
>
> +create_list = []
I would call this the xl_create_list to give its name a bit more
context, and I would also suggest a comment along the lines of:
# List of `xl create` processes which may still be cleaning up after
dead domains
~Andrew
>
> def run_test(test):
> """ Run a specific test """
>
> - cmd = ['xl', 'create', '-p', test.cfg_path()]
> + cmd = ['xl', 'create', '-Fc', test.cfg_path()]
> print "Executing '%s'" % (" ".join(cmd), )
> - rc = subproc_call(cmd)
> - if rc:
> - raise RunnerError("Failed to create VM")
> + guest = Popen(cmd, stdout = PIPE, stderr = PIPE)
> + create_list.append(guest)
>
> - cmd = ['xl', 'console', test.vm_name()]
> - print "Executing '%s'" % (" ".join(cmd), )
> - console = Popen(cmd, stdout = PIPE)
> -
> - cmd = ['xl', 'unpause', test.vm_name()]
> - print "Executing '%s'" % (" ".join(cmd), )
> - rc = subproc_call(cmd)
> - if rc:
> - raise RunnerError("Failed to unpause VM")
> + # stdout is console output, stderr is xl output
> + stdout, stderr = guest.communicate()
>
> - stdout, _ = console.communicate()
> -
> - if console.returncode:
> - raise RunnerError("Failed to obtain VM console")
> + if guest.returncode:
> + print stderr
> + raise RunnerError("Failed to communicate with guest")
>
> lines = stdout.splitlines()
>
> @@ -603,10 +595,14 @@ def main():
> opts.selection = interpret_selection(opts)
>
> if opts.list_tests:
> - return list_tests(opts)
> + ret = list_tests(opts)
> else:
> - return run_tests(opts)
> + ret = run_tests(opts)
> +
> + for child in create_list:
> + child.wait()
>
> + return ret
>
> if __name__ == "__main__":
> try:
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-08 13:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-08 11:24 [XTF PATCH v2] xtf-runner: use xl create -Fc directly Wei Liu
2016-08-08 13:06 ` Andrew Cooper [this message]
2016-08-08 13:13 ` Wei Liu
2016-08-09 13:11 ` Andrew Cooper
2016-08-09 15:37 ` Wei Liu
2016-08-10 11:01 ` Wei Liu
2016-08-10 11:33 ` Andrew Cooper
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=86aa4c33-61c8-0f3d-0b6b-9a3f285a44a5@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).