Re: [libvirt] [Docs] More work on the API and architecture

2009-04-15 Thread Daniel P. Berrange
On Tue, Apr 14, 2009 at 03:43:18PM +0200, Daniel Veillard wrote:
   Another patch, incomplete adding a new page api.html[.in]
 with the goals of describing the main API concepts, architectures,
 naming conventions, etc ... It includes Dan's graphics and a change of
 how the stylesheet process the .html.in content allowing to turn
 code class='docref'foo/code into a link to reference for foo in the
 API page. Ultimately I should be able to load the API description from
 the stylesheet and do that link generation automagically without any
 markup (like all the links in the API reference).
   Still need to write the drivers and remote sections, and augment some
 of the APIs entry points, but it's a first step and better in than out.

Looks good, but its missing Makefile.am rule to generate the images
from the .fig files. It'd be nicer to use PNG instead of GIF and
get nicely anti-aliased, transparent background images. ImageMagick
can do this fairly easily using a rule like

%.png: %.fig
convert -rotate 90 $ $@

The 'rotate 90' bit is because for some wierd reason it defaults to
rotating it 90 degrees in a direction you don't want unless you look
at images side-ways on :-)


Regards,
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] Fix vcpupin to inactive domains on Xend3.0.3.

2009-04-15 Thread Daniel Veillard
On Wed, Apr 15, 2009 at 09:52:39AM +0900, Takahashi Tomohiro wrote:
 Hi Daniel-san,
 
 Thank you for your reply.
 
 I see.
 And I checked this problem is solved by your patch.

  Okay, good, applied and commited,

   thanks !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] lxc: Add lxcGetHostname()

2009-04-15 Thread Daniel Veillard
On Tue, Apr 14, 2009 at 11:29:36AM -0700, Dan Smith wrote:
 This patch adds the getHostname method to the lxc driver structure
 (using the qemu driver's generic code).  Apparently virsh started
 using that method during console attachment recently.  Without this
 implementation, the virsh refused to attach to lxc consoles.
 
 Signed-off-by: Dan Smith da...@us.ibm.com

  Yup, looks fine, applied and commited to CVS,

   thanks !

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.3.3 and unix_sock_group

2009-04-15 Thread Daniel P. Berrange
On Tue, Apr 14, 2009 at 02:06:52PM -0700, Daniel Labrosse wrote:
 Hi All,
 
 I've been using libvirt 0..4.4 for a few weeks now. I have
 unix_sock_group = mygroup set so that i can perform non-root
 management capabilities on the host. 
 
 I have recently installed a new host running Scientific Linux 5.3 and
 libvirt 0.3.3 comes as default. First off, there is no libvirtd.conf
 file included with 0.3.3, so I copied the file from libvirt 0.4.4 (which
 is running on my Fedora 8 box).

The 'unix_sock_group' config param *is* supported in 0.3.3, but the
libvirtd  daemon will not change the group ownership in the directory
/var/run/libvirt where the socket is created. So you almost certainly
won't be able to access the socket itself. You could try chgrp'ing the
directory. A good test is to make sure you can access the socket as
non-root, eg

  ls -l /var/run/libvirt/libvirt-sock


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] lxc: Add lxcGetHostname()

2009-04-15 Thread Daniel P. Berrange
On Tue, Apr 14, 2009 at 11:29:36AM -0700, Dan Smith wrote:
 This patch adds the getHostname method to the lxc driver structure
 (using the qemu driver's generic code).  Apparently virsh started
 using that method during console attachment recently.  Without this
 implementation, the virsh refused to attach to lxc consoles.
 
 Signed-off-by: Dan Smith da...@us.ibm.com

ACK, my fault, I had thought we'd implemented this in all drivers
already. Will add a test for getHostname to the TCK


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] lxc: stop rootless containers from messing with system mounts

2009-04-15 Thread Daniel P. Berrange
On Tue, Apr 07, 2009 at 10:14:23AM +0100, Daniel P. Berrange wrote:
 On Mon, Apr 06, 2009 at 01:47:42PM -0500, Serge E. Hallyn wrote:
  If a container has no root, liblxc remounts /proc.  If the
  system had marked / as MS_SHARED, then even though the
  container is in a new mounts namespace, the mount event is
  propagated back to the host mounts namespace, overwriting
  /proc.  After that, for instance, ps will no longer show
  system processes.
  
  A Fedora 11 default install has / MS_SHARED.
  
  Make sure that root is not MS_SHARED before remounting
  /proc.  I'm making it MS_SLAVE so that the container
  will receive mount events from the host, but not vice
  versa.
  
  Signed-off-by: Serge Hallyn se...@us.ibm.com
 
 Doh, that's rather annoying. ACK to this patch. 


Was just about to commit this, but seems Dan Smith beat me to it. The
following pivot_root patch is committed too


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] How can I attach a network interface to KVM machine

2009-04-15 Thread Anton Protopopov
2009/4/7 Daniel P. Berrange berra...@redhat.com

 On Tue, Apr 07, 2009 at 05:30:02PM +0400, Anton Protopopov wrote:
  Hi.
 
  When I am trying to attach an interface
  interface type='bridge'
mac address='52:54:00:db:1a:bb'/
source bridge='mkvebr0'/
  /interface
  libvirt reports me, that
   libvirt.libvirtError: this function is not supported by the
 hypervisor:
  this device type cannot be attached
 
  Is there a legal way to attach a network interface to QEMU/KVM machine?

 Not at this time. The QEMU monitor interface doesn't provide sufficient
 functionality to be able todo this, because there's no way to pass have
 libvirt create  setup the TAP device, and then pass it to QEMU. The
 QEMU monitor needs to gain the ability to do SCM_RIGHTS to accept an
 open file handle before we can hotplug NICs in any useful manner.

And what about attaching a device to stopped machine?
Stop, attach, and start. Just as temporary decision.



 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/http://search.cpan.org/%7Edanberr/:|
 |: 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] vcpuinfo returns wrong CPU value for kvm

2009-04-15 Thread Daniel P. Berrange
On Tue, Apr 14, 2009 at 09:53:51PM +0200, Gerrit Slomma wrote:
 vcpuinfo returns a wrong value for kvm with libvirt 0.6.2:

 Furthermore even when pinning all - in my case both - vCPUs of the 
 domain to the second CPU of the node virsh reports the first cpu as the 
 assigned cpu.
 
 virsh # vcpupin rr019v3 0 1
 virsh # vcpuinfo rr019v3
 VCPU:   0
 CPU:0
 Status: laufend
 CPU-Affinität: -y
 
 VCPU:   1
 CPU:0
 Status: laufend
 CPU-Affinität: -y
 
 
 Watching at the code in virsh.c i am a little bit on my wits end where 
 virVcpuInfoPtr is defined as i am no c-programmer - only some java on my 
 side.

Unfortunately the answer is rather simple. We never fill in any value
for the 'cpu' field of virVcpuInfo for QEMU/KVM guests, which means 
the 'CPU:' line should by virsh will always be zero. We need to fix 
this in the QEMU driver.


Regards,
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: Libvirt PHP binding

2009-04-15 Thread Radek Hladik

Daniel Veillard napsal(a):

On Tue, Apr 14, 2009 at 07:14:32PM +0200, Radek Hladik wrote:

Daniel P. Berrange napsal(a):
I've updated the documentation - added note that version 0.6.2 is  
required :-) - and modified the code to refuse to connect when version  
is lower that 0.6.2. I've put the modified version to  


  I would avoid this. Don't put a hard limitiation like this in the
  software, the only hard requirement should be feature based, it's
  perfectly possible to ship 0.6.0 with a set of patches fixing the
  bugs you experienced.

Daniel



I will change it to warning then and I will put a lot of warnings on the 
page and into the documentation. I do not like such hard limitations too 
but if the situation is that I am able to crash the daemon very easily, 
(almost with default example code), I want to be careful. I do not want 
to end up with users downloading the code, running a few examples and 
crashing their daemon just because they didn't read the docs :-)


Radek

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


Re: [libvirt] Re: Libvirt PHP binding

2009-04-15 Thread Daniel Veillard
On Wed, Apr 15, 2009 at 02:10:20PM +0200, Radek Hladik wrote:
 Daniel Veillard napsal(a):
 On Tue, Apr 14, 2009 at 07:14:32PM +0200, Radek Hladik wrote:
 Daniel P. Berrange napsal(a):
 I've updated the documentation - added note that version 0.6.2 is   
 required :-) - and modified the code to refuse to connect when 
 version  is lower that 0.6.2. I've put the modified version to  

   I would avoid this. Don't put a hard limitiation like this in the
   software, the only hard requirement should be feature based, it's
   perfectly possible to ship 0.6.0 with a set of patches fixing the
   bugs you experienced.

 Daniel


 I will change it to warning then and I will put a lot of warnings on the  
 page and into the documentation. I do not like such hard limitations too  
 but if the situation is that I am able to crash the daemon very easily,  
 (almost with default example code), I want to be careful. I do not want  
 to end up with users downloading the code, running a few examples and  
 crashing their daemon just because they didn't read the docs :-)

0.6.0 as shipped should not be installed anywhere, there should have been
updates where it was pushed, though it's hard to coordinate.

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


[libvirt] problem to connect to libvirtd as ordinary user

2009-04-15 Thread Sebastian Reitenbach
Hi,

I'm trying to setup an eucalyptus cloud managing my virtual xen nodes.

I'm on SLES11, x86_64. I compiled libvirt-0.6.2 with the following configure 
parameters:
./configure --prefix=/usr --without-storage-iscsi --without-remote 
--without-sasl --without-openvz --without-storage-disk


below the parameters I've set in the /etc/libvirt/libvirt.conf file:
listen_tls = 0
listen_tcp = 1
unix_sock_group = libvirt
unix_sock_ro_perms = 0777
unix_sock_rw_perms = 0777
unix_sock_dir = /var/run/libvirt
auth_unix_ro = none
auth_unix_rw = none
auth_tcp = none
auth_tls = none
log_level = 1
log_outputs=0:stderr

as root, I can run virsh list or virsh -c xen+unix:/// list
and it just works, however, I cannot do this as user eucalyptus.
The user eucalyptus is a member of the libvirt group.
# id eucalyptus
uid=1000(eucalyptus) gid=1000(eucalyptus) groups=1000(eucalyptus),0(root),16
(dialout),17(audio),33(video),100(users),1001(libvirt)

I ran virsh through strace, to see what happens:

strace virsh.bin -c xen+unix:/// list
...
open(/proc/xen/privcmd, O_RDWR)   = -1 EACCES (Permission denied)
...

Shouldn't the permissions of /proc/xen/privcmd be OK due to the libvirt.conf 
file?
However, I changed them, and now the strace output looks like this:

chmod 777 /proc/xen/privcmd
strace virsh.bin -c xen+unix:/// list
...
open(/proc/xen/privcmd, O_RDWR)   = 3
ioctl(3, SNDCTL_DSP_RESET, 0x7fff4721a0f0) = 196611
mlock(0x7fff4721a070, 72)   = 0
mlock(0x7fff47219f00, 136)  = 0
ioctl(3, SNDCTL_DSP_RESET, 0x7fff47219d80) = -1 EACCES (Permission denied)
munlock(0x7fff47219f00, 136)= 0
munlock(0x7fff4721a070, 72) = 0
mlock(0x7fff4721a070, 72)   = 0
mlock(0x7fff47219f00, 136)  = 0
ioctl(3, SNDCTL_DSP_RESET, 0x7fff47219d80) = -1 EACCES (Permission denied)
munlock(0x7fff47219f00, 136)= 0
munlock(0x7fff4721a070, 72) = 0
mlock(0x7fff4721a070, 72)   = 0
mlock(0x7fff47219f00, 136)  = 0
ioctl(3, SNDCTL_DSP_RESET, 0x7fff47219d80) = -1 EACCES (Permission denied)
munlock(0x7fff47219f00, 136)= 0
munlock(0x7fff4721a070, 72) = 0
mlock(0x7fff4721a070, 72)   = 0
mlock(0x7fff47219f00, 136)  = 0
ioctl(3, SNDCTL_DSP_RESET, 0x7fff47219d80) = 0
munlock(0x7fff47219f00, 136)= 0
munlock(0x7fff4721a070, 72) = 0
mlock(0x7fff47219e00, 136)  = 0
ioctl(3, SNDCTL_DSP_RESET, 0x7fff47219d80) = 0
munlock(0x7fff47219e00, 136)= 0
close(3)= 0
...

actually, there is no sound card at all, I wonder what the SNDCTL_DSP_RESET is 
doing there. After the close(3), the virsh is only looking for language to 
generate the error message: error: failed to connect to the hypervisor

Those xen versions are installed:
xen-doc-pdf-3.3.1_18546_12-3.1
xen-doc-html-3.3.1_18546_12-3.1
xen-3.3.1_18546_12-3.1
xen-libs-3.3.1_18546_12-3.1
xen-tools-3.3.1_18546_12-3.1
xen-kmp-default-3.3.1_18546_12_2.6.27.19_5-3.1
kernel-xen-base-2.6.27.19-5.1
kernel-xen-2.6.27.19-5.1
xen-devel-3.3.1_18546_12-3.1

any idea what is wrong here?

kind regards
sebastian

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


[libvirt] virNodeGetFreeMemory() returns bytes with Xen driver

2009-04-15 Thread Tyrel Datwyler


The libvirt API states that the return value of virNodeGetFreeMemory() is
in kilobytes. When making this call against a Xen hypervisor and comparing
the returned value with what is listed by xm info it appears that libvirt
is returning the free memory in bytes and not kilobytes. Can anybody
confirm this behavior?

This code snippet:

conn = virConnectOpen(xen:///localhost/);
hostmem = virNodeGetFreeMemory(conn);
fprintf(stdout, Host free memory = %llu\n, hostmem);

produces the following output:

Host free memory = 3236012032

The following comes from running xm info on the Xen host:

free_memory: 3086

The libvirt value is convertable into the xm returned value if bytes is
assumed.

Regards,

Tyrel Datwyler

Linux Software Engineer
eServer Systems Management
IBM Systems and Technology Group
Email: tyr...@us.ibm.com
External: (503) 578-3489,  T/L: 775-3489
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] How to prevent libvirt from adding iptables rules?

2009-04-15 Thread Thomas Woerner

Daniel P. Berrange wrote:

On Mon, Apr 06, 2009 at 02:36:16PM +0200, Ludwig Nussel wrote:

Daniel P. Berrange wrote:

On Thu, Apr 02, 2009 at 10:16:13AM +0200, Ludwig Nussel wrote:

Daniel P. Berrange wrote:

On Tue, Mar 31, 2009 at 04:08:24PM -0300, Mariano Absatz wrote:

[...]
I modified my VMs to use isolated rather than default, but rules keep 
being added to iptables when libvirt-bin is started.


Is there a way to convince libvirt not to add these rules?

No, libvirt needs to add the rules here because otherwise the guest
virtual network would not be guarenteed to be isolated from the host
network.

Messing with iptables rules isn't guaranteed to work either. Esp if the
existing firewall is re-run. SuSEfirewall2 for example runs when
interfaces come or go so it will kill any rules that someone added
behind it's back.

We have a similar issue with the Fedora equivalent of SuSSfirewall, and
it provides a mechanism for us to register the set of rules we want, so
when it is re-run, it re-adds our rules.

SuSEfirewall2 does not have such a mechanism and TBH I pretty much
dislike the idea of allowing applications to inject arbitrary rules.
I'd prefer some higher level abstraction so it's left to the
firewall to decide how to translate the request into actual iptables
rules (or whatever else technology is used in the background).


I don't much like it either, but currently there isn't any other viable
way to provide good network connectivity out of the box, with zero 
configuration required by the user. In the perfect world we could

delegate setup to NetworkManager, and indeed NM's latest connection
sharing capabilities does very similar things with IPtables that
libvirt does - we worked with the NM developers to make sure our
stuff was compatible. So there's potentiall for more work with NM if
someone's interested in pursuing that direction

Daniel


Can you please define the requirements for a firewall interface for libvirt?

Thomas

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


[libvirt] PATCH: Allow LXC to use private /dev/pts instance

2009-04-15 Thread Daniel P. Berrange
One of the current flaws in the LXC driver is that when doing the better-
chroot-than-chroot mode setup, /dev/pts leaks the parent OS TTYs into
the container.

As of 2.6.29 it is possible to create new instances of /dev/pts by passing
the 'newinstance' flag to mount. In this way /dev/pts inside the container
will be totally independant of the parent OS.

This is a kind of fun / tricky thing to get right, because the monitor
process (libvirt_lxc) actually needs 2 ttys, one in the host's /dev/pts
(which virsh console connects to), and the other in the container's
/dev/pts (which acts as its stdin/out/err).

This means that libvirt_lxc has to mount the new devpts instance on
the containers root filesystem before starting the container itself.
To avoid this then appearing in the host OS, we make libvirt_lxc
call unshare(CLONE_NEWNS). This also has the nice advantage of adding
a guarentee that this new devpts instance is cleaned up with libvirt_lxc
exits.

Now in the container startup sequence, instead of mounting a devpts
instance, it just moves the instance that libvirt_lxc previously
setup into its desired location.

I have arranged this so that if the host OS kernel lacks support for
the 'newinstance' flag with devpts, it'll just use a regular shared
instance. If this happens, then /var/log/libvirt/lxc/$NAME.log
should warn you

 16:55:00.454: warning : kernel does not support private devpts, using shared 
devpts


Also the previous patch to pivot_root() setup added a chroot() call. For
some wierd reason, with this all the host OS's mounts are still visible
in the container's /proc/mounts, even though they are not actually
accessible (since we pivot'd onto a new root)

This change seemed to fix that problem with no ill-effects.

-if (chroot(oldroot)  0) {
-virReportSystemError(NULL, errno, %s,
- _(failed to chroot into tmpfs));
-goto err;
-}
-
-if (chdir(/new)  0) {
-virReportSystemError(NULL, errno, %s,
- _(failed to chdir into /new on tmpfs));
+if (chdir(newroot)  0) {
+virReportSystemError(NULL, errno,
+ _(failed to chroot into %s), newroot);
 goto err;
 }
 


There was also a call added to umount the .oldroot location, but
this was being done too early, because later methods still needed
to access various bits under /.oldroot - eg to mount other (non-root)
filesystems from the host OS in the container.

So I'm removing this chunk:

 if (chdir(/)  0)
 goto err;
 
-if (umount2(.oldroot, MNT_DETACH)  0) {
-virReportSystemError(NULL, errno, %s,
- _(failed to lazily unmount old root));
-goto err;
-}
-


This showed up a different problem  though. Our call later on which
would unmount /.oldroot was failing because there were some open
file descriptors on /var/ still. 

This was because we didn't setup stdin/out until after we'd dealt
with all the mounts. So my patch also makes sure that the first
thing we do is close all open file descriptors and move stdin/out/err
immdiately onto the TTY allocated for this container. That ensures
all the mounts are able to be released.

I've tested this patch on 2.6.27 (lacking 'newinstance') and on
2.6.29 (with 'newinstance' for devpts). It seemed to work correctly
in both cases, but would appreciate someone else confirming

 domain_conf.c|   15 
 domain_conf.h|2 
 libvirt_private.syms |1 
 lxc_container.c  |  175 +++
 lxc_container.h  |1 
 lxc_controller.c |   87 +++--
 util.c   |   22 --
 util.h   |4 +
 8 files changed, 230 insertions(+), 77 deletions(-)


Daniel

Index: src/domain_conf.c
===
RCS file: /data/cvs/libvirt/src/domain_conf.c,v
retrieving revision 1.75
diff -u -p -r1.75 domain_conf.c
--- src/domain_conf.c   3 Apr 2009 14:10:17 -   1.75
+++ src/domain_conf.c   15 Apr 2009 15:44:52 -
@@ -3855,6 +3857,21 @@ const char *virDomainDefDefaultEmulator(
 return emulator;
 }
 
+virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def)
+{
+int i;
+
+for (i = 0 ; i  def-nfss ; i++) {
+if (def-fss[i]-type != VIR_DOMAIN_FS_TYPE_MOUNT)
+continue;
+
+if (STREQ(def-fss[i]-dst, /))
+return def-fss[i];
+}
+
+return NULL;
+}
+
 
 void virDomainObjLock(virDomainObjPtr obj)
 {
Index: src/domain_conf.h
===
RCS file: /data/cvs/libvirt/src/domain_conf.h,v
retrieving revision 1.40
diff -u -p -r1.40 domain_conf.h
--- src/domain_conf.h   3 Mar 2009 16:53:13 -   1.40
+++ src/domain_conf.h   15 Apr 2009 15:44:52 -
@@ -635,6 +635,8 @@ const char *virDomainDefDefaultEmulator(
 

[libvirt] XML network model type stripped on define.

2009-04-15 Thread Adrian Garay
Greetings!

I am currently testing Centos5.3, KVM-84, libvirt from the Centos default 
packages and a Vista 32 guest.  
I am unfortunately experiencing difficulties with the default realtek8139 
network driver, the solution for which I've read would be to change the 
emulated network device type to e1000.

When editing the xml file for my guest, I change:

interface type='bridge'
  mac address='00:16:3e:38:a8:ad'/
  source bridge='br0'/
/interface

to:

interface type='bridge'
  mac address='00:16:3e:38:a8:ad'/
  source bridge='br0'/
  model type='e1000'/
 /interface

and then doing a:

virsh --connect qemu:///system define /etc/libvirt/qemu/vista32.xml

The correct guest is updated, but the model type information I've just added is 
stripped from my XML and I'm once again left with an 8139 emulated nic.

According to the command:
qemu-kvm -net nic,model=? /dev/null

I should be able to use the e1000 driver.

My sincerest apologies if this is already known, or I'm missing something 
terribly obvious.  I am new to mailing lists (this would be my first!)

Thanks in advance.

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


[libvirt] virsh ttyconsole [node] has rc of 1?

2009-04-15 Thread Darryl L. Pierce
I have a script that's breaking when trying to get the ttyconsole for a
node. The script gets the console by invoking:

virsh ttyconsole [nodename]

The script also has trap on error enabled, and the above command has a
return code of 1. This is causing the script to exit at that point.

Is this a bug? Or is there a reason that return code is 1 and not 0?
-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Virtual Machine Management - http://www.ovirt.org/
Is fearr Gaeilge bhriste ná Béarla cliste.


pgpWVed6AhteP.pgp
Description: PGP signature
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] XML network model type stripped on define.

2009-04-15 Thread Daniel P. Berrange
On Wed, Apr 15, 2009 at 11:08:54AM -0500, Adrian Garay wrote:
 Greetings!
 
 I am currently testing Centos5.3, KVM-84, libvirt from the Centos
 default packages and a Vista 32 guest.  
 I am unfortunately experiencing difficulties with the default 
 realtek8139 network driver, the solution for which I've read 
 would be to change the emulated network device type to e1000.
 
 When editing the xml file for my guest, I change:
 
 interface type='bridge'
   mac address='00:16:3e:38:a8:ad'/
   source bridge='br0'/
 /interface
 
 to:
 
 interface type='bridge'
   mac address='00:16:3e:38:a8:ad'/
   source bridge='br0'/
   model type='e1000'/
  /interface
 
 and then doing a:
 
 virsh --connect qemu:///system define /etc/libvirt/qemu/vista32.xml
 
 The correct guest is updated, but the model type information I've 
 just added is stripped from my XML and I'm once again left with an
 8139 emulated nic.
 
 According to the command:
 qemu-kvm -net nic,model=? /dev/null
 
 I should be able to use the e1000 driver.
 
 My sincerest apologies if this is already known, or I'm missing something
 terribly obvious.  I am new to mailing lists (this would be my first!)

What libvirt version do you have ?  It sounds very much like it is too
old for the 'model' attribute

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] virsh ttyconsole [node] has rc of 1?

2009-04-15 Thread Daniel P. Berrange
On Wed, Apr 15, 2009 at 12:18:55PM -0400, Darryl L. Pierce wrote:
 I have a script that's breaking when trying to get the ttyconsole for a
 node. The script gets the console by invoking:
 
 virsh ttyconsole [nodename]
 
 The script also has trap on error enabled, and the above command has a
 return code of 1. This is causing the script to exit at that point.
 
 Is this a bug? Or is there a reason that return code is 1 and not 0?

It is a bug - the ttyconsole method is missing a 'ret = TRUE' line
to set exit status upon success


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] problem to connect to libvirtd as ordinary user

2009-04-15 Thread Daniel P. Berrange
On Wed, Apr 15, 2009 at 03:13:03PM +0200, Sebastian Reitenbach wrote:
 Hi,
 
 I'm trying to setup an eucalyptus cloud managing my virtual xen nodes.
 
 I'm on SLES11, x86_64. I compiled libvirt-0.6.2 with the following configure 
 parameters:
 ./configure --prefix=/usr --without-storage-iscsi --without-remote 
 --without-sasl --without-openvz --without-storage-disk

This is your problem. You have disabled the remote driver at compile
time.  

The remote driver is what is used to talk to libvirtd when running
non-root. So you need to have it 


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] XML network model type stripped on define.

2009-04-15 Thread Adrian Garay
virsh --version returns 0.3.3

Thank you.

From: Daniel P. Berrange [berra...@redhat.com]
Sent: Wednesday, April 15, 2009 11:20 AM
To: Adrian Garay
Cc: libvir-list@redhat.com
Subject: Re: [libvirt] XML network model type stripped on define.

On Wed, Apr 15, 2009 at 11:08:54AM -0500, Adrian Garay wrote:
 Greetings!

 I am currently testing Centos5.3, KVM-84, libvirt from the Centos
 default packages and a Vista 32 guest.
 I am unfortunately experiencing difficulties with the default
 realtek8139 network driver, the solution for which I've read
 would be to change the emulated network device type to e1000.

 When editing the xml file for my guest, I change:

 interface type='bridge'
   mac address='00:16:3e:38:a8:ad'/
   source bridge='br0'/
 /interface

 to:

 interface type='bridge'
   mac address='00:16:3e:38:a8:ad'/
   source bridge='br0'/
   model type='e1000'/
  /interface

 and then doing a:

 virsh --connect qemu:///system define /etc/libvirt/qemu/vista32.xml

 The correct guest is updated, but the model type information I've
 just added is stripped from my XML and I'm once again left with an
 8139 emulated nic.

 According to the command:
 qemu-kvm -net nic,model=? /dev/null

 I should be able to use the e1000 driver.

 My sincerest apologies if this is already known, or I'm missing something
 terribly obvious.  I am new to mailing lists (this would be my first!)

What libvirt version do you have ?  It sounds very much like it is too
old for the 'model' attribute

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] XML network model type stripped on define.

2009-04-15 Thread Daniel P. Berrange
On Wed, Apr 15, 2009 at 12:00:34PM -0500, Adrian Garay wrote:
 virsh --version returns 0.3.3

Yes, that's too old to support the NIC model setting.

You should be able to build the current libvirt release as an RPM for
RHEL-5 though.

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] Multpile network interfaces have same MAC address

2009-04-15 Thread David Mueller


On Wed, 25 Feb 2009, Daniel P. Berrange wrote:


On Tue, Feb 24, 2009 at 01:29:41PM -0800, David Mueller wrote:

I remember seeing this problem before, but I can't remember what the
resolution was, nor can I find a discussion of the issue in
the list archives or Bugzilla.

I've had my setup working for a while now, on both Fedora 8 and Fedora 10.
Now I'm trying to get it to work with CentOS 5 and
running into an old bug.  My guest VM has multiple virtual network
interfaces, with the MAC address defined in the XML file used to
define the VM.  However, I'm seeing each network interface getting the
same MAC addrss (the last one defined in the XML file) on
all if the interfaces when I run ifconfig in the guest.

Was there a workaround for this, or do I need to upgrade libvirt?  CentOS
5.2 is what I'm working with; they haven't released 5.3
yet so I don't know if that will have a newer version.


Last time I saw this was with QEMU and the rtl8139 nic, where there was
a bug setting up the MMIO space, so all NICs were reading their mac
from the first NIC's region instead of their own.


Does anyone know if the patch for this is going to be rolled into RHEL5 at 
some point?  I'm still having this problem with CentOS 5.3.  For 
reference, I found the original Fedora 7 bug as well as filed one for 
CentOS:


https://bugzilla.redhat.com/show_bug.cgi?id=247641

http://bugs.centos.org/bug_view_page.php?bug_id=3466

Thanks,

David

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


Re: [libvirt] PATCH: Allow LXC to use private /dev/pts instance

2009-04-15 Thread Serge E. Hallyn
Quoting Daniel P. Berrange (berra...@redhat.com):
 This change seemed to fix that problem with no ill-effects.
 
 -if (chroot(oldroot)  0) {
 -virReportSystemError(NULL, errno, %s,
 - _(failed to chroot into tmpfs));
 -goto err;
 -}
 -
 -if (chdir(/new)  0) {
 -virReportSystemError(NULL, errno, %s,
 - _(failed to chdir into /new on tmpfs));
 +if (chdir(newroot)  0) {
 +virReportSystemError(NULL, errno,
 + _(failed to chroot into %s), newroot);

Yes, good.  We can probably pare it down later, but I'll look at that
once other stuff settles down.

 So I'm removing this chunk:
 
  if (chdir(/)  0)
  goto err;
 
 -if (umount2(.oldroot, MNT_DETACH)  0) {
 -virReportSystemError(NULL, errno, %s,
 - _(failed to lazily unmount old root));
 -goto err;
 -}
 -

Yeah as I added that I actually was wondering whether that would happen
- whether libvirt would try to make later bind mounts out of the old
fs which I'd umonted.  But I couldn't find where else it was umounted.
Glad you solved it :)

...
 Index: src/lxc_container.c
 ===
...

This all looks good, though I haven't tested it yet.

 +/*
 + * If doing a chroot style setup, we need to prepare
 + * a private /dev/pts for the child now, which they
 + * will later move into position.
 + *
 + * This is complex because 'virsh console' needs to
 + * use /dev/pts from the host OS, and the guest OS
 + * needs to use /dev/pts from the guest.
 + *
 + * This means that we (libvirt_lxc) need to see and
 + * use both /dev/pts instances. We're running in the
 + * host OS context though and don't want to expose
 + * the guest OS /dev/pts there.
 + *
 + * Thus we call unshare(CLONE_NS) so that we can see
 + * the guest's new /dev/pts, without it becoming
 + * visible to the host OS.
 + */

Calling unshare(CLONE_NEWNS) will not prevent the host OS from
seeing the new /dev/pts if / was MS_SHARED.  That isn't taken
care of anywhere else for this process's namespace, is it?

I assume the reason you want the new devpts not visible in the
host OS is so that it will be auto-umounted when the container is
released?

Thanks for doing this, the patch looks really good (minus MS_SHARED
bit).

-serge

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


Re: [libvirt] XML network model type stripped on define.

2009-04-15 Thread Gerrit Slomma

Daniel P. Berrange schrieb:

On Wed, Apr 15, 2009 at 12:00:34PM -0500, Adrian Garay wrote:
  

virsh --version returns 0.3.3



Yes, that's too old to support the NIC model setting.

You should be able to build the current libvirt release as an RPM for
RHEL-5 though.

Daniel
  

I too use RHEL5 (5.1 at work and 5.3 at home).
I use KVM-84 built from sourceforge-source.
I built libvirt-0.6.2 with the patch for RHEL5/CentOS5 issued yesterday, 
but:


- migration (live) does not work
- migration (unlive) of a live domain works, but i have to suspend and 
resume the domain on the target host and i boots up fine
- migration of a domain doesn't work if the domain is defined on the 
target host, but if it isn't define back-migration is not possible and 
the libvirt-daemon of the target-host hangs endless and must be rebooted.
- i have configured bridged lan via 
/etc/sysconfig/network-scripts/ifcfg-eth[01] and 
/etc/sysconfig/network-scripts/ifcfg-sw[01] respectively, virsh start 
for a domain only works if the fd was invoked by a kvm on the 
commandline, otherwise i get failed to add tap interface 'vnet%d' to 
bridge 'sw1' : invalid parameter - need to get back to work tomorrow to 
get more specific
- specifying target dev='vnet7'/ for a domain doesn't work, if i 
define the domain this parameter is stripped and is vanished if i do a 
dumpxml of the specific domain afterwards - i thought i could evade the 
vnet%d with this, but if i try to start the domain and do a dumpxml 
afterwards a target dev='vnet%d'/ is in the domain-specification


I think i should bundle this all into one new thread tomorrow when i am 
at work.
This is a show-stopper for a productive scenario (okay, devel-releases 
should not go productive), i think i would use kvm with 
command-line-script until this works - it is a pitty the RH Enterprise 
Virtualization Hypervisor is not out yet and no release-path is 
announced - i can not wait since my new servers are installed next week 
or the following one and i didn't like to use xen anymore and would 
definitely not go for VMWare with its fat TCO-footprint.


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


[libvirt] [PATCH 0/3] Drop pool lock during volume allocation

2009-04-15 Thread Cole Robinson
The following three patches rearrange storage volume creation so that we
can drop the pool lock during the long allocation process. This also has
the nice side effect of allowing storage allocation progress reporting,
if the API user polls the volume in a separate thread. This is currently
only implemented for FS volumes: all other volume creation will maintain
existing behavior.

Thanks,
Cole

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


[libvirt] [PATCH 1/3] Add 'asyncjobs' counter to storage pool

2009-04-15 Thread Cole Robinson
Add an 'asyncjobs' counter to the storage pool definition. The counter
tracks how many nonblocking jobs the pool is currently running, and
prevents the operations destroy, refresh, undefine, and delete.

Will be used for non-blocking volume creation.

- Cole
diff --git a/src/storage_conf.h b/src/storage_conf.h
index 4e35ccb..9c9fd3e 100644
--- a/src/storage_conf.h
+++ b/src/storage_conf.h
@@ -238,6 +238,7 @@ struct _virStoragePoolObj {
 char *autostartLink;
 int active;
 int autostart;
+unsigned int asyncjobs;
 
 virStoragePoolDefPtr def;
 virStoragePoolDefPtr newDef;
diff --git a/src/storage_driver.c b/src/storage_driver.c
index 97fcf69..8759ab2 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -564,6 +564,13 @@ storagePoolUndefine(virStoragePoolPtr obj) {
 goto cleanup;
 }
 
+if (pool-asyncjobs  0) {
+virStorageReportError(obj-conn, VIR_ERR_INTERNAL_ERROR,
+  _(pool '%s' has asynchronous jobs running.),
+  pool-def-name);
+goto cleanup;
+}
+
 if (virStoragePoolObjDeleteDef(obj-conn, pool)  0)
 goto cleanup;
 
@@ -696,6 +703,13 @@ storagePoolDestroy(virStoragePoolPtr obj) {
 goto cleanup;
 }
 
+if (pool-asyncjobs  0) {
+virStorageReportError(obj-conn, VIR_ERR_INTERNAL_ERROR,
+  _(pool '%s' has asynchronous jobs running.),
+  pool-def-name);
+goto cleanup;
+}
+
 if (backend-stopPool 
 backend-stopPool(obj-conn, pool)  0)
 goto cleanup;
@@ -745,6 +759,13 @@ storagePoolDelete(virStoragePoolPtr obj,
 goto cleanup;
 }
 
+if (pool-asyncjobs  0) {
+virStorageReportError(obj-conn, VIR_ERR_INTERNAL_ERROR,
+  _(pool '%s' has asynchronous jobs running.),
+  pool-def-name);
+goto cleanup;
+}
+
 if (!backend-deletePool) {
 virStorageReportError(obj-conn, VIR_ERR_NO_SUPPORT,
   %s, _(pool does not support volume delete));
@@ -788,6 +809,13 @@ storagePoolRefresh(virStoragePoolPtr obj,
 goto cleanup;
 }
 
+if (pool-asyncjobs  0) {
+virStorageReportError(obj-conn, VIR_ERR_INTERNAL_ERROR,
+  _(pool '%s' has asynchronous jobs running.),
+  pool-def-name);
+goto cleanup;
+}
+
 virStoragePoolObjClearVols(pool);
 if (backend-refreshPool(obj-conn, pool)  0) {
 if (backend-stopPool)
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] Add 'building' field to storage volume definition.

2009-04-15 Thread Cole Robinson
Add 'building' boolean field to storage volume definition.

If marked, the volume cannot be deleted. To be used for non-blocking
volume allocation.

- Cole
diff --git a/src/storage_conf.h b/src/storage_conf.h
index 9c9fd3e..8a4fed2 100644
--- a/src/storage_conf.h
+++ b/src/storage_conf.h
@@ -84,6 +84,8 @@ struct _virStorageVolDef {
 char *key;
 int type; /* virStorageVolType enum */
 
+unsigned int building;
+
 unsigned long long allocation;
 unsigned long long capacity;
 
diff --git a/src/storage_driver.c b/src/storage_driver.c
index 8759ab2..8cb8d4b 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -1294,6 +1294,13 @@ storageVolumeDelete(virStorageVolPtr obj,
 goto cleanup;
 }
 
+if (vol-building) {
+virStorageReportError(obj-conn, VIR_ERR_INTERNAL_ERROR,
+  _(volume '%s' is still being allocated.),
+  vol-name);
+goto cleanup;
+}
+
 if (!backend-deleteVol) {
 virStorageReportError(obj-conn, VIR_ERR_NO_SUPPORT,
   %s, _(storage pool does not support vol deletion));
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/3] Implement non-pool-blocking volume allocation for FS volumes

2009-04-15 Thread Cole Robinson
Implement non-pool-blocking volume allocation for FS volumes.

We setup the volume object, then drop the pool lock, and start the
actual storage allocation. Certain pool operations will be blocked
(start, stop, destroy, refresh), but the basic things like volume
listings will still work.

This also allows storage allocation progress reporting: the API user can
watch the volume object in a separate thread, polling it's 'info' for
update to date capacity/allocation reporting.

- Cole
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 350a931..b6ac8e0 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -46,6 +46,7 @@ virGetDomain;
 virGetNetwork;
 virGetStoragePool;
 virGetStorageVol;
+virUnrefStorageVol;
 virGetNodeDevice;
 virUnrefDomain;
 virUnrefConnect;
diff --git a/src/storage_backend.h b/src/storage_backend.h
index 7fab384..c9c1e35 100644
--- a/src/storage_backend.h
+++ b/src/storage_backend.h
@@ -34,6 +34,7 @@ typedef int (*virStorageBackendRefreshPool)(virConnectPtr conn, virStoragePoolOb
 typedef int (*virStorageBackendStopPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
 typedef int (*virStorageBackendDeletePool)(virConnectPtr conn, virStoragePoolObjPtr pool, unsigned int flags);
 
+typedef int (*virStorageBackendBuildVol)(virConnectPtr conn, virStorageVolDefPtr vol);
 typedef int (*virStorageBackendCreateVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol);
 typedef int (*virStorageBackendRefreshVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol);
 typedef int (*virStorageBackendDeleteVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, unsigned int flags);
@@ -52,6 +53,7 @@ struct _virStorageBackend {
 virStorageBackendStopPool stopPool;
 virStorageBackendDeletePool deletePool;
 
+virStorageBackendBuildVol buildVol;
 virStorageBackendCreateVol createVol;
 virStorageBackendRefreshVol refreshVol;
 virStorageBackendDeleteVol deleteVol;
diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c
index 5000f43..7a1bba8 100644
--- a/src/storage_backend_fs.c
+++ b/src/storage_backend_fs.c
@@ -982,16 +982,16 @@ virStorageBackendFileSystemDelete(virConnectPtr conn,
 
 
 /**
- * Allocate a new file as a volume. This is either done directly
- * for raw/sparse files, or by calling qemu-img/qcow-create for
- * special kinds of files
+ * Set up a volume definition to be added to a pool's volume list, but
+ * don't do any file creation or allocation. By separating the two processes,
+ * we allow allocation progress reporting (by polling the volume's 'info'
+ * function), and can drop the parent pool lock during the (slow) allocation.
  */
 static int
 virStorageBackendFileSystemVolCreate(virConnectPtr conn,
  virStoragePoolObjPtr pool,
  virStorageVolDefPtr vol)
 {
-int fd;
 
 if (VIR_ALLOC_N(vol-target.path, strlen(pool-def-target.path) +
 1 + strlen(vol-name) + 1)  0) {
@@ -1008,6 +1008,20 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
 return -1;
 }
 
+return 0;
+}
+
+/**
+ * Allocate a new file as a volume. This is either done directly
+ * for raw/sparse files, or by calling qemu-img/qcow-create for
+ * special kinds of files
+ */
+static int
+virStorageBackendFileSystemVolBuild(virConnectPtr conn,
+virStorageVolDefPtr vol)
+{
+int fd;
+
 if (vol-target.format == VIR_STORAGE_VOL_FILE_RAW) {
 if ((fd = open(vol-target.path, O_RDWR | O_CREAT | O_EXCL,
vol-target.perms.mode))  0) {
@@ -1017,6 +1031,16 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
 return -1;
 }
 
+/* Seek to the final size, so the capacity is available upfront
+ * for progress reporting */
+if (ftruncate(fd, vol-capacity)  0) {
+virReportSystemError(conn, errno,
+ _(cannot extend file '%s'),
+ vol-target.path);
+close(fd);
+return -1;
+}
+
 /* Pre-allocate any data if requested */
 /* XXX slow on non-extents-based file systems */
 /* FIXME: Add in progress bars  bg thread if progress bar requested */
@@ -1039,7 +1063,6 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
 virReportSystemError(conn, r,
  _(cannot fill file '%s'),
  vol-target.path);
-unlink(vol-target.path);
 close(fd);
 return -1;
 }
@@ -1052,22 +1075,12 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
 virReportSystemError(conn, r,
  _(cannot fill 

[libvirt] [PATCH] trivial fix for virsh return value bug

2009-04-15 Thread Daniel Veillard
https://bugzilla.redhat.com/show_bug.cgi?id=495954

virsh ttyconsole [node] always sets a return code of 1
we initialize ret to FALSE, but don't set it to TRUE when the operation
succeeds

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
Index: src/virsh.c
===
RCS file: /data/cvs/libxen/src/virsh.c,v
retrieving revision 1.200
diff -u -u -p -r1.200 virsh.c
--- src/virsh.c 3 Apr 2009 14:03:38 -   1.200
+++ src/virsh.c 15 Apr 2009 19:48:49 -
@@ -4930,6 +4930,7 @@ cmdTTYConsole(vshControl *ctl, const vsh
 goto cleanup;
 }
 vshPrint(ctl, %s\n, (const char *)obj-stringval);
+ret = TRUE;
 
  cleanup:
 xmlXPathFreeObject(obj);
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Re: [PATCH] add some text to http://libvirt.org/drvlxc.html

2009-04-15 Thread Daniel Veillard
On Wed, Apr 15, 2009 at 09:49:59AM -0500, Serge E. Hallyn wrote:
 --- drvlxc-orig.html  2009-04-15 09:36:48.0 -0500
 +++ drvlxc.html   2009-04-15 09:44:27.0 -0500
 @@ -140,7 +140,89 @@
/div
  
div id=content
 -h1LXC container driver/h1

  Cool, some doc is better than no doc, applied (but to drvlxc.html.in
since drvlxc.html is generated from it)

  Applied and commited as promised,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] [PATCH] trivial fix for virsh return value bug

2009-04-15 Thread Daniel Veillard
On Wed, Apr 15, 2009 at 09:49:23PM +0200, Daniel Veillard wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=495954
 
 virsh ttyconsole [node] always sets a return code of 1
 we initialize ret to FALSE, but don't set it to TRUE when the operation
 succeeds

  Since Dan found this too earlier today, I commited it,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


Re: [libvirt] libvirt 0.3.3 and unix_sock_group

2009-04-15 Thread Daniel Labrosse
Hi Daniel 

Thanks for getting back to me. The permissions on that directory look ok
to me, see below (cadc is the group specified in my libvirtd.conf).
Which leads me to think it could be something else.

labro...@proc5-09$ ls -la /var/run/libvirt
total 16
drwxr-xr-x  2 root root 4096 Apr 15 03:25 .
drwxr-xr-x 21 root root 4096 Apr 15 04:02 ..
srwxrwx---  1 root cadc0 Apr 15 03:25 libvirt-sock
srwxrwxrwx  1 root cadc0 Apr 15 03:25 libvirt-sock-ro

labro...@proc5-09$ ls -l /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root cadc 0 Apr 15 03:25 /var/run/libvirt/libvirt-sock

It seems as if its xen causing the issue (although i cannot see any
issues in the logs). I get a 'Xen Daemon error' when connecting as my
user. I have verified the xen daemon is running and I can sudo virsh
list without seeing any errors.

 labro...@proc5-09$ virsh list
 libvir: Xen Daemon error : internal error failed to connect to xend
 libvir: Xen Daemon error : internal error failed to connect to xend
  Id Name State
 --
   0 Domain-0 running
   7 1-d462220a-8dfe-4b7b-b853-a89f3cac2d46 blocked
 
 labro...@proc5-09$ sudo virsh list
  Id Name State
 --
   0 Domain-0 running
   7 1-d462220a-8dfe-4b7b-b853-a89f3cac2d46 blocked
 


Are you aware of any other configuration that needs to be done elsewhere?

thanks
Daniel


On Wed, 2009-04-15 at 10:08 +0100, Daniel P. Berrange wrote:
 On Tue, Apr 14, 2009 at 02:06:52PM -0700, Daniel Labrosse wrote:
  Hi All,
  
  I've been using libvirt 0..4.4 for a few weeks now. I have
  unix_sock_group = mygroup set so that i can perform non-root
  management capabilities on the host. 
  
  I have recently installed a new host running Scientific Linux 5.3 and
  libvirt 0.3.3 comes as default. First off, there is no libvirtd.conf
  file included with 0.3.3, so I copied the file from libvirt 0.4.4 (which
  is running on my Fedora 8 box).
 
 The 'unix_sock_group' config param *is* supported in 0.3.3, but the
 libvirtd  daemon will not change the group ownership in the directory
 /var/run/libvirt where the socket is created. So you almost certainly
 won't be able to access the socket itself. You could try chgrp'ing the
 directory. A good test is to make sure you can access the socket as
 non-root, eg
 
   ls -l /var/run/libvirt/libvirt-sock
 
 
 Daniel

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


RE: [libvirt] XML network model type stripped on define.

2009-04-15 Thread Adrian Garay
Updated to 0.6.0 and the problem is solved, thank you!

-Original Message-
From: Daniel P. Berrange [mailto:berra...@redhat.com] 
Sent: Wednesday, April 15, 2009 12:36 PM
To: Adrian Garay
Cc: libvir-list@redhat.com
Subject: Re: [libvirt] XML network model type stripped on define.

On Wed, Apr 15, 2009 at 12:00:34PM -0500, Adrian Garay wrote:
 virsh --version returns 0.3.3

Yes, that's too old to support the NIC model setting.

You should be able to build the current libvirt release as an RPM for
RHEL-5 though.

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] [Docs] More work on the API and architecture

2009-04-15 Thread Daniel Veillard
On Wed, Apr 15, 2009 at 09:54:30AM +0100, Daniel P. Berrange wrote:
 On Tue, Apr 14, 2009 at 03:43:18PM +0200, Daniel Veillard wrote:
Another patch, incomplete adding a new page api.html[.in]
  with the goals of describing the main API concepts, architectures,
  naming conventions, etc ... It includes Dan's graphics and a change of
  how the stylesheet process the .html.in content allowing to turn
  code class='docref'foo/code into a link to reference for foo in the
  API page. Ultimately I should be able to load the API description from
  the stylesheet and do that link generation automagically without any
  markup (like all the links in the API reference).
Still need to write the drivers and remote sections, and augment some
  of the APIs entry points, but it's a first step and better in than out.
 
 Looks good, but its missing Makefile.am rule to generate the images
 from the .fig files. It'd be nicer to use PNG instead of GIF and
 get nicely anti-aliased, transparent background images. ImageMagick
 can do this fairly easily using a rule like
 
 %.png: %.fig
   convert -rotate 90 $ $@
 
 The 'rotate 90' bit is because for some wierd reason it defaults to
 rotating it 90 degrees in a direction you don't want unless you look
 at images side-ways on :-)

  Okay, I didn't know of that trick, so switched to png, I added the
conversion rule but no more explicit make target to avoid some build
in random condition trying to rebuild the PNGs and breaking because
ImageMagic support is missing.
  All commited, but there is still missing pieces on that page,
I will try to work on it before the 0.6.3 release,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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