[libvirt] [PATCH v2] rpmbuild: add ebtables & ip(6)tables dependency for rpm
by Stefan Berger
Add ebtables,iptables & iptables-ipv6 dependency to rpm.
Changes from V1 to V2:
-passing --without-libpcap to configure script, if libpcap is not to be used
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
libvirt.spec.in | 7 +++++++
1 file changed, 7 insertions(+)
Index: libvirt-acl/libvirt.spec.in
===================================================================
--- libvirt-acl.orig/libvirt.spec.in
+++ libvirt-acl/libvirt.spec.in
@@ -61,6 +61,7 @@
%define with_udev 0%{!?_without_udev:0}
%define with_hal 0%{!?_without_hal:0}
%define with_yajl 0%{!?_without_yajl:0}
+%define with_nwfilter 0%{!?_without_nwfilter:0}
%define with_libpcap 0%{!?_without_libpcap:0}
# Non-server/HV driver defaults which are always enabled
@@ -150,6 +151,7 @@
# Enable libpcap library
%if %{with_qemu}
+%define with_nwfilter 0%{!?_without_nwfilter:%{server_drivers}}
%define with_libpcap 0%{!?_without_libpcap:%{server_drivers}}
%endif
@@ -195,6 +197,11 @@ Requires: bridge-utils
Requires: dnsmasq
Requires: iptables
%endif
+%if %{with_nwfilter}
+Requires: ebtables
+Requires: iptables
+Requires: iptables-ipv6
+%endif
# needed for device enumeration
%if %{with_hal}
Requires: hal
@@ -517,6 +524,10 @@ of recent versions of Linux (and other O
%define _without_yajl --without-yajl
%endif
+%if ! %{with_libpcap}
+%define _without_libpcap --without-libpcap
+%endif
+
%configure %{?_without_xen} \
%{?_without_qemu} \
%{?_without_openvz} \
@@ -545,6 +556,7 @@ of recent versions of Linux (and other O
%{?_without_hal} \
%{?_without_udev} \
%{?_without_yajl} \
+ %{?_without_libpcap} \
--with-qemu-user=%{qemu_user} \
--with-qemu-group=%{qemu_group} \
--with-init-script=redhat \
14 years, 7 months
[libvirt] [PATCH] rpmbuild: add ebtables & ip(6)tables dependency for rpm
by Stefan Berger
Add ebtables,iptables & iptables-ipv6 dependency to rpm.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
libvirt.spec.in | 7 +++++++
1 file changed, 7 insertions(+)
Index: libvirt-acl/libvirt.spec.in
===================================================================
--- libvirt-acl.orig/libvirt.spec.in
+++ libvirt-acl/libvirt.spec.in
@@ -61,6 +61,7 @@
%define with_udev 0%{!?_without_udev:0}
%define with_hal 0%{!?_without_hal:0}
%define with_yajl 0%{!?_without_yajl:0}
+%define with_nwfilter 0%{!?_without_nwfilter:0}
%define with_libpcap 0%{!?_without_libpcap:0}
# Non-server/HV driver defaults which are always enabled
@@ -150,6 +151,7 @@
# Enable libpcap library
%if %{with_qemu}
+%define with_nwfilter 0%{!?_without_nwfilter:%{server_drivers}}
%define with_libpcap 0%{!?_without_libpcap:%{server_drivers}}
%endif
@@ -195,6 +197,11 @@ Requires: bridge-utils
Requires: dnsmasq
Requires: iptables
%endif
+%if %{with_nwfilter}
+Requires: ebtables
+Requires: iptables
+Requires: iptables-ipv6
+%endif
# needed for device enumeration
%if %{with_hal}
Requires: hal
14 years, 7 months
[libvirt] libvirt with qemu-kvm, not recognizing NIC model
by Jonathan Hoover
Is this the right list for this question, or should I be elsewhere?
I am trying to specify a network card "model type" of "pcnet" (to
emulate vmware esxi's network card). No matter what I put for model type
in my xml config file, it comes up as an Intel e1000. I ran "qemu-kvm
-net nic,model=? /dev/null" and I got back a list of supported models
including pcnet,e1000,virtio, and others as expected. No matter which I
put in my xml file for /etc/libvirt/qemu/Symantec-bg.xml (a Symantec
Brightmail Gateway virtual machine), I just get back that its an Intel
card on boot (which doesn't work with Symantec BG).
I am running Fedora 12, kernel is 2.6.31.6-166.fc12.x86_64. The version
of libvirt is 0.7.1. I am running it on an Intel Core 2 Quad CPU Q8400 @
2.66 GHz. I have the same problem under Fedora 13 Beta.
Thoughts?
Jonathan Hoover
14 years, 7 months
[libvirt] Alternative to XML Creation and Parsing?
by Ganesh Pagade
Hello,
We plan to develop a fancy GUI which would help creating and managing
VMs/Domains for RHEL 5.4 KVM.
However looking at the schemas provided in docs/schemas/ (Ex:
domain.rng) generating
the XML file from the inputs taken from the GUI and pass it on to
virDomainDefineXML() turns out to be a huge tasks in itself. I was wondering
if there is an better way for me to provide my configurations to the library
and also to read data from it (instead of creating, parsing XMLs)? If an
alternate approach exist, are there any limitations with it?
Also the schema given in docs/schemas/ would be generic for all hyper visor.
How can I identify the tags applicable only for a particular hyper visor?
I found:
virConnectDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
const char * nativeConfig, unsigned int flags)
in API reference, which could solve my first problem but couldn't figure out
what nativeFormat would be.
Any inputs/pointers would be highly appreciated.
Regards,
Ganesh
14 years, 7 months
[libvirt] Fwd: Re: need your help about virito vmchannel
by Matthew Booth
FYI for the list. I haven't looked at this yet.
Matt
-------- Original Message --------
Subject: Re: need your help about virito vmchannel
Date: Tue, 4 May 2010 18:00:02 +0530
From: Amit Shah <amit.shah(a)redhat.com>
To: Matthew Booth <mbooth(a)redhat.com>
CC: Jianlin Liu <jialiu(a)redhat.com>
On (Tue) May 04 2010 [13:18:30], Matthew Booth wrote:
> On 04/05/10 12:48, Jianlin Liu wrote:
> > Hi Matthew,
> >
> > I want to create a virtio vm channel in my guest. So I add the followiong to my guest xml file:
> > <channel type='pty'>
> > <target type='virtio' name='org.linux-kvm.port.0'/>
> > </channel>
>
> Jianlin,
>
> While I wrote the libvirt->vmchannel glue, I'm not actually that
> familiar with vmchannel itself. I've cc'd Amit, who hopefully might
> recognise this problem and tell me how to fix it ;)
>
> Amit,
>
> Any idea what's going on here?
Yes:
> > Then I try to start the guest:
> > # virsh start winxp
> > error: Failed to start domain winxp
> > error: internal error Process exited while reading console log output: char device redirected to /dev/pts/4
> > char device redirected to /dev/pts/5
> > qemu-kvm: -device virtio-serial-pci,id=virtio-serial0,max_ports=0,vectors=0,bus=pci.0,addr=0x5: Device 'virtio-serial-pci' could not be initialized
With max_ports=0, the virtio-serial device doesn't get created and hence
this error.
Amit
14 years, 7 months
[libvirt] [PATCH] configure.ac: Avoid uname, which breaks cross-compilation
by Matthias Bolte
When cross-compiling on Linux, configure will misdetect the target as
Linux because it uses uname instead of relying on the $host variable.
This results in including libvirt_linux.syms into libvirt.syms and
therefore trying to export undefined symbols.
Replace uname checks with $host checks to fix this.
---
configure.ac | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6ee5b90..5d68dcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,8 +210,11 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
fi
dnl lxc and qemu drivers require linux headers
-if test `uname -s` != "Linux"
-then
+case "$host" in
+ *-*-linux*)
+ # match linux here so the *) case will match anything non-linux
+ ;;
+ *)
if test "x$with_lxc" != "xyes"
then
with_lxc=no
@@ -220,7 +223,8 @@ then
then
with_qemu=no
fi
-fi
+ ;;
+esac
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
AC_ARG_WITH([xen],
@@ -1983,7 +1987,13 @@ then
fi
AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
-AM_CONDITIONAL([WITH_LINUX], [test `uname -s` = "Linux"])
+with_linux=no
+case "$host" in
+ *-*-linux*)
+ with_linux=yes
+ ;;
+esac
+AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
AC_ARG_WITH([qemu-user],
--
1.7.0.4
14 years, 7 months
[libvirt] [PATCH] Don't wipe generated iface target in active domains
by jdenemar@redhat.com
From: Jiri Denemark <jdenemar(a)redhat.com>
Wipe generated interface target only when reading configuration of
inactive domains.
---
src/conf/domain_conf.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 546ddf2..3e45f79 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1889,7 +1889,8 @@ virDomainNetDefParseXML(virCapsPtr caps,
xmlStrEqual(cur->name, BAD_CAST "target")) {
ifname = virXMLPropString(cur, "dev");
if ((ifname != NULL) &&
- ((STRPREFIX((const char*)ifname, "vnet")) ||
+ (((flags & VIR_DOMAIN_XML_INACTIVE) &&
+ (STRPREFIX((const char*)ifname, "vnet"))) ||
(!isValidIfname(ifname)))) {
/* An auto-generated target name, blank it out */
/* blank out invalid interface names */
--
1.7.1
14 years, 7 months
[libvirt] [PATCH] Various fixes for the spec file
by Daniel Veillard
This includes various things:
- fix the Requires: libvirt-client to use %{name} to allow easy renaming
- when building ESX support one need libcurl-devel
- remove Makefile[.in] from xml/nwfilter in the docs, as this breaks
parallel install ation of i686 and x86_64 packages
- don't include nwfilter config files if not building with the daemon
all relatively trivial which is why I packed them together,
Daniel
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 47e3050..9045c9a 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -184,7 +184,7 @@ URL: http://libvirt.org/
BuildRequires: python-devel
# The client side, i.e. shared libs and virsh are in a subpackage
-Requires: libvirt-client = %{version}-%{release}
+Requires: %{name}-client = %{version}-%{release}
# Used by many of the drivers, so turn it on whenever the
# daemon is present
@@ -347,6 +347,9 @@ BuildRequires: libssh2-devel
%if %{with_netcf}
BuildRequires: netcf-devel >= 0.1.4
%endif
+%if %{with_esx}
+BuildRequires: libcurl-devel
+%endif
# Fedora build root suckage
BuildRequires: gawk
@@ -378,7 +381,7 @@ virtualization capabilities of recent versions of Linux (and other OSes).
%package devel
Summary: Libraries, includes, etc. to compile with the libvirt library
Group: Development/Libraries
-Requires: libvirt-client = %{version}-%{release}
+Requires: %{name}-client = %{version}-%{release}
Requires: pkgconfig
%if %{with_xen}
Requires: xen-devel
@@ -392,7 +395,7 @@ the virtualization capabilities of recent versions of Linux (and other OSes).
%package python
Summary: Python bindings for the libvirt library
Group: Development/Libraries
-Requires: libvirt-client = %{version}-%{release}
+Requires: %{name}-client = %{version}-%{release}
%description python
The libvirt-python package contains a module that permits applications
@@ -556,7 +559,7 @@ gzip -9 ChangeLog
rm -fr %{buildroot}
%makeinstall
-for i in domain-events/events-c dominfo domsuspend hellolibvirt python
+for i in domain-events/events-c dominfo domsuspend hellolibvirt python xml/nwfilter
do
(cd examples/$i ; make clean ; rm -rf .deps .libs Makefile Makefile.in)
done
@@ -600,6 +603,10 @@ rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-python-%{version}
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version}
%endif
+%if ! %{with_libvirtd}
+rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter
+%endif
+
%if ! %{with_qemu}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
14 years, 7 months
[libvirt] why we should use a mechanical indentation checker
by Jim Meyering
I introduced a bug with this supposedly-safe, no-semantic-change delta:
http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=b6719eab9e95c5daeeea85
See if you can spot it.
Here is the loop in question, as it was prior to my erroneous change:
for (i = 0; i < nruleInstances; i++)
switch (inst[i]->ruleType) {
case RT_EBTABLES:
ebiptablesInstCommand(&buf,
inst[i]->commandTemplate,
'A', -1, 1);
break;
case RT_IPTABLES:
haveIptables = true;
break;
case RT_IP6TABLES:
haveIp6tables = true;
break;
}
Its formatting is WRONG.
Sure, it is technically correct to omit the curly braces
when the for-loop body is a single *statement*, as it is above.
However, the moment the construct in the body occupies
more than one line, it is very risky to omit the curly braces.
I demonstrated that yesterday by inserting a no-op sa_assert
statement as the "first" line of that loop body, not noticing
that unlike my other two additions, this one pushed the
single-stmt body *out of the loop*. Nasty.
For example, do not omit the curly braces even when the body is
just a single-line statement but with a preceding comment.
while (true)
/* explanation... */ BAD!
single_line_stmt ();
while (true) { /* Always put braces around a multi-line body. */
/* explanation... */
single_line_stmt ();
}
Of course do not do this, either:
if (expr)
while (other_expr) { BAD!
...
}
Do this, instead:
if (expr) {
while (other_expr) {
...
}
}
I am adding something like the following to coreutils' HACKING,
and will add the equivalent (adjusting indentation/brace-positioning style
in the examples) to libvirt's hacking.html.in, so if you object,
speak up soon.
While writing the above and below,
I noticed that with the GNU formatting style,
this is less of a problem, since there you do not add those
oh-so-important-to-semantics curly braces at the *end* of a line
where it easy to miss them, but at the beginning. In addition,
with the GNU style, adding the opening curly brace changes the
indentation level of the body, while in libvirt's style, it does not.
In either case, an automatic indentation checker would catch the problem.
This is yet another reason to enforce an indentation style.
The longer we wait, the harder it will become.
Note: these diffs are relative to coreutils' HACKING file, not libvirt's:
diff --git a/HACKING b/HACKING
index 124c666..4a6d593 100644
--- a/HACKING
+++ b/HACKING
@@ -233,6 +233,110 @@ Try to make the summary line fit one of the following forms:
maint: change-description
+Curly braces: use judiciously
+=============================
+Omit the curly braces around an "if", "while", "for" etc. body only when
+that body occupies a single line. In every other case we require the braces.
+This ensures that it is trivially easy to identify a single-*statement* loop:
+each has only one *line* in its body.
+
+For example, do not omit the curly braces even when the body is just a
+single-line statement but with a preceding comment.
+
+Omitting braces with a single-line body is fine:
+
+ while (expr)
+ single_line_stmt ();
+
+However, the moment your loop body extends onto a second line, for
+whatever reason (even if it's just an added comment), then you should
+add braces. Otherwise, it would be too easy to insert a statement just
+before that comment (without adding braces), thinking it is already a
+multi-statement loop:
+
+ while (true)
+ /* comment... */ // BAD: multi-line body without braces
+ single_line_stmt ();
+
+Do this instead:
+
+ while (true)
+ { /* Always put braces around a multi-line body. */
+ /* explanation... */
+ single_line_stmt ();
+ }
+
+There is one exception: when the second body line is not
+at the same indentation level as the first body line.
+
+ if (expr)
+ error (0, 0, _("a diagnostic that would make this line"
+ " extend past the 80-column limit"));
+
+It seems safe not to require curly braces in this case,
+since the further-indented second body line makes it obvious
+that this is still a single-statement body.
+
+To reiterate, don't do this:
+
+ if (expr)
+ while (expr_2) // BAD: multi-line body without braces
+ {
+ ...
+ }
+
+Do this, instead:
+
+ if (expr)
+ {
+ while (expr_2)
+ {
+ ...
+ }
+ }
+
+However, there is one exception in the other direction, when
+even a one-line block should have braces.
+That occurs when that one-line, brace-less block
+is an "else" block, and the corresponding "then" block *does* use braces.
+In that case, either put braces around the "else" block, or negate the
+"if"-condition and swap the bodies, putting the one-line block first
+and making the longer, multi-line block be the "else" block.
+
+ if (expr)
+ {
+ ...
+ ...
+ }
+ else
+ x = y; // BAD: braceless "else" with braced "then"
+
+This is preferred, especially when the multi-line body is more
+than a few lines long, because it is easier to read and grasp
+the semantics of an if-then-else block when the simpler block
+occurs first, rather than after the more involved block:
+
+ if (!expr)
+ x = y; /* more readable */
+ else
+ {
+ ...
+ ...
+ }
+
+If you'd rather not negate the condition, then add braces:
+
+ if (expr)
+ {
+ ...
+ ...
+ }
+ else
+ {
+ x = y;
+ }
+
+
Use SPACE-only indentation in all[*] files
==========================================
We use space-only indentation in nearly all files.
14 years, 8 months
[libvirt] [PATCH 0/3] lxc: Fix domain lookup and error handling
by jdenemar@redhat.com
From: Jiri Denemark <jdenemar(a)redhat.com>
Jiri Denemark (3):
lxc: Use virDomainFindByUUID for domain lookup
lxc: Make SetMemory work for active domains only
lxc: Check domain is active/inactive as required by operation
src/lxc/lxc_driver.c | 138 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 94 insertions(+), 44 deletions(-)
14 years, 8 months