Re: [libvirt] Libvirt Xen daemon interaction in Red Hat Enterprise with virtualization

2008-08-20 Thread Daniel Veillard
On Wed, Aug 20, 2008 at 03:34:38PM -0700, vaibhav chugh wrote:
> What I am looking for is the exact function call that is made by libvirt to
> connect to xen daemon. i.e. the function that makes libvirt send out xml RPC
> message for xend to read.

  see src/xend_internal.[ch] code in the source of libvirt.

> session.login_with_password() is not supported by xenAPI version being used
> in Red Hat. Please help me with the substitute of this method in Red Hat.

  Very simple, you have the source, take a debugger and see how libvirt
connects. If you don't want to spend the effort, use libvirt directly,
it was designed explicitely for people like you to not have to mess with
the internals of Xen, it's complex, it's hard, sometimes inefficient,
and tend to changes between release. The code available from libvirt is
the best we have to offer, read it, learn it, and use it !

  And please don't post the same request many time, you will get less
help if you try to proceed that way.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] PATCH: Ensure errors are guarenteed reported in virConnectOpen

2008-08-20 Thread Daniel Veillard
On Wed, Aug 20, 2008 at 07:24:59PM +0100, Daniel P. Berrange wrote:
> On Wed, Aug 20, 2008 at 02:22:58PM +0100, Richard W.M. Jones wrote:
> > On Tue, Aug 19, 2008 at 11:35:18AM +0100, Daniel P. Berrange wrote:
> > > The guarenteed correct solution is actually rather simple
> > > 
> > >  - Always report errors against the virConnect object, even in the driver
> > >open method
> > > 
> > >  - In the cleanup patch of do_open() in libvirt.c, if no global error is
> > >set, copy the error from the virConnect object's virError, into the 
> > >global virError.
> > 
> > +1 , although unfortunately this isn't thread-safe.  Nothing can be
> > thread-safe unless we change the API.
> 
> Well we're not making it any less thread-safe. You alrady have to use the
> virGetLastError() global func - we're simply making sure it actually
> records all errors. 
> 
> To make it thread-safe we'll need to add a real virGetThreadLastError()
> API, which is something on my todo list - with that new apps can just
> call thevirGetThreadLastError() exclusively and never need to know the
> distinction between  global/connection errors which causes so much
> trouble. I'm fairly sure I can preseve existing semantics at same 
> time with some suitable internal cleverness.

  I really wished we could avoid thread local storage mess, and in
general anything having to do with API exported global variables. In
general (I mean for the vast majority of the userland code dealing with
libvirt) there is always a domain or connection object where we can plug
the error, and provide it in-context. The only exception is the
connection creation, maybe this means we need to provide a better entry
point for this, but I would really prefer to not expose the notion of
thread at the API level.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


[libvirt] pthread_sigmask undefined reference error

2008-08-20 Thread Jun Koi
Hi,

The latest cvs version has an error when compiling:

make[3]: Entering directory `/home/jun/projects/libvirt-0821/src'
/bin/bash ../libtool --tag=CC   --mode=link gcc   -g -O2 -Wall
-Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings
-Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls
-Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fasynchronous-unwind-tables-o virsh virsh-console.o
virsh-util-lib.o virsh-virsh.o -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables  libvirt.la
../gnulib/lib/libgnu.la
gcc -g -O2 -Wall -Wformat -Wformat-security -Wmissing-prototypes
-Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align
-Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline
-Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fasynchronous-unwind-tables -o .libs/virsh
virsh-console.o virsh-util-lib.o virsh-virsh.o -Wall -Wformat
-Wformat-security -Wmissing-prototypes -Wnested-externs
-Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings
-Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls
-Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fasynchronous-unwind-tables  ./.libs/libvirt.so
../gnulib/lib/.libs/libgnu.a
./.libs/libvirt.so: undefined reference to `pthread_sigmask'
collect2: ld returned 1 exit status
make[3]: *** [virsh] Error 1
make[3]: Leaving directory `/home/jun/projects/libvirt-0821/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/jun/projects/libvirt-0821/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jun/projects/libvirt-0821'
make: *** [all] Error 2


It seems I lack a particular library??


Thanks,
Jun

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


Re: [libvirt] Re: qemud/.libs/libvirtd?

2008-08-20 Thread Jun Koi
On Wed, Aug 20, 2008 at 10:39 PM, Richard W.M. Jones <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 20, 2008 at 08:22:00PM +0900, Jun Koi wrote:
>> Ah, that is so confused, the way to name files here.
>>
>> So if qemu/.libs/libvirtd is installed into /usr/sbin/libvirtd, where
>> qemud/libvirtd is installed???
>
> It isn't installed anywhere.
>
>> (It seems only qemud/libvirtd works for me)
>
> This is a libtool thing.  Admittedly quite horrible and counter-
> intuitive, but using libtool arguably beats trying to work out how
> shared libraries are created on Windows / HP-UX / AIX / CP/M / etc.
> which is what libtool gives us.
>
> You can find out plenty more in the libtool manual:
>
>  
> http://www.gnu.org/software/libtool/manual/libtool.html#index-g_t_0040file_007b_0040value_007bobjdir_007d_007d-subdirectory-26
>

OK, but now running /usr/sbin/libvirtd fails (" ... failed to connect
to the hypervisor"), meanwhile qemud/libvirtd works for me. What
should I do now to run libvirtd???

Thanks,
Jun

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


Re: [libvirt] Re: virsh/virt-install for dummies

2008-08-20 Thread Jun Koi
On Thu, Aug 21, 2008 at 1:57 AM, Cole Robinson <[EMAIL PROTECTED]> wrote:
> Jun Koi wrote:
>> On Wed, Aug 20, 2008 at 1:23 AM, Cole Robinson <[EMAIL PROTECTED]> wrote:
>>> Jun Koi wrote:
>>> Hmm, yeah we should check that and throw a more clear error message.
>>>
>>> However, the root cause is that your capabilities xml is screwy
>>> (posted a few messages back.) There is only a  element
>>> for x86_64 qemu but you're host arch is reported as i686.
>>>
>>> What libvirt version are you using?
>>> What virt-install/python-virtinst version are you using?
>>
>> I use libvirt-0.4.4-cvs, and virt-install-0.300.3.
>>
>>> Is kvm installed?
>
>> Yes, but does that really matter? I guess qemu is not even started at this 
>> step.
>>
>
> Yes it does matter because I am trying to figure out why your
> capabilities xml is messed up.
>
> Here is a piece of the capabilities xml you posted:
>
>  
>hvm
>
>  32
>  /usr/bin/qemu
>  pc
>  isapc
>
>
>...
>
>  
>
> This piece here should have a  element, but since
> it doesn't that means libvirt didn't have executable access
> to /usr/bin/qemu. Is this named differently on Ubuntu?

Though I use Ubuntu, I installed KVM from source code. And the vanilla
QEMU is not installed. And I use the KVM binary for QEMU (so no
accelerator is active in that case)

And there is no /usr/bin/qemu, but only /usr/bin/qemu-system-x86_64 in
KVM installation.


>  
>hvm
>
>  64
>  /usr/bin/qemu-system-x86_64
>  pc
>  isapc
>  
>  
>
>
>...
>
>  
>
> If kvm is installed, then this should have a kvm 
> entry. Is /dev/kvm present/kvm module loaded? Is
> /usr/bin/qemu-kvm present?

There is nothing like qemu-kvm anywhere in my box. I guess that is
from Fedora package only? (I compiled and installed KVM from source
code)

Thanks,
J

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


Re: [libvirt] Libvirt Xen daemon interaction in Red Hat Enterprise with virtualization

2008-08-20 Thread vaibhav chugh
Thanks a lot for the reply. I checked the setting in my config file and they
look correct as specified by the webpage. I am able to connect to the unix
socket but my login to xend is failing.

What I am looking for is the exact function call that is made by libvirt to
connect to xen daemon. i.e. the function that makes libvirt send out xml RPC
message for xend to read.

session.login_with_password() is not supported by xenAPI version being used
in Red Hat. Please help me with the substitute of this method in Red Hat.

Thanks
Vaibhav



>
>
>
> On Wed, Aug 20, 2008 at 10:18 AM, Daniel P. Berrange <[EMAIL PROTECTED]>wrote:
>
>> On Wed, Aug 20, 2008 at 10:15:49AM -0700, vaibhav chugh wrote:
>> > Hi,
>> >
>> > I am new to libvirt and I am trying to figure out that how libvert
>> connects
>> > to Xend in Red Hat Enterprise with virtualization. I read a few posts
>> but
>> > was not able to find this out.
>> >
>> > The eariler versions of Xen were using xen_session_login_with_password()
>> > function call to connect to Xen daemon but I am not able to find
>> anything
>> > similar to this in libvirt.
>>
>> Libvirt talks to XenD using its UNIX socket, and SEXPR interface. This
>> page gives a quick list of config settings you need in XenD to make it
>> work with libvirt:
>>
>>  http://libvirt.org/drvxen.html
>>
>> Daniel
>> --
>> |: Red Hat, Engineering, London   -o-
>> http://people.redhat.com/berrange/ :|
>> |: http://libvirt.org  -o-  http://virt-manager.org  -o-
>> http://ovirt.org :|
>> |: http://autobuild.org   -o-
>> http://search.cpan.org/~danberr/  :|
>> |: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505
>> :|
>>
>
>
>
> --
> Vaibhav Chugh
>
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] On shutdown Destroy/Delete

2008-08-20 Thread Stefan de Konink

Daniel P. Berrange schreef:

On Wed, Aug 20, 2008 at 02:34:22PM +0100, Richard W.M. Jones wrote:

On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:

On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
I would really like to know how I can make a defined domain *gone* after  
shutdown :) (instead of it still be defined, after shutdown)

[...]

Oh right, so am I correct in thinking you want the domain to be
undefined after it has shutdown itself?  That's not possible
currently.  AIUI undefining a running domain is either an illegal
operation or shuts it down abruptly -- you'll need to look in the
source to see which.  So you'd need some sort of 'reaper' cronjob to
regularly undefine domains after they have gone into the shutdown
state.


The easy answer is to simply *not* define it in the first place. If
you use  virDomainCreateLinux() instead of virDomainDefine+virDomainCreate
then you'll get a running VM without any persistent config file behind
it. Then all trace will disappear when it shuts down.


That would be too easy ;) I define the domain because my API interacts 
and ads resources before it is started. What I could do is before the 
actualy 'start' command to undefine it, and start it with a 
virDomainCreateLinux. That would be an interesting thought and now I 
think of it, probably a clean way :)


My domains are automatically migrated across my cluster, so I am not 
able to undefine it after shutdown, because technically I cannot know 
that a domain is defined at that place. Alternatively I really hope that 
the the ListDomains command shows the defined domains too :)



Stefan

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


Re: [libvirt] PATCH: Ensure errors are guarenteed reported in virConnectOpen

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 02:22:58PM +0100, Richard W.M. Jones wrote:
> On Tue, Aug 19, 2008 at 11:35:18AM +0100, Daniel P. Berrange wrote:
> > The guarenteed correct solution is actually rather simple
> > 
> >  - Always report errors against the virConnect object, even in the driver
> >open method
> > 
> >  - In the cleanup patch of do_open() in libvirt.c, if no global error is
> >set, copy the error from the virConnect object's virError, into the 
> >global virError.
> 
> +1 , although unfortunately this isn't thread-safe.  Nothing can be
> thread-safe unless we change the API.

Well we're not making it any less thread-safe. You alrady have to use the
virGetLastError() global func - we're simply making sure it actually
records all errors. 

To make it thread-safe we'll need to add a real virGetThreadLastError()
API, which is something on my todo list - with that new apps can just
call thevirGetThreadLastError() exclusively and never need to know the
distinction between  global/connection errors which causes so much
trouble. I'm fairly sure I can preseve existing semantics at same 
time with some suitable internal cleverness.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] [PATCH] Implement vol delete for disk pools

2008-08-20 Thread Daniel P. Berrange
On Tue, Aug 12, 2008 at 11:58:07PM -0400, Cole Robinson wrote:
> Daniel P. Berrange wrote:
> >
> > This isn't correct because the target path is not guarenteed to point to
> > the master device name /dev/sda1.  The user could have configured it to
> > use a stable path such as 
> > /dev/disk/by-uuid/4cb23887-0d02-4e4c-bc95-7599c85afc1a
> >
> >   
> 
> Hmm, I couldn't actually get /dev/disk/by-uuid to work. Seems like the
> vol populating code for disks doesn't take into account the the pools
> target path, and just uses the real partition path.

Yes it does - this is what the virStorageBackendStablePath() method call
does.  What I expect is going on is that you merely created a bunch of
partitions, but don't have any filesystems formatted in them. The UUID
stuff is actually the UUID of the filesystem. If you try with a target
path of /dev/disk/by-path  you'll probably have more luck. If it can't
find a stable path under the target you give, it automatically falls
back to the generic /dev/sdXX path.

The following config should show it in action


  mydisk
  


  
  
/dev/disk/by-path
  


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] Libvirt Xen daemon interaction in Red Hat Enterprise with virtualization

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 10:15:49AM -0700, vaibhav chugh wrote:
> Hi,
> 
> I am new to libvirt and I am trying to figure out that how libvert connects
> to Xend in Red Hat Enterprise with virtualization. I read a few posts but
> was not able to find this out.
> 
> The eariler versions of Xen were using xen_session_login_with_password()
> function call to connect to Xen daemon but I am not able to find anything
> similar to this in libvirt.

Libvirt talks to XenD using its UNIX socket, and SEXPR interface. This
page gives a quick list of config settings you need in XenD to make it
work with libvirt:

  http://libvirt.org/drvxen.html

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


[libvirt] Libvirt Xen daemon interaction in Red Hat Enterprise with virtualization

2008-08-20 Thread vaibhav chugh
Hi,

I am new to libvirt and I am trying to figure out that how libvert connects
to Xend in Red Hat Enterprise with virtualization. I read a few posts but
was not able to find this out.

The eariler versions of Xen were using xen_session_login_with_password()
function call to connect to Xen daemon but I am not able to find anything
similar to this in libvirt.

Please help me with the functions or the area of source code which are being
used by libvirt to make the connections.

Thanks
Vaibhav
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Don't list capabilities entries if emulators can't be accessed

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 12:51:05PM -0400, Cole Robinson wrote:
> The patch below fixes capabilities xml generation for
> the qemu driver if the emulators aren't found in the
> hardcoded paths. Current behavior will add a 
> entry for the emulator even if it does not exist, patch
> fixes this to check that we actually have access.
> 
> This brings up another issue, that hardcoded paths
> aren't exactly distro friendly. I'm not really familiar
> with what options we have to allow specifying these
> at build time (or something else). Anyone have an
> idea?

Ideally we'd just list the binary names, and search in $PATH for them.
Patches for this welcome...

> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
> index dc9e42a..0328cc1 100644
> --- a/src/qemu_conf.c
> +++ b/src/qemu_conf.c
> @@ -230,6 +230,10 @@ qemudCapsInitGuest(virCapsPtr caps,
>  virCapsGuestPtr guest;
>  int i;
>  
> +/* Check for existance of base emulator */
> +if (access(info->binary, X_OK) == -1)
> +return 0;
> +

This isn't right - this means that if KVM is installed, but QEMU is
not installed you won't get any capabilities.

Basically we need todo all the access() checks for QEMU, KVM, /dev/kvm
up-front. And then generated the capabilites if either QEMU or KVM is
available.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] Using Xen config files

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 04:44:04PM +0100, Richard W.M. Jones wrote:
> On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> 
> It certainly looks OK, and it seems like the domain should run after
> virDomainCreate.  Have you tried adding a delay of 30 seconds just to
> check if the domain is starting up slowly?

Yep, that debug suggests the libvirt part of creation has completed OK.
I think if anything is going wrong, its going to be in XenD's arena. I'd
recommend looking in /var/log/xen for any further hints of trouble

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] Re: virsh/virt-install for dummies

2008-08-20 Thread Cole Robinson
Jun Koi wrote:
> On Wed, Aug 20, 2008 at 1:23 AM, Cole Robinson <[EMAIL PROTECTED]> wrote:
>> Jun Koi wrote:
>> Hmm, yeah we should check that and throw a more clear error message.
>>
>> However, the root cause is that your capabilities xml is screwy
>> (posted a few messages back.) There is only a  element
>> for x86_64 qemu but you're host arch is reported as i686.
>>
>> What libvirt version are you using?
>> What virt-install/python-virtinst version are you using?
> 
> I use libvirt-0.4.4-cvs, and virt-install-0.300.3.
>
>> Is kvm installed?

> Yes, but does that really matter? I guess qemu is not even started at this 
> step.
>

Yes it does matter because I am trying to figure out why your
capabilities xml is messed up.
 
Here is a piece of the capabilities xml you posted:

  
hvm

  32
  /usr/bin/qemu
  pc
  isapc


...

  

This piece here should have a  element, but since
it doesn't that means libvirt didn't have executable access
to /usr/bin/qemu. Is this named differently on Ubuntu? How
about all the other binaries (qemu-system-mips, ...)?

  
hvm

  64
  /usr/bin/qemu-system-x86_64
  pc
  isapc
  
  


...

  

If kvm is installed, then this should have a kvm 
entry. Is /dev/kvm present/kvm module loaded? Is
/usr/bin/qemu-kvm present?

Thanks,
Cole

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


[libvirt] [PATCH] Don't list capabilities entries if emulators can't be accessed

2008-08-20 Thread Cole Robinson
The patch below fixes capabilities xml generation for
the qemu driver if the emulators aren't found in the
hardcoded paths. Current behavior will add a 
entry for the emulator even if it does not exist, patch
fixes this to check that we actually have access.

This brings up another issue, that hardcoded paths
aren't exactly distro friendly. I'm not really familiar
with what options we have to allow specifying these
at build time (or something else). Anyone have an
idea?

Thanks,
Cole
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index dc9e42a..0328cc1 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -230,6 +230,10 @@ qemudCapsInitGuest(virCapsPtr caps,
 virCapsGuestPtr guest;
 int i;
 
+/* Check for existance of base emulator */
+if (access(info->binary, X_OK) == -1)
+return 0;
+
 if ((guest = virCapabilitiesAddGuest(caps,
  hvm ? "hvm" : "xen",
  info->arch,
@@ -241,9 +245,7 @@ qemudCapsInitGuest(virCapsPtr caps,
 return -1;
 
 if (hvm) {
-/* Check for existance of base emulator */
-if (access(info->binary, X_OK) == 0 &&
-virCapabilitiesAddGuestDomain(guest,
+if (virCapabilitiesAddGuestDomain(guest,
   "qemu",
   NULL,
   NULL,
@@ -263,6 +265,7 @@ qemudCapsInitGuest(virCapsPtr caps,
 return -1;
 
 if (access("/dev/kvm", F_OK) == 0 &&
+access("/usr/bin/qemu-kvm", X_OK) == 0 &&
 virCapabilitiesAddGuestDomain(guest,
   "kvm",
   "/usr/bin/qemu-kvm",
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] PATCH: 5/5: Make all code use virExec

2008-08-20 Thread Jim Meyering
"Daniel P. Berrange" <[EMAIL PROTECTED]> wrote:
> This final patch switches over all places which do fork()/exec() to use the
> new enhanced virExec() code. A fair amount of code is deleted, but that's
> not the whole story - the new impl is more robust that most of the existing
> code we're deleting here.

Nice clean-up!

> diff -r 2591ebc40bd7 src/bridge.c
...
> @@ -680,7 +645,10 @@
>
>  argv[n++] = NULL;
>
> -retval = brctlSpawn(argv);
> +if (virRun(NULL, argv, NULL) < 0)
> +retval = errno;

Using errno here isn't always kosher, since _virExec doesn't always
preserve it when things go wrong (the ReportError call and close
calls after "cleanup:" can clobber errno).
But one can argue that it doesn't matter too much, since virExec
does diagnose each failure.  However, that would suggest not
using errno upon virRun failure.

...
> -retval = brctlSpawn(argv);
> +if (virRun(NULL, argv, NULL) < 0)
> +retval = errno;

Likewise.

...
> diff -r 2591ebc40bd7 src/qemu_conf.c
> --- a/src/qemu_conf.c Tue Aug 12 15:29:29 2008 +0100
> +++ b/src/qemu_conf.c Tue Aug 12 15:33:42 2008 +0100
> @@ -397,116 +397,88 @@
>
>
>  int qemudExtractVersionInfo(const char *qemu, int *version, int *flags) {
> +const char *const qemuarg[] = { qemu, "-help", NULL };
> +const char *const qemuenv[] = { "LANG=C", NULL };

If you have to use just one environment variable, use LC_ALL=C.
It trumps all others, when it comes to locale-related things.

>  pid_t child;
> -int newstdout[2];
> +int newstdout = -1;
> +char help[8192]; /* Ought to be enough to hold QEMU help screen */
> +int got = 0, ret = -1, status;
> +int major, minor, micro;
> +int ver;

If you make the above 4 variables unsigned
and adjust the %d formats accordingly, the version
parsing will be a little tighter.

>  if (flags)
>  *flags = 0;
>  if (version)
>  *version = 0;
>
> -if (pipe(newstdout) < 0) {
> +if (virExec(NULL, qemuarg, qemuenv, &child,
> +-1, &newstdout, NULL, VIR_EXEC_NONE) < 0)
>  return -1;
> +
> +
> +while (got < (sizeof(help)-1)) {
> +int len;
> +if ((len = read(newstdout, help+got, sizeof(help)-got-1)) <= 0) {
> +if (!len)
> +break;
> +if (errno == EINTR)
> +continue;
> +goto cleanup2;
> +}
> +got += len;
> +}

Any reason not to use saferead in place of this while-loop?

> +help[got] = '\0';
> +
> +if (sscanf(help, "QEMU PC emulator version %d.%d.%d", &major,&minor, 
> ยต) != 3) {
> +goto cleanup2;
>  }
>
> -if ((child = fork()) < 0) {
> -close(newstdout[0]);
> -close(newstdout[1]);
> -return -1;
> +ver = (major * 1000 * 1000) + (minor * 1000) + micro;
> +if (version)
> +*version = ver;
> +if (flags) {
> +if (strstr(help, "-no-kqemu"))
> +*flags |= QEMUD_CMD_FLAG_KQEMU;
> +if (strstr(help, "-no-reboot"))
> +*flags |= QEMUD_CMD_FLAG_NO_REBOOT;
> +if (strstr(help, "-name"))
> +*flags |= QEMUD_CMD_FLAG_NAME;
> +if (strstr(help, "-drive"))
> +*flags |= QEMUD_CMD_FLAG_DRIVE;
> +if (strstr(help, "boot=on"))
> +*flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
> +if (ver >= 9000)
> +*flags |= QEMUD_CMD_FLAG_VNC_COLON;
> +}
> +ret = 0;
> +
> +qemudDebug("Version %d %d %d  Cooked version: %d, with flags ? %d",

If version can really be NULL, as the above "if (version)" tests
suggest, then you'll want to change "*version" here, to e.g.,
version ? *version : "NA"

Same for *flags.

> +   major, minor, micro, *version, *flags);
> +
> +cleanup2:
> +if (close(newstdout) < 0)
> +ret = -1;
> +
> +rewait:
> +if (waitpid(child, &status, 0) != child) {
> +if (errno == EINTR)
> +goto rewait;
> +
> +qemudLog(QEMUD_ERR,
> + _("Unexpected exit status from qemu %d pid %lu"),
> + status, (unsigned long)child);

You've probably already fixed this, but "status" here is a
combination of exit status and signal number.

> +ret = -1;
> +}
> +/* Check & log unexpected exit status, but don't fail,
> + * as there's really no need to throw an error if we did
> + * actually read a valid version number above */
> +if (WEXITSTATUS(status) != 0) {
> +qemudLog(QEMUD_WARN,
> + _("Unexpected exit status '%d', qemu probably failed"),
> + status);
>  }
...
>  int qemudExtractVersion(virConnectPtr conn,
> diff -r 2591ebc40bd7 src/remote_internal.c
> --- a/src/remote_internal.c   Tue Aug 12 15:29:29 2008 +0100
> +++ b/src/remote_internal.c   Tue Aug 12 15:33:42 2008 +0100
> @@ -72,6 +72,7 @@
>  #include "remote_internal.h"
>  #include "remote_protocol.h"
>  #include "memory.h"
> +#include "util.h"
>
>  #define DEBUG(fmt,...) VIR_DEB

Re: AW: [libvirt] libvirt-java: change org.libvirt.Error implementingSerializable

2008-08-20 Thread Daniel Veillard
On Wed, Aug 20, 2008 at 04:22:49PM +0200, Daniel Schwager wrote:
> Here we are:

  Okay, that didn't applied correctly due to mail reformating of
the patch but i applied those manually and commited,

  thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


RE: [libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
Found it!  I added serial and console devices to the XML and it appears to
be running.  It's not working completely as expcted but it's doing more than
it was.

Thanks for your help.
-matthew

> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 20, 2008 11:44 AM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> > Thanks for the quick reply!
> > 
> > I set the LIBVIRT_DEBUG flag to 1 and ran it again.  (The 
> output is below.)
> [...]
> > [EMAIL PROTECTED] ~]$ gcc -g virt_test.c -lvirt && ./a.out
> > DEBUG: libvirt.c: virInitialize (register drivers)
> > DEBUG: xen_internal.c: xenHypervisorInit (Using new 
> hypervisor call: 30001
> > )
> > DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor 
> call v2, sys ver3
> > dom ver5
> > )
> > DEBUG: libvirt.c: virConnectOpen (name=xen:///)
> > DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
> >   scheme xen
> >   opaque (null)
> >   authority (null)
> >   server (null)
> >   user (null)
> >   port 0
> >   path /
> > )
> > DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
> > DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
> > DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
> > DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor 
> sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
> > DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
> > DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
> > DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
> > DEBUG: remote_internal.c: doRemoteOpen (proceeding with 
> name = xen:///)
> > DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 1 storage 
> returned DECLINED)
> > DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
> > DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml= > 
> type='xen'>fc8.confhvm/u
> sr/lib/xen/boo
> > t/hvmloader > 
> dev='hd'/>10241 >destroy > 
> oweroff>restartrestart ash>
> >  > 
> sync="localtime"/>/usr/lib/xen/bin/qemu-dm<
> /emulator> > erface type='bridge'>

Re: [libvirt] Using Xen config files

2008-08-20 Thread Richard W.M. Jones
On Wed, Aug 20, 2008 at 11:35:17AM -0400, Matthew Donovan wrote:
> Thanks for the quick reply!
> 
> I set the LIBVIRT_DEBUG flag to 1 and ran it again.  (The output is below.)
[...]
> [EMAIL PROTECTED] ~]$ gcc -g virt_test.c -lvirt && ./a.out
> DEBUG: libvirt.c: virInitialize (register drivers)
> DEBUG: xen_internal.c: xenHypervisorInit (Using new hypervisor call: 30001
> )
> DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor call v2, sys ver3
> dom ver5
> )
> DEBUG: libvirt.c: virConnectOpen (name=xen:///)
> DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
>   scheme xen
>   opaque (null)
>   authority (null)
>   server (null)
>   user (null)
>   port 0
>   path /
> )
> DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
> DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
> DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
> DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
> DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
> DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
> DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor sub-driver)
> DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
> DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
> DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
> DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
> DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
> DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
> DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
> DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = xen:///)
> DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
> DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
> DEBUG: libvirt.c: do_open (storage driver 1 storage returned DECLINED)
> DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
> DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml= type='xen'>fc8.confhvm/usr/lib/xen/boo
> t/hvmloader dev='hd'/>10241destroy oweroff>restartrestart
>  sync="localtime"/>/usr/lib/xen/bin/qemu-dm erface type='bridge'>

Re: [libvirt] networking

2008-08-20 Thread Cole Robinson
James Bardin wrote:
> 
> Cole Robinson wrote:
>> Make sure hald (or some equivalently named service) is
>> running. Bar that, you'll probably have to ask the
>> ubuntu folks.
>>
> 
> It's running. I'll see if I can figure out where this went wrong.
> 
> Does this apply to virsh as well?
> 
> Thanks
> -jim

No virsh/libvirt doesn't use hal.

If you want to try manually adding the bridge device to
the domain, try the following.

'virsh dumpxml vmname > tmpxml'

edit 'tmpxml', add to the  section:


  


'virsh define tmpxml'

Hope that helps,
Cole

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


Re: [libvirt] networking

2008-08-20 Thread James Bardin


Cole Robinson wrote:
> Make sure hald (or some equivalently named service) is
> running. Bar that, you'll probably have to ask the
> ubuntu folks.
> 

It's running. I'll see if I can figure out where this went wrong.

Does this apply to virsh as well?

Thanks
-jim

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


RE: [libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
Thanks for the quick reply!

I set the LIBVIRT_DEBUG flag to 1 and ran it again.  (The output is below.)


One other thing I can think to mention is that I'm using version 0.4.4-2,
installed with yum.  Maybe I should try compiling and installing from
source?

Thanks again!
-matthew

[EMAIL PROTECTED] ~]$ gcc -g virt_test.c -lvirt && ./a.out
DEBUG: libvirt.c: virInitialize (register drivers)
DEBUG: xen_internal.c: xenHypervisorInit (Using new hypervisor call: 30001
)
DEBUG: xen_internal.c: xenHypervisorInit (Using hypervisor call v2, sys ver3
dom ver5
)
DEBUG: libvirt.c: virConnectOpen (name=xen:///)
DEBUG: libvirt.c: do_open (name "xen:///" to URI components:
  scheme xen
  opaque (null)
  authority (null)
  server (null)
  user (null)
  port 0
  path /
)
DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated hypervisor sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XenD sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Trying XS sub-driver)
DEBUG: xen_unified.c: xenUnifiedOpen (Activated XS sub-driver)
DEBUG: libvirt.c: do_open (driver 2 Xen returned SUCCESS)
DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = xen:///)
DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 1 storage returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: virDomainDefineXML (conn=0x96fe478, xml=fc8.confhvm/usr/lib/xen/boo
t/hvmloader10241destroyrestartrestart
/usr/lib/xen/bin/qemu-dm)
DEBUG: libvirt.c: virDomainLookupByName (conn=0x96fe478, name=fc8.conf)
DEBUG: hash.c: __virGetDomain (New hash entry 0x9702a18)
DEBUG: libvirt.c: virDomainCreate (domain=0x9702a18)
DEBUG: libvirt.c: virDomainGetInfo (domain=0x9702a18, info=0xbfa2b658)
state = 0
DEBUG: libvirt.c: virConnectClose (conn=0x96fe478)
DEBUG: hash.c: virUnrefConnect (unref connection 0x96fe478 xen:/// 2)


> -Original Message-
> From: Richard W.M. Jones [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 20, 2008 9:49 AM
> To: Matthew Donovan
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] Using Xen config files
> 
> On Wed, Aug 20, 2008 at 08:35:46AM -0400, Matthew Donovan wrote:
> > I am trying to programmatically start Xen guest VMs (HVM) 
> with libvirt (on
> > Fedora Core 8) and I'm having some trouble with it. I've 
> included my code
> > below.  Essentially, the domain seems to get created 
> correctly but it
> > doesn't seem to run.
> >
> > I don't receive any error messages from the libvirt
> > functions but the VM does not get any CPU time (as shown 
> with "xm list").  
> > 
> > [EMAIL PROTECTED] ~]$ xm list
> > NameID   Mem VCPUs  
> State
> > Time(s)
> > Domain-0 0  1462 2  
>r-
> > 1313.5
> > fc8.conf 7   128 1  
>--
> > 0.0
> > 
> > Can someone explain what I'm doing wrong here?  I've tried 
> to get this
> > working with linux and windows guests with the same results.
> 
> That's really strange.  Your program looks correct to me (but see my
> comment about error handling below).  One thing you can do is to run
> your program after first setting the environment variable
> LIBVIRT_DEBUG=1 which will cause all calls to libvirt to be printed
> out.  Just to make sure you are actually calling the functions that
> you think you are calling.
> 
> > I've seen references on this mailing list to libvirt's 
> ability to handle Xen
> > configuration files but I haven't seen anything in the API 
> documentation or
> > public header files that refer to it.  Is there a public 
> interface to
> > specifying a configuration file?
> 
> No there isn't.  This ability refers to old versions of Xen which used
> /etc/xen.  We have a driver that can parse files from here and present
> those as inactive ("defined" but not running) domains, eg.  when you
> do "virsh list".
> 
> For all other uses, use the libvirt XML configuration format.  The
> advantage is that it will keep working with other types of
> virtualization.
> 
> > domain = virDomainDefineXML (con, fedora);
> > if (!domain) {
> > virErrorPtr err = virGetLastError ();
> > printf ("virDomainDefineXML failed: %s\n",
> > err->message);
> 
> By the way, this error reporting is wrong.  Confusingly the

Re: [libvirt] networking

2008-08-20 Thread Cole Robinson
James Bardin wrote:
> Cole Robinson wrote:
>> What virt-manager version are you using?
>> Distro?
> 
> libvirt: 0.4.0-2ubuntu8
> virt-manager: 0.5.3-0ubuntu10
> 
> Distro: Ubuntu 8.04.1 server x86_64
> 
>> Is there anything showing up in the shared device drop
>> down (even if you can't select it?)
>>
> 
> The drop-down activates, but is empty.
> 
>> Also if you could attach ~/.virt-manager/virt-manager.log
>> it might help.
>>
> 
> This group popped up a lot yesterday:
> 
> [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:494)
> Unable to list active networks
> [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:498)
> Unable to list inactive networks
> [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] ERROR (engine:158) Could
> not refresh connection qemu:///system
>  virConnectListDomainsID() failed Broken pipe
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/engine.py", line 152, in _tick
> self.connections[uri]["connection"].tick()
>   File "/usr/share/virt-manager/virtManager/connection.py", line 550, in
> tick
> newActiveIDs = self.vmm.listDomainsID()
>   File "/usr/lib/python2.5/site-packages/libvirt.py", line 795, in
> listDomainsID
> if ret is None: raise libvirtError ('virConnectListDomainsID()
> failed', conn=self)
> libvirtError: virConnectListDomainsID() failed Broken pipe
> 

This is probably from a libvirtd restart while virt-manager
was running. If so, nothing to worry about.

> 
> Here's the output when I try to add a new network device:
> 
> [Wed, 20 Aug 2008 10:57:39 virt-manager 6673] ERROR (connection:158)
> Unable to connect to HAL to list network devices: '%s' 'dbus.exceptions.DBusException'>
> org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal
> was not provided by any .service files
> Traceback (most recent call last):
>   File "/usr/share/virt-manager/virtManager/connection.py", line 144, in
> detect_network_devices
> hal_object = self.bus.get_object('org.freedesktop.Hal',
> '/org/freedesktop/Hal/Manager')
>   File "/var/lib/python-support/python2.5/dbus/bus.py", line 244, in
> get_object
> follow_name_owner_changes=follow_name_owner_changes)
>   File "/var/lib/python-support/python2.5/dbus/proxies.py", line 241, in
> __init__
> self._named_service = conn.activate_name_owner(bus_name)
>   File "/var/lib/python-support/python2.5/dbus/bus.py", line 183, in
> activate_name_owner
> self.start_service_by_name(bus_name)
>   File "/var/lib/python-support/python2.5/dbus/bus.py", line 281, in
> start_service_by_name
> 'su', (bus_name, flags)))
>   File "/var/lib/python-support/python2.5/dbus/connection.py", line 607,
> in call_blocking
> message, timeout)
> DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name
> org.freedesktop.Hal was not provided by any .service files
> [Wed, 20 Aug 2008 10:57:47 virt-manager 6673] ERROR (console:106) Cannot
> initialize notification
> systemorg.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute
> dbus-launch to autolaunch D-Bus session
> 
> 

This is the problem: we use dbus to contact hal to list
physical net devices on the system, then we probe their
/sys path to determine if they are in a bridge, among
other things.

Make sure hald (or some equivalently named service) is
running. Bar that, you'll probably have to ask the
ubuntu folks.

Thanks,
Cole

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


Re: [libvirt] networking

2008-08-20 Thread James Bardin

Cole Robinson wrote:
> What virt-manager version are you using?
> Distro?

libvirt: 0.4.0-2ubuntu8
virt-manager: 0.5.3-0ubuntu10

Distro: Ubuntu 8.04.1 server x86_64

> Is there anything showing up in the shared device drop
> down (even if you can't select it?)
> 

The drop-down activates, but is empty.

> Also if you could attach ~/.virt-manager/virt-manager.log
> it might help.
> 

This group popped up a lot yesterday:

[Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:494)
Unable to list active networks
[Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:498)
Unable to list inactive networks
[Tue, 19 Aug 2008 14:55:19 virt-manager 5811] ERROR (engine:158) Could
not refresh connection qemu:///system
 virConnectListDomainsID() failed Broken pipe
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/engine.py", line 152, in _tick
self.connections[uri]["connection"].tick()
  File "/usr/share/virt-manager/virtManager/connection.py", line 550, in
tick
newActiveIDs = self.vmm.listDomainsID()
  File "/usr/lib/python2.5/site-packages/libvirt.py", line 795, in
listDomainsID
if ret is None: raise libvirtError ('virConnectListDomainsID()
failed', conn=self)
libvirtError: virConnectListDomainsID() failed Broken pipe


Here's the output when I try to add a new network device:

[Wed, 20 Aug 2008 10:57:39 virt-manager 6673] ERROR (connection:158)
Unable to connect to HAL to list network devices: '%s'
org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal
was not provided by any .service files
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 144, in
detect_network_devices
hal_object = self.bus.get_object('org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
  File "/var/lib/python-support/python2.5/dbus/bus.py", line 244, in
get_object
follow_name_owner_changes=follow_name_owner_changes)
  File "/var/lib/python-support/python2.5/dbus/proxies.py", line 241, in
__init__
self._named_service = conn.activate_name_owner(bus_name)
  File "/var/lib/python-support/python2.5/dbus/bus.py", line 183, in
activate_name_owner
self.start_service_by_name(bus_name)
  File "/var/lib/python-support/python2.5/dbus/bus.py", line 281, in
start_service_by_name
'su', (bus_name, flags)))
  File "/var/lib/python-support/python2.5/dbus/connection.py", line 607,
in call_blocking
message, timeout)
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name
org.freedesktop.Hal was not provided by any .service files
[Wed, 20 Aug 2008 10:57:47 virt-manager 6673] ERROR (console:106) Cannot
initialize notification
systemorg.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute
dbus-launch to autolaunch D-Bus session



Thanks
-jim

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


Re: [libvirt] networking

2008-08-20 Thread Cole Robinson
James Bardin wrote:
> Hello,
> 
> I'm having trouble digging up some documentation on libvirt's network
> config.
> 
> I'm not sure where to set this up, but I have a bridged device br0 that
> I would like to have available in virt-manager/virsh.
> 
> Right now, I can edit the VM's xml interface element manually to use
> br0. Virt-manager has an option for shared physical device, but it's
> empty, and I can't figure out how to see it from virsh.
> 
> 

cc-ing et-mgmt-tools which is the virt-manager list

The bridge should be showing up in shared physical device
drop down automatically, there shouldn't be anything you
need to teach libvirt.

What virt-manager version are you using?
Distro?
Is there anything showing up in the shared device drop
down (even if you can't select it?)

Also if you could attach ~/.virt-manager/virt-manager.log
it might help.

Thanks,
Cole

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


Re: [libvirt] On shutdown Destroy/Delete

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 02:34:22PM +0100, Richard W.M. Jones wrote:
> On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:
> > On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
> > > I would really like to know how I can make a defined domain *gone* after  
> > > shutdown :) (instead of it still be defined, after shutdown)
> 
> [...]
> 
> Oh right, so am I correct in thinking you want the domain to be
> undefined after it has shutdown itself?  That's not possible
> currently.  AIUI undefining a running domain is either an illegal
> operation or shuts it down abruptly -- you'll need to look in the
> source to see which.  So you'd need some sort of 'reaper' cronjob to
> regularly undefine domains after they have gone into the shutdown
> state.

The easy answer is to simply *not* define it in the first place. If
you use  virDomainCreateLinux() instead of virDomainDefine+virDomainCreate
then you'll get a running VM without any persistent config file behind
it. Then all trace will disappear when it shuts down.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


AW: [libvirt] libvirt-java: change org.libvirt.Error implementingSerializable

2008-08-20 Thread Daniel Schwager
Here we are:

### Eclipse Workspace Patch 1.0
#P libvirt-java
Index: src/org/libvirt/Error.java
===
RCS file: /data/cvs/libvirt-java/src/org/libvirt/Error.java,v
retrieving revision 1.1
diff -u -r1.1 Error.java
--- src/org/libvirt/Error.java  18 Jul 2008 14:37:21 -  1.1
+++ src/org/libvirt/Error.java  20 Aug 2008 14:22:30 -
@@ -1,8 +1,10 @@
 package org.libvirt;
 
-public class Error  {
+import java.io.Serializable;
 
-   public static enum ErrorDomain{
+public class Error  implements Serializable{
+
+   public static enum ErrorDomain {
VIR_FROM_NONE,
/**
 * Error at Xen hypervisor layer


Regards
Danny

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


Re: [libvirt] libvirt-java: change org.libvirt.Error implementing Serializable

2008-08-20 Thread Daniel Veillard
On Tue, Aug 19, 2008 at 07:32:50PM +0200, Daniel Schwager wrote:
> Hi java-api-team (-:
> 
> could you please let org.libvirt.Error implements the serializable interface ?
> Exceptions (and the content like org.libvirt.Error) should be serializable.
> 
> I got an exception on my host system connected via RMI to the client-system
> running libvirt-java (libvirt-java, cvs-snapshot 2008-08-18) like this:

  Any chance you could cook a patch doing this ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] Using Xen config files

2008-08-20 Thread Richard W.M. Jones
On Wed, Aug 20, 2008 at 08:35:46AM -0400, Matthew Donovan wrote:
> I am trying to programmatically start Xen guest VMs (HVM) with libvirt (on
> Fedora Core 8) and I'm having some trouble with it. I've included my code
> below.  Essentially, the domain seems to get created correctly but it
> doesn't seem to run.
>
> I don't receive any error messages from the libvirt
> functions but the VM does not get any CPU time (as shown with "xm list").  
> 
> [EMAIL PROTECTED] ~]$ xm list
> NameID   Mem VCPUs  State
> Time(s)
> Domain-0 0  1462 2 r-
> 1313.5
> fc8.conf 7   128 1 --
> 0.0
> 
> Can someone explain what I'm doing wrong here?  I've tried to get this
> working with linux and windows guests with the same results.

That's really strange.  Your program looks correct to me (but see my
comment about error handling below).  One thing you can do is to run
your program after first setting the environment variable
LIBVIRT_DEBUG=1 which will cause all calls to libvirt to be printed
out.  Just to make sure you are actually calling the functions that
you think you are calling.

> I've seen references on this mailing list to libvirt's ability to handle Xen
> configuration files but I haven't seen anything in the API documentation or
> public header files that refer to it.  Is there a public interface to
> specifying a configuration file?

No there isn't.  This ability refers to old versions of Xen which used
/etc/xen.  We have a driver that can parse files from here and present
those as inactive ("defined" but not running) domains, eg.  when you
do "virsh list".

For all other uses, use the libvirt XML configuration format.  The
advantage is that it will keep working with other types of
virtualization.

> domain = virDomainDefineXML (con, fedora);
> if (!domain) {
> virErrorPtr err = virGetLastError ();
> printf ("virDomainDefineXML failed: %s\n",
> err->message);

By the way, this error reporting is wrong.  Confusingly there are two
levels of errors stored by virterror, a global error and a
per-connection error.  The global error is only used where you don't
have a virConnectPtr object (almost the only time is just after
virConnectOpen fails, when conn == NULL).  The rest of the time you
should use virConnGetLastError:

  http://libvirt.org/html/libvirt-virterror.html#virConnGetLastError

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

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


Re: [libvirt] [PATCH] Delete veth devices during lxcVMCleanup

2008-08-20 Thread Daniel Veillard
On Thu, Aug 14, 2008 at 08:51:35AM -0700, Dan Smith wrote:
> This makes sure to delete veth devices after we've killed the container.
> In the case of a destroy or crash, this ensures the system is cleaned
> up properly.
> 
> To be applied atop Daniel Berrange's current LXC patch stack.

  Looks reasonable, is there anything blocking DanB patches from being
commited at this point ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] [PATCH] manage number of virtual CPUs

2008-08-20 Thread Daniel Veillard
On Thu, Aug 14, 2008 at 06:31:31PM +0400, Evgeniy Sokolov wrote:
>
>> On Wed, Aug 13, 2008 at 05:04:45PM +0400, Evgeniy Sokolov wrote:
>>> +static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type) {
>>> +if (STRCASEEQ(type, "openvz"))
>>> +return 4096; //OpenVZ has no limitation
>>
>> This should be 1024 since that's the max CPUs exposed by the kernel
>> to userspace for  sched params.
>>
>>> +if (virRun(conn, (char **)prog, NULL) < 0) {
>>> +openvzError(conn, VIR_ERR_INTERNAL_ERROR,
>>> + _("Could not exec %s"), VZCTL);
>>> +return -1;
>>> +}
>>
>> There's no need to cast to '(char **)' anymore - virRun has
>> the correct constness defined.
>>
>> With those two things changed this looks fine to commit
> Thanks for review!
>
> fixed patch is attached.

  Okidoc, applied and commited,

thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] Re: qemud/.libs/libvirtd?

2008-08-20 Thread Richard W.M. Jones
On Wed, Aug 20, 2008 at 08:22:00PM +0900, Jun Koi wrote:
> Ah, that is so confused, the way to name files here.
> 
> So if qemu/.libs/libvirtd is installed into /usr/sbin/libvirtd, where
> qemud/libvirtd is installed???

It isn't installed anywhere.

> (It seems only qemud/libvirtd works for me)

This is a libtool thing.  Admittedly quite horrible and counter-
intuitive, but using libtool arguably beats trying to work out how
shared libraries are created on Windows / HP-UX / AIX / CP/M / etc.
which is what libtool gives us.

You can find out plenty more in the libtool manual:

  
http://www.gnu.org/software/libtool/manual/libtool.html#index-g_t_0040file_007b_0040value_007bobjdir_007d_007d-subdirectory-26

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 60 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] On shutdown Destroy/Delete

2008-08-20 Thread Richard W.M. Jones
On Wed, Aug 20, 2008 at 02:31:52PM +0100, Richard W.M. Jones wrote:
> On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
> > I would really like to know how I can make a defined domain *gone* after  
> > shutdown :) (instead of it still be defined, after shutdown)

[...]

Oh right, so am I correct in thinking you want the domain to be
undefined after it has shutdown itself?  That's not possible
currently.  AIUI undefining a running domain is either an illegal
operation or shuts it down abruptly -- you'll need to look in the
source to see which.  So you'd need some sort of 'reaper' cronjob to
regularly undefine domains after they have gone into the shutdown
state.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 60 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] On shutdown Destroy/Delete

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 10:26:33PM +0200, Stefan de Konink wrote:
> I would really like to know how I can make a defined domain *gone* after  
> shutdown :) (instead of it still be defined, after shutdown)

virsh undefine?

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

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


Re: [libvirt] networking

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 04:12:06PM -0500, Charles Duffy wrote:
> James Bardin wrote:
>> I'm not sure where to set this up, but I have a bridged device br0 that
>> I would like to have available in virt-manager/virsh.
>>
>> Right now, I can edit the VM's xml interface element manually to use
>> br0.
>
> AFAIK, you're doing the right thing (as long as you're doing a  
> "dump-xml" to get the XML description out and then a "define" to put the  
> updated one in; directly modifying /etc/libvirt/qemu/* is bad form).
>
> Personally, I use xmlstarlet [from shell scripts] or lxml [from python]  
> to automate tweaking the XML host descriptions, but the details are your  
> own call.

As a completely separate aside to this, in the new version of libvirt
(either CVS or 0.4.5 whenever that is released) you will be able to
do:

  virsh edit 
  virsh net-edit 
  virsh pool-edit 

These do the dumpxml/edit/define sequence of operations, and have
sensible behaviour in the case of failure.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 60 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] [PATCH] Ignore specified target path when creating logical vol

2008-08-20 Thread Daniel Veillard
On Tue, Aug 12, 2008 at 11:59:01PM -0400, Cole Robinson wrote:
> Specifying a target path when creating a storage
> volume has no effect, since volumes only really use
> the pool's target path and 'name' field to
> establish the volume's target. Logical volumes
> expect a target path to be passed, and it can
> only cause problems.
> 
> The attached patch erases the passed target volume
> and fills it in with the one generated from the
> create operation.

  Okidoc, looks fine, applied and commited,

   thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] PATCH: Improve some remote driver error messages

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 11:47:38AM +0100, Daniel P. Berrange wrote:
> Bug reports from users have shown diagnosing problems with the remote
> driver are quite tricky, so I've been looking at improving its error
> messages where possible. There's a number of places where we simply
> pass in  strerror(errno) as the only data in virRaiseError. This doesn't
> let us narrow down just which call failed - we just get a generic message
> "Permission denied" or "Connection refused" with no clue what was being
> tried.

+1, totally sensible.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

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


Re: [libvirt] PATCH: Ensure errors are guarenteed reported in virConnectOpen

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 11:35:18AM +0100, Daniel P. Berrange wrote:
> The guarenteed correct solution is actually rather simple
> 
>  - Always report errors against the virConnect object, even in the driver
>open method
> 
>  - In the cleanup patch of do_open() in libvirt.c, if no global error is
>set, copy the error from the virConnect object's virError, into the 
>global virError.

+1 , although unfortunately this isn't thread-safe.  Nothing can be
thread-safe unless we change the API.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

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


Re: [libvirt] Libvirt XML description

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 01:39:38PM +0300, Dimitrios Kalogeras wrote:
> Hi Victor and Daniel,
> 
> I browsed in the libvirt source tree in the docs directory and on the
> below mentioned url. I have also found the libvirt-cim-0.5/doc/schema
> 
> What is the relation of the http://libvirt.org/libvirt.rng  to the DMTF
> CIM v2.16 schema ( experimental or not) ?

There is no relationship.  However there is CIM support built on top
of libvirt:

  http://libvirt.org/CIM/

There's also a separate mailing list for discussing that:

  https://www.redhat.com/mailman/listinfo/libvirt-cim/

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 60 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] [PATCH] Fix size reporting for disk pools without partitions

2008-08-20 Thread Daniel Veillard
On Tue, Aug 12, 2008 at 11:58:23PM -0400, Cole Robinson wrote:
> The attached patch updates parthelper to print size
> information for a disk device if it doesn't have any
> allocated partitions.
> 
> The current code starts by requesting the first partition,
> then iterating from there. But if there is no first
> partition, that whole info reporting thing never happens :)
> 
> Seems to produce desired results for partitioned and
> unpartitioned devices.

  Sounds fine, applied and commited, thanks !

sorry for the delay !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] networking

2008-08-20 Thread James Bardin


Charles Duffy wrote:
> James Bardin wrote:
>> I'm not sure where to set this up, but I have a bridged device br0 that
>> I would like to have available in virt-manager/virsh.
>>
>> Right now, I can edit the VM's xml interface element manually to use
>> br0.
> 
> AFAIK, you're doing the right thing (as long as you're doing a
> "dump-xml" to get the XML description out and then a "define" to put the
> updated one in; directly modifying /etc/libvirt/qemu/* is bad form).
> 

Yeah, that's what I am doing. I can't seem to figure out what to do to
get br0 configured in libvirt, so that it can managed through
virsh/virt-manager. Right now I'm resorting to creating a vm with the
default adapter, then modifying the adapter in /etc/libvirt/qemu/*.xml.



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


Re: [libvirt] [PATCH] check for XHTML1 DTDs availability

2008-08-20 Thread Daniel Veillard
On Wed, Aug 13, 2008 at 03:50:10PM +0200, Chris Lalancette wrote:
> Daniel Veillard wrote:
> > On Wed, Aug 13, 2008 at 08:10:36AM -0400, Daniel Veillard wrote:
> >>   Well apparently the XSL output is post-processed by xmlling --valid 
> >> --format
> >> which then introduce a dependancy on the XHTML1 DTDs . If you don't have 
> >> them
> >> installed locally you will get validation error messages when building
> >> in docs and the output will diverge.
> >>
> >>   The simplest solution for you is probably to make sure you have XHTML1
> >> DTDs installed in your local XML catalog, which on RHEL/Fedora is as simple
> >> as having the package xhtml1-dtds installed on your machine(s).
> > 
> >   The patch enclosed adds detection for the XHTML1 dtds at runtime on the 
> > build machine, and should solve the problem of diverging docs, replace the
> > XML validity warnings by a more general message and add the requirement
> > when building the RPM. I guess this should solve the issue
> 
> Yes, that did it for me.  I like the warning message too; at least that gives
> someone a fighting chance of figuring out what to install if they do want to
> generate the docs for some reason.

  Okay, that's far from perfect but better than the status quo, so
  commited !

   thanks,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


Re: [libvirt] Re: virsh/virt-install for dummies

2008-08-20 Thread Richard W.M. Jones
On Tue, Aug 19, 2008 at 11:25:21AM +0900, Jun Koi wrote:
> Yes, that was a mistake. I changed -c to --connect, and get the error
> "Unsupported virtualization type" now. How can I fix it?

I've been bitten by this very same error message in virt-install.
Took me absolutely ages to work out that I had to use the '--hvm'
option.  It's a usability bug in virt-install, plain and simple.
Attached is a patch which clarifies the error message.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 60 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
diff -r de5bcee1e78f virtinst/ImageManager.py
--- a/virtinst/ImageManager.py  Mon Aug 18 16:33:57 2008 -0400
+++ b/virtinst/ImageManager.py  Wed Aug 20 14:08:00 2008 +0100
@@ -46,7 +46,7 @@
 
 self._guest = self._capabilities.guestForOSType(self._boot_caps.type, 
self._boot_caps.arch)
 if self._guest is None:
-raise PlatformMatchException(_("Unsupported virtualization type"))
+raise PlatformMatchException(_("Unsupported virtualization type. 
If the host only supports full virtualization, try adding the --hvm option."))
 
 self._domain = self._guest.bestDomainType()
 self.type = self._domain.hypervisor_type
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] "static" ip address

2008-08-20 Thread Daniel Veillard
On Fri, Aug 15, 2008 at 10:43:15AM +0100, Daniel P. Berrange wrote:
> On Tue, Aug 12, 2008 at 05:24:01PM -0400, Daniel Veillard wrote:
> >   New patch with just a pair of minor fixes which seems to work just fine 
> > for
> > me. The syntax is nearly the old one, just use host instead of statichost:
> > 
> >   
> > 
> >   
> >
> Seems a little odd to have 'host' as the element name and attribute
> name at once. Perhaps the atribute should just be name='' ?

  Okidoc, so I commited the patch but changed the attribute to name
instead of host, nicer and makes more sense,

  thanks,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


[libvirt] Using Xen config files

2008-08-20 Thread Matthew Donovan
I am trying to programmatically start Xen guest VMs (HVM) with libvirt (on
Fedora Core 8) and I'm having some trouble with it. I've included my code
below.  Essentially, the domain seems to get created correctly but it
doesn't seem to run.  I don't receive any error messages from the libvirt
functions but the VM does not get any CPU time (as shown with "xm list").  

[EMAIL PROTECTED] ~]$ xm list
NameID   Mem VCPUs  State
Time(s)
Domain-0 0  1462 2 r-
1313.5
fc8.conf 7   128 1 --
0.0

Can someone explain what I'm doing wrong here?  I've tried to get this
working with linux and windows guests with the same results.

I've seen references on this mailing list to libvirt's ability to handle Xen
configuration files but I haven't seen anything in the API documentation or
public header files that refer to it.  Is there a public interface to
specifying a configuration file?

Thanks 
-matthew


CODE:
#include 
#include 
#include 

  //""
//""

const char* fedora = 
""
"fc8.conf"
""
"hvm"
"/usr/lib/xen/boot/hvmloader"
""
""
"1024"
"1"
"destroy"
"restart"
"restart"
""
""
""
""
""
""
""
"/usr/lib/xen/bin/qemu-dm"
""
 ""
  ""
""
""
  ""
  ""
""
""
  ""
  ""
  ""
""
""
  ""
"";


int main (int argc, char** argv) 
{
virConnectPtr con;  /* connection to the Xen hypervisor */
virDomainPtr  domain;

virInitialize();
con = virConnectOpen ("xen:///");
if (!con) {
virErrorPtr err = virGetLastError ();
printf ("virConnectOpen failed: %s\n",
err->message);
return -1;
}

domain = virDomainDefineXML (con, fedora);
if (!domain) {
virErrorPtr err = virGetLastError ();
printf ("virDomainDefineXML failed: %s\n",
err->message);

} else {

if (virDomainCreate (domain) < 0) {
virErrorPtr err = virGetLastError ();
printf ("virDomainCreate failed: %s\n",
err->message);
} else {
virDomainInfo info = {0};
virDomainGetInfo (domain, &info);
printf ("state = %d\n", info.state);
}
}

virConnectClose (con);
return 0;
}

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


Re: [libvirt] Re: qemud/.libs/libvirtd?

2008-08-20 Thread Jun Koi
On Wed, Aug 20, 2008 at 8:05 PM, Daniel P. Berrange <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 20, 2008 at 08:01:42PM +0900, Jun Koi wrote:
>> On Wed, Aug 20, 2008 at 4:30 PM, Jun Koi <[EMAIL PROTECTED]> wrote:
>> > Hi,
>> >
>> > I added some new code to libvirt.c, and recompile. However, when "make
>> > install". qemud/.libs/libvirtd is installed but not qemud/libvirtd.
>> > Why? Looks like a bug?
>
> No, this is correct behaviour.  qemud/libvirtd is not a binary - it is
> a mere shell script which calls into qemud/.libs/libvirtd. This is all
> part of the libtool build process.
>

Ah, that is so confused, the way to name files here.

So if qemu/.libs/libvirtd is installed into /usr/sbin/libvirtd, where
qemud/libvirtd is installed???
(It seems only qemud/libvirtd works for me)


Thanks,
Jun

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


Re: [libvirt] Re: qemud/.libs/libvirtd?

2008-08-20 Thread Daniel P. Berrange
On Wed, Aug 20, 2008 at 08:01:42PM +0900, Jun Koi wrote:
> On Wed, Aug 20, 2008 at 4:30 PM, Jun Koi <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I added some new code to libvirt.c, and recompile. However, when "make
> > install". qemud/.libs/libvirtd is installed but not qemud/libvirtd.
> > Why? Looks like a bug?

No, this is correct behaviour.  qemud/libvirtd is not a binary - it is
a mere shell script which calls into qemud/.libs/libvirtd. This is all
part of the libtool build process.

> > The problem is that qemud/libvirtd has my new code, but not
> > qemud/.libs/libvirtd! So "make install" installs the old binary, which
> > I dont know where it is from. (Perhaps from the first compilation?)

You are mistaken - qemud/libvirtd is just a shell script wrapper.
The actual binaries are in the .libs directory.

> > I am not familiar with the autoconf Makefile, and cannot figure it out
> > why it is working this way.
> >
> 
> This is not getting funny anymore. I clean src/.libs/*, and
> qemud/.libs/*, and recompile and "make install" again. This step
> installed stuffs in .libs/ into system.

Run  'make distclean' and then start again from 'configure'

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


[libvirt] Re: qemud/.libs/libvirtd?

2008-08-20 Thread Jun Koi
On Wed, Aug 20, 2008 at 4:30 PM, Jun Koi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I added some new code to libvirt.c, and recompile. However, when "make
> install". qemud/.libs/libvirtd is installed but not qemud/libvirtd.
> Why? Looks like a bug?
>
> The problem is that qemud/libvirtd has my new code, but not
> qemud/.libs/libvirtd! So "make install" installs the old binary, which
> I dont know where it is from. (Perhaps from the first compilation?)
>
> I am not familiar with the autoconf Makefile, and cannot figure it out
> why it is working this way.
>

This is not getting funny anymore. I clean src/.libs/*, and
qemud/.libs/*, and recompile and "make install" again. This step
installed stuffs in .libs/ into system.

Then I found that qemud/libvirtd and src/virsh works well together
(for ex, src/virsh -c qemu:///system list works well), but
/usr/sbin/libvirtd and /usr/bin/virsh dont work: "virsh -c
qemu:///system list" reports "failed to connect to hypervisor".

I am wondering what is going on with those binary in .libs/??

Thanks,
J

> Many thanks,
> Jun
>

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


Re: [libvirt] PATCH: 4/5: Support daemonizing child & env variables

2008-08-20 Thread Daniel P. Berrange
On Tue, Aug 19, 2008 at 11:10:49PM +0200, Jim Meyering wrote:
> "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote:
> > On Tue, Aug 19, 2008 at 10:51:29PM +0200, Jim Meyering wrote:
> >> "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote:
> >> > Some of the existing usage of fork/exec in libvirt is done such that the
> >> > child process is daemonized. In particular the libvirt_proxy and the
> >> > auto-spawned  libvirtd for qemu:///session. Since we want to switch these
> >> > to use virExec, we need to suport a daemon mode.
> >> >
> >> > This patch removes the two alternate virExec and virExecNonBlock 
> >> > functions
> >> > and renames the internal __virExec to virExec. It then gains a 'flags'
> >> > parameter which can be used to specify non-blocking mode, or daemon mode.
> >> >
> >> > We also add the ability to pass in a list of environment variables which
> >> > get passed on to execve(). We also now explicitly close all file handles.
> >> > Although libvirt code is careful to set O_CLOSEXEC on all its file 
> >> > handles,
> >> > in multi-threaded apps there is a race condition between opening a FD and
> >> > setting O_CLOSEXEC. Furthermore, we can't guarentee that all applications
> >> > using libvirt are careful to set O_CLOSEXEC. Leaking FDs to a child is a
> >> > potential security risk and often causes SELinux AVCs to be raised. Thus
> >> > explicitely  closing all FDs is a important safety net.
> >>
> >> How about closing those FDs in the child instead, right after the fork?
> >> Then, if a virExec caller has an open socket or file descriptor,
> >> it won't be closed behind its back.
> >
> > This is being done after a fork(). The diff context in this patch is
> > a little misleading. The fork() shown here is the 2nd optional fork() done
> > in daemon mode. The first fork() is higher up before we close the FDs.
> 
> I should have known.  Next time I'll review with the full context.
> ACK, then.

Ok, committed now.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] PATCH: 3/5: Allow FD for stdout/err to be passed in

2008-08-20 Thread Daniel P. Berrange
On Tue, Aug 19, 2008 at 10:00:37PM +0200, Jim Meyering wrote:
> "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote:
> > The contract for virExec() currently allows the caller to pass in a NULL
> > for stdout/err parameters in which case the child will be connected to
> > /dev/null, or they can pass in a pointer to an int, in which case the
> > child will be connected to a pair of pipes, and the read end of the pipe
> > is returned to the caller.
> >
> > The LXC driver will require a 3rd option - we want to pass in a existing
> > file handler connected to a logfile. So this patch extends the semantics
> > of these two parameters. If the stderr/out params are non-NULL, but are
> > initialized to -1, then a pipe will be allocated. If they are >= 0, then
> > they are assumed to be existing FDs to dup onto the child's stdout/err.
> >
> > This change neccessitated updating all existing callers of virExec to
> > make sure they initialize the parameters to -1 to maintain existing
> > behaviour.
> 
> ACK
> No technical problems...
> so here are some stylistic suggestions

Committed, along with the style changes.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] PATCH: 2/5: Fix signal handler race condition

2008-08-20 Thread Daniel P. Berrange
On Tue, Aug 19, 2008 at 06:25:01PM +0200, Jim Meyering wrote:
> "Daniel P. Berrange" <[EMAIL PROTECTED]> wrote:
> > This is the same patch from yesterday to fix the signal handler race
> > condition. We block signals before doing a fork(), and then in the child
> > reset all signal handlers before finally unblocking all signals. The
> > parent will restore its original signal mask after fork. I've fixed the
> > incorrect return code check on pthread_sigmask() and iterate from 1
> > instead of 0. I'll switch to pid_t later, since that'll involve changing
> > all callers too.
> >
> > In the internal.h file I also #define pthread_sigmask to sigprocmask
> > for scenarios where we don't have pthread - as per other usage. This
> > exposed a bug in remote_protocol.c file where it was not including
> > the config.h file, hence that change here too
> 
> This looks fine now.

Thanks, this is committed

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


[libvirt] qemud/.libs/libvirtd?

2008-08-20 Thread Jun Koi
Hi,

I added some new code to libvirt.c, and recompile. However, when "make
install". qemud/.libs/libvirtd is installed but not qemud/libvirtd.
Why? Looks like a bug?

The problem is that qemud/libvirtd has my new code, but not
qemud/.libs/libvirtd! So "make install" installs the old binary, which
I dont know where it is from. (Perhaps from the first compilation?)

I am not familiar with the autoconf Makefile, and cannot figure it out
why it is working this way.

Many thanks,
Jun

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