[libvirt] How to stop libvirt from deleting tap device after shutdown
by Matthias Dahl
Hi.
I am currently setting up a new server machine which will host several kvm's
managed largely by libvirt. The network setup though is done prior to libvirtd
startup and shouldn't be touched by it.
So currently everything works just fine with 0.6.0 except that libvirt deletes
the tap device after I shut a kvm machine down which is something I naturally
don't want. I looked through all the documentation I could find but I could
not come up with a solution.
Forgot to mention: all kvm machine are connected through a tap device with no
bridge or whatsoever but 1:1 NAT. This done for performance reasons. As model
I use "virtio".
Any help would be greatly appreciated.
Best regards,
Matthias Dahl
= XML File for one of the machines ===========================================
<domain type='kvm'>
<name>charon</name>
<uuid>08a3af0e-f145-54c6-30a2-efdab5478523</uuid>
<memory>2097152</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<source file='/dev/diskspace/kvm_charon'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='ethernet'>
<mac address='52:54:00:25:6f:3f'/>
<script path='/bin/true'/>
<target dev='charon_pvnet1'/>
<model type='virtio'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target port='0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target port='0'/>
</console>
</devices>
</domain>
15 years, 9 months
[libvirt] PATCH: Fix DBus thread safety
by Daniel P. Berrange
We are using DBus from multiple threads in libvirtd. We are not calling
dbus_threads_init_default(). Very bad things result. Happy-crashy-daemon
This patch fixes that, and also stops DBus messing around with SIGPIPE and
also stops it calling exit() when the bus disconnects, so we can actually
see the error & continue with life.
Daniel
diff -rup libvirt-0.6.0.orig/qemud/qemud.c libvirt-0.6.0.new/qemud/qemud.c
--- libvirt-0.6.0.orig/qemud/qemud.c 2009-02-18 10:56:34.000000000 +0000
+++ libvirt-0.6.0.new/qemud/qemud.c 2009-02-18 12:52:18.000000000 +0000
@@ -860,6 +860,10 @@ static struct qemud_server *qemudNetwork
if (auth_unix_rw == REMOTE_AUTH_POLKIT ||
auth_unix_ro == REMOTE_AUTH_POLKIT) {
DBusError derr;
+
+ dbus_connection_set_change_sigpipe(FALSE);
+ dbus_threads_init_default();
+
dbus_error_init(&derr);
server->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr);
if (!(server->sysbus)) {
@@ -868,6 +872,7 @@ static struct qemud_server *qemudNetwork
dbus_error_free(&derr);
goto cleanup;
}
+ dbus_connection_set_exit_on_disconnect(server->sysbus, FALSE);
}
#endif
diff -rup libvirt-0.6.0.orig/src/node_device_hal.c libvirt-0.6.0.new/src/node_device_hal.c
--- libvirt-0.6.0.orig/src/node_device_hal.c 2009-01-16 12:44:22.000000000 +0000
+++ libvirt-0.6.0.new/src/node_device_hal.c 2009-02-18 12:52:48.000000000 +0000
@@ -685,6 +685,9 @@ static int halDeviceMonitorStartup(void)
nodeDeviceLock(driverState);
/* Allocate and initialize a new HAL context */
+ dbus_connection_set_change_sigpipe(FALSE);
+ dbus_threads_init_default();
+
dbus_error_init(&err);
hal_ctx = libhal_ctx_new();
if (hal_ctx == NULL) {
@@ -696,6 +699,8 @@ static int halDeviceMonitorStartup(void)
fprintf(stderr, "%s: dbus_bus_get failed\n", __FUNCTION__);
goto failure;
}
+ dbus_connection_set_exit_on_disconnect(dbus_conn, FALSE);
+
if (!libhal_ctx_set_dbus_connection(hal_ctx, dbus_conn)) {
fprintf(stderr, "%s: libhal_ctx_set_dbus_connection failed\n",
__FUNCTION__);
--
|: 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 :|
15 years, 9 months
[libvirt] [PATCH] small fixes in storage_conf.c
by Ryota Ozaki
Hi,
These patches fix:
- missing VIR_FREE for the return value of virXPathString
- wrong error message "missing owner element" where should be "missing
group element"
Signed-off-by: Ryota Ozaki <ozaki.ryota(a)gmail.com>
15 years, 9 months
[libvirt] [PATCH] don't dereference uninitialized pointer
by Jim Meyering
>From a907d2da7e7f9d1f58009ff6a95454ac0eb2cbf1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 2 Mar 2009 10:10:02 +0100
Subject: [PATCH] don't dereference uninitialized pointer
* src/storage_conf.c (virStoragePoolDefParsePerms): Initialize
"ptr" to NULL.
---
ChangeLog | 6 ++++++
src/storage_conf.c | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 12715f5..ede7e0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-02 Jim Meyering <meyering(a)redhat.com>
+
+ don't dereference uninitialized pointer
+ * src/storage_conf.c (virStoragePoolDefParsePerms): Initialize
+ "ptr" to NULL.
+
Fri Feb 27 17:15:00 CET 2009 Chris Lalancette <clalance(a)redhat.com>
* src/qemu_driver.c: If there is a failure during offline migrate,
diff --git a/src/storage_conf.c b/src/storage_conf.c
index 70107a2..4a53ff4 100644
--- a/src/storage_conf.c
+++ b/src/storage_conf.c
@@ -381,7 +381,7 @@ virStoragePoolDefParsePerms(virConnectPtr conn,
if (!mode) {
perms->mode = 0700;
} else {
- char *end;
+ char *end = NULL;
perms->mode = strtol(mode, &end, 8);
if (*end || perms->mode < 0 || perms->mode > 0777) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
--
1.6.2.rc1.285.gc5f54
15 years, 9 months
[libvirt] Update on host interface configuration
by David Lutterkort
Hi,
I thought I'd write an update of what I've been doing with the host
interface configuration previously discussed[1]
After talking with Dan Williams, who is working in NetworkManager, it is
clear that the network interface functionality for libvirt is also
useful for NM and would help them with handling system-wide interface
configuration. To accomodate that, I will implement network interface
configuration in a separate library (inspiringly called 'netcf', until
somebody thinks of something catchier) and add public API to libvirt
that will use netcf to do the actual work.
One thorny issue is how libvirt's public API and netcf's public API
relate to each other, especially since both libvirt and netcf use XML
descriptions to describe network interfaces (netcf does that for exactly
the same reasons that libvirt does it, since it will have to deal with
similar stability issues)
For the time being, I am assuming that the two XML descriptions are
identical, with no guarantee that that will always be the case. If and
when we run into a case where libvirt's and netcf's needs diverge, we'll
break that identity. On the implementation side, that means that, for
now, netcf will do all the validation and pass errors back to libvirt.
In more concrete terms, I put up a git repo[2] for netcf. There's hardly
any code in there, the things I'd particularly appreciate
review/feedback on are
* the RelaxNG specification of the interface XML (in
xml/interface.rng) together with examples of such interface
specifications (in tests/interface/)
* the (very rough) sketch of the netcf public API, which should
map almost 1-1 to the public libvirt API in src/netcf.h
I know that the XML schema doesn't cover everything we've discussed in
[1], but I think it's a small enough subset to tackle relatively quickly
and large enough to be useful. So, one of the main things to think about
when looking at the schema is places where the schema would make it hard
to make desirable enhancements in the near future (like Marius' point
about default routes/gateways)
One important point about the model of network config in the schema is
that it is centered around what NM calls a 'connection' (though it's
called 'interface' in the schema): a grouping of the components that
make up the interface the user really cares about (a bridge or a bond)
together with the components subordinate to it (e.g. ethernet interfaces
enslaved to the bridge or bond) It's those groups that netcf deals with,
i.e. if eth0 is enslaved to br0, netcf won't list eth0 as an interface,
but only br0, with eth0 as a subinterface.
For the implementation, netcf will have a separate backend for each
network configuration regime (initscripts for
Fedora/RHEL, /etc/network/interfaces for Debian, ...) - once the
initscripts backend is done, I'd be very grateful for contributions for
the other backends.
To sketch out the initscripts implementation, I wrote two XSL
stylesheets, xml/initscripts-get.xml that goes from interface XML ->
initscripts files (via Augeas) and xml/initscripts-put.xml to go the
other way for querying; I'll use those for the core of the initscripts
backend. Whether other backands can be done in a similar manner is TBD.
David
[1] https://www.redhat.com/archives/libvir-list/2009-January/msg00350.html
[2] http://git.et.redhat.com/?p=netcf.git;a=tree
15 years, 9 months
[libvirt] virsh and api
by Zvi Dubitzky
Hi
How about adding the following info to the virsh / dominfo command ( and
to the programmable libvirt API:):
- IP address of the domain in case the host was configured as a bridge
- cpu utilization (at least for Linux)
Is that possible ?
thanks
Zvi Dubitzky
Virtualization and System Architecture Email:dubi@il.ibm.com
IBM Haifa Research Laboratory Phone: +972-4-8296182
Haifa, 31905, ISRAEL
15 years, 9 months