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

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



> -----Original Message-----
> From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel-
> bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of James Dingwall
> Sent: 06 November 2015 15:26
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: [win-pv-devel] xenstore/wmi behaviour
> 
> Hi,
> 
> 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
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

_______________________________________________
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®.