Re: [libvirt] Using callback under Windows compiling of libvirt library

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

 



I use libportablexdr 4.9.1 from the web site you indicate. I have compile it without any problem using the mingwin fedora environment (I have compile all under this environment), I haven't modified anything in the source, a simple configure like this :

./configure --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/sys-root/mingw/

then, make and make install, nothing else.

Can explain me or point me on an explaination for registering event-handling please ?

--------------------------------------------------
From: "Matthias Bolte" <matthias.bolte@xxxxxxxxxxxxxx>
Sent: Thursday, March 18, 2010 11:39 AM
To: "Dev.Atom" <arnaud.champion@xxxxxxxxxx>
Cc: <libvir-list@xxxxxxxxxx>
Subject: Re: [libvirt] Using callback under Windows compiling of libvirt library

2010/3/18 Dev.Atom <arnaud.champion@xxxxxxxxxx>:
Hi,

I have compiled LibVirt 0.7.4 under mingw, and I want to use it with domain callback. Here is a a code sample of my situation (I'm using visual studio)

Did you compile it on Windows, or cross-compile it from Linux?


static

int domain_event(virConnectPtr conn,

virDomainPtr dom,

int evt,

int detail,

void *opaque)

{

bool test = true;

return 0;

}

int

_tmain(int argc, _TCHAR* argv[])

{

virConnectPtr conn = virConnectOpen(

"qemu+tcp://192.168.220.198/session");

// Set Callback

int cbresult = virConnectDomainEventRegister(conn, domain_event, NULL,
NULL);

// Lookup Domain

virDomainPtr dom = virDomainLookupByName(conn,

"Test1");

if (virDomainIsActive(dom) == 1)

{

// Start Domain

int startDom = virDomainCreate(dom);

if (startDom != 0)

{

virErrorPtr e = virGetLastError();

bool test = true;

}

}

else

{

// Stop Domain

int StopDom = virDomainDestroy(dom);

if (StopDom != 0)

{

virErrorPtr e = virGetLastError();

bool test = true;

}

}

return 0;

}

This code is incomplete, you're missing the event-handling, see the
virEventRegisterImpl function.

Have you tried the domain-event example yet? See
examples/domain-events/events-c/event-test.c in the libvirt codebase.


This code works well when I did'nt use callbacks, but when I use it, it
throw an error at the virDomainCreate or virDomainDestroy call. In the
application windows (console) I have an "unmarshaling msg", I have study the
case it comme from the call of "xdr_string" method in the
"xdr_remote_nonull_string" method (remote_protocol.c).

I think, the xdr_string method is unable to marshall strings from the XDR*
object to a char**.


Where did you get your XDR lib from? I'm using libportablexdr [1]
version 4.9.1 on Windows, but had to patch it to get it compile
correctly with MinGW.

This may be a bug in your XDR lib, or may be a problem in the way
libvirt uses XDR, or it's just a symptom of that fact that you try to
use domain events without registering event-handling first.

[1] http://people.redhat.com/~rjones/portablexdr/

Matthias


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]