2016-09-07 14:20 GMT+02:00 Fernando Casas Schössow <casasfernando@xxxxxxxxxxx>: > 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 ) 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. -- Matthias Bolte http://photron.blogspot.com -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list