[libvirt] [libvirt-php] libvirt_list_active_domains returns garbage querying a Hyper-V host

Fernando Casas Schössow casasfernando at hotmail.com
Wed Sep 7 16:27:13 UTC 2016


The patch is working Michal. :)

Thanks.

Fer

On mié, sep 7, 2016 at 6:16 , Fernando Casas Schössow 
<casasfernando at hotmail.com> wrote:
> Thanks Michal. :)
> 
> I'm patching and re-building as we speak.
> Will report the results in a few minutes.
> 
> On mié, sep 7, 2016 at 6:01 , Michal Privoznik <mprivozn at redhat.com> 
> wrote:
>> On 07.09.2016 15:58, Matthias Bolte wrote:
>>>  2016-09-07 14:20 GMT+02:00 Fernando Casas Schössow 
>>> <casasfernando at hotmail.com>:
>>>>  Hi all,
>>>> 
>>>>  I'm using libvirt-php to manage a Hyper-V 2012 R2 host.
>>>>  When trying to retrieve the active VMs using the function
>>>>  libvirt_list_active_domains() I get an array with the correct 
>>>> amount of
>>>>  items but with garbage instead of the domain names:
>>>> 
>>>>  Array ( [0] => P’*µ [1] => +µ [2] => `„*µ [3] => °Ø*µ 
>>>> [4] => Є*µ [5] =>
>>>>  `†*µ [6] => [7] => `†*µ [8] => [9] => p +µ [10] => p"+µ 
>>>> [11] => P#+µ [12] =>
>>>>  ß*µ )
>>>> 
>>>>  On the other hand libvirt_list_inactive_domains() and 
>>>> libvirt_list_domains()
>>>>  work as expected returning the right amount of items and the 
>>>> domain names
>>>>  correctly:
>>>> 
>>>>  libvirt_list_inactive_domains() output:
>>>> 
>>>>  Array ( [0] => DCHOMELAB01 [1] => VMFCSW7 [2] => REMOTEAPP01 [3] 
>>>> => MPSSD01
>>>>  [4] => CS16SVR )
>> 
>> Hey thank you for the bug report. It's important to me to fix 
>> whatever
>> bugs you find, because libvirt-php hasn't been given enough attention
>> lately.
>> 
>>> 
>>>  The problem is here
>>> 
>>>  
>>> http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=2045c59644075c00a22695d7b8534ff593120f14;hb=HEAD#l9131
>>> 
>>>  libvirt_list_active_domains gets the domain name using
>>>  virDomainGetName, then frees the domain object using virDomainFree
>>>  (this also frees the domain name) and afterwards tries to use the
>>>  already freed domain name.
>>> 
>>>  libvirt_list_active_domains needs to add the domian name to the 
>>> result
>>>  list and then free the domain. For example, libvirt_list_domains 
>>> does
>>>  it in the correct order.
>>> 
>> 
>> And thanks to Matthias for the analysis. You're right. I've just 
>> pushed
>> the patch for it. @Fernando you can try it out.
>> 
>> http://libvirt.org/git/?p=libvirt-php.git;a=commitdiff;h=a0039f72a1c480e500363645ce6b93a0925a0c1f
>> 
>> Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160907/d7701ff9/attachment-0001.htm>


More information about the libvir-list mailing list