Re: [libvirt] Some problem with the save function

2009-09-17 Thread Daniel Berteaud
Le mercredi 16 septembre 2009 à 22:14 +0100, Daniel P. Berrange a
écrit :

 Ok, I'd recommend filing a bug report against libvirt then with at
 least the folowing information
 
  - The guest XML file
  - The guest log from /var/log/libvirt/qemu/$GUEST.log after the
restore failed
  - Edit /etc/libvirt/libvirtd.conf and set
 
  log_level=1
  log_filters=1:libvirt 1:qemu 1:util
  log_outputs=1:file:/var/log/libvirt/daemon.log
 
and then restart libvirtd, and try the save/restore again. Then
upload the log you get to the bug
  - Version of QEMU or KVM used
 
 That ought to help us diagnose the problem futher

Thanks for helping me reporting that ;)
Bug opened: https://bugzilla.redhat.com/show_bug.cgi?id=523916

Should I open separated bug for the other problem reported (save with
qemu user and cat -c) ?

Regards, Daniel

 
 Regards,
 Daniel
-- 
Daniel Berteaud
FIREWALL-SERVICES SARL.
Société de Services en Logiciels Libres
Technopôle Montesquieu
33650 MARTILLAC
Tel : 05 56 64 15 32
Fax : 05 56 64 15 32
Mail: dan...@firewall-services.com
Web : http://www.firewall-services.com

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


[libvirt] Re: SOLVED kvm networking on debian unstable

2009-09-17 Thread Thomas Koch
The solution is, to delete 

/etc/udev/rules.d/70-persistent-net.rules

in the guest and reboot. This is an autogenerated file, which stores the 
mapping of MAC adresses to interface names. Since my MAC address changed, the 
interface wasn't automatically added anymore.

found at:
http://vmfaq.com/entry/24/

Thomas Koch, http://www.koch.ro

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


Re: [libvirt] Re: OpenVZ : The restriction of domain name should be addressed

2009-09-17 Thread Yuji NISHIDA

Hi Daniel

Fixed patch according to your comments in openvzDomainDefineCmd func.

--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -101,6 +101,9 @@ static int openvzDomainDefineCmd(virConnectPtr conn,
 virDomainDefPtr vmdef)
{
int narg;
+int veid;
+int max_veid;
+FILE *fp;

for (narg = 0; narg  maxarg; narg++)
args[narg] = NULL;
@@ -130,6 +133,38 @@ static int openvzDomainDefineCmd(virConnectPtr  
conn,

ADD_ARG_LIT(VZCTL);
ADD_ARG_LIT(--quiet);
ADD_ARG_LIT(create);
+
+if ((fp = popen(VZLIST  -a -ovpsid -H 2/dev/null, r)) ==  
NULL) {
+openvzError(NULL, VIR_ERR_INTERNAL_ERROR, %s, _(popen  
failed));

+return -1;
+}
+max_veid = 0;
+while(!feof(fp)) {
+if (fscanf(fp, %d\n, veid ) != 1) {
+if (feof(fp))
+break;
+
+openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
+%s, _(Failed to parse vzlist output));
+goto cleanup;
+}
+if(veid  max_veid){
+max_veid = veid;
+}
+}
+fclose(fp);
+
+if(max_veid == 0){
+max_veid = 100;
+}else{
+max_veid++;
+}
+
+char str_id[10];
+sprintf( str_id, %d, max_veid++ );
+ADD_ARG_LIT(str_id);
+
+ADD_ARG_LIT(--name);
ADD_ARG_LIT(vmdef-name);

if (vmdef-nfss == 1 
@@ -151,6 +186,11 @@ static int openvzDomainDefineCmd(virConnectPtr  
conn,

openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_(Could not put argument to %s), VZCTL);
return -1;
+
+  cleanup:
+fclose(fp);
+return -1;
+
#undef ADD_ARG
#undef ADD_ARG_LIT
}



-
Yuji Nishida
nish...@nict.go.jp

On 2009/09/15, at 18:59, Daniel P. Berrange wrote:


On Tue, Sep 15, 2009 at 03:40:09PM +0900, Yuji NISHIDA wrote:

Hi Daniel,

I didn't realize that I even did not follow the manner of XML.
I have worked with this problem and got a small patch to handle ID
in OpenVZ functionality.
I found it is working well with the XML script included ID in  
domain

tag.

I am concerned that I had to edit the common file domain_conf.c.
I still believe I should keep it away from this problem for
compatibility with the others.
How do you think can I avoid this?


The 'id' value is not intended to be settable by the end user,
which is why the domain_conf.c parser does not parse it by
default.

So for your usage in OpenVZ, you'll need to auto-assign an 'id'
value when creating a new guest. eg, get a list of existing
OpenVZ guest 'id' values and then pick the first one which is
not used.


diff --git a/src/openvz_driver.c b/src/openvz_driver.c
index a8c24ba..c0c1e0f 100644
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -130,6 +131,11 @@ static int openvzDomainDefineCmd(virConnectPtr
conn,
   ADD_ARG_LIT(VZCTL);
   ADD_ARG_LIT(--quiet);
   ADD_ARG_LIT(create);
+
+sprintf( str_id, %d, vmdef-id );
+ADD_ARG_LIT(str_id);
+
+ADD_ARG_LIT(--name);
   ADD_ARG_LIT(vmdef-name);


This is where you need to pull in an auto-assigned ID value
instead of using vmdef-id.


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


[libvirt] Refactor libvirt spec file

2009-09-17 Thread Daniel P. Berrange
The following patch refactors the libvirt spec file conditional
logic to make it a little easier to manage all the different
Fedora/RHEL OS build variations, and also allow for easy 
creation of a client-only build

The patch follows, but I'm including the full specfile below
too, since its easier to understand than the diff

# -*- rpm-spec -*-

# A client only build will create a libvirt.so only containing
# the generic RPC driver, and test driver and no libvirtd
# Default to a full server + client build
%define client_only0

# Now turn off server build in certain cases

# RHEL-5 builds are client-only for s390, ppc
%if 0%{?rhel} == 5
%ifnarch i386 i586 i686 x86_64 ia64
%define client_only1
%endif
%endif

# Disable all server side drivers if client only build requested
%if %{client_only}
%define server_drivers 0
%else
%define server_drivers 1
%endif


# Now set the defaults for all the important features, independant
# of any particular OS

# First the daemon itself
%define with_libvirtd  0%{!?_without_libvirtd:%{server_drivers}}
%define with_avahi 0%{!?_without_avahi:%{server_drivers}}

# Then the hypervisor drivers
%define with_xen   0%{!?_without_xen:%{server_drivers}}
%define with_xen_proxy 0%{!?_without_xen_proxy:%{server_drivers}}
%define with_qemu  0%{!?_without_qemu:%{server_drivers}}
%define with_openvz0%{!?_without_openvz:%{server_drivers}}
%define with_lxc   0%{!?_without_lxc:%{server_drivers}}
%define with_vbox  0%{!?_without_vbox:%{server_drivers}}
%define with_uml   0%{!?_without_uml:%{server_drivers}}
%define with_one   0%{!?_without_one:%{server_drivers}}
%define with_phyp  0%{!?_without_phyp:%{server_drivers}}
%define with_esx   0%{!?_without_esx:%{server_drivers}}

# Then the secondary host drivers
%define with_network   0%{!?_without_network:%{server_drivers}}
%define with_storage_fs0%{!?_without_storage_fs:%{server_drivers}}
%define with_storage_lvm   0%{!?_without_storage_lvm:%{server_drivers}}
%define with_storage_iscsi 0%{!?_without_storage_iscsi:%{server_drivers}}
%define with_storage_disk  0%{!?_without_storage_disk:%{server_drivers}}
%define with_storage_mpath 0%{!?_without_storage_mpath:%{server_drivers}}
%define with_numactl   0%{!?_without_numactl:%{server_drivers}}
%define with_selinux   0%{!?_without_selinux:%{server_drivers}}
%define with_hal   0%{!?_without_hal:%{server_drivers}}

# A few optional bits off by default, we enable later
%define with_polkit0%{!?_without_polkit:0}
%define with_capng 0%{!?_without_capng:0}
%define with_netcf 0%{!?_without_netcf:0}

# Non-server/HV driver defaults which are always enabled
%define with_python0%{!?_without_python:1}
%define with_sasl  0%{!?_without_sasl:1}


# Finally set the OS / architecture specific special cases

# Xen is available only on i386 x86_64 ia64
%ifnarch i386 i586 i686 x86_64 ia64
%define with_xen 0
%endif


# RHEL doesn't ship OpenVZ, VBox, UML, OpenNebula, PowerHypervisor or ESX
%if 0%{?rhel}
%define with_openvz 0
%define with_vbox 0
%define with_uml 0
%define with_one 0
%define with_phyp 0
%define with_esx 0
%endif

# RHEL-5 has restricted QEMU to x86_64 only and is too old for LXC
%if 0%{?rhel} == 5
%ifnarch x86_64
%define with_qemu 0
%endif
%define with_lxc 0
%endif

# RHEL-6 has restricted QEMU to x86_64 only, stopped including Xen
# on all archs. Other archs all have LXC available though
%if 0%{?rhel} = 6
%ifnarch x86_64
%define with_qemu 0
%endif
%define with_xen 0
%endif
# If Xen isn't turned on, we shouldn't build the xen proxy either
%if ! %{with_xen}
%define with_xen_proxy 0
%endif

# Fedora doesn't have any QEMU on ppc64 - only ppc
%if 0%{?fedora}
%ifarch ppc64
%define with_qemu 0
%endif
%endif

# PolicyKit was introduced in Fedora 8 / RHEL-6 or newer, allowing
# the setuid Xen proxy to be killed off
%if 0%{?fedora} = 8 || 0%{?rhel} = 6
%define with_polkit0%{!?_without_polkit:1}
%define with_xen_proxy 0
%endif

# libcapng is used to manage capabilities in Fedora 12 / RHEL-6 or newer
%if 0%{?fedora} = 12 || 0%{?rhel} = 6
%define with_capng 0%{!?_without_capng:1}
%endif

# netcf is used to manage network interfaces in Fedora 12 / RHEL-6 or newer
%if 0%{?fedora} = 12 || 0%{?rhel} = 6
%define with_netcf 0%{!?_without_netcf:%{server_drivers}}
%endif

# Force QEMU to run as non-root
%if 0%{?fedora} = 12 || 0%{?rhel} = 6
%define qemu_user  qemu
%define qemu_group  qemu
%else
%define qemu_user  root
%define qemu_group  root
%endif


# The RHEL-5 Xen package has some feature backports. This
# flag is set to enable use of those special bits on RHEL-5
%if 0%{?rhel} == 5
%define with_rhel5  1
%else
%define with_rhel5  0
%endif


Summary: Library providing a simple API virtualization
Name: libvirt
Version: 0.7.1
Release: 1%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
Source: 

[libvirt] [PATCH] Refactor libvirt.spec to allow client-only builds

2009-09-17 Thread Daniel P. Berrange
Some architectures in certain RHEL versions do not include any
hypervisors. Update the specfile to allow those to easily build
a remote client only version of libvirt. ie no libvirtd related
bits at all.

* qemud/Makefile.am: Always instal SASL config since its needed
  by client too
* libvirt.spec.in: Re-factor specfile conditionals to allow entire
  server side build to be disabled easily, eg a remote client only
  build. Make RHEL-5 do client only build for s390/ppc. Enable LXC
  on RHEL-6. Enable all Fedora = 6 features on RHEL-6 too. Add some
  more conditionals around dnsmasq/iptables/hal Requires tags.
  Add missing e2fsprogs-devel BR for RHEL-5 as workaround for broken
  parted. Fix the device mapper BR for RHEL-5. Add conditional rules
  for ESX build. Add conditional rules for SELinux + HAL builds.
  Fix a mistaken %{with_qemu} to be %{with_network} when setting
  up default network XML
---
 libvirt.spec.in   |  214 -
 qemud/Makefile.am |   31 
 2 files changed, 180 insertions(+), 65 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index f4cfbf1..0ab3b4e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1,60 +1,133 @@
 # -*- rpm-spec -*-
 
-%define with_xen   0%{!?_without_xen:1}
-%define with_xen_proxy 0%{!?_without_xen_proxy:1}
-%define with_qemu  0%{!?_without_qemu:1}
-%define with_openvz0%{!?_without_openvz:1}
-%define with_lxc   0%{!?_without_lxc:1}
-%define with_vbox  0%{!?_without_vbox:1}
-%define with_sasl  0%{!?_without_sasl:1}
-%define with_avahi 0%{!?_without_avahi:1}
-%define with_python0%{!?_without_python:1}
-%define with_libvirtd  0%{!?_without_libvirtd:1}
-%define with_uml   0%{!?_without_uml:1}
-%define with_one   0%{!?_without_one:1}
-%define with_phyp  0%{!?_without_phyp:1}
-%define with_network   0%{!?_without_network:1}
-%define with_storage_fs0%{!?_without_storage_fs:1}
-%define with_storage_lvm   0%{!?_without_storage_lvm:1}
-%define with_storage_iscsi 0%{!?_without_storage_iscsi:1}
-%define with_storage_disk  0%{!?_without_storage_disk:1}
-%define with_storage_mpath 0%{!?_without_storage_mpath:1}
-%define with_numactl   0%{!?_without_numactl:1}
-
-# default to off - selectively enabled below
+# A client only build will create a libvirt.so only containing
+# the generic RPC driver, and test driver and no libvirtd
+# Default to a full server + client build
+%define client_only0
+
+# Now turn off server build in certain cases
+
+# RHEL-5 builds are client-only for s390, ppc
+%if 0%{?rhel} == 5
+%ifnarch i386 i586 i686 x86_64 ia64
+%define client_only1
+%endif
+%endif
+
+# Disable all server side drivers if client only build requested
+%if %{client_only}
+%define server_drivers 0
+%else
+%define server_drivers 1
+%endif
+
+
+# Now set the defaults for all the important features, independant
+# of any particular OS
+
+# First the daemon itself
+%define with_libvirtd  0%{!?_without_libvirtd:%{server_drivers}}
+%define with_avahi 0%{!?_without_avahi:%{server_drivers}}
+
+# Then the hypervisor drivers
+%define with_xen   0%{!?_without_xen:%{server_drivers}}
+%define with_xen_proxy 0%{!?_without_xen_proxy:%{server_drivers}}
+%define with_qemu  0%{!?_without_qemu:%{server_drivers}}
+%define with_openvz0%{!?_without_openvz:%{server_drivers}}
+%define with_lxc   0%{!?_without_lxc:%{server_drivers}}
+%define with_vbox  0%{!?_without_vbox:%{server_drivers}}
+%define with_uml   0%{!?_without_uml:%{server_drivers}}
+%define with_one   0%{!?_without_one:%{server_drivers}}
+%define with_phyp  0%{!?_without_phyp:%{server_drivers}}
+%define with_esx   0%{!?_without_esx:%{server_drivers}}
+
+# Then the secondary host drivers
+%define with_network   0%{!?_without_network:%{server_drivers}}
+%define with_storage_fs0%{!?_without_storage_fs:%{server_drivers}}
+%define with_storage_lvm   0%{!?_without_storage_lvm:%{server_drivers}}
+%define with_storage_iscsi 0%{!?_without_storage_iscsi:%{server_drivers}}
+%define with_storage_disk  0%{!?_without_storage_disk:%{server_drivers}}
+%define with_storage_mpath 0%{!?_without_storage_mpath:%{server_drivers}}
+%define with_numactl   0%{!?_without_numactl:%{server_drivers}}
+%define with_selinux   0%{!?_without_selinux:%{server_drivers}}
+%define with_hal   0%{!?_without_hal:%{server_drivers}}
+
+# A few optional bits off by default, we enable later
 %define with_polkit0%{!?_without_polkit:0}
 %define with_capng 0%{!?_without_capng:0}
 %define with_netcf 0%{!?_without_netcf:0}
 
+# Non-server/HV driver defaults which are always enabled
+%define with_python0%{!?_without_python:1}
+%define with_sasl  0%{!?_without_sasl:1}
+
+
+# Finally set the OS / architecture specific special cases
+
 # Xen is 

Re: [libvirt] [PATCH] Refactor libvirt.spec to allow client-only builds

2009-09-17 Thread Daniel Veillard
On Thu, Sep 17, 2009 at 01:14:22PM +0100, Daniel P. Berrange wrote:
 Some architectures in certain RHEL versions do not include any
 hypervisors. Update the specfile to allow those to easily build
 a remote client only version of libvirt. ie no libvirtd related
 bits at all.
 
 * qemud/Makefile.am: Always instal SASL config since its needed
   by client too
 * libvirt.spec.in: Re-factor specfile conditionals to allow entire
   server side build to be disabled easily, eg a remote client only
   build. Make RHEL-5 do client only build for s390/ppc. Enable LXC
   on RHEL-6. Enable all Fedora = 6 features on RHEL-6 too. Add some
   more conditionals around dnsmasq/iptables/hal Requires tags.
   Add missing e2fsprogs-devel BR for RHEL-5 as workaround for broken
   parted. Fix the device mapper BR for RHEL-5. Add conditional rules
   for ESX build. Add conditional rules for SELinux + HAL builds.
   Fix a mistaken %{with_qemu} to be %{with_network} when setting
   up default network XML

  ACK, very nice cleanup, allows to keep an unified spec file for
very diverse builds and it's way easier to find now what is
(des)activated, where and why !

   thanks a lot !

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] Refactor libvirt spec file

2009-09-17 Thread Daniel P. Berrange
On Thu, Sep 17, 2009 at 03:23:29PM +0200, Matthias Bolte wrote:
 2009/9/17 Daniel P. Berrange berra...@redhat.com:
  The following patch refactors the libvirt spec file conditional
  logic to make it a little easier to manage all the different
  Fedora/RHEL OS build variations, and also allow for easy
  creation of a client-only build
 
  The patch follows, but I'm including the full specfile below
  too, since its easier to understand than the diff
 
  # -*- rpm-spec -*-
 
  # A client only build will create a libvirt.so only containing
  # the generic RPC driver, and test driver and no libvirtd
  # Default to a full server + client build
  %define client_only        0
 
  # Now turn off server build in certain cases
 
  # RHEL-5 builds are client-only for s390, ppc
  %if 0%{?rhel} == 5
  %ifnarch i386 i586 i686 x86_64 ia64
  %define client_only        1
  %endif
  %endif
 
  # Disable all server side drivers if client only build requested
  %if %{client_only}
  %define server_drivers     0
  %else
  %define server_drivers     1
  %endif
 
 
  # Now set the defaults for all the important features, independant
  # of any particular OS
 
  # First the daemon itself
  %define with_libvirtd      0%{!?_without_libvirtd:%{server_drivers}}
  %define with_avahi         0%{!?_without_avahi:%{server_drivers}}
 
  # Then the hypervisor drivers
  %define with_xen           0%{!?_without_xen:%{server_drivers}}
  %define with_xen_proxy     0%{!?_without_xen_proxy:%{server_drivers}}
  %define with_qemu          0%{!?_without_qemu:%{server_drivers}}
  %define with_openvz        0%{!?_without_openvz:%{server_drivers}}
  %define with_lxc           0%{!?_without_lxc:%{server_drivers}}
  %define with_vbox          0%{!?_without_vbox:%{server_drivers}}
  %define with_uml           0%{!?_without_uml:%{server_drivers}}
  %define with_one           0%{!?_without_one:%{server_drivers}}
  %define with_phyp          0%{!?_without_phyp:%{server_drivers}}
  %define with_esx           0%{!?_without_esx:%{server_drivers}}
 
 Technically the phyp and esx drivers are client side drivers, because
 they don't rely on libvirtd for their remote communication. If the
 phyp and esx drivers are disabled due to a client only build, then the
 access to phyp and esx servers (using this client only build) is not
 possible, because there is no libvirtd running on phyp and esx servers
 a client only libvirt could connect to.

Good point - I'll make them toggle independantly on the 'server_drivers'
flag.

 [...]
  %if %{with_phyp}
  BuildRequires: libssh2-devel
  %endif
 
 The build requirement for libssh2-devel should have an explicit check
 for version = 1.0.
 
 I think a build requirement for libcurl is missing here.
 
 %if %{with_esx}
 BuildRequires: libcurl-devel  7.18.0
 %endif

I think that's pulled in to the build roots automatically, but there's
no harm in adding an explicit requires 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] guests and pulseaudio fighting over audio devices

2009-09-17 Thread Dave Allan

Daniel P. Berrange wrote:

On Tue, Sep 15, 2009 at 04:45:31PM -0400, Dave Allan wrote:
I noticed that when a KVM guest created with virt-manager is running on 
F10, sound on the physical host stops working.  When all VMs are 
shutdown, sound starts working again.  Removing the sound tag from the 
VM XML allows sound to work while the VM is booted.  To further 
complicate troubleshooting, if audio is already playing when the guest 
is started it keeps playing, since pulse already has the device open.


The message in /var/log/messages when I try to play audio is:

pulseaudio[6492]: module-alsa-sink.c: Error opening PCM device front:0: 
Device or resource busy


strace of pulseaudio shows:

open(/dev/snd/pcmC0D0p, O_RDWR|O_NONBLOCK) = -1 EBUSY (Device or 
resource busy)


but fuser and lsof show nothing.  A trivial test program also sees 
Device or resource busy when trying to open /dev/snd/pcmC0D0p


I am in favor of removing the sound tag from the default 
configuration, since I don't use sound from within guests and I do use 
sound on my desktop, but perhaps this behavior is specific to my 
configuration.  I haven't investigated it exhaustively.  What does 
everybody else think?


It is complicated :-)  In Fedora = 11 we currently disable all use of
sound cards, but this upsets people who want sound ;-P  I'm working
on a new version of the patch which sets up audio-over-VNC, while for
SDL allows the host audio backend to be used  configured.

I still need to finish my GTK-VNC patches to do the client end of 
audio over VNC, then it'll all play correctly with desktop audio

services via gstreamer/pulseaudio


Sounds good--I'm looking forward to it (not that I really use sound in 
VMs, but that sounds like the right way to do it.)


Dave

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


Re: [libvirt] [PATCH 00/11] Generic data stream handling

2009-09-17 Thread Chris Lalancette
Daniel P. Berrange wrote:
 I still see a safewrite() in the your virStreamWrite() impl in the
 code currently pushed to gitorious.or, but perhaps you've changed
 that locally already. The other thing is that if the stream  open

Yeah, sorry, I just never pushed it up to gitorious.  I'll make the changes
along with the virSetNonBlock() and push it up there, probably tomorrow.

 flags included VIR_STREAM_NONBLOCK, you must make sur eyou put your
 socket in non-blocking mode, eg
 
 if ((st-flags  VIR_STREAM_NONBLOCK) 
 virSetNonBlock(create ? fds[1] : fds[0])  0) {
 virReportSystemError(st-conn, errno, %s,
  _(cannot make stream non-blocking));
 goto error;
 }
 
 in your stream open method. That shouldn't have caused a crash though - it
 would merely make libvirtd non-responsive for a while it QEMU blocked
 the incoming migration socket.
 
 
 All in all though the code looks reasonable and I don't see any obvious
 problems. I'll have to try running it to see if any crash appears

Thanks.

-- 
Chris Lalancette

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


Re: [libvirt] [PATCH 00/11] Generic data stream handling

2009-09-17 Thread Daniel P. Berrange
On Tue, Sep 15, 2009 at 02:35:02PM +0200, Chris Lalancette wrote:
 Daniel P. Berrange wrote:
  The immediate use case for this data stream code is Chris' QEMU
  migration patchset.
  
  The next use case is to allow serial console access to be tunnelled
  over libvirtd, eg to make  'virsh console GUEST' work remotely.
  This use case is why I included the support for non-blocking data
  streams and event loop integration (not required for Chris'
  migration use case)
  
  Anyway, assuming Chris confirms that I've not broken his code, then
  patches 1-6 are targetted for this next release.
 
 I'm sorry for the very long delay in getting back to this.  I've been playing
 around with my tunnelled migration patches on top of this code, and I just 
 can't
 seem to make the new nonblocking stuff work properly.  I'm getting a couple of
 behaviors that are highly undesirable:
 
 1)  Immediately after starting the stream, I get a virStreamRecv() callback on
 the destination side.  The problem is that this is wrong for migration; 
 there's
 no data that I can read *from* the destination qemu process which makes any
 sense.  While I could implement the method and just throw away the data, that
 doesn't seem right to me.  This leads to...

I realize this is due to the remoteAddClientStream() method in
qemud/stream.c. It unconditionally sets 'stream-tx' to 1. I
didn't notice the problem myself, since the test driver is using
pipes which are unidirectional, but yor UNIX domain socket is
bi-directional.

We could either add a flag to remoteAddClientStream() to indicate
whether the stream should allow read or write or both. Or you
might be able to call   shutdown(sockfd, SHUT_RD) on your UNIX
socket to indicate that its only going to be used for write
effectively making it unidirectional.

A 3rd option is to define more flags for virStreamNew(), one for
READ, one for WRITE, and have the remote daemon pay attention to
these

 2)  A crash in libvirtd on the source side of the destination.  It doesn't
 happen every single time, but when it has happened I've traced it down to the
 fact that src/remote_internal.c:remoteDomainEventFired() can get called 
 *after*
 conn-privateData has been set to NULL, leading to a SEGV on NULL pointer
 dereference.  I can provide a core-dump for this if needed.

I don't have any explanation for this - its a little wierd and we ought
to try and figure it out if possible.

 3) (minor) The python bindings refuse to build with these patches in place.

Yeah I completely forgot to add rules for virSecret APIs there

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] [PATCH 1/2] Fix net/disk hot-unplug segfault

2009-09-17 Thread Mark McLoughlin
When we hot-unplug the last device, we're currently double-freeing
the device definition.

Reported by Michal Nowak here:

  https://bugzilla.redhat.com/523953

* src/qemu_driver.c: fix double free
---
 src/qemu_driver.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index a65334f..de31581 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -5998,7 +5998,7 @@ try_command:
 /* ignore, harmless */
 }
 } else {
-VIR_FREE(vm-def-disks[0]);
+VIR_FREE(vm-def-disks);
 vm-def-ndisks = 0;
 }
 virDomainDiskDefFree(detach);
@@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
 /* ignore, harmless */
 }
 } else {
-VIR_FREE(vm-def-nets[0]);
+VIR_FREE(vm-def-nets);
 vm-def-nnets = 0;
 }
 virDomainNetDefFree(detach);
-- 
1.6.2.5

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


[libvirt] [PATCH 2/2] Fix leak in PCI hostdev hot-unplug

2009-09-17 Thread Mark McLoughlin
* src/qemu_driver.c: sync the hostdev hot-unplug code with the disk/net
  code.
---
 src/qemu_driver.c |   20 +---
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index de31581..2ddcdc0 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -6206,14 +6206,20 @@ static int
qemudDomainDetachHostPciDevice(virConnectPtr conn,
 pciFreeDevice(conn, pci);
 }
 
-if (i != --vm-def-nhostdevs)
-memmove(vm-def-hostdevs[i],
-vm-def-hostdevs[i+1],
-sizeof(*vm-def-hostdevs) * (vm-def-nhostdevs-i));
-if (VIR_REALLOC_N(vm-def-hostdevs, vm-def-nhostdevs)  0) {
-virReportOOMError(conn);
-ret = -1;
+if (vm-def-nhostdevs  1) {
+memmove(vm-def-hostdevs + i,
+vm-def-hostdevs + i + 1,
+sizeof(*vm-def-hostdevs) *
+(vm-def-nhostdevs - (i + 1)));
+vm-def-nhostdevs--;
+if (VIR_REALLOC_N(vm-def-hostdevs, vm-def-nhostdevs)  0) {
+/* ignore, harmless */
+}
+} else {
+VIR_FREE(vm-def-hostdevs);
+vm-def-nhostdevs = 0;
 }
+virDomainHostdevDefFree(detach);
 
 return ret;
 }
-- 
1.6.2.5

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


[libvirt] Re: [PATCH 1/2] Fix net/disk hot-unplug segfault

2009-09-17 Thread Mark McLoughlin
On Thu, 2009-09-17 at 16:02 +0100, Mark McLoughlin wrote:
 When we hot-unplug the last device, we're currently double-freeing
 the device definition.
 
 Reported by Michal Nowak here:
 
   https://bugzilla.redhat.com/523953

Sorry, I got bugs mixed up, it was Martin Banas who reported this.

Cheers,
Mark.

 
 * src/qemu_driver.c: fix double free
 ---
  src/qemu_driver.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/qemu_driver.c b/src/qemu_driver.c
 index a65334f..de31581 100644
 --- a/src/qemu_driver.c
 +++ b/src/qemu_driver.c
 @@ -5998,7 +5998,7 @@ try_command:
  /* ignore, harmless */
  }
  } else {
 -VIR_FREE(vm-def-disks[0]);
 +VIR_FREE(vm-def-disks);
  vm-def-ndisks = 0;
  }
  virDomainDiskDefFree(detach);
 @@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
  /* ignore, harmless */
  }
  } else {
 -VIR_FREE(vm-def-nets[0]);
 +VIR_FREE(vm-def-nets);
  vm-def-nnets = 0;
  }
  virDomainNetDefFree(detach);

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


Re: [libvirt] Refactor libvirt spec file

2009-09-17 Thread Daniel Veillard
On Thu, Sep 17, 2009 at 02:33:53PM +0100, Daniel P. Berrange wrote:
 On Thu, Sep 17, 2009 at 03:23:29PM +0200, Matthias Bolte wrote:
  2009/9/17 Daniel P. Berrange berra...@redhat.com:
  
  %if %{with_esx}
  BuildRequires: libcurl-devel  7.18.0
  %endif
 
 I think that's pulled in to the build roots automatically, but there's
 no harm in adding an explicit requires too.

  Another one, there is no numactl on s390[x]

thanks :-)

Daniel

---
paphio:~/fcpkgs/libvirt/devel - cvs -z9 diff -r 1.177 libvirt.spec
Index: libvirt.spec
===
RCS file: /cvs/pkgs/rpms/libvirt/devel/libvirt.spec,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- libvirt.spec17 Sep 2009 12:32:32 -  1.177
+++ libvirt.spec17 Sep 2009 13:30:50 -  1.178
@@ -69,6 +69,10 @@
 %define with_xen 0
 %endif
 
+# Numactl is not available on s390[x]
+%ifarch s390 s390x
+%define with_numactl 0
+%endif
 
 # RHEL doesn't ship OpenVZ, VBox, UML, OpenNebula, PowerHypervisor or
 # ESX
 %if 0%{?rhel}
--

-- 
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 00/11] Generic data stream handling

2009-09-17 Thread Daniel P. Berrange
In looking at your migration patches I realized we could tweak
things a little bit to allow the implementation of a new style
migration API which does not require the destination virConnectPtr
object. More importantly this could be used independantly of
the tunnelled migration. So the patch that follows takes the
public API bits of your migration code and adds a new flag
VIR_MIGRATE_PEER2PEER, and virDomainMigrateToURI method. It
implements it for the Xen driver. 

For the QEMU driver you already have code which copes with the
combination of VIR_MIGRATE_PEER2PEER + VIR_MIGRATE_TUNNELLED.
We could easily adapt that to also cope with doing a migration
using VIR_MIGRATE_PEER2PEER on its own. ie, source libvirtd
opens connection to destination libvirtd, runs the existing
prepare method, then uses QEMU monitor todo a plain TCP migration
and then invokes the existing finish method. 

This patch applies between the data streams code  your migration
code - it'll clash a little - it ought to cover everything you
have relating to the public API with exception of the new internal
method virDomainMigratePrepareTunnel

Regards,
Daniel

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


[libvirt] [PATCH] Support a new peer-to-peer migration mode public API

2009-09-17 Thread Daniel P. Berrange
Introduces several new public API options for migration

 - VIR_MIGRATE_PEER2PEER: With this flag the client only
   invokes the virDomainMigratePerform method, expecting
   the source host driver to do whatever is required to
   complete the entire migration process.
 - VIR_MIGRATE_TUNNELLED: With this flag the actual data
   for migration will be tunnelled over the libvirtd RPC
   channel. This requires that VIR_MIGRATE_PEER2PEER is
   also set.
 - virDomainMigrateToURI: This is variant of the existing
   virDomainMigrate method which can be used when the
   VIR_MIGRATE_PEER2PEER flag is set. The benefit of this
   method is that no virConnectPtr object is required for
   the destination host, only a destination URI.

The URI for VIR_MIGRATE_TUNNELLED must be a valid libvirt
URI. For non-tunnelled migration a hypervisor specific
migration URI is used.

* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in:
  Add VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_TUNNELLED and
  virDomainMigrateToURI.
* src/driver.h: Remove feature flags
* src/libvirt_internal.h: Add feature flags, and include
  new VIR_FEATURE_MIGRATE_P2P indicating support for the
  new VIR_MIGRATE_PEER2PEER mode.
* src/libvirt.c: Implement support for VIR_MIGRATE_PEER2PEER
  and virDomainMigrateToURI APIs.
* src/virsh.c: Add --p2p and --tunnelled args and use the
  new virDomainMigrateToURI method where possible.
* src/xen_unified.c: Advertise support for P2P migration
* src/xend_internal.c: Accept VIR_MIGRATE_PEER2PEER flag.
* src/libvirt_public.syms: Export virDomainMigrateToURI
  method
---
 include/libvirt/libvirt.h|8 ++-
 include/libvirt/libvirt.h.in |8 ++-
 src/driver.h |   19 
 src/internal.h   |2 +
 src/libvirt.c|  224 +-
 src/libvirt_internal.h   |   30 ++
 src/libvirt_public.syms  |1 +
 src/virsh.c  |   42 ++--
 src/xen_unified.c|7 +-
 src/xend_internal.c  |6 +
 10 files changed, 286 insertions(+), 61 deletions(-)

diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
index 10ec04a..1745396 100644
--- a/include/libvirt/libvirt.h
+++ b/include/libvirt/libvirt.h
@@ -336,7 +336,9 @@ typedef virDomainInterfaceStatsStruct 
*virDomainInterfaceStatsPtr;
 
 /* Domain migration flags. */
 typedef enum {
-  VIR_MIGRATE_LIVE  = 1, /* live migration */
+VIR_MIGRATE_LIVE  = (1  0), /* live migration */
+VIR_MIGRATE_PEER2PEER = (1  1), /* direct source - dest host 
control channel */
+VIR_MIGRATE_TUNNELLED = (1  2), /* tunnel migration data over 
libvirtd connection */
 } virDomainMigrateFlags;
 
 /* Domain migration. */
@@ -344,6 +346,10 @@ virDomainPtr virDomainMigrate (virDomainPtr domain, 
virConnectPtr dconn,
unsigned long flags, const char *dname,
const char *uri, unsigned long bandwidth);
 
+int virDomainMigrateToURI (virDomainPtr domain, const char *duri,
+   unsigned long flags, const char *dname,
+   unsigned long bandwidth);
+
 /**
  * VIR_NODEINFO_MAXCPUS:
  * @nodeinfo: virNodeInfo instance
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 012d30e..5e1a500 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -336,7 +336,9 @@ typedef virDomainInterfaceStatsStruct 
*virDomainInterfaceStatsPtr;
 
 /* Domain migration flags. */
 typedef enum {
-  VIR_MIGRATE_LIVE  = 1, /* live migration */
+VIR_MIGRATE_LIVE  = (1  0), /* live migration */
+VIR_MIGRATE_PEER2PEER = (1  1), /* direct source - dest host 
control channel */
+VIR_MIGRATE_TUNNELLED = (1  2), /* tunnel migration data over 
libvirtd connection */
 } virDomainMigrateFlags;
 
 /* Domain migration. */
@@ -344,6 +346,10 @@ virDomainPtr virDomainMigrate (virDomainPtr domain, 
virConnectPtr dconn,
unsigned long flags, const char *dname,
const char *uri, unsigned long bandwidth);
 
+int virDomainMigrateToURI (virDomainPtr domain, const char *duri,
+   unsigned long flags, const char *dname,
+   unsigned long bandwidth);
+
 /**
  * VIR_NODEINFO_MAXCPUS:
  * @nodeinfo: virNodeInfo instance
diff --git a/src/driver.h b/src/driver.h
index 6a3dcc2..893e98b 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -44,25 +44,6 @@ typedef enum {
 VIR_DRV_OPEN_ERROR = -2,
 } virDrvOpenStatus;
 
-/* Feature detection.  This is a libvirt-private interface for determining
- * what features are supported by the driver.
- *
- * The remote driver passes features through to the real driver at the
- * remote end unmodified, except if you query a VIR_DRV_FEATURE_REMOTE*
- * feature.
- */
-/* Driver supports V1-style virDomainMigrate, ie. 

Re: [libvirt] Refactor libvirt spec file

2009-09-17 Thread Paul Jenner
Hi.

On Thu, 2009-09-17 at 13:14 +0100, Daniel P. Berrange wrote: 
 %if %{with_python}
 %package python
 Summary: Python bindings for the libvirt library
 Group: Development/Libraries
 Requires: libvirt = %{version}-%{release}

Do the python bindings really depend on the libvirt (daemon) package or
just libvirt-client libraries?

At the moment, I don't think I can install virt-manager on a management
client machine without also installing the libvirt daemon due to this
dependency - which feels wrong.

Paul



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


Re: [libvirt] Refactor libvirt spec file

2009-09-17 Thread Daniel P. Berrange
On Thu, Sep 17, 2009 at 08:31:54PM +0100, Paul Jenner wrote:
 Hi.
 
 On Thu, 2009-09-17 at 13:14 +0100, Daniel P. Berrange wrote: 
  %if %{with_python}
  %package python
  Summary: Python bindings for the libvirt library
  Group: Development/Libraries
  Requires: libvirt = %{version}-%{release}
 
 Do the python bindings really depend on the libvirt (daemon) package or
 just libvirt-client libraries?
 
 At the moment, I don't think I can install virt-manager on a management
 client machine without also installing the libvirt daemon due to this
 dependency - which feels wrong.

Yeah that's bogus, we forgot to change the dep to libvirt-client


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] Some problem with the save function

2009-09-17 Thread Charles Duffy

Daniel Berteaud wrote:

- the second problem is present since libvirt 0.7.1. Now that the saved
file can be compressed, it seems we cannot save in a raw format any
more.


Yeeowch.

How's this for a fix?
From b0673955435ca0c441a536b05216497f68f41be0 Mon Sep 17 00:00:00 2001
From: Charles Duffy charles_du...@dell.com
Date: Thu, 17 Sep 2009 18:24:15 -0500
Subject: [PATCH] prevent attempt to call cat -c during virDomainSave to raw

---
 src/qemu_driver.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index a65334f..ff30421 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3912,10 +3912,15 @@ static int qemudDomainSave(virDomainPtr dom,
 goto cleanup;
 }
 
-if (STREQ (prog, raw))
+const char *args;
+if (STREQ (prog, raw)) {
 prog = cat;
+args = ;
+} else {
+args = -c;
+}
 internalret = virAsprintf(command, migrate \exec:
-  %s -c  '%s' 2/dev/null\, prog, safe_path);
+  %s %s  '%s' 2/dev/null\, prog, args, safe_path);
 
 if (internalret  0) {
 virReportOOMError(dom-conn);
-- 
1.6.4

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


Re: [libvirt] Some problem with the save function

2009-09-17 Thread Charles Duffy

Daniel P. Berrange wrote:

Hmm, bad error message :-(  We might also need todo a chown()
in the restore path to allow QEMU to read it. NB there is no
compatability between QEMU version, so if you have upgraded
your install of QEMU between the time you saved  restored
it is very likely to crash  burn.


How difficult would it be to set up named pipes for save and restore 
operations, and splice from those pipes to the actual files on the 
libvirtd side? Seems much preferable from a security perspective to 
chown'ing things around, and (unlike pipes set up ahead of time with 
pipe() and friends) shouldn't be disrupted by a libvirtd restart.


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