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

Re: [Xen-devel] [XTF PATCH v2] xtf-runner: use xl create -Fc directly



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@xxxxxxxxxx>

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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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