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

[libvirt] [libvirt-php] Bug(?) in getting domain resource from sub-function



Hi everyone!

I ran into a rather annoying bug this evening. It appears that having
a special function to connect to libvirt (in a class), like:

<?php
function libvirtConnect(){
    return libvirt_connect('qemu+tls://'.$this->hostname.':16514/system',
false);
}
?>

..causes any calls to get a domain resource to be corrupted somehow, like:

<?php
function getDomainResource(){
    $lvd = $this->libvirtConnect();
    return libvirt_domain_lookup_by_uuid_string($lvd, $this->uuid);
}

function doSomething(){
    $res = $this->getDomainResource();
    libvirt_domain_create($res);
}
?>

This throws a warning: invalid domain pointer in virDomainGetXMLDesc

However, doing everything in one function, or maunally doing a
libvirt_connect(), makes everything work fine. Which is why my bug
senses are tingling- or am I just not understanding how LV pointers
work?

libvirt_version returns:
$ php -r 'print_r(libvirt_version());'
Array
(
    [libvirt.release] => 3
    [libvirt.minor] => 8
    [libvirt.major] => 0
    [connector.version] => 0.4.5
    [connector.major] => 0
    [connector.minor] => 4
    [connector.release] => 5
)

Full, working test code: http://pastie.org/4347100

Thank you!
Katelyn Schiesser


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