|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [XTF PATCH 1/3] xtf-runner: introduce get_xen_version
On 10/08/16 16:07, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> xtf-runner | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/xtf-runner b/xtf-runner
> index c063699..7b69c45 100755
> --- a/xtf-runner
> +++ b/xtf-runner
> @@ -151,6 +151,19 @@ def __repr__(self):
> return "TestInfo(%s)" % (self.name, )
>
>
> +def get_xen_version():
> + """Get the version string of Xen"""
> +
> + for line in check_output(['xl', 'info']).splitlines():
> + if not line.startswith("xen_version"):
> + continue
> +
> + version_str = line.split()[2:][0]
> + break
> +
> + return version_str
This will hit a name error if xen_version isn't found in the output.
A better option would be to "return line.split()[2:][0]" directly and
raise a RunnerError() at this point.
However, xen_version was introduced by me a while ago, but not so very
long ago, and won't work on older versions of Xen.
I think at this point, it would just be easier to use the python libxc
bindings, so
from xen.lowlevel.xc import xc
libxc = xc()
info = libxc.xeninfo()
return "%s.%s" % (info["xen_major"], info["xen_minor"])
Make sure the import statement is inside the function call to avoid
breaking the usecase of `xtf-runner --list` offhost.
~Andrew
> +
> +
> def parse_test_instance_string(arg):
> """Parse a test instance string.
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |