Displaying 20 results from an estimated 23 matches for "libvirt_connection".
2016 Jun 12
1
How to use PHP libvirt_connect?
I'm having a go at writing some PHP scripts to do simple things like view
the status of VMs running on my Ubuntu KVM host.
I've installed php_libvirt_php but am failing at the first hurdle at the
moment as I can't get the PHP script to connect.
My normal way of connecting virsh from the command line is like this:
$ virsh -c qemu+ssh://localhost/system
This asks for a password which
2013 Oct 14
2
event handler
...n exit
{
if(virEventRunDefaultImpl() < 0)
{
virErrorPtr err = virGetLastError();
fprintf(stderr, "Failed to run event loop: %s\n", err && err->message
? err->message : "Unknown error");
}
}
}
...
virSetErrorFunc(NULL, libvirt_error_handler);
libvirt_connection = virConnectOpen("qemu:///system");
if (virEventRegisterDefaultImpl() < 0)
{
virErrorPtr err = virGetLastError();
fprintf(stderr, "Failed to register event implementation: %s\n", err
&& err->message ? err->message: "Unknown error");
return -1...
2013 Jun 24
3
deadlock on connection loosing
libvirtd will lock if for example kill programm which established connection,
only sigkill + restart helps., to reproduce:
virConnectPtr libvirt_connection = virConnectOpen("qemu:///system");
if(libvirt_connection == NULL)
{
std::cout<<"failed to connect to qemu:///system\n";
exit(-1);
}
exit(0);
2013 Aug 22
1
Re: virConnectDomainEventRegisterAny problem
..._handler(virConnectPtr conn,
>>>>>> virDomainPtr dom, int event, int detail, void * opaque) {
>>>>>> switch(event) { } return 0; }
>>>>>>
>>>>>> ..... int callback =
>>>>>> virConnectDomainEventRegisterAny(libvirt_connection,
>>>>>> NULL, VIR_DOMAIN_EVENT_ID_LIFECYCLE,
>>>>>> VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL,
>>>>>> NULL); if(callback == -1) { std::cout<<"Error: failed to
>>>>>> register domain event handle callba...
2013 Oct 14
2
Re: event handler
...uot;Failed to run event loop: %s\n", err &&
>> err->message ? err->message : "Unknown error");
>> }
>> }
>> }
>>
>>
>>
>> ...
>>
>> virSetErrorFunc(NULL, libvirt_error_handler);
>> libvirt_connection = virConnectOpen("qemu:///system");
>
> Move this line ^^^ ...
>
>> if (virEventRegisterDefaultImpl() < 0)
>> {
>> virErrorPtr err = virGetLastError();
>> fprintf(stderr, "Failed to register event implementation:
>>...
2013 Oct 14
2
Re: event handler
...e ? err->message : "Unknown error");
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>> ...
>>>>
>>>> virSetErrorFunc(NULL, libvirt_error_handler);
>>>> libvirt_connection = virConnectOpen("qemu:///system");
>>>
>>> Move this line ^^^ ...
>>>
>>>> if (virEventRegisterDefaultImpl() < 0)
>>>> {
>>>> virErrorPtr err = virGetLastError();
>>>> fprintf(stderr,...
2013 Aug 21
2
Re: virConnectDomainEventRegisterAny problem
...>> static int domain_event_handler(virConnectPtr conn,
> >>> virDomainPtr dom, int event, int detail, void * opaque) {
> >>> switch(event) { } return 0; }
> >>>
> >>> ..... int callback =
> >>> virConnectDomainEventRegisterAny(libvirt_connection, NULL,
> >>> VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> >>> VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL);
> >>> if(callback == -1) { std::cout<<"Error: failed to register
> >>> domain event handle callback\n"; return -1; } ......
2013 Aug 20
2
virConnectDomainEventRegisterAny problem
...to know when domain started, stopped or
crashed, i have write following code
static int domain_event_handler(virConnectPtr conn, virDomainPtr dom,
int event, int detail, void * opaque)
{
switch(event)
{
}
return 0;
}
.....
int callback =
virConnectDomainEventRegisterAny(libvirt_connection, NULL,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL);
if(callback == -1)
{
std::cout<<"Error: failed to register domain event handle
callback\n";
return -1;
}
.....
but "domain_event...
2013 Aug 21
2
Re: virConnectDomainEventRegisterAny problem
...rashed, i have write following code
>>
>> static int domain_event_handler(virConnectPtr conn,
>> virDomainPtr dom, int event, int detail, void * opaque) {
>> switch(event) { } return 0; }
>>
>> ..... int callback =
>> virConnectDomainEventRegisterAny(libvirt_connection, NULL,
>> VIR_DOMAIN_EVENT_ID_LIFECYCLE,
>> VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL);
>> if(callback == -1) { std::cout<<"Error: failed to register domain
>> event handle callback\n"; return -1; } .....
>>
>>
>> but...
2013 Jun 25
0
Re: deadlock on connection loosing
On 24.06.2013 11:36, Александр wrote:
> libvirtd will lock if for example kill programm which established connection,
> only sigkill + restart helps., to reproduce:
>
> virConnectPtr libvirt_connection = virConnectOpen("qemu:///system");
> if(libvirt_connection == NULL)
> {
> std::cout<<"failed to connect to qemu:///system\n";
> exit(-1);
> }
> exit(0);
>
>
Unfortunately, I'm unable to reproduce. Can you 't a a bt' again? Ar...
2013 Oct 14
0
Re: event handler
...Error();
> fprintf(stderr, "Failed to run event loop: %s\n", err &&
> err->message ? err->message : "Unknown error");
> }
> }
> }
>
>
>
> ...
>
> virSetErrorFunc(NULL, libvirt_error_handler);
> libvirt_connection = virConnectOpen("qemu:///system");
Move this line ^^^ ...
> if (virEventRegisterDefaultImpl() < 0)
> {
> virErrorPtr err = virGetLastError();
> fprintf(stderr, "Failed to register event implementation: %s\n",
> err && err->...
2013 Oct 14
0
Re: event handler
..., err &&
>>> err->message ? err->message : "Unknown error");
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>> ...
>>>
>>> virSetErrorFunc(NULL, libvirt_error_handler);
>>> libvirt_connection = virConnectOpen("qemu:///system");
>>
>> Move this line ^^^ ...
>>
>>> if (virEventRegisterDefaultImpl() < 0)
>>> {
>>> virErrorPtr err = virGetLastError();
>>> fprintf(stderr, "Failed to register event...
2013 Oct 14
0
Re: event handler
...error");
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> ...
>>>>>
>>>>> virSetErrorFunc(NULL, libvirt_error_handler);
>>>>> libvirt_connection = virConnectOpen("qemu:///system");
>>>>
>>>> Move this line ^^^ ...
>>>>
>>>>> if (virEventRegisterDefaultImpl() < 0)
>>>>> {
>>>>> virErrorPtr err = virGetLastError();
>>>>>...
2013 Jun 30
2
Re: deadlock on connection loosing
...от Вторник, 25-июн-2013 11:47:10 пользователь Michal Privoznik
написал:
> On 24.06.2013 11:36, Александр wrote:
> > libvirtd will lock if for example kill programm which established
> > connection,>
> > only sigkill + restart helps., to reproduce:
> > virConnectPtr libvirt_connection = virConnectOpen("qemu:///system");
> > if(libvirt_connection == NULL)
> > {
> >
> > std::cout<<"failed to connect to qemu:///system\n";
> > exit(-1);
> >
> > }
> > exit(0);
>
> Unfortunately, I'm unabl...
2013 Jul 08
2
Re: deadlock on connection loosing
On 07.07.2013 01:53, Александр wrote:
> В письме от Воскресенье, 30-июн-2013 03:41:37 пользователь Александр написал:
>> В письме от Вторник, 25-июн-2013 11:47:10 пользователь Michal Privoznik
....
>
> i have found source of problem, my code looks like this:
>
> int count = virConnectListAllDomains(connection, NULL, 0);
> ....
> domain = virDomainDefineXML(connection,
2013 Jul 06
0
Re: deadlock on connection loosing
...hal Privoznik
>
> написал:
> > On 24.06.2013 11:36, Александр wrote:
> > > libvirtd will lock if for example kill programm which established
> > > connection,>
> > >
> > > only sigkill + restart helps., to reproduce:
> > > virConnectPtr libvirt_connection = virConnectOpen("qemu:///system");
> > > if(libvirt_connection == NULL)
> > > {
> > >
> > > std::cout<<"failed to connect to qemu:///system\n";
> > > exit(-1);
> > >
> > > }
> > > exit(0);...
2011 Oct 28
0
libvirt-php - API libvirt_domain_suspend() problem, doesn't work
Hi Guys,
I was trying to suspend a virtual machine but fail not sure why.... However
i was successfully list all the vm on the host, below are my source code,
can any one who have experience in this area give me some advised ?
*My OUTPUT from browser*
Array
(
[libvirt.release] => 3
[libvirt.minor] => 9
[libvirt.major] => 0
[connector.version] => 0.4.3
2013 Jul 08
0
Re: deadlock on connection loosing
...fprintf(stderr, " str2: %s\n", err->str2);
fprintf(stderr, " str3: %s\n", err->str3);
fprintf(stderr, " int1: %d\n", err->int1);
fprintf(stderr, " int2: %d\n", err->int2);
}
int init_libvirt()
{
virSetErrorFunc(NULL, libvirt_error_handler);
libvirt_connection = virConnectOpen("qemu:///system");
.....
i will also check virConnectListAllDomains with correct pointer instead of
null later, now have some other work to do.
2013 Aug 21
0
Re: virConnectDomainEventRegisterAny problem
...ollowing code
>
> static int domain_event_handler(virConnectPtr conn, virDomainPtr dom,
> int event, int detail, void * opaque)
> {
> switch(event)
> {
> }
> return 0;
> }
>
> .....
> int callback =
> virConnectDomainEventRegisterAny(libvirt_connection, NULL,
> VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL);
> if(callback == -1)
> {
> std::cout<<"Error: failed to register domain event handle
> callback\n";
> return -1;
>...
2013 Aug 21
0
Re: virConnectDomainEventRegisterAny problem
...g code
>>>
>>> static int domain_event_handler(virConnectPtr conn,
>>> virDomainPtr dom, int event, int detail, void * opaque) {
>>> switch(event) { } return 0; }
>>>
>>> ..... int callback =
>>> virConnectDomainEventRegisterAny(libvirt_connection, NULL,
>>> VIR_DOMAIN_EVENT_ID_LIFECYCLE,
>>> VIR_DOMAIN_EVENT_CALLBACK(domain_event_handler), NULL, NULL);
>>> if(callback == -1) { std::cout<<"Error: failed to register
>>> domain event handle callback\n"; return -1; } .....
>>>
>...