[libvirt-users] C API example

Trying to build the hellolibvirt example. I get the project to compile okay but when I try to run it I get: Unable to connect to '/usr/local/var/run/libvirt/libivrt-sock Given libvirt --status says it's in /var/run/libvirt/libvirt-sock that makes sense. How do I make the git version run with my local copy? Or even better does anyone have any example projects that have the proper includes documented, seperate from the build tree? I'd like to just use the API not compile and deal with all of libvirt at the moment. Thanks a ton!

On 07/01/2010 11:12 AM, steven765@yahoo.com wrote:
Trying to build the hellolibvirt example. I get the project to compile okay but when I try to run it I get:
Unable to connect to '/usr/local/var/run/libvirt/libivrt-sock
Given libvirt --status says it's in /var/run/libvirt/libvirt-sock that makes sense. How do I make the git version run with my local copy?
At the moment (still learning things), this works for me: $ ./configure --prefix=/ $ make I don't (!) do "make install" afterwards though, as that would likely install over the top of system provided things. It does let me connect to the libvirtd daemon using the newly compiled virsh (shell utility) though: $ sudo tools/virsh Hope that helps. :) Regards and best wishes, Justin Clift -- Salasaga - Open Source eLearning IDE http://www.salasaga.org

On Thu, Jul 01, 2010 at 11:34:12AM +1000, Justin Clift wrote:
On 07/01/2010 11:12 AM, steven765@yahoo.com wrote:
Trying to build the hellolibvirt example. I get the project to compile okay but when I try to run it I get:
Unable to connect to '/usr/local/var/run/libvirt/libivrt-sock
Given libvirt --status says it's in /var/run/libvirt/libvirt-sock that makes sense. How do I make the git version run with my local copy?
./hellolibvirt \ qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock will let you connect to the packaged daemon.
At the moment (still learning things), this works for me:
$ ./configure --prefix=/ $ make
I don't (!) do "make install" afterwards though, as that would likely install over the top of system provided things.
Indeed it will overwrite things. If I'm building from source on a machine that has packaged libvirt installed, I just use a prefix like --prefix=/root/gitlibvirt/install Then you can run a second copy of libvirtd if you decide you want to. Dave

On 07/01/2010 11:54 AM, Dave Allan wrote: <snip>
./hellolibvirt \ qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock
Thanks Dave. The +unix:// and ?socket=xxx bits are what I'd not been picking up on. Should be good now. Steven, is it working for you? Regards and best wishes, Justin Clift -- Salasaga - Open Source eLearning IDE http://www.salasaga.org

I think so, but I'm locked out at home. I'll have to try at school tomorrow. It gave me a remote error, but with the correct directory so fingers crossed thanks! btw might you or anyone know what I have to include to start a clean project of my own? So if I want to just build an application that uses the API with nothing else but what's necessary? Thanks, Steve --- On Wed, 6/30/10, Justin Clift <justin@salasaga.org> wrote:
From: Justin Clift <justin@salasaga.org> Subject: Re: [libvirt-users] C API example To: "Dave Allan" <dallan@redhat.com> Cc: steven765@yahoo.com, libvirt-users@redhat.com Date: Wednesday, June 30, 2010, 10:09 PM On 07/01/2010 11:54 AM, Dave Allan wrote: <snip>
./hellolibvirt \
qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock
Thanks Dave. The +unix:// and ?socket=xxx bits are what I'd not been picking up on. Should be good now.
Steven, is it working for you?
Regards and best wishes,
Justin Clift
-- Salasaga - Open Source eLearning IDE http://www.salasaga.org

On Wed, Jun 30, 2010 at 07:37:27PM -0700, steven765@yahoo.com wrote:
I think so, but I'm locked out at home. I'll have to try at school tomorrow. It gave me a remote error, but with the correct directory so fingers crossed thanks!
btw might you or anyone know what I have to include to start a clean project of my own? So if I want to just build an application that uses the API with nothing else but what's necessary?
If you're talking about a C application, you're pretty much describing hellolibvirt. I tried to put enough in there to demonstrate a couple of different calls, but hopefully not so much that it's overwhelming. If it seems like there's a lot there, cut some of it out. You don't need the showDomains function, for example. Remove it, compile and see what happens. Dave
Thanks, Steve
--- On Wed, 6/30/10, Justin Clift <justin@salasaga.org> wrote:
From: Justin Clift <justin@salasaga.org> Subject: Re: [libvirt-users] C API example To: "Dave Allan" <dallan@redhat.com> Cc: steven765@yahoo.com, libvirt-users@redhat.com Date: Wednesday, June 30, 2010, 10:09 PM On 07/01/2010 11:54 AM, Dave Allan wrote: <snip>
./hellolibvirt \
qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock
Thanks Dave. The +unix:// and ?socket=xxx bits are what I'd not been picking up on. Should be good now.
Steven, is it working for you?
Regards and best wishes,
Justin Clift
-- Salasaga - Open Source eLearning IDE http://www.salasaga.org
participants (3)
-
Dave Allan
-
Justin Clift
-
steven765@yahoo.com