Drop UML driver

The driver is unmaintained, untested and severely broken for
quite some time now. Since nobody even reported any issue with it
let us drop it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2018-12-14 14:45:07 +01:00
parent eb1b551d21
commit 29682196d8
32 changed files with 31 additions and 3764 deletions

View File

@ -225,7 +225,6 @@ if test "$with_libvirtd" = "no" ; then
with_qemu=no
with_lxc=no
with_libxl=no
with_uml=no
with_vbox=no
fi
@ -445,7 +444,6 @@ LIBVIRT_DRIVER_ARG_VBOX
LIBVIRT_DRIVER_ARG_LXC
LIBVIRT_DRIVER_ARG_VZ
LIBVIRT_DRIVER_ARG_BHYVE
LIBVIRT_DRIVER_ARG_UML
LIBVIRT_DRIVER_ARG_ESX
LIBVIRT_DRIVER_ARG_HYPERV
LIBVIRT_DRIVER_ARG_TEST
@ -464,7 +462,6 @@ LIBVIRT_DRIVER_CHECK_VBOX
LIBVIRT_DRIVER_CHECK_LXC
LIBVIRT_DRIVER_CHECK_VZ
LIBVIRT_DRIVER_CHECK_BHYVE
LIBVIRT_DRIVER_CHECK_UML
LIBVIRT_DRIVER_CHECK_ESX
LIBVIRT_DRIVER_CHECK_HYPERV
LIBVIRT_DRIVER_CHECK_TEST
@ -947,7 +944,6 @@ AC_MSG_NOTICE([])
AC_MSG_NOTICE([Drivers])
AC_MSG_NOTICE([])
LIBVIRT_DRIVER_RESULT_QEMU
LIBVIRT_DRIVER_RESULT_UML
LIBVIRT_DRIVER_RESULT_OPENVZ
LIBVIRT_DRIVER_RESULT_VMWARE
LIBVIRT_DRIVER_RESULT_VBOX

View File

@ -381,10 +381,6 @@
<td>storage</td>
<td>storage</td>
</tr>
<tr>
<td>uml</td>
<td>UML</td>
</tr>
<tr>
<td>vbox</td>
<td>VBOX</td>

View File

@ -29,7 +29,6 @@
<li><strong><a href="drvopenvz.html">OpenVZ</a></strong></li>
<li><strong><a href="drvqemu.html">QEMU</a></strong></li>
<li><strong><a href="drvtest.html">Test</a></strong> - Used for testing</li>
<li><strong><a href="drvuml.html">UML</a></strong> - User Mode Linux</li>
<li><strong><a href="drvvbox.html">VirtualBox</a></strong></li>
<li><strong><a href="drvesx.html">VMware ESX</a></strong></li>
<li><strong><a href="drvvmware.html">VMware Workstation/Player</a></strong></li>

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>User Mode Linux driver</h1>
<p>
The UML driver for libvirt allows use and management of paravirtualized
guests built for User Mode Linux. UML requires no special support in
the host kernel, so can be used by any user of any linux system, provided
they have enough free RAM for their guest's needs, though there are
certain restrictions on network connectivity unless the administrator
has pre-created TAP devices.
</p>
<h2><a id="project">Project Links</a></h2>
<ul>
<li>
The <a href="http://user-mode-linux.sourceforge.net/">User
Mode Linux</a> paravirtualized kernel
</li>
</ul>
<h2>Connections to UML driver</h2>
<p>
The libvirt UML driver follows the QEMU driver in providing two
types of connection. There is one privileged instance per host,
which runs as root. This is called the "system" instance, and allows
full use of all host resources. Then, there is a per-user unprivileged
"session", instance. This has more restricted capabilities, and may
require the host administrator to setup certain resources ahead of
time to allow full integration with the network. Example connection
URIs are
</p>
<pre>
uml:///session (local access to per-user instance)
uml+unix:///session (local access to per-user instance)
uml:///system (local access to system instance)
uml+unix:///system (local access to system instance)
uml://example.com/system (remote access, TLS/x509)
uml+tcp://example.com/system (remote access, SASl/Kerberos)
uml+ssh://root@example.com/system (remote access, SSH tunnelled)
</pre>
<h2>Example XML configuration</h2>
<p>
User mode Linux driver only supports directly kernel boot at
this time. A future driver enhancement may allow a paravirt
bootloader in a similar style to Xen's pygrub. For now though,
the UML kernel must be stored on the host and referenced
explicitly in the "os" element. Since UML is a paravirtualized
technology, the kernel "type" is set to "uml"
</p>
<p>
There is not yet support for networking in the driver, but
disks can be specified in the usual libvirt manner. The main
variation is the target device naming scheme "ubd0", and
bus type of "uml".
</p>
<p>
Once booted the primary console is connected to a PTY, and
thus accessible with "virsh console" or equivalent tools
</p>
<pre>
&lt;domain type='uml'&gt;
&lt;name&gt;demo&lt;/name&gt;
&lt;uuid&gt;b4433fc2-a22e-ffb3-0a3d-9c173b395800&lt;/uuid&gt;
&lt;memory&gt;500000&lt;/memory&gt;
&lt;currentMemory&gt;500000&lt;/currentMemory&gt;
&lt;vcpu&gt;1&lt;/vcpu&gt;
&lt;os&gt;
&lt;type arch='x86_64'&gt;uml&lt;/type&gt;
&lt;kernel&gt;/home/berrange/linux-uml-2.6.26-x86_64&lt;/kernel&gt;
&lt;/os&gt;
&lt;devices&gt;
&lt;disk type='file' device='disk'&gt;
&lt;source file='/home/berrange/FedoraCore6-AMD64-root_fs'/&gt;
&lt;target dev='ubd0' bus='uml'/&gt;
&lt;/disk&gt;
&lt;console type='pty'/&gt;
&lt;/devices&gt;
&lt;/domain&gt;
</pre>
</body>
</html>

View File

@ -87,9 +87,6 @@
<dt><code>exe</code></dt>
<dd>Container based virtualization</dd>
<dt><code>uml</code></dt>
<dd>User Mode Linux</dd>
</dl>
</dd>

View File

@ -7161,9 +7161,9 @@ qemu-kvm -net nic,model=? /dev/null
Valid values for the <code>type</code> attribute are:
<code>serial</code> (described below);
<code>virtio</code> (usable whenever VirtIO support is available);
<code>xen</code>, <code>lxc</code>, <code>uml</code> and
<code>openvz</code> (available when the corresponding hypervisor is in
use). <code>sclp</code> and <code>sclplm</code> (usable for s390 and
<code>xen</code>, <code>lxc</code> and <code>openvz</code>
(available when the corresponding hypervisor is in use).
<code>sclp</code> and <code>sclplm</code> (usable for s390 and
s390x QEMU guests) are supported for compatibility reasons but should
not be used for new guests: use the <code>sclpconsole</code> and
<code>sclplmconsole</code> target models, respectively, with the

View File

@ -278,7 +278,6 @@
&lt;value&gt;virtio&lt;/value&gt;
&lt;value&gt;xen&lt;/value&gt;
&lt;value&gt;usb&lt;/value&gt;
&lt;value&gt;uml&lt;/value&gt;
&lt;value&gt;sata&lt;/value&gt;
&lt;value&gt;sd&lt;/value&gt;
&lt;/enum&gt;

View File

@ -2265,7 +2265,7 @@ echo 3 > /proc/sys/net/netfilter/nf_conntrack_icmp_timeout
to the incoming and outgoing direction. All this is related to the ftp
data traffic originating from TCP port 20 of the VM. This then leads to
the following solution
<span class="since">(since 0.8.5 (QEMU, KVM, UML))</span>:
<span class="since">(since 0.8.5 (QEMU, KVM))</span>:
</p>
<pre>
&lt;filter name='test-eth0'&gt;

View File

@ -59,6 +59,20 @@
</description>
</change>
</section>
<section title="Removed features">
<change>
<summary>
Drop UML driver
</summary>
<description>
The UML driver was unmaintained and not tested for
quite some time now. Worse, there is a bug that causes
it to deadlock on some very basic operations (e.g.
dumping domain XML). These facts make us believe no one
uses it.
</description>
</change>
</section>
<section title="Improvements">
<change>
<summary>

View File

@ -412,7 +412,7 @@
but is also used by phyp driver -->
<value>hvm</value> <!-- unmodified OS -->
<value>exe</value> <!-- For container based virt -->
<value>uml</value> <!-- user mode linux -->
<value>uml</value> <!-- user mode linux; NOT USED ANYMORE -->
</choice>
</element>
</define>
@ -484,7 +484,7 @@
<value>kqemu</value>
<value>kvm</value>
<value>xen</value>
<value>uml</value>
<value>uml</value> <!-- NOT USED ANYMORE -->
<value>lxc</value>
<value>openvz</value>
<value>test</value>

View File

@ -204,7 +204,7 @@
<value>kvm</value>
<value>xen</value>
<value>lxc</value>
<value>uml</value>
<value>uml</value> <!-- NOT USED ANYMORE -->
<value>openvz</value>
<value>test</value>
<value>vmware</value>
@ -1907,7 +1907,7 @@
<value>virtio</value>
<value>xen</value>
<value>usb</value>
<value>uml</value>
<value>uml</value> <!-- NOT USED ANYMORE -->
<value>sata</value>
<value>sd</value>
</choice>
@ -3725,7 +3725,7 @@
<choice>
<value>xen</value>
<value>serial</value>
<value>uml</value>
<value>uml</value> <!-- NOT USED ANYMORE -->
<value>virtio</value>
<value>lxc</value>
<value>openvz</value>

View File

@ -74,7 +74,7 @@ typedef enum {
VIR_FROM_NETWORK = 19, /* Error from network config */
VIR_FROM_DOMAIN = 20, /* Error from domain config */
VIR_FROM_UML = 21, /* Error at the UML driver */
VIR_FROM_UML = 21, /* Error at the UML driver; unused since 5.0.0 */
VIR_FROM_NODEDEV = 22, /* Error from node device monitor */
VIR_FROM_XEN_INOTIFY = 23, /* Error from xen inotify layer */
VIR_FROM_SECURITY = 24, /* Error from security framework */

View File

@ -20,7 +20,6 @@
# The hypervisor drivers that run in libvirtd
%define with_qemu 0%{!?_without_qemu:1}
%define with_lxc 0%{!?_without_lxc:1}
%define with_uml 0%{!?_without_uml:1}
%define with_libxl 0%{!?_without_libxl:1}
%define with_vbox 0%{!?_without_vbox:1}
@ -111,13 +110,12 @@
%endif
# RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor,
# RHEL doesn't ship OpenVZ, VBox, PowerHypervisor,
# VMware, libxenserver (xenapi), libxenlight (Xen 4.1 and newer),
# or HyperV.
%if 0%{?rhel}
%define with_openvz 0
%define with_vbox 0
%define with_uml 0
%define with_phyp 0
%define with_vmware 0
%define with_xenapi 0
@ -178,7 +176,7 @@
%endif
%if %{with_qemu} || %{with_lxc} || %{with_uml}
%if %{with_qemu} || %{with_lxc}
# numad is used to manage the CPU and memory placement dynamically,
# it's not available on many non-x86 architectures.
%ifnarch s390 s390x %{arm} riscv64
@ -231,9 +229,9 @@ Requires: libvirt-daemon-driver-lxc = %{version}-%{release}
%if %{with_qemu}
Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
%endif
%if %{with_uml}
Requires: libvirt-daemon-driver-uml = %{version}-%{release}
%endif
# We had UML driver, but we've removed it.
Obsoletes: libvirt-daemon-driver-uml <= 5.0.0
Obsoletes: libvirt-daemon-uml <= 5.0.0
%if %{with_vbox}
Requires: libvirt-daemon-driver-vbox = %{version}-%{release}
%endif
@ -743,19 +741,6 @@ the Linux kernel
%endif
%if %{with_uml}
%package daemon-driver-uml
Summary: Uml driver plugin for the libvirtd daemon
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
%description daemon-driver-uml
The UML driver plugin for the libvirtd daemon, providing
an implementation of the hypervisor driver APIs using
User Mode Linux
%endif
%if %{with_vbox}
%package daemon-driver-vbox
Summary: VirtualBox driver plugin for the libvirtd daemon
@ -843,26 +828,6 @@ capabilities of LXC
%endif
%if %{with_uml}
%package daemon-uml
Summary: Server side daemon & driver required to run UML guests
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-driver-uml = %{version}-%{release}
Requires: libvirt-daemon-driver-interface = %{version}-%{release}
Requires: libvirt-daemon-driver-network = %{version}-%{release}
Requires: libvirt-daemon-driver-nodedev = %{version}-%{release}
Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release}
Requires: libvirt-daemon-driver-secret = %{version}-%{release}
Requires: libvirt-daemon-driver-storage = %{version}-%{release}
# There are no UML kernel RPMs in Fedora/RHEL to depend on.
%description daemon-uml
Server side daemon and driver required to manage the virtualization
capabilities of UML
%endif
%if %{with_libxl}
%package daemon-xen
Summary: Server side daemon & driver required to run XEN guests
@ -1068,12 +1033,6 @@ exit 1
%define arg_vmware --without-vmware
%endif
%if %{with_uml}
%define arg_uml --with-uml
%else
%define arg_uml --without-uml
%endif
%if %{with_storage_rbd}
%define arg_storage_rbd --with-storage-rbd
%else
@ -1187,7 +1146,6 @@ rm -f po/stamp-po
--with-avahi \
--with-polkit \
--with-libvirtd \
%{?arg_uml} \
%{?arg_phyp} \
%{?arg_esx} \
%{?arg_hyperv} \
@ -1316,9 +1274,6 @@ rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.libxl
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_libxl.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%endif
%if ! %{with_uml}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml
%endif
# Copied into libvirt-docs subpackage eventually
mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-%{version} libvirt-docs
@ -1725,15 +1680,6 @@ exit 0
%{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so
%endif
%if %{with_uml}
%files daemon-driver-uml
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
%ghost %dir %{_localstatedir}/run/libvirt/uml/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
%{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
%endif
%if %{with_libxl}
%files daemon-driver-libxl
%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
@ -1764,10 +1710,6 @@ exit 0
%files daemon-lxc
%endif
%if %{with_uml}
%files daemon-uml
%endif
%if %{with_libxl}
%files daemon-xen
%endif

View File

@ -1,54 +0,0 @@
dnl The UML driver
dnl
dnl Copyright (C) 2005-2015 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_DRIVER_ARG_UML],[
LIBVIRT_ARG_WITH_FEATURE([UML], [UML], [check])
])
AC_DEFUN([LIBVIRT_DRIVER_CHECK_UML],[
if test "$with_libvirtd" = "no" || test "$with_linux" = "no"; then
if test "$with_uml" = "yes"; then
AC_MSG_ERROR([The UML driver cannot be enabled])
elif test "$with_uml" = "check"; then
with_uml="no"
fi
fi
if test "$with_uml" = "yes" || test "$with_uml" = "check"; then
AC_CHECK_HEADER([sys/inotify.h], [
with_uml=yes
], [
if test "$with_uml" = "check"; then
with_uml=no
AC_MSG_NOTICE([<sys/inotify.h> is required for the UML driver, disabling it])
else
AC_MSG_ERROR([The <sys/inotify.h> is required for the UML driver. Upgrade your libc6.])
fi
])
fi
if test "$with_uml" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_UML], 1, [whether UML driver is enabled])
fi
AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
])
AC_DEFUN([LIBVIRT_DRIVER_RESULT_UML],[
LIBVIRT_RESULT([UML], [$with_uml])
])

View File

@ -177,7 +177,6 @@ autoreconf -if
--without-avahi \
--without-polkit \
--without-libvirtd \
--without-uml \
%{?_without_phyp} \
%{?_without_esx} \
%{?_without_hyperv} \

View File

@ -190,8 +190,6 @@ src/storage/storage_backend_zfs.c
src/storage/storage_driver.c
src/storage/storage_util.c
src/test/test_driver.c
src/uml/uml_conf.c
src/uml/uml_driver.c
src/util/iohelper.c
src/util/viralloc.c
src/util/virarptable.c

View File

@ -107,7 +107,6 @@ include logging/Makefile.inc.am
include locking/Makefile.inc.am
include admin/Makefile.inc.am
include rpc/Makefile.inc.am
include uml/Makefile.inc.am
include phyp/Makefile.inc.am
include test/Makefile.inc.am
include esx/Makefile.inc.am

View File

@ -34,7 +34,6 @@ Then there are the hypervisor implementations:
* qemu/ - QEMU / KVM using qemu CLI/monitor
* remote/ - Generic libvirt native RPC client
* test/ - A "mock" driver for testing
* uml/ - User Mode Linux
* vbox/ - Virtual Box using native API
* vmware/ - VMware Workstation and Player using the vmrun tool
* xen/ - Xen using hypercalls, XenD SEXPR & XenStore
@ -42,7 +41,7 @@ Then there are the hypervisor implementations:
Finally some secondary drivers that are shared for several HVs.
Currently these are used by LXC, OpenVZ, QEMU, UML and Xen drivers.
Currently these are used by LXC, OpenVZ, QEMU and Xen drivers.
The ESX, Hyper-V, Power Hypervisor, Remote, Test & VirtualBox drivers all
implement the secondary drivers directly

View File

@ -124,7 +124,7 @@ struct _virLockManagerParam {
* too old to support key features.
*
* NB: A plugin may be loaded multiple times, for different
* libvirt drivers (eg QEMU, LXC, UML)
* libvirt drivers (eg QEMU, LXC)
*
* Returns -1 if the requested version/flags were inadequate
*/

View File

@ -39,7 +39,6 @@ LOGROTATE_FILES_IN += \
remote/libvirtd.qemu.logrotate.in \
remote/libvirtd.lxc.logrotate.in \
remote/libvirtd.libxl.logrotate.in \
remote/libvirtd.uml.logrotate.in \
remote/libvirtd.logrotate.in \
$(NULL)

View File

@ -1,8 +0,0 @@
@localstatedir@/log/libvirt/uml/*.log {
weekly
missingok
rotate 4
compress
delaycompress
copytruncate
}

View File

@ -339,10 +339,6 @@ static int daemonInitialize(void)
if (virDriverLoadModule("lxc", "lxcRegister", false) < 0)
return -1;
#endif
#ifdef WITH_UML
if (virDriverLoadModule("uml", "umlRegister", false) < 0)
return -1;
#endif
#ifdef WITH_VBOX
if (virDriverLoadModule("vbox", "vboxRegister", false) < 0)
return -1;

View File

@ -1,48 +0,0 @@
UML_DRIVER_SOURCES = \
uml/uml_conf.c \
uml/uml_conf.h \
uml/uml_driver.c \
uml/uml_driver.h \
$(NULL)
DRIVER_SOURCE_FILES += $(UML_DRIVER_SOURCES)
STATEFUL_DRIVER_SOURCE_FILES += $(UML_DRIVER_SOURCES)
EXTRA_DIST += $(UML_DRIVER_SOURCES)
if WITH_UML
noinst_LTLIBRARIES += libvirt_driver_uml_impl.la
libvirt_driver_uml_la_SOURCES =
libvirt_driver_uml_la_LIBADD = \
libvirt_driver_uml_impl.la \
libvirt.la \
../gnulib/lib/libgnu.la \
$(NULL)
mod_LTLIBRARIES += libvirt_driver_uml.la
libvirt_driver_uml_la_LDFLAGS = $(AM_LDFLAGS_MOD_NOUNDEF)
libvirt_driver_uml_impl_la_CFLAGS = \
-I$(srcdir)/access \
-I$(srcdir)/conf \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_uml_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_uml_impl_la_SOURCES = $(UML_DRIVER_SOURCES)
INSTALL_DATA_DIRS += uml
install-data-uml:
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/uml"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/uml"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/uml"
uninstall-data-uml:
rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/uml" ||:
rmdir "$(DESTDIR)$(localstatedir)/run/libvirt/uml" ||:
rmdir "$(DESTDIR)$(localstatedir)/log/libvirt/uml" ||:
endif WITH_UML
.PHONY: \
install-data-uml \
uninstall-data-uml \
$(NULL)

View File

@ -1,481 +0,0 @@
/*
* uml_conf.c: UML driver configuration
*
* Copyright (C) 2006-2014, 2016 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include "uml_conf.h"
#include "viruuid.h"
#include "virbuffer.h"
#include "virconf.h"
#include "viralloc.h"
#include "virlog.h"
#include "domain_nwfilter.h"
#include "virfile.h"
#include "vircommand.h"
#include "virnetdevtap.h"
#include "virnodesuspend.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_UML
VIR_LOG_INIT("uml.uml_conf");
virCapsPtr umlCapsInit(void)
{
virCapsPtr caps;
virCapsGuestPtr guest;
if ((caps = virCapabilitiesNew(virArchFromHost(),
false, false)) == NULL)
goto error;
/* Some machines have problematic NUMA topology causing
* unexpected failures. We don't want to break the QEMU
* driver in this scenario, so log errors & carry on
*/
if (virCapabilitiesInitNUMA(caps) < 0) {
virCapabilitiesFreeNUMAInfo(caps);
VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities");
}
if (virCapabilitiesInitCaches(caps) < 0)
VIR_WARN("Failed to get host CPU cache info");
if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
VIR_WARN("Failed to get host power management capabilities");
if (virGetHostUUID(caps->host.host_uuid)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot get the host uuid"));
goto error;
}
if ((guest = virCapabilitiesAddGuest(caps,
VIR_DOMAIN_OSTYPE_UML,
caps->host.arch,
NULL,
NULL,
0,
NULL)) == NULL)
goto error;
if (virCapabilitiesAddGuestDomain(guest,
VIR_DOMAIN_VIRT_UML,
NULL,
NULL,
0,
NULL) == NULL)
goto error;
return caps;
error:
virObjectUnref(caps);
return NULL;
}
static int
umlConnectTapDevice(virDomainDefPtr vm,
virDomainNetDefPtr net,
const char *bridge)
{
bool template_ifname = false;
int tapfd = -1;
if (!net->ifname ||
STRPREFIX(net->ifname, VIR_NET_GENERATED_TAP_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_TAP_PREFIX "%d") < 0)
goto error;
/* avoid exposing vnet%d in getXMLDesc or error outputs */
template_ifname = true;
}
if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, &net->mac,
vm->uuid, net->backend.tap, &tapfd, 1,
virDomainNetGetActualVirtPortProfile(net),
virDomainNetGetActualVlan(net),
NULL, 0, NULL,
VIR_NETDEV_TAP_CREATE_IFUP |
VIR_NETDEV_TAP_CREATE_PERSIST) < 0) {
if (template_ifname)
VIR_FREE(net->ifname);
goto error;
}
if (net->filter) {
if (virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0) {
if (template_ifname)
VIR_FREE(net->ifname);
goto error;
}
}
VIR_FORCE_CLOSE(tapfd);
return 0;
error:
VIR_FORCE_CLOSE(tapfd);
return -1;
}
static char *
umlBuildCommandLineNet(virConnectPtr conn,
virDomainDefPtr vm,
virDomainNetDefPtr def,
int idx)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char macaddr[VIR_MAC_STRING_BUFLEN];
/* General format: ethNN=type,options */
virBufferAsprintf(&buf, "eth%d=", idx);
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_USER:
/* ethNNN=slirp,macaddr */
virBufferAddLit(&buf, "slirp");
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap,");
if (def->ifname)
virBufferAdd(&buf, def->ifname, -1);
if (def->guestIP.nips > 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet interface"));
goto error;
}
break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vhostuser networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_SERVER:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP server networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_CLIENT:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP client networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_UDP:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("UDP networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_MCAST:
/* ethNNN=tuntap,macaddr,ipaddr,port */
virBufferAddLit(&buf, "mcast");
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
{
char *bridge;
virNetworkPtr network = virNetworkLookupByName(conn,
def->data.network.name);
if (!network) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' not found"),
def->data.network.name);
goto error;
}
bridge = virNetworkGetBridgeName(network);
virObjectUnref(network);
if (bridge == NULL)
goto error;
if (umlConnectTapDevice(vm, def, bridge) < 0) {
VIR_FREE(bridge);
goto error;
}
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAsprintf(&buf, "tuntap,%s", def->ifname);
break;
}
case VIR_DOMAIN_NET_TYPE_BRIDGE:
if (umlConnectTapDevice(vm, def,
def->data.bridge.brname) < 0)
goto error;
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAsprintf(&buf, "tuntap,%s", def->ifname);
break;
case VIR_DOMAIN_NET_TYPE_INTERNAL:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_DIRECT:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("direct networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("hostdev networking type not supported"));
goto error;
case VIR_DOMAIN_NET_TYPE_LAST:
break;
}
if (def->script) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("interface script execution not supported by this driver"));
goto error;
}
virBufferAsprintf(&buf, ",%s", virMacAddrFormat(&def->mac, macaddr));
if (def->type == VIR_DOMAIN_NET_TYPE_MCAST) {
virBufferAsprintf(&buf, ",%s,%d",
def->data.socket.address,
def->data.socket.port);
}
if (virBufferCheckError(&buf) < 0)
return NULL;
return virBufferContentAndReset(&buf);
error:
virBufferFreeAndReset(&buf);
return NULL;
}
static char *
umlBuildCommandLineChr(virDomainChrDefPtr def,
const char *dev,
virCommandPtr cmd)
{
char *ret = NULL;
switch (def->source->type) {
case VIR_DOMAIN_CHR_TYPE_NULL:
if (virAsprintf(&ret, "%s%d=null", dev, def->target.port) < 0)
return NULL;
break;
case VIR_DOMAIN_CHR_TYPE_PTY:
if (virAsprintf(&ret, "%s%d=pts", dev, def->target.port) < 0)
return NULL;
break;
case VIR_DOMAIN_CHR_TYPE_DEV:
if (virAsprintf(&ret, "%s%d=tty:%s", dev, def->target.port,
def->source->data.file.path) < 0)
return NULL;
break;
case VIR_DOMAIN_CHR_TYPE_STDIO:
if (virAsprintf(&ret, "%s%d=fd:0,fd:1", dev, def->target.port) < 0)
return NULL;
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
if (def->source->data.tcp.listen != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only TCP listen is supported for chr device"));
return NULL;
}
if (virAsprintf(&ret, "%s%d=port:%s", dev, def->target.port,
def->source->data.tcp.service) < 0)
return NULL;
break;
case VIR_DOMAIN_CHR_TYPE_FILE:
{
int fd_out;
if ((fd_out = open(def->source->data.file.path,
O_WRONLY | O_APPEND | O_CREAT, 0660)) < 0) {
virReportSystemError(errno,
_("failed to open chardev file: %s"),
def->source->data.file.path);
return NULL;
}
if (virAsprintf(&ret, "%s%d=null,fd:%d", dev, def->target.port, fd_out) < 0) {
VIR_FORCE_CLOSE(fd_out);
return NULL;
}
virCommandPassFD(cmd, fd_out,
VIR_COMMAND_PASS_FD_CLOSE_PARENT);
}
break;
case VIR_DOMAIN_CHR_TYPE_PIPE:
/* XXX could open the pipe & just pass the FDs. Be wary of
* the effects of blocking I/O, though. */
case VIR_DOMAIN_CHR_TYPE_VC:
case VIR_DOMAIN_CHR_TYPE_UDP:
case VIR_DOMAIN_CHR_TYPE_UNIX:
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported chr device type %d"), def->source->type);
break;
}
return ret;
}
/*
* Null-terminate the current argument and return a pointer to the next.
* This should follow the same rules as the Linux kernel: arguments are
* separated by spaces; arguments can be quoted with double quotes; double
* quotes can't be escaped.
*/
static char *umlNextArg(char *args)
{
int in_quote = 0;
for (; *args; args++) {
if (*args == ' ' && !in_quote) {
*args++ = '\0';
break;
}
if (*args == '"')
in_quote = !in_quote;
}
while (*args == ' ')
args++;
return args;
}
/*
* Constructs a argv suitable for launching uml with config defined
* for a given virtual machine.
*/
virCommandPtr umlBuildCommandLine(virConnectPtr conn,
struct uml_driver *driver,
virDomainObjPtr vm)
{
size_t i, j;
virCommandPtr cmd;
cmd = virCommandNew(vm->def->os.kernel);
virCommandAddEnvPassCommon(cmd);
/* virCommandAddArgPair(cmd, "con0", "fd:0,fd:1"); */
virCommandAddArgFormat(cmd, "mem=%lluK", vm->def->mem.cur_balloon);
virCommandAddArgPair(cmd, "umid", vm->def->name);
virCommandAddArgPair(cmd, "uml_dir", driver->monitorDir);
if (vm->def->os.root)
virCommandAddArgPair(cmd, "root", vm->def->os.root);
for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i];
if (!STRPREFIX(disk->dst, "ubd")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type '%s'"), disk->dst);
goto error;
}
virCommandAddArgPair(cmd, disk->dst, virDomainDiskGetSource(disk));
}
for (i = 0; i < vm->def->nnets; i++) {
char *ret = umlBuildCommandLineNet(conn, vm->def, vm->def->nets[i], i);
if (!ret)
goto error;
virCommandAddArg(cmd, ret);
VIR_FREE(ret);
}
for (i = 0; i < UML_MAX_CHAR_DEVICE; i++) {
virDomainChrDefPtr chr = NULL;
char *ret = NULL;
for (j = 0; j < vm->def->nconsoles; j++)
if (vm->def->consoles[j]->target.port == i)
chr = vm->def->consoles[j];
if (chr)
ret = umlBuildCommandLineChr(chr, "con", cmd);
if (!ret)
if (virAsprintf(&ret, "con%zu=none", i) < 0)
goto error;
virCommandAddArg(cmd, ret);
VIR_FREE(ret);
}
for (i = 0; i < UML_MAX_CHAR_DEVICE; i++) {
virDomainChrDefPtr chr = NULL;
char *ret = NULL;
for (j = 0; j < vm->def->nserials; j++)
if (vm->def->serials[j]->target.port == i)
chr = vm->def->serials[j];
if (chr)
ret = umlBuildCommandLineChr(chr, "ssl", cmd);
if (!ret)
if (virAsprintf(&ret, "ssl%zu=none", i) < 0)
goto error;
virCommandAddArg(cmd, ret);
VIR_FREE(ret);
}
if (vm->def->os.cmdline) {
char *args, *next_arg;
char *cmdline;
if (VIR_STRDUP(cmdline, vm->def->os.cmdline) < 0)
goto error;
args = cmdline;
while (*args == ' ')
args++;
while (*args) {
next_arg = umlNextArg(args);
virCommandAddArg(cmd, args);
args = next_arg;
}
VIR_FREE(cmdline);
}
return cmd;
error:
virCommandFree(cmd);
return NULL;
}

View File

@ -1,82 +0,0 @@
/*
* uml_conf.h: VM configuration management
*
* Copyright (C) 2006, 2007, 2010 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_UML_CONF_H
# define LIBVIRT_UML_CONF_H
# include "internal.h"
# include "libvirt_internal.h"
# include "capabilities.h"
# include "network_conf.h"
# include "virdomainobjlist.h"
# include "domain_event.h"
# include "virerror.h"
# include "virthread.h"
# include "vircommand.h"
# include "virhash.h"
# define umlDebug(fmt, ...) do {} while (0)
# define UML_CPUMASK_LEN CPU_SETSIZE
# define UML_MAX_CHAR_DEVICE 16
/* Main driver state */
struct uml_driver {
virMutex lock;
bool privileged;
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
unsigned long umlVersion;
int nextvmid;
virDomainObjListPtr domains;
size_t nactive;
char *configDir;
char *autostartDir;
char *logDir;
char *monitorDir;
int inotifyFD;
int inotifyWatch;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
/* Event handling */
virObjectEventStatePtr domainEventState;
/* Mapping of 'char *uuidstr' -> virConnectPtr
* of guests which will be automatically killed
* when the virConnectPtr is closed*/
virHashTablePtr autodestroy;
};
virCapsPtr umlCapsInit (void);
virCommandPtr umlBuildCommandLine(virConnectPtr conn,
struct uml_driver *driver,
virDomainObjPtr dom);
#endif /* LIBVIRT_UML_CONF_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
/*
* uml_driver.h: user mode Linux driver
*
* Copyright (C) 2006, 2007 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_UML_DRIVER_H
# define LIBVIRT_UML_DRIVER_H
# include "internal.h"
int umlRegister(void);
#endif /* LIBVIRT_UML_DRIVER_H */

View File

@ -1,25 +0,0 @@
<domainCapabilities>
<path>/bin/emulatorbin</path>
<domain>uml</domain>
<machine>my-machine-type</machine>
<arch>x86_64</arch>
<iothreads supported='no'/>
<os supported='no'/>
<cpu>
<mode name='host-passthrough' supported='no'/>
<mode name='host-model' supported='no'/>
<mode name='custom' supported='no'/>
</cpu>
<devices>
<disk supported='no'/>
<graphics supported='no'/>
<video supported='no'/>
<hostdev supported='no'/>
</devices>
<features>
<gic supported='no'/>
<vmcoreinfo supported='no'/>
<genid supported='no'/>
<sev supported='no'/>
</features>
</domainCapabilities>

View File

@ -409,8 +409,6 @@ mymain(void)
ret = -1; \
} while (0)
DO_TEST("basic", "/bin/emulatorbin", "my-machine-type",
"x86_64", VIR_DOMAIN_VIRT_UML, CAPS_NONE);
DO_TEST("full", "/bin/emulatorbin", "my-machine-type",
"x86_64", VIR_DOMAIN_VIRT_KVM, CAPS_ALL);

View File

@ -121,7 +121,6 @@ let driverLockMethods = [
"openvzDriverLock";
"testDriverLock";
"lxcDriverLock";
"umlDriverLock";
"nodedevDriverLock";
"networkDriverLock";
"storageDriverLock";
@ -136,7 +135,6 @@ let driverUnlockMethods = [
"openvzDriverUnlock";
"testDriverUnlock";
"lxcDriverUnlock";
"umlDriverUnlock";
"nodedevDriverUnlock";
"networkDriverUnlock";
"storageDriverUnlock";
@ -153,7 +151,6 @@ let lockableDrivers = [
"openvz_driver";
"testConnPtr";
"lxc_driver_t";
"uml_driver";
"virStorageDriverStatePtr";
"network_driver";
"virNodeDeviceState";

View File

@ -89,9 +89,6 @@ mymain(void)
#ifdef WITH_LXC
TEST("lxc");
#endif
#ifdef WITH_UML
TEST("uml");
#endif
#ifdef WITH_VBOX
TEST("vbox");
#endif

View File

@ -518,9 +518,6 @@ virshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED)
#ifdef WITH_LXC
vshPrint(ctl, " LXC");
#endif
#ifdef WITH_UML
vshPrint(ctl, " UML");
#endif
#ifdef WITH_LIBXL
vshPrint(ctl, " LibXL");
#endif