On 11/10/2011 09:39 AM, Wouter - Iamotor wrote:
Hello,
My bad, I thought it said that it was running but it that the daemon wasn't doing
anything.
Because when I try to run this php script:
<?php
$uri="qemu+tcp:///system";
Instead of that uri, try this one: "qemu:///system".
And if you want to connect to virsh on some other host "remotehost", use
this uri:
qemu+ssh://root@remotehost/system
$credentials=Array(VIR_CRED_AUTHNAME=>"team7",VIR_CRED_PASSPHRASE=>"password");
echo ("Connecting to libvirt (URI:$uri)\n");
$conn=libvirt_connect($uri,false,$credentials);
if ($conn==false)
{
echo ("Libvirt last error: ".libvirt_get_last_error()."\n");
exit;
}
else
{
$hostname=libvirt_get_hostname($conn);
echo ("hostname:$hostname\n");
echo ("Domain count: Active
".libvirt_get_active_domain_count($conn).",Inactive
".libvirt_get_inactive_domain_count($conn).", Total
".libvirt_get_domain_count($conn)."\n");
$domains=libvirt_list_domains($conn);
foreach ($domains as $dom)
{
echo ("Name:\t".libvirt_domain_get_name($dom)."\n");
echo("UUID:\t".libvirt_domain_get_uuid_string($dom)."\n");
$dominfo=libvirt_domain_get_info($dom);
print_r($dominfo);
}
}
?>
The script can also be found on this link:
http://phplibvirt.cybersales.cz/bightml.html
Then I get this error:
Connecting to libvirt (URI:qemu+tcp:///system) Libvirt last error: unable to connect to
server at 'localhost:16509': Connection refused
The user team7 is added to the group libvirtd and kvm.
Which configuration is necessary so that the script could run on the server?
Thanks for your help so far.
With kind regards,
Wouter.
-----Oorspronkelijk bericht-----
Van: Daniel P. Berrange [mailto:berrange@redhat.com]
Verzonden: donderdag 10 november 2011 15:23
Aan: Wouter - Iamotor
CC: libvirt-list(a)redhat.com
Onderwerp: Re: [libvirt] Problem with libvirt daemon
On Thu, Nov 10, 2011 at 02:46:42PM +0100, Wouter - Iamotor wrote:
> Hello,
>
>
>
> I have a problem with the libvirt daemon. I have a little php script
> which should connect with libvirt, but it won't.
>
>
>
> When I try to start the libvirt daemon I get this error (using the
> command libvirtd --listen):
>
> 2011-11-09 19:35:18.095: 3560: info : libvirt version: 0.9.7
>
> 2011-11-09 19:35:18.095: 3560: error : virPidFileAcquirePath:345 :
> Failed to acquire pid file '/var/run/libvirtd.pid': Resource
> temporarily unavailable
>
>
>
> So the daemon won't start and isn't started yet. If I check if the
> service is running with ps -ef | grep libvirtd I get this output:
>
> root 2865 1 0 15:50 ? 00:00:00 /usr/sbin/libvirtd -d
>
> root 3149 1 0 19:17 ? 00:00:00 libvirtd -d
>
> root 3206 1 0 19:17 ? 00:00:00 libvirtd -dl
>
> root 3300 1 0 19:20 ? 00:00:00 libvirtd --listen --daemon
>
> root 3356 1 0 19:21 ? 00:00:00 libvirtd --listen --daemon
>
> root 3564 3077 0 19:36 pts/0 00:00:00 grep --color=auto libvirtd
>
>
>
> Here you can see that the service isn't running.
Err, that shows precisely the opposite of what you say. It shows that you have libvirtd
running *5* times, no doubt due to you deleting the pidfiles.
Daniel