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

Re: [win-pv-devel] xenstore/wmi behaviour



> -----Original Message-----
> From: James Dingwall [mailto:james@xxxxxxxxxxxxxx]
> Sent: 12 February 2016 08:50
> To: Paul Durrant
> Cc: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [win-pv-devel] xenstore/wmi behaviour
> 
> On Fri, Nov 06, 2015 at 05:04:16PM +0000, Paul Durrant wrote:
> > > I am accessing xenstore using python via wmi and I appear to have
> > > inconsistent behaviour compared to Linux with xenstore-read.  My
> > > xenstore key is:
> > >
> > > /a/path/to/a/key = ""
> > >
> > > In xs.c in the xen source:
> > >
> > >             char *val = xs_read(xsh, xth, argv[optind], &len);
> > >             if (val == NULL) {
> > >                 warnx("couldn't read path %s", argv[optind]);
> > >                 return 1;
> > >             }
> > >
> > > So a NULL return value is used to indicate that the key does not exist.
> Testing
> > > this:
> > >
> > > # xenstore-read /a/path/to/a/key ; echo $?
> > >
> > > 0
> > > # # no output or error
> > >
> > > However reading the same key on Windows through wmi instead results
> in
> > > python getting a None type object where I believe it should
> > > get an empty string "".
> > >
> > > Setting up a connection in Python through wmi to xenstore then:
> > >
> > > >>> print session.GetValue("/a/path/to/a/key")
> > > (None,)
> > >
> > > In powershell:
> > > PS C:\>$base = gwmi -n root\wmi -cl XenProjectXenStoreBase
> > > PS C:\>$sid = $base.AddSession("MyNewSession")
> > > PS C:\>$session = gwmi -n root\wmi -q "select * from
> > > XenProjectXenStoreSession where SessionId=$($sid.SessionId)"
> > > PS C:\>$v = $session.GetValue("/a/path/to/a/key").value
> > > PS C:\>echo $v.getType();
> > > You cannot call a method on a null-valued expression.
> > > At line:1 char:1
> > > + echo $v.getType()
> > > + ~~~~~~~~~~~~~~~~~
> > >     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
> > >     + FullyQualifiedErrorId : InvokeMethodOnNull
> > > PS C:\>echo "".getType()
> > >
> > > IsPublic IsSerial Name                                     BaseType
> > > -------- -------- ----                                     --------
> > > True     True     String                                   System.Object
> > >
> > > So the behaviour outside of python seems to be the same.
> > >
> > > I have tried to follow the xen source code and I didn't find any special
> NULL -
> > > > "" conversion in the read path but it is quite
> > > possible I have missed something.  Therefore I believe that
> > > SessionExecuteGetValue() of wmi.c should be doing something special so
> > > there is compatibility in its behaviour between operating systems.
> > >
> >
> > Yes, there should be a clear distinction between an empty value and a non-
> existent value so it does seem this is a bug. Thanks for pointing it out.
> >
> >   Cheers,
> >
> >     Paul
> >
> > > Thanks,
> > > James
> 
> Hi,
> 
> We have been testing a recent build of the pv-drivers and have noted that
> this issue is still present.  Is it
> something that is likely to be an easy fix which we can test?  We have a
> common python module for working with
> xenstore in Linux and Windows and I would prefer to not have to code
> around this issue if possible.

Hi James,

  This is something we can take a look at after the release of the 8.1 drivers 
(which we've been hard-at-work getting through HCK testing).

>  Also is
> there a bug tracker for the pv drivers project where I can report this?
> 

  No, we don't have anything at the moment. As a first step I'll see about 
creating a wiki page on xenproject.org where we can note issues like this. I'll 
at least write it down somewhere so it doesn't get forgotten.

  Cheers,

    Paul

> Thanks,
> James

_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

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