[libvirt] [PATCHv2 00/16] Introduce hvf domain type for Hypevisor.framework
by Roman Bolshakov
Hypervisor.framework provides a lightweight interface to run a virtual
cpu on macOS without the need to install third-party kernel
extensions (KEXTs).
It's supported since macOS 10.10 on machines with Intel VT-x feature
set that includes Extended Page Tables (EPT) and Unrestricted Mode.
QEMU supports Hypervisor.framework since 2.12.
The patch series adds "hvf" domain that uses Hypevisor.framework.
v1: https://www.redhat.com/archives/libvir-list/2018-October/msg01090.html
Changes since v1:
- [x] Fixed unconditional addition of KVM CPU models into capabilities cache.
That fixed a "make check" issue in qemucapabilitiestest on Linux.
- [x] Fixed missing brace in virQEMUCapsFormatCPUModels in PATCH 6
- [x] Squashed patch 12 into the first patch (second one in the patch series)
- [x] Added hvf domain definition to docs/formatdomain.html.in into the first
patch (second in the patch series)
- [x] Removed redundant argument in virQEMUCapsProbeHVF (patch 3)
- [x] Added separate virQEMUCapsProbeHVF for non-apple platforms (patch 3)
- [x] Added macOS support page
- [x] Marked HVF support for all working domain elements
I wasn't able to resolve the issues below, but I think they should go
into separate patches/patch series:
- [ ] To make qemucapabilitiestests work regardless of OS, accelerator probing
should be done via QMP command.
So, there's a need to add a new generic
command to QEMU "query-accelerator accel=NAME"
- [ ] VIRT_TEST_PRELOAD doesn't work on macOS. There are a few
reasons:
* DYLD_INSERT_LIBRARIES should be used instead of LD_PRELOAD
*
-module flag shouldn't be added to LDFLAGS in tests/Makefile.am.
The flag instructs libtool to creates bundles (MH_BUNDLE) instead of
dynamic libraries (MH_DYLIB) and unlike dylibs they cannot be preloaded.
* Either symbol interposing or flat namespaces should be used to perform
overrides of the calls to the mocks.
I've tried both but neither worked for me, need to make a minimal
example.
I haven't completed the investigation as it looks like a separate work item.
- [ ] Can't retrieve qemucapsprobe replies for macOS because qemucapsprobemock
is not getting injected because of the issue with VIRT_TEST_PRELOAD
- [ ] Can't add to tests/qemuxml2argvtest.c to illustrate the hvf example
because qemucapsprobe doesn't work yet.
Roman Bolshakov (16):
qemu: Add KVM CPUs into cache only if KVM is present
conf: Add hvf domain type
qemu: Define hvf capability
qemu: Query hvf capability on macOS
qemu: Expose hvf domain type if hvf is supported
qemu: Rename kvmCPU to accelCPU
qemu: Introduce virQEMUCapsTypeIsAccelerated
qemu: Introduce virQEMUCapsHaveAccel
qemu: Introduce virQEMUCapsToVirtType
qemu: Introduce virQEMUCapsAccelStr
qemu: Make error message accel-agnostic
qemu: Correct CPU capabilities probing for hvf
news: Mention hvf domain type
docs: Add hvf on QEMU driver page
docs: Note hvf support for domain elements
docs: Add support page for libvirt on macOS
docs/docs.html.in | 3 +
docs/drvqemu.html.in | 49 +++++++-
docs/formatdomain.html.in | 141 ++++++++++++---------
docs/index.html.in | 4 +-
docs/macos.html.in | 229 ++++++++++++++++++++++++++++++++++
docs/news.xml | 12 ++
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 201 +++++++++++++++++++++--------
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 4 +
12 files changed, 534 insertions(+), 116 deletions(-)
create mode 100644 docs/macos.html.in
--
2.19.1
5 years, 11 months
[libvirt] [PULL 31/31] hw/i386: Remove deprecated machines pc-0.10 and pc-0.11
by Michael S. Tsirkin
From: Thomas Huth <thuth(a)redhat.com>
They've been deprecated for two releases and nobody complained that they
are still required anymore, so it's time to remove these now.
And while we're at it, mark the other remaining old 0.x machine types
as deprecated (since they can not properly be used for live-migration
anyway).
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
Reviewed-by: Michael S. Tsirkin <mst(a)redhat.com>
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost(a)redhat.com>
---
hw/i386/pc_piix.c | 70 ++-----------------------------------------
tests/cpu-plug-test.c | 4 +--
qemu-deprecated.texi | 2 +-
3 files changed, 4 insertions(+), 72 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e000c7511a..7f1cb527b5 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -368,7 +368,7 @@ static void pc_compat_1_2(MachineState *machine)
x86_cpu_change_kvm_default("kvm-pv-eoi", NULL);
}
-/* PC compat function for pc-0.10 to pc-0.13 */
+/* PC compat function for pc-0.12 and pc-0.13 */
static void pc_compat_0_13(MachineState *machine)
{
pc_compat_1_2(machine);
@@ -834,6 +834,7 @@ static void pc_i440fx_0_15_machine_options(MachineClass *m)
{
pc_i440fx_1_0_machine_options(m);
m->hw_version = "0.15";
+ m->deprecation_reason = "use a newer machine type instead";
SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
}
@@ -951,73 +952,6 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m)
DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
pc_i440fx_0_12_machine_options);
-
-#define PC_COMPAT_0_11 \
- PC_CPU_MODEL_IDS("0.11") \
- {\
- .driver = "virtio-blk-pci",\
- .property = "vectors",\
- .value = stringify(0),\
- },{\
- .driver = TYPE_PCI_DEVICE,\
- .property = "rombar",\
- .value = stringify(0),\
- },{\
- .driver = "ide-drive",\
- .property = "ver",\
- .value = "0.11",\
- },{\
- .driver = "scsi-disk",\
- .property = "ver",\
- .value = "0.11",\
- },
-
-static void pc_i440fx_0_11_machine_options(MachineClass *m)
-{
- pc_i440fx_0_12_machine_options(m);
- m->hw_version = "0.11";
- m->deprecation_reason = "use a newer machine type instead";
- SET_MACHINE_COMPAT(m, PC_COMPAT_0_11);
-}
-
-DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
- pc_i440fx_0_11_machine_options);
-
-
-#define PC_COMPAT_0_10 \
- PC_CPU_MODEL_IDS("0.10") \
- {\
- .driver = "virtio-blk-pci",\
- .property = "class",\
- .value = stringify(PCI_CLASS_STORAGE_OTHER),\
- },{\
- .driver = "virtio-serial-pci",\
- .property = "class",\
- .value = stringify(PCI_CLASS_DISPLAY_OTHER),\
- },{\
- .driver = "virtio-net-pci",\
- .property = "vectors",\
- .value = stringify(0),\
- },{\
- .driver = "ide-drive",\
- .property = "ver",\
- .value = "0.10",\
- },{\
- .driver = "scsi-disk",\
- .property = "ver",\
- .value = "0.10",\
- },
-
-static void pc_i440fx_0_10_machine_options(MachineClass *m)
-{
- pc_i440fx_0_11_machine_options(m);
- m->hw_version = "0.10";
- SET_MACHINE_COMPAT(m, PC_COMPAT_0_10);
-}
-
-DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13,
- pc_i440fx_0_10_machine_options);
-
typedef struct {
uint16_t gpu_device_id;
uint16_t pch_device_id;
diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index f4a677d238..668f00144e 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -157,9 +157,7 @@ static void add_pc_test_case(const char *mname)
(strcmp(mname, "pc-0.15") == 0) ||
(strcmp(mname, "pc-0.14") == 0) ||
(strcmp(mname, "pc-0.13") == 0) ||
- (strcmp(mname, "pc-0.12") == 0) ||
- (strcmp(mname, "pc-0.11") == 0) ||
- (strcmp(mname, "pc-0.10") == 0)) {
+ (strcmp(mname, "pc-0.12") == 0)) {
path = g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=%u",
mname, data->sockets, data->cores,
data->threads, data->maxcpus);
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index e362d37225..c3735b698e 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -134,7 +134,7 @@ their usecases.
@section System emulator machines
-@subsection pc-0.10 and pc-0.11 (since 3.0)
+@subsection pc-0.12, pc-0.13, pc-0.14 and pc-0.15 (since 4.0)
These machine types are very old and likely can not be used for live migration
from old QEMU versions anymore. A newer machine type should be used instead.
--
MST
5 years, 11 months
[libvirt] [PATCH] util: fix translation of error message strings
by Daniel P. Berrangé
The arguments to the N_() macro must only ever be a literal string. It
is not possible to use macro arguments, or use macro string
concatenation in this context. The N_() macro is a no-op whose only
purpose is to act as a marker for xgettext when it extracts translatable
strings from the source code. Anything other than a literal string will
be silently ignored by xgettext.
Unfortunately this means that the clever MSG, MSG2 & MSG_EXISTS macros
used for building up error message strings have prevented any of the
error messages getting marked for translation. We must sadly, revert to
a more explicit listing of strings for now.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/virerror.c | 431 +++++++++++++++++++++++++++++++-------------
1 file changed, 303 insertions(+), 128 deletions(-)
diff --git a/src/util/virerror.c b/src/util/virerror.c
index b08427005f..3cdc825157 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -908,138 +908,313 @@ typedef struct {
} virErrorMsgTuple;
-/**
- * These macros expand to the following format of error message:
- * MSG2("error message", " suffix %s")
- * - no info: "error message"
- * - info: "error message suffix %s"
- *
- * MSG("error message")
- * - no info: "error message"
- * - info: "error message: %s"
- *
- * MSG_EXISTS("sausage")
- * - no info: "this sausage exists already"
- * - info: "sausage %s exists already"
- *
- * For any other case please use:
- * { "error message without info string", "message containing %s description"}
- */
-#define MSG2(msg, sfx) \
- { N_(msg), N_(msg sfx) }
-#define MSG(msg) \
- MSG2(msg, ": %s")
-#define MSG_EXISTS(object) \
- { N_("this " object " exists already"), N_(object " %s exists already") }
-
const virErrorMsgTuple virErrorMsgStrings[VIR_ERR_NUMBER_LAST] = {
[VIR_ERR_OK] = { NULL, NULL },
- [VIR_ERR_INTERNAL_ERROR] = MSG("internal error"),
- [VIR_ERR_NO_MEMORY] = MSG("out of memory"),
- [VIR_ERR_NO_SUPPORT] = MSG("this function is not supported by the connection driver"),
- [VIR_ERR_UNKNOWN_HOST] = MSG2("unknown host", " %s"),
- [VIR_ERR_NO_CONNECT] = MSG2("no connection driver available", " for %s"),
- [VIR_ERR_INVALID_CONN] = MSG2("invalid connection pointer in", " %s"),
- [VIR_ERR_INVALID_DOMAIN] = MSG2("invalid domain pointer in", " %s"),
- [VIR_ERR_INVALID_ARG] = MSG("invalid argument"),
- [VIR_ERR_OPERATION_FAILED] = MSG("operation failed"),
- [VIR_ERR_GET_FAILED] = MSG("GET operation failed"),
- [VIR_ERR_POST_FAILED] = MSG("POST operation failed"),
- [VIR_ERR_HTTP_ERROR] = MSG2("got unknown HTTP error code", " %s"),
- [VIR_ERR_SEXPR_SERIAL] = MSG("failed to serialize S-Expr"),
- [VIR_ERR_NO_XEN] = MSG2("could not use Xen hypervisor entry", " %s"),
- [VIR_ERR_XEN_CALL] = MSG2("failed Xen syscall", " %s"),
- [VIR_ERR_OS_TYPE] = MSG2("unknown OS type", " %s"),
- [VIR_ERR_NO_KERNEL] = MSG("missing kernel information"),
- [VIR_ERR_NO_ROOT] = MSG2("missing root device information", " in %s"),
- [VIR_ERR_NO_SOURCE] = MSG2("missing source information for device", " %s"),
- [VIR_ERR_NO_TARGET] = MSG2("missing target information for device", " %s"),
- [VIR_ERR_NO_NAME] = MSG2("missing name information", " in %s"),
- [VIR_ERR_NO_OS] = MSG2("missing operating system information", " for %s"),
- [VIR_ERR_NO_DEVICE] = MSG2("missing devices information", " for %s"),
- [VIR_ERR_NO_XENSTORE] = MSG2("could not connect to Xen Store", " %s"),
- [VIR_ERR_DRIVER_FULL] = MSG2("too many drivers registered", " in %s"),
- [VIR_ERR_CALL_FAILED] = MSG("library call failed"),
- [VIR_ERR_XML_ERROR] = { "XML description is invalid or not well formed", "XML error: %s" },
- [VIR_ERR_DOM_EXIST] = MSG_EXISTS("domain"),
- [VIR_ERR_OPERATION_DENIED] = { "operation forbidden for read only access", "operation forbidden: %s" },
- [VIR_ERR_OPEN_FAILED] = MSG2("failed to open configuration file", " %s"),
- [VIR_ERR_READ_FAILED] = MSG2("failed to read configuration file", " %s"),
- [VIR_ERR_PARSE_FAILED] = MSG2("failed to parse configuration file", " %s"),
- [VIR_ERR_CONF_SYNTAX] = MSG("configuration file syntax error"),
- [VIR_ERR_WRITE_FAILED] = MSG("failed to write configuration file"),
- [VIR_ERR_XML_DETAIL] = { "parser error", "%s" },
- [VIR_ERR_INVALID_NETWORK] = MSG2("invalid network pointer in", " %s"),
- [VIR_ERR_NETWORK_EXIST] = MSG_EXISTS("network"),
- [VIR_ERR_SYSTEM_ERROR] = { "system call error", "%s" },
- [VIR_ERR_RPC] = { "RPC error", "%s" },
- [VIR_ERR_GNUTLS_ERROR] = { "GNUTLS call error", "%s" },
- [VIR_WAR_NO_NETWORK] = MSG("Failed to find the network"),
- [VIR_ERR_NO_DOMAIN] = MSG("Domain not found"),
- [VIR_ERR_NO_NETWORK] = MSG("Network not found"),
- [VIR_ERR_INVALID_MAC] = MSG("invalid MAC address"),
- [VIR_ERR_AUTH_FAILED] = MSG("authentication failed"),
- [VIR_ERR_INVALID_STORAGE_POOL] = MSG2("invalid storage pool pointer in", " %s"),
- [VIR_ERR_INVALID_STORAGE_VOL] = MSG2("invalid storage volume pointer in", " %s"),
- [VIR_WAR_NO_STORAGE] = MSG("Failed to find a storage driver"),
- [VIR_ERR_NO_STORAGE_POOL] = MSG("Storage pool not found"),
- [VIR_ERR_NO_STORAGE_VOL] = MSG("Storage volume not found"),
- [VIR_WAR_NO_NODE] = MSG("Failed to find a node driver"),
- [VIR_ERR_INVALID_NODE_DEVICE] = MSG2("invalid node device pointer", " in %s"),
- [VIR_ERR_NO_NODE_DEVICE] = MSG("Node device not found"),
- [VIR_ERR_NO_SECURITY_MODEL] = MSG("Security model not found"),
- [VIR_ERR_OPERATION_INVALID] = MSG("Requested operation is not valid"),
- [VIR_WAR_NO_INTERFACE] = MSG("Failed to find the interface"),
- [VIR_ERR_NO_INTERFACE] = MSG("Interface not found"),
- [VIR_ERR_INVALID_INTERFACE] = MSG2("invalid interface pointer in", " %s"),
- [VIR_ERR_MULTIPLE_INTERFACES] = MSG("multiple matching interfaces found"),
- [VIR_WAR_NO_NWFILTER] = MSG("Failed to start the nwfilter driver"),
- [VIR_ERR_INVALID_NWFILTER] = MSG("Invalid network filter"),
- [VIR_ERR_NO_NWFILTER] = MSG("Network filter not found"),
- [VIR_ERR_BUILD_FIREWALL] = MSG("Error while building firewall"),
- [VIR_WAR_NO_SECRET] = MSG("Failed to find a secret storage driver"),
- [VIR_ERR_INVALID_SECRET] = MSG("Invalid secret"),
- [VIR_ERR_NO_SECRET] = MSG("Secret not found"),
- [VIR_ERR_CONFIG_UNSUPPORTED] = MSG("unsupported configuration"),
- [VIR_ERR_OPERATION_TIMEOUT] = MSG("Timed out during operation"),
- [VIR_ERR_MIGRATE_PERSIST_FAILED] = MSG("Failed to make domain persistent after migration"),
- [VIR_ERR_HOOK_SCRIPT_FAILED] = MSG("Hook script execution failed"),
- [VIR_ERR_INVALID_DOMAIN_SNAPSHOT] = MSG("Invalid snapshot"),
- [VIR_ERR_NO_DOMAIN_SNAPSHOT] = MSG("Domain snapshot not found"),
- [VIR_ERR_INVALID_STREAM] = MSG2("invalid stream pointer", " in %s"),
- [VIR_ERR_ARGUMENT_UNSUPPORTED] = MSG("argument unsupported"),
- [VIR_ERR_STORAGE_PROBE_FAILED] = MSG("Storage pool probe failed"),
- [VIR_ERR_STORAGE_POOL_BUILT] = MSG("Storage pool already built"),
- [VIR_ERR_SNAPSHOT_REVERT_RISKY] = MSG("revert requires force"),
- [VIR_ERR_OPERATION_ABORTED] = MSG("operation aborted"),
- [VIR_ERR_AUTH_CANCELLED] = MSG("authentication cancelled"),
- [VIR_ERR_NO_DOMAIN_METADATA] = MSG("metadata not found"),
- [VIR_ERR_MIGRATE_UNSAFE] = MSG("Unsafe migration"),
- [VIR_ERR_OVERFLOW] = MSG("numerical overflow"),
- [VIR_ERR_BLOCK_COPY_ACTIVE] = MSG("block copy still active"),
- [VIR_ERR_OPERATION_UNSUPPORTED] = MSG("Operation not supported"),
- [VIR_ERR_SSH] = MSG("SSH transport error"),
- [VIR_ERR_AGENT_UNRESPONSIVE] = MSG("Guest agent is not responding"),
- [VIR_ERR_RESOURCE_BUSY] = MSG("resource busy"),
- [VIR_ERR_ACCESS_DENIED] = MSG("access denied"),
- [VIR_ERR_DBUS_SERVICE] = MSG("error from service"),
- [VIR_ERR_STORAGE_VOL_EXIST] = MSG_EXISTS("storage volume"),
- [VIR_ERR_CPU_INCOMPATIBLE] = MSG("the CPU is incompatible with host CPU"),
- [VIR_ERR_XML_INVALID_SCHEMA] = MSG("XML document failed to validate against schema"),
- [VIR_ERR_MIGRATE_FINISH_OK] = MSG("migration successfully aborted"),
- [VIR_ERR_AUTH_UNAVAILABLE] = MSG("authentication unavailable"),
- [VIR_ERR_NO_SERVER] = MSG("Server not found"),
- [VIR_ERR_NO_CLIENT] = MSG("Client not found"),
- [VIR_ERR_AGENT_UNSYNCED] = MSG("guest agent replied with wrong id to guest-sync command"),
- [VIR_ERR_LIBSSH] = MSG("libssh transport error"),
- [VIR_ERR_DEVICE_MISSING] = MSG("device not found"),
- [VIR_ERR_INVALID_NWFILTER_BINDING] = MSG("Invalid network filter binding"),
- [VIR_ERR_NO_NWFILTER_BINDING] = MSG("Network filter binding not found"),
+ [VIR_ERR_INTERNAL_ERROR] = {
+ N_("internal error"),
+ N_("internal error: %s") },
+ [VIR_ERR_NO_MEMORY] = {
+ N_("out of memory"),
+ N_("out of memory: %s") },
+ [VIR_ERR_NO_SUPPORT] = {
+ N_("this function is not supported by the connection driver"),
+ N_("this function is not supported by the connection driver: %s") },
+ [VIR_ERR_UNKNOWN_HOST] = {
+ N_("unknown host"),
+ N_("unknown host %s") },
+ [VIR_ERR_NO_CONNECT] = {
+ N_("no connection driver available"),
+ N_("no connection driver available for %s") },
+ [VIR_ERR_INVALID_CONN] = {
+ N_("invalid connection pointer in"),
+ N_("invalid connection pointer in %s") },
+ [VIR_ERR_INVALID_DOMAIN] = {
+ N_("invalid domain pointer in"),
+ N_("invalid domain pointer in %s") },
+ [VIR_ERR_INVALID_ARG] = {
+ N_("invalid argument"),
+ N_("invalid argument: %s") },
+ [VIR_ERR_OPERATION_FAILED] = {
+ N_("operation failed"),
+ N_("operation failed: %s") },
+ [VIR_ERR_GET_FAILED] = {
+ N_("GET operation failed"),
+ N_("GET operation failed: %s") },
+ [VIR_ERR_POST_FAILED] = {
+ N_("POST operation failed"),
+ N_("POST operation failed: %s") },
+ [VIR_ERR_HTTP_ERROR] = {
+ N_("got unknown HTTP error code"),
+ N_("got unknown HTTP error code %s") },
+ [VIR_ERR_SEXPR_SERIAL] = {
+ N_("failed to serialize S-Expr"),
+ N_("failed to serialize S-Expr: %s") },
+ [VIR_ERR_NO_XEN] = {
+ N_("could not use Xen hypervisor entry"),
+ N_("could not use Xen hypervisor entry %s") },
+ [VIR_ERR_XEN_CALL] = {
+ N_("failed Xen syscall"),
+ N_("failed Xen syscall %s") },
+ [VIR_ERR_OS_TYPE] = {
+ N_("unknown OS type"),
+ N_("unknown OS type %s") },
+ [VIR_ERR_NO_KERNEL] = {
+ N_("missing kernel information"),
+ N_("missing kernel information: %s") },
+ [VIR_ERR_NO_ROOT] = {
+ N_("missing root device information"),
+ N_("missing root device information in %s") },
+ [VIR_ERR_NO_SOURCE] = {
+ N_("missing source information for device"),
+ N_("missing source information for device %s") },
+ [VIR_ERR_NO_TARGET] = {
+ N_("missing target information for device"),
+ N_("missing target information for device %s") },
+ [VIR_ERR_NO_NAME] = {
+ N_("missing name information"),
+ N_("missing name information in %s") },
+ [VIR_ERR_NO_OS] = {
+ N_("missing operating system information"),
+ N_("missing operating system information for %s") },
+ [VIR_ERR_NO_DEVICE] = {
+ N_("missing devices information"),
+ N_("missing devices information for %s") },
+ [VIR_ERR_NO_XENSTORE] = {
+ N_("could not connect to Xen Store"),
+ N_("could not connect to Xen Store %s") },
+ [VIR_ERR_DRIVER_FULL] = {
+ N_("too many drivers registered"),
+ N_("too many drivers registered in %s") },
+ [VIR_ERR_CALL_FAILED] = {
+ N_("library call failed"),
+ N_("library call failed: %s") },
+ [VIR_ERR_XML_ERROR] = {
+ N_("XML description is invalid or not well formed"),
+ N_("XML error: %s") },
+ [VIR_ERR_DOM_EXIST] = {
+ N_("this domain exists already"),
+ N_("domain %s exists already") },
+ [VIR_ERR_OPERATION_DENIED] = {
+ N_("operation forbidden for read only access"),
+ N_("operation forbidden: %s") },
+ [VIR_ERR_OPEN_FAILED] = {
+ N_("failed to open configuration file"),
+ N_("failed to open configuration file %s") },
+ [VIR_ERR_READ_FAILED] = {
+ N_("failed to read configuration file"),
+ N_("failed to read configuration file %s") },
+ [VIR_ERR_PARSE_FAILED] = {
+ N_("failed to parse configuration file"),
+ N_("failed to parse configuration file %s") },
+ [VIR_ERR_CONF_SYNTAX] = {
+ N_("configuration file syntax error"),
+ N_("configuration file syntax error: %s") },
+ [VIR_ERR_WRITE_FAILED] = {
+ N_("failed to write configuration file"),
+ N_("failed to write configuration file: %s") },
+ [VIR_ERR_XML_DETAIL] = {
+ N_("parsers error"),
+ "%s" },
+ [VIR_ERR_INVALID_NETWORK] = {
+ N_("invalid network pointer in"),
+ N_("invalid network pointer in %s") },
+ [VIR_ERR_NETWORK_EXIST] = {
+ N_("this network exists already"),
+ N_("network %s exists already") },
+ [VIR_ERR_SYSTEM_ERROR] = {
+ N_("system call error"),
+ "%s" },
+ [VIR_ERR_RPC] = {
+ N_("RPC error"),
+ "%s" },
+ [VIR_ERR_GNUTLS_ERROR] = {
+ N_("GNUTLS call error"),
+ "%s" },
+ [VIR_WAR_NO_NETWORK] = {
+ N_("Failed to find the network"),
+ N_("Failed to find the network: %s") },
+ [VIR_ERR_NO_DOMAIN] = {
+ N_("Domain not found"),
+ N_("Domain not found: %s") },
+ [VIR_ERR_NO_NETWORK] = {
+ N_("Network not found"),
+ N_("Network not found: %s") },
+ [VIR_ERR_INVALID_MAC] = {
+ N_("invalid MAC address"),
+ N_("invalid MAC address: %s") },
+ [VIR_ERR_AUTH_FAILED] = {
+ N_("authentication failed"),
+ N_("authentication failed: %s") },
+ [VIR_ERR_INVALID_STORAGE_POOL] = {
+ N_("invalid storage pool pointer in"),
+ N_("invalid storage pool pointer in %s") },
+ [VIR_ERR_INVALID_STORAGE_VOL] = {
+ N_("invalid storage volume pointer in"),
+ N_("invalid storage volume pointer in %s") },
+ [VIR_WAR_NO_STORAGE] = {
+ N_("Failed to find a storage driver"),
+ N_("Failed to find a storage driver: %s") },
+ [VIR_ERR_NO_STORAGE_POOL] = {
+ N_("Storage pool not found"),
+ N_("Storage pool not found: %s") },
+ [VIR_ERR_NO_STORAGE_VOL] = {
+ N_("Storage volume not found"),
+ N_("Storage volume not found: %s") },
+ [VIR_WAR_NO_NODE] = {
+ N_("Failed to find a node driver"),
+ N_("Failed to find a node driver: %s") },
+ [VIR_ERR_INVALID_NODE_DEVICE] = {
+ N_("invalid node device pointer"),
+ N_("invalid node device pointer in %s") },
+ [VIR_ERR_NO_NODE_DEVICE] = {
+ N_("Node device not found"),
+ N_("Node device not found: %s") },
+ [VIR_ERR_NO_SECURITY_MODEL] = {
+ N_("Security model not found"),
+ N_("Security model not found: %s") },
+ [VIR_ERR_OPERATION_INVALID] = {
+ N_("Requested operation is not valid"),
+ N_("Requested operation is not valid: %s") },
+ [VIR_WAR_NO_INTERFACE] = {
+ N_("Failed to find the interface"),
+ N_("Failed to find the interface: %s") },
+ [VIR_ERR_NO_INTERFACE] = {
+ N_("Interface not found"),
+ N_("Interface not found: %s") },
+ [VIR_ERR_INVALID_INTERFACE] = {
+ N_("invalid interface pointer in"),
+ N_("invalid interface pointer in %s") },
+ [VIR_ERR_MULTIPLE_INTERFACES] = {
+ N_("multiple matching interfaces found"),
+ N_("multiple matching interfaces found: %s") },
+ [VIR_WAR_NO_NWFILTER] = {
+ N_("Failed to start the nwfilter driver"),
+ N_("Failed to start the nwfilter driver: %s") },
+ [VIR_ERR_INVALID_NWFILTER] = {
+ N_("Invalid network filter"),
+ N_("Invalid network filter: %s") },
+ [VIR_ERR_NO_NWFILTER] = {
+ N_("Network filter not found"),
+ N_("Network filter not found: %s") },
+ [VIR_ERR_BUILD_FIREWALL] = {
+ N_("Error while building firewall"),
+ N_("Error while building firewall: %s") },
+ [VIR_WAR_NO_SECRET] = {
+ N_("Failed to find a secret storage driver"),
+ N_("Failed to find a secret storage driver: %s") },
+ [VIR_ERR_INVALID_SECRET] = {
+ N_("Invalid secret"),
+ N_("Invalid secret: %s") },
+ [VIR_ERR_NO_SECRET] = {
+ N_("Secret not found"),
+ N_("Secret not found: %s") },
+ [VIR_ERR_CONFIG_UNSUPPORTED] = {
+ N_("unsupported configuration"),
+ N_("unsupported configuration: %s") },
+ [VIR_ERR_OPERATION_TIMEOUT] = {
+ N_("Timed out during operation"),
+ N_("Timed out during operation: %s") },
+ [VIR_ERR_MIGRATE_PERSIST_FAILED] = {
+ N_("Failed to make domain persistent after migration"),
+ N_("Failed to make domain persistent after migration: %s") },
+ [VIR_ERR_HOOK_SCRIPT_FAILED] = {
+ N_("Hook script execution failed"),
+ N_("Hook script execution failed: %s") },
+ [VIR_ERR_INVALID_DOMAIN_SNAPSHOT] = {
+ N_("Invalid snapshot"),
+ N_("Invalid snapshot: %s") },
+ [VIR_ERR_NO_DOMAIN_SNAPSHOT] = {
+ N_("Domain snapshot not found"),
+ N_("Domain snapshot not found: %s") },
+ [VIR_ERR_INVALID_STREAM] = {
+ N_("invalid stream pointer"),
+ N_("invalid stream pointer in %s") },
+ [VIR_ERR_ARGUMENT_UNSUPPORTED] = {
+ N_("argument unsupported"),
+ N_("argument unsupported: %s") },
+ [VIR_ERR_STORAGE_PROBE_FAILED] = {
+ N_("Storage pool probe failed"),
+ N_("Storage pool probe failed: %s") },
+ [VIR_ERR_STORAGE_POOL_BUILT] = {
+ N_("Storage pool already built"),
+ N_("Storage pool already built: %s") },
+ [VIR_ERR_SNAPSHOT_REVERT_RISKY] = {
+ N_("revert requires force"),
+ N_("revert requires force: %s") },
+ [VIR_ERR_OPERATION_ABORTED] = {
+ N_("operation aborted"),
+ N_("operation aborted: %s") },
+ [VIR_ERR_AUTH_CANCELLED] = {
+ N_("authentication cancelled"),
+ N_("authentication cancelled: %s") },
+ [VIR_ERR_NO_DOMAIN_METADATA] = {
+ N_("metadata not found"),
+ N_("metadata not found: %s") },
+ [VIR_ERR_MIGRATE_UNSAFE] = {
+ N_("Unsafe migration"),
+ N_("Unsafe migration: %s") },
+ [VIR_ERR_OVERFLOW] = {
+ N_("numerical overflow"),
+ N_("numerical overflow: %s") },
+ [VIR_ERR_BLOCK_COPY_ACTIVE] = {
+ N_("block copy still active"),
+ N_("block copy still active: %s") },
+ [VIR_ERR_OPERATION_UNSUPPORTED] = {
+ N_("Operation not supported"),
+ N_("Operation not supported: %s") },
+ [VIR_ERR_SSH] = {
+ N_("SSH transport error"),
+ N_("SSH transport error: %s") },
+ [VIR_ERR_AGENT_UNRESPONSIVE] = {
+ N_("Guest agent is not responding"),
+ N_("Guest agent is not responding: %s") },
+ [VIR_ERR_RESOURCE_BUSY] = {
+ N_("resource busy"),
+ N_("resource busy: %s") },
+ [VIR_ERR_ACCESS_DENIED] = {
+ N_("access denied"),
+ N_("access denied: %s") },
+ [VIR_ERR_DBUS_SERVICE] = {
+ N_("error from service"),
+ N_("error from service: %s") },
+ [VIR_ERR_STORAGE_VOL_EXIST] = {
+ N_("this storage volume exists already"),
+ N_("storage volume %s exists already") },
+ [VIR_ERR_CPU_INCOMPATIBLE] = {
+ N_("the CPU is incompatible with host CPU"),
+ N_("the CPU is incompatible with host CPU: %s") },
+ [VIR_ERR_XML_INVALID_SCHEMA] = {
+ N_("XML document failed to validate against schema"),
+ N_("XML document failed to validate against schema: %s") },
+ [VIR_ERR_MIGRATE_FINISH_OK] = {
+ N_("migration successfully aborted"),
+ N_("migration successfully aborted: %s") },
+ [VIR_ERR_AUTH_UNAVAILABLE] = {
+ N_("authentication unavailable"),
+ N_("authentication unavailable: %s") },
+ [VIR_ERR_NO_SERVER] = {
+ N_("Server not found"),
+ N_("Server not found: %s") },
+ [VIR_ERR_NO_CLIENT] = {
+ N_("Client not found"),
+ N_("Client not found: %s") },
+ [VIR_ERR_AGENT_UNSYNCED] = {
+ N_("guest agent replied with wrong id to guest-sync command"),
+ N_("guest agent replied with wrong id to guest-sync command: %s") },
+ [VIR_ERR_LIBSSH] = {
+ N_("libssh transport error"),
+ N_("libssh transport error: %s") },
+ [VIR_ERR_DEVICE_MISSING] = {
+ N_("device not found"),
+ N_("device not found: %s") },
+ [VIR_ERR_INVALID_NWFILTER_BINDING] = {
+ N_("Invalid network filter binding"),
+ N_("Invalid network filter binding: %s") },
+ [VIR_ERR_NO_NWFILTER_BINDING] = {
+ N_("Network filter binding not found"),
+ N_("Network filter binding not found: %s") },
};
-#undef MSG
-#undef MSG2
-#undef MSG_EXISTS
/**
* virErrorMsg:
--
2.19.2
5 years, 11 months
[libvirt] [PATCH 00/10] error: Refactor error message string convertor and add tests
by Peter Krempa
Make sure that all the error messages have both versions (info and
non-info) and store them in a sorted array rather than a giant switch.
Patch 7/10 adds a test that ensures that no messages were harmed during
the refactor. That commit will not be pushed (along with the
corresponding revert) to avoid polluting git history.
Peter Krempa (10):
include: error: Add enum sentinel for virErrorNumber enum
util: error: Fix error message strings to play well with additional
info
util: error: Add error message versions with info for some error codes
util: error: Export virErrorMsg for use in testsuite
tests: Add test for virErrorMsg message constraints
util: error: Improve docs for virErrorMsg
DO NOT PUSH: Make sure that error messages are not moved around
util: error: Use a more declarative approach in virErrorMsg
Revert "DO NOT PUSH: Make sure that error messages are not moved
around"
tests: virerror: Make sure that error messages stay in correct order
include/libvirt/virterror.h | 5 +
src/Makefile.am | 1 +
src/libvirt_private.syms | 2 +
src/util/Makefile.inc.am | 1 +
src/util/virerror.c | 791 +++++++++---------------------------
src/util/virerrorpriv.h | 36 ++
tests/Makefile.am | 6 +
tests/virerrortest.c | 121 ++++++
8 files changed, 361 insertions(+), 602 deletions(-)
create mode 100644 src/util/virerrorpriv.h
create mode 100644 tests/virerrortest.c
--
2.19.2
5 years, 11 months
[libvirt] [jenkins-ci PATCH] guests: Fix duplicated key in vault
by Andrea Bolognani
Commit d3904591a2d2 added the Jenkins secret for FreeBSD
12 to the vault, but mistakenly created a second entry
for the existing libvirt-freebsd-11 key instead of
introducing a new entry for the libvirt-freebsd-12 key.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed under the binary blob update rule.
guests/vars/vault.yml | 82 +++++++++++++++++++++----------------------
1 file changed, 41 insertions(+), 41 deletions(-)
diff --git a/guests/vars/vault.yml b/guests/vars/vault.yml
index 4229056..4d51fbb 100644
--- a/guests/vars/vault.yml
+++ b/guests/vars/vault.yml
@@ -1,42 +1,42 @@
$ANSIBLE_VAULT;1.1;AES256
-34653262643236653630616233396231366465363137396438363234336539366631666430363735
-3738616330663632323663303738323739366234623932360a306233666539653734353635626334
-39386438383137366436313865623861336331366164383439303466653639383636376265656137
-6133366231346131390a333066333433626630623766383238666630366633353232663430613161
-64373231333739613763303664383233333732636438643234343635356466376234663735356433
-37663038653238386362666536316635363466663266323461376331663735656263643337663161
-31323435323666313665616533393335626638656134303937396232633636393936636439653561
-65323365353531663438646538343537616236363631326666376232313162613134623766353162
-38666262346261306439383235333765613834356231336430306533613262376137333430643062
-62666633343734643636346135303137666263316333656665383837303133613037323266643664
-36373234636466393630393836653538613332306434396533343162396262346234623965373732
-39663634336239616538653337383135613534623462623230633861303764326561646531643636
-30386263626165386361366135333261323435386334613232346533376461656134376636613135
-33646432386632306133383862653065643134303030313032643962316534383366613364316234
-33353765626565386536373634613564383138393164336236343537353936373230653634656238
-35356238656235363235653837393862376335376338636361653535383432613961353832386234
-30336136326163303234333662313666306238383761303836616138343165656264363637383465
-33646561303366313132636633393231393966356633323464396639623066323337326534373835
-62663235343264623564316439343739663565383338373739643966343134643930346366666232
-39633631353365666464323138323036353666636230626563633733656461613736316639366137
-66326234306137653864643263616334316233663761366239346432356463336530326432326238
-30323330643838363631343865663238653335633862316639393237326566613863653834623334
-63613538326332376633376364653033623335356462383231303062643837663332393262613265
-32346635313130306134363133313134336666343439616636306237393466313362366135643862
-38376136323833363737396637336436366338373431333765373738396234626663386538353530
-66626337633337323563343666633131323235396564393534393234373530303135373335643338
-36366264323930396236663932383764313633353663313236376366653237333432333263643962
-63366438343662343331323861313838323837633238356431313034373132363434336536316536
-36646461323832363134386538353130363563373139333734346632346265373530373532643462
-33313661646533303636646337346232356437393334396436343162646631303537383466353230
-62633964303165626636373766616261313036666230306132626239623366346662373061613463
-30633637653838646133346261633934646665666161363137313362626638363961313935633464
-63363762356564393239353232386230313464336364393066646632316265313764393430323037
-33643830613565343263323233656333646161313062666461396264316538626339376339303232
-35653466346533633435613934326538323166613139393166623434326134353238333736383134
-62316266633137356265643638623862373332353665326235316139646362336530373834353966
-62633062303966666230303931653461653331383731376165633030396131363062356163303335
-61353861343338303233373536333331356234656138616561653465646262313662636630313134
-63616465393735623861383564383338626333653763366564396133356664396662653331303632
-62383438366330346261303264326636366239313864343261343364383237626663356262616230
-64376530353433643865626635666332356138623037633935656437653530613461
+30646332646365623231356439373464646464333463383363383036656338373163306636303363
+6439363134666263336362663232613933636138303730390a336365336264376464303436636630
+61323131636136633262613165343933306661616462633161343638326162646339303738616137
+3435343133313837350a656463396464366566376130356634643732616239663433373631303633
+62396633346533633163303433316638663764316633623532643266373436633764653861306235
+66646362396166383536623132646535343364323061613766643431313661353432363339666434
+32663939643263363265336135353439653661643161616537616131376466663139383961623732
+33393065323933643461333062313534646134346264613566376635326331306538383437653834
+61316533633736633432626361626238326532376236373531633430323537333132636637346232
+39326662373036616566653861643534643737323531616164333537626333653339313961626634
+34646362613263373235303734343466313032333232313039653364623266626537643131393563
+63656632666136633165316538346163373835623539326231646131373531383162313332643132
+32626662316330363836383764323966666265346435353037666536396462623336313764376430
+64656662333862393131613965633863343936326535643166666230643963633766323332663066
+62306532323432626664623838353439336334613033376136623734343664373630376534316336
+31393363313265643035626439616131636135313836333137616134623665666535663731303437
+66666634333931323739656631333562663231643738363233623561326363626339663066356664
+63656463306235343739333235333564363764353835306162616236383961356463383364393139
+61646432386362303535623065333061613534336365623339663435383231353230373539633237
+35316530636633323231343464313162633436623334356131376137633165363361623134366434
+62303437653833626466643339316362653363346530343032623462663539393930633035663838
+38393130623536313332343537613833333564316438376432393063613062353931653264326662
+36303631663638633833643630636237393538626134306237323963313438613461346439313839
+31353666653939326333373364376232623638623339376535613662353937353634316166633663
+36633762356334393066326536363066376638663561613864623739313131636666393134366237
+38376566393539353231613730346433653235366237626166616565353730363665643964363236
+66326564303765666237626237653736623336376336356631343564306437393734383431313530
+61353639366338663236643037373665626634353166373935383965303237613561623262376564
+65353063653764663636336534363665656532336532353037313065633836326435303365626537
+30633638346261646233333736376238613332316131303739393137363831633164613262653031
+64383733636666653461633066303763653265633635316464366561353265383539666466356636
+38656232343466353734353263623130623133613064643930393563616164333233663737343335
+30623233383936313762373934643536373534306230386131636534653866646339646438653261
+39623131633836363934656333383032646433623430663138386532626332336363373066336235
+63643166356630366164343566653134323037333238636335353266633036343533633464346532
+32313364613037616531303766656461316438643232646639373564643331376438613237626131
+63353238616633346462653065373137613962383633386664636237373434333938353335386130
+33303866323662363137656562383965626566356663373761653531653536306562353435376639
+66333133373037633362613231656439623931623164393131323063353934333134346365636164
+34396537313863383762633535636263336230333966366533626161336430663031366334623064
+30646566373037393161343231393665316339666635346662663031626161643137
--
2.19.2
5 years, 11 months
[libvirt] [PATCH] cpu: Add support for "stibp" x86_64 feature
by Jiri Denemark
QEMU commit v3.1.0-4-g0e89165829
KVM patch: https://lore.kernel.org/lkml/20181205191956.31480-1-ehabkost@redhat.com/
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/cpu_map/x86_features.xml | 3 +++
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml | 2 +-
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml | 1 +
tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml | 1 +
13 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
index f835b02b02..59236456d6 100644
--- a/src/cpu_map/x86_features.xml
+++ b/src/cpu_map/x86_features.xml
@@ -323,6 +323,9 @@
<feature name='spec-ctrl'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x04000000'/>
</feature>
+ <feature name='stibp'>
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x08000000'/>
+ </feature>
<feature name='ssbd'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x80000000'/>
</feature>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
index e033bb141f..5c9cfa9bd6 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-disabled.xml
@@ -1,6 +1,6 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0800c1dc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x04000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x0c000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
index 4fa4770208..5d3093cec1 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-guest.xml
@@ -23,6 +23,7 @@
<feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='intel-pt'/>
+ <feature policy='require' name='stibp'/>
<feature policy='require' name='xsaveopt'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='abm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
index 25690c099c..a534d2dec5 100644
--- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-ibrs-host.xml
@@ -24,6 +24,7 @@
<feature name='arat'/>
<feature name='tsc_adjust'/>
<feature name='intel-pt'/>
+ <feature name='stibp'/>
<feature name='xsaveopt'/>
<feature name='pdpe1gb'/>
<feature name='abm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
index aacc7a2b14..ec299652f7 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-disabled.xml
@@ -1,6 +1,6 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1fc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x08000000'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
index a66c7a5644..d8aaaad29d 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-guest.xml
@@ -24,6 +24,7 @@
<feature policy='require' name='arat'/>
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmt'/>
+ <feature policy='require' name='stibp'/>
<feature policy='require' name='xsaveopt'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='abm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
index 624d71db20..9bac4b4648 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2609-v3-host.xml
@@ -25,6 +25,7 @@
<feature name='arat'/>
<feature name='tsc_adjust'/>
<feature name='cmt'/>
+ <feature name='stibp'/>
<feature name='xsaveopt'/>
<feature name='pdpe1gb'/>
<feature name='abm'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml
index d904808cec..85369d755c 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-disabled.xml
@@ -1,7 +1,7 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1fc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000000' edx='0x08000000'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
</cpudata>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
index 7b93df3f1b..7718d7ca59 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-guest.xml
@@ -21,6 +21,7 @@
<feature policy='require' name='tsc_adjust'/>
<feature policy='require' name='cmt'/>
<feature policy='require' name='intel-pt'/>
+ <feature policy='require' name='stibp'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
<feature policy='require' name='pdpe1gb'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
index 5078420c7a..43a0b93ab4 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E5-2623-v4-host.xml
@@ -26,6 +26,7 @@
<feature name='tsc_adjust'/>
<feature name='cmt'/>
<feature name='intel-pt'/>
+ <feature name='stibp'/>
<feature name='xsaveopt'/>
<feature name='mbm_total'/>
<feature name='mbm_local'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml
index b5c70a9dc4..a5b85a15c2 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-disabled.xml
@@ -1,7 +1,7 @@
<!-- Features disabled by QEMU -->
<cpudata arch='x86'>
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0804c1fc' edx='0xb0600000'/>
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000008' edx='0x00000000'/>
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x00001000' ecx='0x00000008' edx='0x08000000'/>
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
<cpuid eax_in='0x0000000f' ecx_in='0x01' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000006'/>
<cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
index 480127f341..8f014f6e28 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-guest.xml
@@ -23,6 +23,7 @@
<feature policy='require' name='clflushopt'/>
<feature policy='require' name='intel-pt'/>
<feature policy='require' name='pku'/>
+ <feature policy='require' name='stibp'/>
<feature policy='require' name='xsaves'/>
<feature policy='require' name='mbm_total'/>
<feature policy='require' name='mbm_local'/>
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
index 680b10acef..9de76fd640 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Gold-5115-host.xml
@@ -24,6 +24,7 @@
<feature name='clflushopt'/>
<feature name='intel-pt'/>
<feature name='pku'/>
+ <feature name='stibp'/>
<feature name='xsaves'/>
<feature name='mbm_total'/>
<feature name='mbm_local'/>
--
2.20.1
5 years, 11 months
[libvirt] [PATCH] tests: ignore XML files starting with a .
by Daniel P. Berrangé
If an editor has an XML file open, it may create a temporary . file. The
existance of this file will cause the virschematest to fail, so just
skip these editor temp files.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
tests/virschematest.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 4c348d9909..d1bcdeac9c 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -84,6 +84,8 @@ testSchemaDir(const char *schema,
while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
if (!virFileHasSuffix(ent->d_name, ".xml"))
continue;
+ if (ent->d_name[0] == '.')
+ continue;
if (virAsprintf(&xml_path, "%s/%s", dir_path, ent->d_name) < 0)
goto cleanup;
--
2.19.2
5 years, 11 months
[libvirt] [jenkins-ci PATCH 0/6] Add FreeBSD 12, drop FreeBSD 12
by Andrea Bolognani
FreeBSD 12 was released, like, almost a week ago!
Andrea Bolognani (6):
guests: Fix FreeBSD symlink kludge
guests: Add FreeBSD 12
Build on FreeBSD 12
Stop building on FreeBSD 10
guests: Drop FreeBSD 10
guests: Simplify FreeBSD symlink kludge
.../main.yml | 2 +-
guests/inventory | 2 +-
guests/playbooks/build/jobs/defaults.yml | 2 +-
.../playbooks/build/projects/libvirt-dbus.yml | 4 +-
.../build/projects/libvirt-ocaml.yml | 2 +-
.../playbooks/build/projects/libvirt-tck.yml | 2 +-
.../playbooks/build/projects/virt-manager.yml | 2 +-
guests/playbooks/update/tasks/kludges.yml | 17 +---
guests/vars/vault.yml | 82 +++++++++----------
jobs/defaults.yaml | 2 +-
projects/libvirt-dbus.yaml | 4 +-
projects/libvirt-ocaml.yaml | 2 +-
projects/libvirt-tck.yaml | 2 +-
projects/virt-manager.yaml | 2 +-
14 files changed, 57 insertions(+), 70 deletions(-)
rename guests/host_vars/{libvirt-freebsd-10 => libvirt-freebsd-12}/main.yml (95%)
--
2.19.2
5 years, 11 months
[libvirt] [PATCH] src: Document autostart for session demon
by Michal Privoznik
The autostart under session daemon might not behave as you'd
expect it to behave. This patch is inspired by latest
libvirt-users discussion:
https://www.redhat.com/archives/libvirt-users/2018-December/msg00047.html
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt-domain.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index d49d7f869f..75c9014c0e 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -6693,6 +6693,11 @@ virDomainCreateWithFiles(virDomainPtr domain, unsigned int nfiles,
* configured to be automatically started when the host
* machine boots.
*
+ * Please note that this might result in unexpected behaviour if
+ * used for some session URIs. Since the session daemon is started
+ * with --timeout it comes and goes and as it does so it
+ * autostarts domains which might have been shut off recently.
+ *
* Returns -1 in case of error, 0 in case of success
*/
int
--
2.19.2
5 years, 11 months
[libvirt] [PATCH v3] Drop UML driver
by Michal Privoznik
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(a)redhat.com>
---
diff to v2:
- Add 'Obsoletes' line into the spec file as suggested by Dan.
configure.ac | 4 -
docs/aclpolkit.html.in | 4 -
docs/drivers.html.in | 1 -
docs/drvuml.html.in | 93 -
docs/formatcaps.html.in | 3 -
docs/formatdomain.html.in | 6 +-
docs/formatdomaincaps.html.in | 1 -
docs/formatnwfilter.html.in | 2 +-
docs/news.xml | 14 +
docs/schemas/capability.rng | 4 +-
docs/schemas/domaincommon.rng | 6 +-
include/libvirt/virterror.h | 2 +-
libvirt.spec.in | 67 +-
m4/virt-driver-uml.m4 | 54 -
mingw-libvirt.spec.in | 1 -
po/POTFILES | 2 -
src/Makefile.am | 1 -
src/README | 3 +-
src/locking/lock_driver.h | 2 +-
src/remote/Makefile.inc.am | 1 -
src/remote/libvirtd.uml.logrotate.in | 8 -
src/remote/remote_daemon.c | 4 -
src/uml/Makefile.inc.am | 48 -
src/uml/uml_conf.c | 481 -----
src/uml/uml_conf.h | 82 -
src/uml/uml_driver.c | 2835 --------------------------
src/uml/uml_driver.h | 29 -
tests/domaincapsschemadata/basic.xml | 25 -
tests/domaincapstest.c | 2 -
tests/objectlocking.ml | 3 -
tests/virdrivermoduletest.c | 3 -
tools/virsh.c | 3 -
32 files changed, 30 insertions(+), 3764 deletions(-)
delete mode 100644 docs/drvuml.html.in
delete mode 100644 m4/virt-driver-uml.m4
delete mode 100644 src/remote/libvirtd.uml.logrotate.in
delete mode 100644 src/uml/Makefile.inc.am
delete mode 100644 src/uml/uml_conf.c
delete mode 100644 src/uml/uml_conf.h
delete mode 100644 src/uml/uml_driver.c
delete mode 100644 src/uml/uml_driver.h
delete mode 100644 tests/domaincapsschemadata/basic.xml
diff --git a/configure.ac b/configure.ac
index 8c89ff365b..ac52189dff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/docs/aclpolkit.html.in b/docs/aclpolkit.html.in
index ac54f125da..2cf1f9b5a5 100644
--- a/docs/aclpolkit.html.in
+++ b/docs/aclpolkit.html.in
@@ -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>
diff --git a/docs/drivers.html.in b/docs/drivers.html.in
index c94144aa41..a66651df2f 100644
--- a/docs/drivers.html.in
+++ b/docs/drivers.html.in
@@ -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>
diff --git a/docs/drvuml.html.in b/docs/drvuml.html.in
deleted file mode 100644
index 0860db7dcf..0000000000
--- a/docs/drvuml.html.in
+++ /dev/null
@@ -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>
-<domain type='uml'>
- <name>demo</name>
- <uuid>b4433fc2-a22e-ffb3-0a3d-9c173b395800</uuid>
- <memory>500000</memory>
- <currentMemory>500000</currentMemory>
- <vcpu>1</vcpu>
- <os>
- <type arch='x86_64'>uml</type>
- <kernel>/home/berrange/linux-uml-2.6.26-x86_64</kernel>
- </os>
- <devices>
- <disk type='file' device='disk'>
- <source file='/home/berrange/FedoraCore6-AMD64-root_fs'/>
- <target dev='ubd0' bus='uml'/>
- </disk>
- <console type='pty'/>
- </devices>
-</domain>
-</pre>
- </body>
-</html>
diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index 86534b2ed2..2a0aa963bb 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -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>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 428b0e8bb5..2463261372 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -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
diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in
index 9920de4dac..cafd9abbdf 100644
--- a/docs/formatdomaincaps.html.in
+++ b/docs/formatdomaincaps.html.in
@@ -278,7 +278,6 @@
<value>virtio</value>
<value>xen</value>
<value>usb</value>
- <value>uml</value>
<value>sata</value>
<value>sd</value>
</enum>
diff --git a/docs/formatnwfilter.html.in b/docs/formatnwfilter.html.in
index b2282b7dee..796c16549d 100644
--- a/docs/formatnwfilter.html.in
+++ b/docs/formatnwfilter.html.in
@@ -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>
<filter name='test-eth0'>
diff --git a/docs/news.xml b/docs/news.xml
index 5bdbd34a14..e9b6bb7c65 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -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>
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index fe90a2e4c6..8f3266b9f1 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -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>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5a6c48f1aa..76b49aacc2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -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>
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index f41afcd0a7..fbbe2d5624 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -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 */
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 71cd45c603..f9cec9f7eb 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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,8 @@ 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
%if %{with_vbox}
Requires: libvirt-daemon-driver-vbox = %{version}-%{release}
%endif
@@ -743,19 +740,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 +827,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 +1032,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 +1145,6 @@ rm -f po/stamp-po
--with-avahi \
--with-polkit \
--with-libvirtd \
- %{?arg_uml} \
%{?arg_phyp} \
%{?arg_esx} \
%{?arg_hyperv} \
@@ -1316,9 +1273,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 +1679,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 +1709,6 @@ exit 0
%files daemon-lxc
%endif
-%if %{with_uml}
-%files daemon-uml
-%endif
-
%if %{with_libxl}
%files daemon-xen
%endif
diff --git a/m4/virt-driver-uml.m4 b/m4/virt-driver-uml.m4
deleted file mode 100644
index 9b406a5b6b..0000000000
--- a/m4/virt-driver-uml.m4
+++ /dev/null
@@ -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])
-])
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index b28e40f7f7..7c7ab4146d 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -177,7 +177,6 @@ autoreconf -if
--without-avahi \
--without-polkit \
--without-libvirtd \
- --without-uml \
%{?_without_phyp} \
%{?_without_esx} \
%{?_without_hyperv} \
diff --git a/po/POTFILES b/po/POTFILES
index be2874487c..9dd4ee7d99 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -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
diff --git a/src/Makefile.am b/src/Makefile.am
index 33ff280d78..e2b89e27e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
diff --git a/src/README b/src/README
index bb3cddfc6e..846bf2b664 100644
--- a/src/README
+++ b/src/README
@@ -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
diff --git a/src/locking/lock_driver.h b/src/locking/lock_driver.h
index f2d5266517..50c73a70d4 100644
--- a/src/locking/lock_driver.h
+++ b/src/locking/lock_driver.h
@@ -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
*/
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index eb8d6feb31..d188c4e348 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -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)
diff --git a/src/remote/libvirtd.uml.logrotate.in b/src/remote/libvirtd.uml.logrotate.in
deleted file mode 100644
index 66a848e37e..0000000000
--- a/src/remote/libvirtd.uml.logrotate.in
+++ /dev/null
@@ -1,8 +0,0 @@
-@localstatedir(a)/log/libvirt/uml/*.log {
- weekly
- missingok
- rotate 4
- compress
- delaycompress
- copytruncate
-}
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index f0dd7597e6..3be3ad02fc 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -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;
diff --git a/src/uml/Makefile.inc.am b/src/uml/Makefile.inc.am
deleted file mode 100644
index 975398b928..0000000000
--- a/src/uml/Makefile.inc.am
+++ /dev/null
@@ -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)
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
deleted file mode 100644
index 067600afba..0000000000
--- a/src/uml/uml_conf.c
+++ /dev/null
@@ -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;
-}
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
deleted file mode 100644
index a9520a6d3e..0000000000
--- a/src/uml/uml_conf.h
+++ /dev/null
@@ -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 */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
deleted file mode 100644
index e790273717..0000000000
--- a/src/uml/uml_driver.c
+++ /dev/null
@@ -1,2835 +0,0 @@
-/*
- * uml_driver.c: core driver methods for managing UML guests
- *
- * Copyright (C) 2006-2015 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/>.
- */
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <sys/poll.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/utsname.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <pwd.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <sys/inotify.h>
-#include <sys/un.h>
-
-#include "uml_driver.h"
-#include "uml_conf.h"
-#include "virbuffer.h"
-#include "virhostcpu.h"
-#include "virhostmem.h"
-#include "capabilities.h"
-#include "viralloc.h"
-#include "viruuid.h"
-#include "domain_conf.h"
-#include "domain_audit.h"
-#include "datatypes.h"
-#include "virlog.h"
-#include "domain_nwfilter.h"
-#include "virfile.h"
-#include "virfdstream.h"
-#include "configmake.h"
-#include "virnetdevtap.h"
-#include "virnodesuspend.h"
-#include "virprocess.h"
-#include "viruri.h"
-#include "virstring.h"
-#include "viraccessapicheck.h"
-
-#define VIR_FROM_THIS VIR_FROM_UML
-
-VIR_LOG_INIT("uml.uml_driver");
-
-typedef struct _umlDomainObjPrivate umlDomainObjPrivate;
-typedef umlDomainObjPrivate *umlDomainObjPrivatePtr;
-struct _umlDomainObjPrivate {
- int monitor;
- int monitorWatch;
-};
-
-static int umlProcessAutoDestroyInit(struct uml_driver *driver);
-static void umlProcessAutoDestroyRun(struct uml_driver *driver,
- virConnectPtr conn);
-static void umlProcessAutoDestroyShutdown(struct uml_driver *driver);
-static int umlProcessAutoDestroyAdd(struct uml_driver *driver,
- virDomainObjPtr vm,
- virConnectPtr conn);
-static int umlProcessAutoDestroyRemove(struct uml_driver *driver,
- virDomainObjPtr vm);
-
-
-static int umlStateCleanup(void);
-
-static void *umlDomainObjPrivateAlloc(void *opaque ATTRIBUTE_UNUSED)
-{
- umlDomainObjPrivatePtr priv;
-
- if (VIR_ALLOC(priv) < 0)
- return NULL;
-
- priv->monitor = -1;
- priv->monitorWatch = -1;
-
- return priv;
-}
-
-static void umlDomainObjPrivateFree(void *data)
-{
- umlDomainObjPrivatePtr priv = data;
-
- VIR_FREE(priv);
-}
-
-
-static void umlDriverLock(struct uml_driver *driver)
-{
- virMutexLock(&driver->lock);
-}
-static void umlDriverUnlock(struct uml_driver *driver)
-{
- virMutexUnlock(&driver->lock);
-}
-
-
-static int umlOpenMonitor(struct uml_driver *driver,
- virDomainObjPtr vm);
-static int umlReadPidFile(struct uml_driver *driver,
- virDomainObjPtr vm);
-
-static int umlStartVMDaemon(virConnectPtr conn,
- struct uml_driver *driver,
- virDomainObjPtr vm,
- bool autoDestroy);
-
-static void umlShutdownVMDaemon(struct uml_driver *driver,
- virDomainObjPtr vm,
- virDomainShutoffReason reason);
-
-
-static int umlMonitorCommand(const struct uml_driver *driver,
- const virDomainObj *vm,
- const char *cmd,
- char **reply);
-
-static struct uml_driver *uml_driver;
-
-static virDomainObjPtr
-umlDomObjFromDomainLocked(struct uml_driver *driver,
- const unsigned char *uuid)
-{
- virDomainObjPtr vm;
- char uuidstr[VIR_UUID_STRING_BUFLEN];
-
- if (!(vm = virDomainObjListFindByUUID(driver->domains, uuid))) {
- virUUIDFormat(uuid, uuidstr);
-
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
- return NULL;
- }
-
- return vm;
-}
-
-
-static virDomainObjPtr
-umlDomObjFromDomain(struct uml_driver *driver,
- const unsigned char *uuid)
-{
- virDomainObjPtr vm;
-
- umlDriverLock(driver);
- vm = umlDomObjFromDomainLocked(driver, uuid);
- umlDriverUnlock(driver);
- return vm;
-}
-
-
-struct umlAutostartData {
- struct uml_driver *driver;
- virConnectPtr conn;
-};
-
-static int
-umlAutostartDomain(virDomainObjPtr vm,
- void *opaque)
-{
- const struct umlAutostartData *data = opaque;
- int ret = 0;
- virObjectLock(vm);
- if (vm->autostart &&
- !virDomainObjIsActive(vm)) {
- virResetLastError();
- ret = umlStartVMDaemon(data->conn, data->driver, vm, false);
- virDomainAuditStart(vm, "booted", ret >= 0);
- if (ret < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to autostart VM '%s': %s"),
- vm->def->name, virGetLastErrorMessage());
- } else {
- virObjectEventPtr event =
- virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_STARTED_BOOTED);
- virObjectEventStateQueue(data->driver->domainEventState, event);
- }
- }
- virObjectUnlock(vm);
- return ret;
-}
-
-static void
-umlAutostartConfigs(struct uml_driver *driver)
-{
- /* XXX: Figure out a better way todo this. The domain
- * startup code needs a connection handle in order
- * to lookup the bridge associated with a virtual
- * network
- */
- virConnectPtr conn = virConnectOpen(driver->privileged ?
- "uml:///system" :
- "uml:///session");
- /* Ignoring NULL conn which is mostly harmless here */
-
- struct umlAutostartData data = { driver, conn };
-
- umlDriverLock(driver);
- virDomainObjListForEach(driver->domains, umlAutostartDomain, &data);
- umlDriverUnlock(driver);
-
- virObjectUnref(conn);
-}
-
-
-static int
-umlIdentifyOneChrPTY(struct uml_driver *driver,
- virDomainObjPtr dom,
- virDomainChrDefPtr def,
- const char *dev)
-{
- char *cmd;
- char *res = NULL;
- int retries = 0;
- if (virAsprintf(&cmd, "config %s%d", dev, def->target.port) < 0)
- return -1;
- requery:
- if (umlMonitorCommand(driver, dom, cmd, &res) < 0)
- return -1;
-
- if (res && STRPREFIX(res, "pts:")) {
- VIR_FREE(def->source->data.file.path);
- if (VIR_STRDUP(def->source->data.file.path, res + 4) < 0) {
- VIR_FREE(res);
- VIR_FREE(cmd);
- return -1;
- }
- } else if (!res || STRPREFIX(res, "pts")) {
- /* It can take a while to startup, so retry for
- up to 5 seconds */
- /* XXX should do this in a better non-blocking
- way somehow ...perhaps register a timer */
- if (retries++ < 50) {
- VIR_FREE(res);
- usleep(1000*10);
- goto requery;
- }
- }
-
- VIR_FREE(cmd);
- VIR_FREE(res);
- return 0;
-}
-
-static int
-umlIdentifyChrPTY(struct uml_driver *driver,
- virDomainObjPtr dom)
-{
- size_t i;
-
- for (i = 0; i < dom->def->nconsoles; i++)
- if (dom->def->consoles[i]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
- if (umlIdentifyOneChrPTY(driver, dom,
- dom->def->consoles[i], "con") < 0)
- return -1;
-
- for (i = 0; i < dom->def->nserials; i++)
- if (dom->def->serials[i]->source->type == VIR_DOMAIN_CHR_TYPE_PTY &&
- umlIdentifyOneChrPTY(driver, dom,
- dom->def->serials[i], "ssl") < 0)
- return -1;
-
- return 0;
-}
-
-static void
-umlInotifyEvent(int watch,
- int fd,
- int events ATTRIBUTE_UNUSED,
- void *data)
-{
- char buf[1024];
- struct inotify_event e;
- int got;
- char *tmp, *name;
- struct uml_driver *driver = data;
- virDomainObjPtr dom;
- virObjectEventPtr event = NULL;
-
- umlDriverLock(driver);
- if (watch != driver->inotifyWatch)
- goto cleanup;
-
- reread:
- got = read(fd, buf, sizeof(buf));
- if (got == -1) {
- if (errno == EINTR)
- goto reread;
- goto cleanup;
- }
-
- tmp = buf;
- while (got) {
- if (got < sizeof(e))
- goto cleanup; /* bad */
-
- memcpy(&e, tmp, sizeof(e));
- tmp += sizeof(e);
- got -= sizeof(e);
-
- if (got < e.len)
- goto cleanup;
-
- tmp += e.len;
- got -= e.len;
-
- name = (char *)&(e.name);
-
- dom = virDomainObjListFindByName(driver->domains, name);
-
- if (!dom)
- continue;
-
- if (e.mask & IN_DELETE) {
- VIR_DEBUG("Got inotify domain shutdown '%s'", name);
- if (!virDomainObjIsActive(dom)) {
- virDomainObjEndAPI(&dom);
- continue;
- }
-
- umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
- virDomainAuditStop(dom, "shutdown");
- event = virDomainEventLifecycleNewFromObj(dom,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
- if (!dom->persistent)
- virDomainObjListRemove(driver->domains, dom);
- } else if (e.mask & (IN_CREATE | IN_MODIFY)) {
- VIR_DEBUG("Got inotify domain startup '%s'", name);
- if (virDomainObjIsActive(dom)) {
- virDomainObjEndAPI(&dom);
- continue;
- }
-
- if (umlReadPidFile(driver, dom) < 0) {
- virDomainObjEndAPI(&dom);
- continue;
- }
-
- dom->def->id = driver->nextvmid++;
-
- if (!driver->nactive && driver->inhibitCallback)
- driver->inhibitCallback(true, driver->inhibitOpaque);
- driver->nactive++;
-
- virDomainObjSetState(dom, VIR_DOMAIN_RUNNING,
- VIR_DOMAIN_RUNNING_BOOTED);
-
- if (umlOpenMonitor(driver, dom) < 0) {
- VIR_WARN("Could not open monitor for new domain");
- umlShutdownVMDaemon(driver, dom,
- VIR_DOMAIN_SHUTOFF_FAILED);
- virDomainAuditStop(dom, "failed");
- event = virDomainEventLifecycleNewFromObj(dom,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_FAILED);
- if (!dom->persistent)
- virDomainObjListRemove(driver->domains, dom);
- } else if (umlIdentifyChrPTY(driver, dom) < 0) {
- VIR_WARN("Could not identify character devices for new domain");
- umlShutdownVMDaemon(driver, dom,
- VIR_DOMAIN_SHUTOFF_FAILED);
- virDomainAuditStop(dom, "failed");
- event = virDomainEventLifecycleNewFromObj(dom,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_FAILED);
- if (!dom->persistent)
- virDomainObjListRemove(driver->domains, dom);
- }
- }
- virDomainObjEndAPI(&dom);
- virObjectEventStateQueue(driver->domainEventState, event);
- event = NULL;
- }
-
- cleanup:
- umlDriverUnlock(driver);
-}
-
-
-static int
-umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
- const virDomainDef *def ATTRIBUTE_UNUSED,
- virCapsPtr caps ATTRIBUTE_UNUSED,
- unsigned int parseFlags ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED,
- void *parseOpaque ATTRIBUTE_UNUSED)
-{
- if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
- dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
- dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE)
- dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_UML;
-
- /* forbid capabilities mode hostdev in this kind of hypervisor */
- if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
- dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("hostdev mode 'capabilities' is not "
- "supported in %s"),
- virDomainVirtTypeToString(def->virtType));
- return -1;
- }
-
- return 0;
-}
-
-
-static int
-umlDomainDefPostParse(virDomainDefPtr def ATTRIBUTE_UNUSED,
- virCapsPtr caps ATTRIBUTE_UNUSED,
- unsigned int parseFlags ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED,
- void *parseOpaque ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
-
-virDomainDefParserConfig umlDriverDomainDefParserConfig = {
- .devicesPostParseCallback = umlDomainDeviceDefPostParse,
- .domainPostParseCallback = umlDomainDefPostParse,
-};
-
-
-/**
- * umlStartup:
- *
- * Initialization function for the Uml daemon
- */
-static int
-umlStateInitialize(bool privileged,
- virStateInhibitCallback callback,
- void *opaque)
-{
- char *base = NULL;
- char *userdir = NULL;
-
- virDomainXMLPrivateDataCallbacks privcb = {
- .alloc = umlDomainObjPrivateAlloc,
- .free = umlDomainObjPrivateFree,
- };
-
- if (VIR_ALLOC(uml_driver) < 0)
- return -1;
-
- uml_driver->privileged = privileged;
- uml_driver->inhibitCallback = callback;
- uml_driver->inhibitOpaque = opaque;
-
- if (virMutexInit(¨_driver->lock) < 0) {
- VIR_FREE(uml_driver);
- return -1;
- }
- umlDriverLock(uml_driver);
-
- /* Don't have a dom0 so start from 1 */
- uml_driver->nextvmid = 1;
- uml_driver->inotifyWatch = -1;
-
- if (!(uml_driver->domains = virDomainObjListNew()))
- goto error;
-
- uml_driver->domainEventState = virObjectEventStateNew();
- if (!uml_driver->domainEventState)
- goto error;
-
- userdir = virGetUserDirectory();
- if (!userdir)
- goto error;
-
- if (privileged) {
- if (virAsprintf(¨_driver->logDir,
- "%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
- goto out_of_memory;
-
- if (VIR_STRDUP(base, SYSCONFDIR "/libvirt") < 0)
- goto error;
-
- if (virAsprintf(¨_driver->monitorDir,
- "%s/run/libvirt/uml-guest", LOCALSTATEDIR) == -1)
- goto out_of_memory;
- } else {
- base = virGetUserConfigDirectory();
- if (!base)
- goto error;
-
- if (virAsprintf(¨_driver->logDir,
- "%s/uml/log", base) == -1)
- goto out_of_memory;
-
- if (virAsprintf(¨_driver->monitorDir,
- "%s/.uml", userdir) == -1)
- goto out_of_memory;
- }
-
- /* Configuration paths are either $XDG_CONFIG_HOME/libvirt/uml/... (session) or
- * /etc/libvirt/uml/... (system).
- */
- if (virAsprintf(¨_driver->configDir, "%s/uml", base) == -1)
- goto out_of_memory;
-
- if (virAsprintf(¨_driver->autostartDir, "%s/uml/autostart", base) == -1)
- goto out_of_memory;
-
- VIR_FREE(base);
-
- if ((uml_driver->caps = umlCapsInit()) == NULL)
- goto out_of_memory;
-
- if (!(uml_driver->xmlopt = virDomainXMLOptionNew(¨DriverDomainDefParserConfig,
- &privcb, NULL, NULL, NULL)))
- goto error;
-
- if ((uml_driver->inotifyFD = inotify_init()) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize inotify"));
- goto error;
- }
-
- if (virFileMakePath(uml_driver->monitorDir) < 0) {
- virReportSystemError(errno, _("Failed to create monitor directory %s"),
- uml_driver->monitorDir);
- goto error;
- }
-
- VIR_INFO("Adding inotify watch on %s", uml_driver->monitorDir);
- if (inotify_add_watch(uml_driver->inotifyFD,
- uml_driver->monitorDir,
- IN_CREATE | IN_MODIFY | IN_DELETE) < 0) {
- virReportSystemError(errno, _("Failed to create inotify watch on %s"),
- uml_driver->monitorDir);
- goto error;
- }
-
- if ((uml_driver->inotifyWatch =
- virEventAddHandle(uml_driver->inotifyFD, POLLIN,
- umlInotifyEvent, uml_driver, NULL)) < 0)
- goto error;
-
- if (umlProcessAutoDestroyInit(uml_driver) < 0)
- goto error;
-
- if (virDomainObjListLoadAllConfigs(uml_driver->domains,
- uml_driver->configDir,
- uml_driver->autostartDir, false,
- uml_driver->caps,
- uml_driver->xmlopt,
- NULL, NULL) < 0)
- goto error;
-
- umlDriverUnlock(uml_driver);
-
- VIR_FREE(userdir);
-
- return 0;
-
- out_of_memory:
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("umlStartup: out of memory"));
-
- error:
- VIR_FREE(userdir);
- VIR_FREE(base);
- umlDriverUnlock(uml_driver);
- umlStateCleanup();
- return -1;
-}
-
-/**
- * umlStateAutoStart:
- *
- * Function to autostart the Uml daemons
- */
-static void
-umlStateAutoStart(void)
-{
- if (!uml_driver)
- return;
-
- umlAutostartConfigs(uml_driver);
-}
-
-static void umlNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque)
-{
- struct uml_driver *driver = opaque;
-
- if (newVM) {
- virObjectEventPtr event =
- virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_DEFINED,
- VIR_DOMAIN_EVENT_DEFINED_ADDED);
- virObjectEventStateQueue(driver->domainEventState, event);
- }
-}
-
-
-/**
- * umlStateReload:
- *
- * Function to restart the Uml daemon, it will recheck the configuration
- * files and update its state and the networking
- */
-static int
-umlStateReload(void)
-{
- if (!uml_driver)
- return 0;
-
- umlDriverLock(uml_driver);
- virDomainObjListLoadAllConfigs(uml_driver->domains,
- uml_driver->configDir,
- uml_driver->autostartDir, false,
- uml_driver->caps,
- uml_driver->xmlopt,
- umlNotifyLoadDomain, uml_driver);
- umlDriverUnlock(uml_driver);
-
- return 0;
-}
-
-
-static int
-umlShutdownOneVM(virDomainObjPtr dom, void *opaque)
-{
- struct uml_driver *driver = opaque;
-
- virObjectLock(dom);
- if (virDomainObjIsActive(dom)) {
- umlShutdownVMDaemon(driver, dom, VIR_DOMAIN_SHUTOFF_SHUTDOWN);
- virDomainAuditStop(dom, "shutdown");
- }
- virObjectUnlock(dom);
- return 0;
-}
-
-/**
- * umlStateCleanup:
- *
- * Shutdown the Uml daemon, it will stop all active domains and networks
- */
-static int
-umlStateCleanup(void)
-{
- if (!uml_driver)
- return -1;
-
- umlDriverLock(uml_driver);
- if (uml_driver->inotifyWatch != -1)
- virEventRemoveHandle(uml_driver->inotifyWatch);
- VIR_FORCE_CLOSE(uml_driver->inotifyFD);
- virObjectUnref(uml_driver->caps);
- virObjectUnref(uml_driver->xmlopt);
-
- /* shutdown active VMs
- * XXX allow them to stay around & reconnect */
- virDomainObjListForEach(uml_driver->domains, umlShutdownOneVM, uml_driver);
-
- virObjectUnref(uml_driver->domains);
-
- virObjectUnref(uml_driver->domainEventState);
-
- VIR_FREE(uml_driver->logDir);
- VIR_FREE(uml_driver->configDir);
- VIR_FREE(uml_driver->autostartDir);
- VIR_FREE(uml_driver->monitorDir);
-
- umlProcessAutoDestroyShutdown(uml_driver);
-
- umlDriverUnlock(uml_driver);
- virMutexDestroy(¨_driver->lock);
- VIR_FREE(uml_driver);
-
- return 0;
-}
-
-
-static int umlProcessAutoDestroyInit(struct uml_driver *driver)
-{
- if (!(driver->autodestroy = virHashCreate(5, NULL)))
- return -1;
-
- return 0;
-}
-
-struct umlProcessAutoDestroyData {
- struct uml_driver *driver;
- virConnectPtr conn;
-};
-
-static int umlProcessAutoDestroyDom(void *payload,
- const void *name,
- void *opaque)
-{
- struct umlProcessAutoDestroyData *data = opaque;
- virConnectPtr conn = payload;
- const char *uuidstr = name;
- unsigned char uuid[VIR_UUID_BUFLEN];
- virDomainObjPtr dom;
- virObjectEventPtr event = NULL;
-
- VIR_DEBUG("conn=%p uuidstr=%s thisconn=%p", conn, uuidstr, data->conn);
-
- if (data->conn != conn)
- return 0;
-
- if (virUUIDParse(uuidstr, uuid) < 0) {
- VIR_WARN("Failed to parse %s", uuidstr);
- return 0;
- }
-
- if (!(dom = virDomainObjListFindByUUID(data->driver->domains, uuid))) {
- VIR_DEBUG("No domain object to kill");
- return 0;
- }
-
- VIR_DEBUG("Killing domain");
- umlShutdownVMDaemon(data->driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED);
- virDomainAuditStop(dom, "destroyed");
- event = virDomainEventLifecycleNewFromObj(dom,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
-
- if (!dom->persistent)
- virDomainObjListRemove(data->driver->domains, dom);
-
- virDomainObjEndAPI(&dom);
- virObjectEventStateQueue(data->driver->domainEventState, event);
- virHashRemoveEntry(data->driver->autodestroy, uuidstr);
- return 0;
-}
-
-/*
- * Precondition: driver is locked
- */
-static void umlProcessAutoDestroyRun(struct uml_driver *driver, virConnectPtr conn)
-{
- struct umlProcessAutoDestroyData data = {
- driver, conn
- };
- VIR_DEBUG("conn=%p", conn);
- virHashForEach(driver->autodestroy, umlProcessAutoDestroyDom, &data);
-}
-
-static void umlProcessAutoDestroyShutdown(struct uml_driver *driver)
-{
- virHashFree(driver->autodestroy);
-}
-
-static int umlProcessAutoDestroyAdd(struct uml_driver *driver,
- virDomainObjPtr vm,
- virConnectPtr conn)
-{
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(vm->def->uuid, uuidstr);
- VIR_DEBUG("vm=%s uuid=%s conn=%p", vm->def->name, uuidstr, conn);
- if (virHashAddEntry(driver->autodestroy, uuidstr, conn) < 0)
- return -1;
- return 0;
-}
-
-static int umlProcessAutoDestroyRemove(struct uml_driver *driver,
- virDomainObjPtr vm)
-{
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(vm->def->uuid, uuidstr);
- VIR_DEBUG("vm=%s uuid=%s", vm->def->name, uuidstr);
- if (virHashRemoveEntry(driver->autodestroy, uuidstr) < 0)
- return -1;
- return 0;
-}
-
-
-static int umlReadPidFile(struct uml_driver *driver,
- virDomainObjPtr vm)
-{
- int rc = -1;
- FILE *file;
- char *pidfile = NULL;
- int retries = 0;
-
- vm->pid = -1;
- if (virAsprintf(&pidfile, "%s/%s/pid",
- driver->monitorDir, vm->def->name) < 0)
- return -1;
-
- reopen:
- if (!(file = fopen(pidfile, "r"))) {
- if (errno == ENOENT &&
- retries++ < 50) {
- usleep(1000 * 100);
- goto reopen;
- }
- goto cleanup;
- }
-
- if (fscanf(file, "%d", &vm->pid) != 1) {
- errno = EINVAL;
- VIR_FORCE_FCLOSE(file);
- goto cleanup;
- }
-
- if (VIR_FCLOSE(file) < 0)
- goto cleanup;
-
- rc = 0;
-
- cleanup:
- if (rc != 0)
- virReportSystemError(errno,
- _("failed to read pid: %s"),
- pidfile);
- VIR_FREE(pidfile);
- return rc;
-}
-
-static int umlMonitorAddress(const struct uml_driver *driver,
- const virDomainObj *vm,
- struct sockaddr_un *addr)
-{
- char *sockname;
- int retval = 0;
-
- if (virAsprintf(&sockname, "%s/%s/mconsole",
- driver->monitorDir, vm->def->name) < 0)
- return -1;
-
- memset(addr, 0, sizeof(*addr));
- addr->sun_family = AF_UNIX;
- if (virStrcpyStatic(addr->sun_path, sockname) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unix path %s too long for destination"), sockname);
- retval = -1;
- }
- VIR_FREE(sockname);
- return retval;
-}
-
-static int umlOpenMonitor(struct uml_driver *driver,
- virDomainObjPtr vm)
-{
- struct sockaddr_un addr;
- struct stat sb;
- int retries = 0;
- umlDomainObjPrivatePtr priv = vm->privateData;
-
- if (umlMonitorAddress(driver, vm, &addr) < 0)
- return -1;
-
- VIR_DEBUG("Dest address for monitor is '%s'", addr.sun_path);
- restat:
- if (stat(addr.sun_path, &sb) < 0) {
- if (errno == ENOENT &&
- retries++ < 50) {
- usleep(1000 * 100);
- goto restat;
- }
- return -1;
- }
-
- if ((priv->monitor = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
- virReportSystemError(errno,
- "%s", _("cannot open socket"));
- return -1;
- }
-
- memset(addr.sun_path, 0, sizeof(addr.sun_path));
- snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1,
- "libvirt-uml-%u", vm->pid);
- VIR_DEBUG("Reply address for monitor is '%s'", addr.sun_path+1);
- if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- virReportSystemError(errno,
- "%s", _("cannot bind socket"));
- VIR_FORCE_CLOSE(priv->monitor);
- return -1;
- }
-
- return 0;
-}
-
-
-#define MONITOR_MAGIC 0xcafebabe
-#define MONITOR_BUFLEN 512
-#define MONITOR_VERSION 2
-
-struct monitor_request {
- uint32_t magic;
- uint32_t version;
- uint32_t length;
- char data[MONITOR_BUFLEN];
-};
-
-struct monitor_response {
- uint32_t error;
- uint32_t extra;
- uint32_t length;
- char data[MONITOR_BUFLEN];
-};
-
-
-static int umlMonitorCommand(const struct uml_driver *driver,
- const virDomainObj *vm,
- const char *cmd,
- char **reply)
-{
- struct monitor_request req;
- struct monitor_response res;
- char *retdata = NULL;
- int retlen = 0, ret = 0;
- struct sockaddr_un addr;
- unsigned int addrlen;
- umlDomainObjPrivatePtr priv = vm->privateData;
-
- VIR_DEBUG("Run command '%s'", cmd);
-
- *reply = NULL;
-
- if (umlMonitorAddress(driver, vm, &addr) < 0)
- return -1;
-
- memset(&req, 0, sizeof(req));
- req.magic = MONITOR_MAGIC;
- req.version = MONITOR_VERSION;
- req.length = strlen(cmd);
- if (req.length > (MONITOR_BUFLEN-1)) {
- virReportSystemError(EINVAL,
- _("cannot send too long command %s (%d bytes)"),
- cmd, req.length);
- return -1;
- }
- if (virStrcpyStatic(req.data, cmd) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Command %s too long for destination"), cmd);
- return -1;
- }
-
- if (sendto(priv->monitor, &req, sizeof(req), 0,
- (struct sockaddr *)&addr, sizeof(addr)) != sizeof(req)) {
- virReportSystemError(errno,
- _("cannot send command %s"),
- cmd);
- return -1;
- }
-
- do {
- ssize_t nbytes;
- addrlen = sizeof(addr);
- nbytes = recvfrom(priv->monitor, &res, sizeof(res), 0,
- (struct sockaddr *)&addr, &addrlen);
- if (nbytes < 0) {
- if (errno == EAGAIN || errno == EINTR)
- continue;
- virReportSystemError(errno, _("cannot read reply %s"), cmd);
- goto error;
- }
- /* Ensure res.length is safe to read before validating its value. */
- if (nbytes < offsetof(struct monitor_request, data) ||
- nbytes < offsetof(struct monitor_request, data) + res.length) {
- virReportSystemError(0, _("incomplete reply %s"), cmd);
- goto error;
- }
-
- if (VIR_REALLOC_N(retdata, retlen + res.length) < 0)
- goto error;
- memcpy(retdata + retlen, res.data, res.length);
- retlen += res.length - 1;
- retdata[retlen] = '\0';
-
- if (res.error)
- ret = -1;
-
- } while (res.extra);
-
- VIR_DEBUG("Command reply is '%s'", NULLSTR(retdata));
-
- if (ret < 0)
- VIR_FREE(retdata);
- else
- *reply = retdata;
-
- return ret;
-
- error:
- VIR_FREE(retdata);
- return -1;
-}
-
-
-static void umlCleanupTapDevices(virDomainObjPtr vm)
-{
- size_t i;
-
- for (i = 0; i < vm->def->nnets; i++) {
- virDomainNetDefPtr def = vm->def->nets[i];
-
- if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
- def->type != VIR_DOMAIN_NET_TYPE_NETWORK)
- continue;
-
- ignore_value(virNetDevTapDelete(def->ifname,
- def->backend.tap));
- }
-}
-
-static int umlStartVMDaemon(virConnectPtr conn,
- struct uml_driver *driver,
- virDomainObjPtr vm,
- bool autoDestroy)
-{
- int ret = -1;
- char *logfile;
- int logfd = -1;
- umlDomainObjPrivatePtr priv = vm->privateData;
- virCommandPtr cmd = NULL;
- size_t i;
-
- if (virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("VM is already active"));
- return -1;
- }
-
- if (!vm->def->os.kernel) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("no kernel specified"));
- return -1;
- }
- /* Make sure the binary we are about to try exec'ing exists.
- * Technically we could catch the exec() failure, but that's
- * in a sub-process so its hard to feed back a useful error
- */
- if (!virFileIsExecutable(vm->def->os.kernel)) {
- virReportSystemError(errno,
- _("Cannot find UML kernel %s"),
- vm->def->os.kernel);
- return -1;
- }
-
- if (virFileMakePath(driver->logDir) < 0) {
- virReportSystemError(errno,
- _("cannot create log directory %s"),
- driver->logDir);
- return -1;
- }
-
- if (virAsprintf(&logfile, "%s/%s.log",
- driver->logDir, vm->def->name) < 0)
- return -1;
-
- if ((logfd = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
- S_IRUSR | S_IWUSR)) < 0) {
- virReportSystemError(errno,
- _("failed to create logfile %s"),
- logfile);
- VIR_FREE(logfile);
- return -1;
- }
- VIR_FREE(logfile);
-
- if (virSetCloseExec(logfd) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to set VM logfile close-on-exec flag"));
- VIR_FORCE_CLOSE(logfd);
- return -1;
- }
-
- /* Do this upfront, so any part of the startup process can add
- * runtime state to vm->def that won't be persisted. This let's us
- * report implicit runtime defaults in the XML, like vnc listen/socket
- */
- VIR_DEBUG("Setting current domain def as transient");
- if (virDomainObjSetDefTransient(driver->caps, driver->xmlopt, vm) < 0) {
- VIR_FORCE_CLOSE(logfd);
- return -1;
- }
-
- if (!(cmd = umlBuildCommandLine(conn, driver, vm)))
- goto cleanup;
-
- for (i = 0; i < vm->def->nconsoles; i++) {
- VIR_FREE(vm->def->consoles[i]->info.alias);
- if (virAsprintf(&vm->def->consoles[i]->info.alias, "console%zu", i) < 0)
- goto cleanup;
- }
-
- virCommandWriteArgLog(cmd, logfd);
-
- priv->monitor = -1;
-
- virCommandClearCaps(cmd);
- virCommandSetOutputFD(cmd, &logfd);
- virCommandSetErrorFD(cmd, &logfd);
- virCommandDaemonize(cmd);
-
- if (virCommandRun(cmd, NULL) < 0)
- goto cleanup;
-
- if (autoDestroy &&
- umlProcessAutoDestroyAdd(driver, vm, conn) < 0)
- goto cleanup;
-
- ret = 0;
- cleanup:
- VIR_FORCE_CLOSE(logfd);
- virCommandFree(cmd);
-
- if (ret < 0) {
- virDomainConfVMNWFilterTeardown(vm);
- umlCleanupTapDevices(vm);
- virDomainObjRemoveTransientDef(vm);
- }
-
- /* NB we don't mark it running here - we do that async
- with inotify */
- /* XXX what if someone else tries to start it again
- before we get the inotification ? Sounds like
- trouble.... */
- /* XXX this is bad for events too. must fix this better */
-
- return ret;
-}
-
-static void umlShutdownVMDaemon(struct uml_driver *driver,
- virDomainObjPtr vm,
- virDomainShutoffReason reason)
-{
- int ret;
- umlDomainObjPrivatePtr priv = vm->privateData;
-
- if (!virDomainObjIsActive(vm))
- return;
-
- virProcessKill(vm->pid, SIGTERM);
-
- VIR_FORCE_CLOSE(priv->monitor);
-
- if ((ret = waitpid(vm->pid, NULL, 0)) != vm->pid) {
- VIR_WARN("Got unexpected pid %d != %d",
- ret, vm->pid);
- }
-
- vm->pid = -1;
- vm->def->id = -1;
- virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
-
- virDomainConfVMNWFilterTeardown(vm);
- umlCleanupTapDevices(vm);
-
- /* Stop autodestroy in case guest is restarted */
- umlProcessAutoDestroyRemove(driver, vm);
-
- virDomainObjRemoveTransientDef(vm);
-
- driver->nactive--;
- if (!driver->nactive && driver->inhibitCallback)
- driver->inhibitCallback(false, driver->inhibitOpaque);
-}
-
-
-static int umlConnectURIProbe(char **uri)
-{
- if (uml_driver == NULL)
- return 0;
-
- return VIR_STRDUP(*uri, uml_driver->privileged ?
- "uml:///system" :
- "uml:///session");
-}
-
-
-static virDrvOpenStatus umlConnectOpen(virConnectPtr conn,
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
- virConfPtr conf ATTRIBUTE_UNUSED,
- unsigned int flags)
-{
- virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
-
- /* URI was good, but driver isn't active */
- if (uml_driver == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("uml state driver is not active"));
- return VIR_DRV_OPEN_ERROR;
- }
-
- /* Check path and tell them correct path if they made a mistake */
- if (uml_driver->privileged) {
- if (STRNEQ(conn->uri->path, "/system") &&
- STRNEQ(conn->uri->path, "/session")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected UML URI path '%s', try uml:///system"),
- conn->uri->path);
- return VIR_DRV_OPEN_ERROR;
- }
- } else {
- if (STRNEQ(conn->uri->path, "/session")) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected UML URI path '%s', try uml:///session"),
- conn->uri->path);
- return VIR_DRV_OPEN_ERROR;
- }
- }
-
- if (virConnectOpenEnsureACL(conn) < 0)
- return VIR_DRV_OPEN_ERROR;
-
- conn->privateData = uml_driver;
-
- return VIR_DRV_OPEN_SUCCESS;
-}
-
-static int umlConnectClose(virConnectPtr conn)
-{
- struct uml_driver *driver = conn->privateData;
-
- umlDriverLock(driver);
- umlProcessAutoDestroyRun(driver, conn);
- umlDriverUnlock(driver);
-
- conn->privateData = NULL;
-
- return 0;
-}
-
-static const char *umlConnectGetType(virConnectPtr conn) {
- if (virConnectGetTypeEnsureACL(conn) < 0)
- return NULL;
-
- return "UML";
-}
-
-
-static int umlConnectIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
-{
- /* Trivially secure, since always inside the daemon */
- return 1;
-}
-
-
-static int umlConnectIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
-{
- /* Not encrypted, but remote driver takes care of that */
- return 0;
-}
-
-
-static int umlConnectIsAlive(virConnectPtr conn ATTRIBUTE_UNUSED)
-{
- return 1;
-}
-
-
-static char *umlConnectGetCapabilities(virConnectPtr conn) {
- struct uml_driver *driver = (struct uml_driver *)conn->privateData;
- char *xml;
-
- if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
- return NULL;
-
- umlDriverLock(driver);
- xml = virCapabilitiesFormatXML(driver->caps);
- umlDriverUnlock(driver);
-
- return xml;
-}
-
-
-
-static int umlGetProcessInfo(unsigned long long *cpuTime, pid_t pid)
-{
- char *proc;
- FILE *pidinfo;
- unsigned long long usertime, systime;
-
- if (virAsprintf(&proc, "/proc/%lld/stat", (long long)pid) < 0)
- return -1;
-
- if (!(pidinfo = fopen(proc, "r"))) {
- /* VM probably shut down, so fake 0 */
- *cpuTime = 0;
- VIR_FREE(proc);
- return 0;
- }
-
- VIR_FREE(proc);
-
- if (fscanf(pidinfo, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %llu %llu", &usertime, &systime) != 2) {
- umlDebug("not enough arg");
- VIR_FORCE_FCLOSE(pidinfo);
- return -1;
- }
-
- /* We got jiffies
- * We want nanoseconds
- * _SC_CLK_TCK is jiffies per second
- * So calculate thus....
- */
- *cpuTime = 1000ull * 1000ull * 1000ull * (usertime + systime) / (unsigned long long)sysconf(_SC_CLK_TCK);
-
- umlDebug("Got %llu %llu %llu", usertime, systime, *cpuTime);
-
- VIR_FORCE_FCLOSE(pidinfo);
-
- return 0;
-}
-
-
-static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
- int id)
-{
- struct uml_driver *driver = (struct uml_driver *)conn->privateData;
- virDomainObjPtr vm;
- virDomainPtr dom = NULL;
-
- umlDriverLock(driver);
- vm = virDomainObjListFindByID(driver->domains, id);
- umlDriverUnlock(driver);
-
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching id '%d'"), id);
- goto cleanup;
- }
-
- if (virDomainLookupByIDEnsureACL(conn, vm->def) < 0)
- goto cleanup;
-
- dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return dom;
-}
-
-static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
- const unsigned char *uuid)
-{
- struct uml_driver *driver = (struct uml_driver *)conn->privateData;
- virDomainObjPtr vm;
- virDomainPtr dom = NULL;
-
- if (!(vm = umlDomObjFromDomain(driver, uuid)))
- return NULL;
-
- if (virDomainLookupByUUIDEnsureACL(conn, vm->def) < 0)
- goto cleanup;
-
- dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return dom;
-}
-
-static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
- const char *name)
-{
- struct uml_driver *driver = (struct uml_driver *)conn->privateData;
- virDomainObjPtr vm;
- virDomainPtr dom = NULL;
-
- umlDriverLock(driver);
- vm = virDomainObjListFindByName(driver->domains, name);
- umlDriverUnlock(driver);
-
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching name '%s'"), name);
- goto cleanup;
- }
-
- if (virDomainLookupByNameEnsureACL(conn, vm->def) < 0)
- goto cleanup;
-
- dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return dom;
-}
-
-
-static int umlDomainIsActive(virDomainPtr dom)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr obj;
- int ret = -1;
-
- if (!(obj = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainIsActiveEnsureACL(dom->conn, obj->def) < 0)
- goto cleanup;
-
- ret = virDomainObjIsActive(obj);
-
- cleanup:
- virDomainObjEndAPI(&obj);
- return ret;
-}
-
-
-static int umlDomainIsPersistent(virDomainPtr dom)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr obj;
- int ret = -1;
-
- if (!(obj = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainIsPersistentEnsureACL(dom->conn, obj->def) < 0)
- goto cleanup;
-
- ret = obj->persistent;
-
- cleanup:
- virDomainObjEndAPI(&obj);
- return ret;
-}
-
-static int umlDomainIsUpdated(virDomainPtr dom)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr obj;
- int ret = -1;
-
- if (!(obj = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainIsUpdatedEnsureACL(dom->conn, obj->def) < 0)
- goto cleanup;
-
- ret = obj->updated;
-
- cleanup:
- virDomainObjEndAPI(&obj);
- return ret;
-}
-
-static int umlConnectGetVersion(virConnectPtr conn, unsigned long *version)
-{
- struct uml_driver *driver = conn->privateData;
- struct utsname ut;
- int ret = -1;
-
- if (virConnectGetVersionEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
-
- if (driver->umlVersion == 0) {
- uname(&ut);
-
- if (virParseVersionString(ut.release, &driver->umlVersion, true) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot parse version %s"), ut.release);
- goto cleanup;
- }
- }
-
- *version = driver->umlVersion;
- ret = 0;
-
- cleanup:
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static char *umlConnectGetHostname(virConnectPtr conn)
-{
- if (virConnectGetHostnameEnsureACL(conn) < 0)
- return NULL;
-
- return virGetHostname();
-}
-
-
-static int umlConnectListDomains(virConnectPtr conn, int *ids, int nids)
-{
- struct uml_driver *driver = conn->privateData;
- int n;
-
- if (virConnectListDomainsEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
- umlDriverUnlock(driver);
-
- return n;
-}
-static int umlConnectNumOfDomains(virConnectPtr conn)
-{
- struct uml_driver *driver = conn->privateData;
- int n;
-
- if (virConnectNumOfDomainsEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
- umlDriverUnlock(driver);
-
- return n;
-}
-static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml,
- unsigned int flags)
-{
- struct uml_driver *driver = conn->privateData;
- virDomainDefPtr def;
- virDomainObjPtr vm = NULL;
- virDomainPtr dom = NULL;
- virObjectEventPtr event = NULL;
- unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
-
- virCheckFlags(VIR_DOMAIN_START_AUTODESTROY |
- VIR_DOMAIN_START_VALIDATE, NULL);
-
- if (flags & VIR_DOMAIN_START_VALIDATE)
- parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
-
- virNWFilterReadLockFilterUpdates();
- umlDriverLock(driver);
- if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
- NULL, parse_flags)))
- goto cleanup;
-
- if (virDomainCreateXMLEnsureACL(conn, def) < 0)
- goto cleanup;
-
- if (!(vm = virDomainObjListAdd(driver->domains, def,
- driver->xmlopt,
- VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
- VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
- NULL)))
- goto cleanup;
- def = NULL;
-
- if (umlStartVMDaemon(conn, driver, vm,
- (flags & VIR_DOMAIN_START_AUTODESTROY)) < 0) {
- virDomainAuditStart(vm, "booted", false);
- if (!vm->persistent)
- virDomainObjListRemove(driver->domains, vm);
- goto cleanup;
- }
- virDomainAuditStart(vm, "booted", true);
- event = virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_STARTED_BOOTED);
-
- dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
-
- cleanup:
- virDomainDefFree(def);
- virDomainObjEndAPI(&vm);
- virObjectEventStateQueue(driver->domainEventState, event);
- umlDriverUnlock(driver);
- virNWFilterUnlockFilterUpdates();
- return dom;
-}
-
-
-static int umlDomainShutdownFlags(virDomainPtr dom,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- char *info = NULL;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
- goto cleanup;
-
-#if 0
- if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("shutdown operation failed"));
- goto cleanup;
- }
- ret = 0;
-#endif
-
- cleanup:
- VIR_FREE(info);
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-static int
-umlDomainShutdown(virDomainPtr dom)
-{
- return umlDomainShutdownFlags(dom, 0);
-}
-
-static int
-umlDomainDestroyFlags(virDomainPtr dom,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- virObjectEventPtr event = NULL;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- return -1;
-
- if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- umlShutdownVMDaemon(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
- virDomainAuditStop(vm, "destroyed");
- event = virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
- if (!vm->persistent)
- virDomainObjListRemove(driver->domains, vm);
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- virObjectEventStateQueue(driver->domainEventState, event);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int umlDomainDestroy(virDomainPtr dom)
-{
- return umlDomainDestroyFlags(dom, 0);
-}
-
-
-static char *umlDomainGetOSType(virDomainPtr dom) {
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- char *type = NULL;
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return NULL;
-
- if (virDomainGetOSTypeEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (VIR_STRDUP(type, virDomainOSTypeToString(vm->def->os.type)) < 0)
- goto cleanup;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return type;
-}
-
-/* Returns max memory in kb, 0 if error */
-static unsigned long long
-umlDomainGetMaxMemory(virDomainPtr dom)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- unsigned long long ret = 0;
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainGetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- ret = virDomainDefGetMemoryTotal(vm->def);
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainSetMaxMemoryEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (newmax < vm->def->mem.cur_balloon) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("cannot set max memory lower than current memory"));
- goto cleanup;
- }
-
- virDomainDefSetMemoryTotal(vm->def, newmax);
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainSetMemoryEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set memory of an active domain"));
- goto cleanup;
- }
-
- if (newmem > virDomainDefGetMemoryTotal(vm->def)) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("cannot set memory higher than max memory"));
- goto cleanup;
- }
-
- vm->def->mem.cur_balloon = newmem;
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-static int umlDomainGetInfo(virDomainPtr dom,
- virDomainInfoPtr info)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainGetInfoEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- info->state = virDomainObjGetState(vm, NULL);
-
- if (!virDomainObjIsActive(vm)) {
- info->cpuTime = 0;
- } else {
- if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("cannot read cputime for domain"));
- goto cleanup;
- }
- }
-
- info->maxMem = virDomainDefGetMemoryTotal(vm->def);
- info->memory = vm->def->mem.cur_balloon;
- info->nrVirtCpu = virDomainDefGetVcpus(vm->def);
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-
-static int
-umlDomainGetState(virDomainPtr dom,
- int *state,
- int *reason,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainGetStateEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- *state = virDomainObjGetState(vm, reason);
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-
-static char *umlDomainGetXMLDesc(virDomainPtr dom,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- char *ret = NULL;
-
- /* Flags checked by virDomainDefFormat */
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainGetXMLDescEnsureACL(dom->conn, vm->def, flags) < 0)
- goto cleanup;
-
- ret = virDomainDefFormat((flags & VIR_DOMAIN_XML_INACTIVE) && vm->newDef ?
- vm->newDef : vm->def, driver->caps,
- virDomainDefFormatConvertXMLFlags(flags));
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-
-static int umlConnectListDefinedDomains(virConnectPtr conn,
- char **const names, int nnames) {
- struct uml_driver *driver = conn->privateData;
- int n;
-
- if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL, conn);
- umlDriverUnlock(driver);
-
- return n;
-}
-
-static int umlConnectNumOfDefinedDomains(virConnectPtr conn)
-{
- struct uml_driver *driver = conn->privateData;
- int n;
-
- if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- n = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL, conn);
- umlDriverUnlock(driver);
-
- return n;
-}
-
-
-static int umlDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- virObjectEventPtr event = NULL;
- int ret = -1;
-
- virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1);
-
- virNWFilterReadLockFilterUpdates();
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- ret = umlStartVMDaemon(dom->conn, driver, vm,
- (flags & VIR_DOMAIN_START_AUTODESTROY));
- virDomainAuditStart(vm, "booted", ret >= 0);
- if (ret == 0)
- event = virDomainEventLifecycleNewFromObj(vm,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_STARTED_BOOTED);
-
- cleanup:
- virDomainObjEndAPI(&vm);
- virObjectEventStateQueue(driver->domainEventState, event);
- umlDriverUnlock(driver);
- virNWFilterUnlockFilterUpdates();
- return ret;
-}
-
-static int umlDomainCreate(virDomainPtr dom)
-{
- return umlDomainCreateWithFlags(dom, 0);
-}
-
-static virDomainPtr
-umlDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
-{
- struct uml_driver *driver = conn->privateData;
- virDomainDefPtr def;
- virDomainObjPtr vm = NULL;
- virDomainPtr dom = NULL;
- unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE;
-
- virCheckFlags(VIR_DOMAIN_DEFINE_VALIDATE, NULL);
-
- if (flags & VIR_DOMAIN_DEFINE_VALIDATE)
- parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA;
-
- umlDriverLock(driver);
- if (!(def = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
- NULL, parse_flags)))
- goto cleanup;
-
- if (virXMLCheckIllegalChars("name", def->name, "\n") < 0)
- goto cleanup;
-
- if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
- goto cleanup;
-
- if (!(vm = virDomainObjListAdd(driver->domains, def,
- driver->xmlopt,
- 0, NULL)))
- goto cleanup;
- def = NULL;
- vm->persistent = 1;
-
- if (virDomainSaveConfig(driver->configDir, driver->caps,
- vm->newDef ? vm->newDef : vm->def) < 0) {
- virDomainObjListRemove(driver->domains, vm);
- goto cleanup;
- }
-
- dom = virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id);
-
- cleanup:
- virDomainDefFree(def);
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return dom;
-}
-
-static virDomainPtr
-umlDomainDefineXML(virConnectPtr conn, const char *xml)
-{
- return umlDomainDefineXMLFlags(conn, xml, 0);
-}
-
-static int umlDomainUndefineFlags(virDomainPtr dom,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- virCheckFlags(0, -1);
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainUndefineFlagsEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (!vm->persistent) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot undefine transient domain"));
- goto cleanup;
- }
-
- if (virDomainDeleteConfig(driver->configDir, driver->autostartDir, vm) < 0)
- goto cleanup;
-
- if (virDomainObjIsActive(vm))
- vm->persistent = 0;
- else
- virDomainObjListRemove(driver->domains, vm);
-
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int umlDomainUndefine(virDomainPtr dom)
-{
- return umlDomainUndefineFlags(dom, 0);
-}
-
-static int umlDomainAttachUmlDisk(struct uml_driver *driver,
- virDomainObjPtr vm,
- virDomainDiskDefPtr disk)
-{
- size_t i;
- char *cmd = NULL;
- char *reply = NULL;
-
- for (i = 0; i < vm->def->ndisks; i++) {
- if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), disk->dst);
- return -1;
- }
- }
-
- if (!virDomainDiskGetSource(disk)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("disk source path is missing"));
- goto error;
- }
-
- if (virAsprintf(&cmd, "config %s=%s", disk->dst,
- virDomainDiskGetSource(disk)) < 0)
- return -1;
-
- if (umlMonitorCommand(driver, vm, cmd, &reply) < 0)
- goto error;
-
- if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
- goto error;
-
- virDomainDiskInsertPreAlloced(vm->def, disk);
-
- VIR_FREE(reply);
- VIR_FREE(cmd);
-
- return 0;
-
- error:
-
- VIR_FREE(reply);
- VIR_FREE(cmd);
-
- return -1;
-}
-
-
-static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- virDomainDeviceDefPtr dev = NULL;
- int ret = -1;
-
- umlDriverLock(driver);
-
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainAttachDeviceEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot attach device on inactive domain"));
- goto cleanup;
- }
-
- dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
- VIR_DOMAIN_DEF_PARSE_INACTIVE);
-
- if (dev == NULL)
- goto cleanup;
-
- if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
- if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_UML) {
- ret = umlDomainAttachUmlDisk(driver, vm, dev->data.disk);
- if (ret == 0)
- dev->data.disk = NULL;
- } else {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk bus '%s' cannot be hotplugged."),
- virDomainDiskBusTypeToString(dev->data.disk->bus));
- }
- } else {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("device type '%s' cannot be attached"),
- virDomainDeviceTypeToString(dev->type));
- goto cleanup;
- }
-
- cleanup:
-
- virDomainDeviceDefFree(dev);
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int
-umlDomainAttachDeviceFlags(virDomainPtr dom,
- const char *xml,
- unsigned int flags)
-{
- virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
-
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
- return -1;
- }
-
- return umlDomainAttachDevice(dom, xml);
-}
-
-
-static int umlDomainDetachUmlDisk(struct uml_driver *driver,
- virDomainObjPtr vm,
- virDomainDeviceDefPtr dev)
-{
- size_t i;
- int ret = -1;
- virDomainDiskDefPtr detach = NULL;
- char *cmd;
- char *reply;
-
- for (i = 0; i < vm->def->ndisks; i++) {
- if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst))
- break;
- }
-
- if (i == vm->def->ndisks) {
- virReportError(VIR_ERR_OPERATION_FAILED,
- _("disk %s not found"), dev->data.disk->dst);
- return -1;
- }
-
- detach = vm->def->disks[i];
-
- if (virAsprintf(&cmd, "remove %s", detach->dst) < 0)
- return -1;
-
- if (umlMonitorCommand(driver, vm, cmd, &reply) < 0)
- goto cleanup;
-
- virDomainDiskRemove(vm->def, i);
-
- virDomainDiskDefFree(detach);
-
- ret = 0;
-
- VIR_FREE(reply);
-
- cleanup:
- VIR_FREE(cmd);
-
- return ret;
-}
-
-
-static int umlDomainDetachDevice(virDomainPtr dom, const char *xml)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- virDomainDeviceDefPtr dev = NULL;
- int ret = -1;
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainDetachDeviceEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot detach device on inactive domain"));
- goto cleanup;
- }
-
- dev = virDomainDeviceDefParse(xml, vm->def, driver->caps, driver->xmlopt,
- VIR_DOMAIN_DEF_PARSE_INACTIVE |
- VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE);
- if (dev == NULL)
- goto cleanup;
-
- if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
- dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
- if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_UML)
- ret = umlDomainDetachUmlDisk(driver, vm, dev);
- else
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("This type of disk cannot be hot unplugged"));
- } else {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("This type of device cannot be hot unplugged"));
- }
-
- cleanup:
- virDomainDeviceDefFree(dev);
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int
-umlDomainDetachDeviceFlags(virDomainPtr dom,
- const char *xml,
- unsigned int flags)
-{
- virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
-
- if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
- return -1;
- }
-
- return umlDomainDetachDevice(dom, xml);
-}
-
-
-static int umlDomainGetAutostart(virDomainPtr dom,
- int *autostart)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int ret = -1;
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainGetAutostartEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- *autostart = vm->autostart;
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-static int umlDomainSetAutostart(virDomainPtr dom,
- int autostart)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- char *configFile = NULL, *autostartLink = NULL;
- int ret = -1;
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainSetAutostartEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (!vm->persistent) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set autostart for transient domain"));
- goto cleanup;
- }
-
- autostart = (autostart != 0);
-
- if (vm->autostart != autostart) {
- if ((configFile = virDomainConfigFile(driver->configDir, vm->def->name)) == NULL)
- goto cleanup;
- if ((autostartLink = virDomainConfigFile(driver->autostartDir, vm->def->name)) == NULL)
- goto cleanup;
-
- if (autostart) {
- if (virFileMakePath(driver->autostartDir) < 0) {
- virReportSystemError(errno,
- _("cannot create autostart directory %s"),
- driver->autostartDir);
- goto cleanup;
- }
-
- if (symlink(configFile, autostartLink) < 0) {
- virReportSystemError(errno,
- _("Failed to create symlink '%s to '%s'"),
- autostartLink, configFile);
- goto cleanup;
- }
- } else {
- if (unlink(autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
- virReportSystemError(errno,
- _("Failed to delete symlink '%s'"),
- autostartLink);
- goto cleanup;
- }
- }
-
- vm->autostart = autostart;
- }
- ret = 0;
-
- cleanup:
- VIR_FREE(configFile);
- VIR_FREE(autostartLink);
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int
-umlDomainBlockPeek(virDomainPtr dom,
- const char *path,
- unsigned long long offset, size_t size,
- void *buffer,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm;
- int fd = -1, ret = -1;
- const char *actual;
-
- virCheckFlags(0, -1);
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainBlockPeekEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (!path || path[0] == '\0') {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("NULL or empty path"));
- goto cleanup;
- }
-
- /* Check the path belongs to this domain. */
- if (!(actual = virDomainDiskPathByName(vm->def, path))) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("invalid path '%s'"), path);
- goto cleanup;
- }
- path = actual;
-
- /* The path is correct, now try to open it and get its size. */
- fd = open(path, O_RDONLY);
- if (fd == -1) {
- virReportSystemError(errno,
- _("cannot open %s"), path);
- goto cleanup;
- }
-
- /* Seek and read. */
- /* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
- * be 64 bits on all platforms.
- */
- if (lseek(fd, offset, SEEK_SET) == (off_t)-1 ||
- saferead(fd, buffer, size) == (ssize_t)-1) {
- virReportSystemError(errno,
- _("cannot read %s"), path);
- goto cleanup;
- }
-
- ret = 0;
-
- cleanup:
- VIR_FORCE_CLOSE(fd);
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-
-static int
-umlDomainOpenConsole(virDomainPtr dom,
- const char *dev_name,
- virStreamPtr st,
- unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- virDomainObjPtr vm = NULL;
- int ret = -1;
- virDomainChrDefPtr chr = NULL;
- size_t i;
-
- virCheckFlags(0, -1);
-
- umlDriverLock(driver);
- if (!(vm = umlDomObjFromDomainLocked(driver, dom->uuid)))
- goto cleanup;
-
- if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- if (virDomainObjCheckActive(vm) < 0)
- goto cleanup;
-
- if (dev_name) {
- for (i = 0; i < vm->def->nconsoles; i++) {
- if (vm->def->consoles[i]->info.alias &&
- STREQ(vm->def->consoles[i]->info.alias, dev_name)) {
- chr = vm->def->consoles[i];
- break;
- }
- }
- } else {
- if (vm->def->nconsoles)
- chr = vm->def->consoles[0];
- else if (vm->def->nserials)
- chr = vm->def->serials[0];
- }
-
- if (!chr) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot find console device '%s'"),
- dev_name ? dev_name : _("default"));
- goto cleanup;
- }
-
- if (chr->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("character device %s is not using a PTY"),
- dev_name ? dev_name : NULLSTR(chr->info.alias));
- goto cleanup;
- }
-
- if (virFDStreamOpenFile(st, chr->source->data.file.path,
- 0, 0, O_RDWR) < 0)
- goto cleanup;
-
- ret = 0;
- cleanup:
- virDomainObjEndAPI(&vm);
- umlDriverUnlock(driver);
- return ret;
-}
-
-
-static int
-umlConnectDomainEventRegister(virConnectPtr conn,
- virConnectDomainEventCallback callback,
- void *opaque,
- virFreeCallback freecb)
-{
- struct uml_driver *driver = conn->privateData;
- int ret = 0;
-
- if (virConnectDomainEventRegisterEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- if (virDomainEventStateRegister(conn,
- driver->domainEventState,
- callback, opaque, freecb) < 0)
- ret = -1;
- umlDriverUnlock(driver);
-
- return ret;
-}
-
-static int
-umlConnectDomainEventDeregister(virConnectPtr conn,
- virConnectDomainEventCallback callback)
-{
- struct uml_driver *driver = conn->privateData;
- int ret = 0;
-
- if (virConnectDomainEventDeregisterEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- if (virDomainEventStateDeregister(conn,
- driver->domainEventState,
- callback) < 0)
- ret = -1;
- umlDriverUnlock(driver);
-
- return ret;
-}
-
-static int
-umlConnectDomainEventRegisterAny(virConnectPtr conn,
- virDomainPtr dom,
- int eventID,
- virConnectDomainEventGenericCallback callback,
- void *opaque,
- virFreeCallback freecb)
-{
- struct uml_driver *driver = conn->privateData;
- int ret;
-
- if (virConnectDomainEventRegisterAnyEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- if (virDomainEventStateRegisterID(conn,
- driver->domainEventState,
- dom, eventID,
- callback, opaque, freecb, &ret) < 0)
- ret = -1;
- umlDriverUnlock(driver);
-
- return ret;
-}
-
-
-static int
-umlConnectDomainEventDeregisterAny(virConnectPtr conn,
- int callbackID)
-{
- struct uml_driver *driver = conn->privateData;
- int ret = 0;
-
- if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- if (virObjectEventStateDeregisterID(conn,
- driver->domainEventState,
- callbackID, true) < 0)
- ret = -1;
- umlDriverUnlock(driver);
-
- return ret;
-}
-
-
-static int umlConnectListAllDomains(virConnectPtr conn,
- virDomainPtr **domains,
- unsigned int flags)
-{
- struct uml_driver *driver = conn->privateData;
- int ret = -1;
-
- virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
-
- if (virConnectListAllDomainsEnsureACL(conn) < 0)
- return -1;
-
- umlDriverLock(driver);
- ret = virDomainObjListExport(driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
- umlDriverUnlock(driver);
-
- return ret;
-}
-
-
-static int
-umlNodeGetInfo(virConnectPtr conn,
- virNodeInfoPtr nodeinfo)
-{
- if (virNodeGetInfoEnsureACL(conn) < 0)
- return -1;
-
- return virCapabilitiesGetNodeInfo(nodeinfo);
-}
-
-
-static int
-umlNodeGetCPUStats(virConnectPtr conn,
- int cpuNum,
- virNodeCPUStatsPtr params,
- int *nparams,
- unsigned int flags)
-{
- if (virNodeGetCPUStatsEnsureACL(conn) < 0)
- return -1;
-
- return virHostCPUGetStats(cpuNum, params, nparams, flags);
-}
-
-
-static int
-umlNodeGetMemoryStats(virConnectPtr conn,
- int cellNum,
- virNodeMemoryStatsPtr params,
- int *nparams,
- unsigned int flags)
-{
- if (virNodeGetMemoryStatsEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemGetStats(cellNum, params, nparams, flags);
-}
-
-
-static int
-umlNodeGetCellsFreeMemory(virConnectPtr conn,
- unsigned long long *freeMems,
- int startCell,
- int maxCells)
-{
- if (virNodeGetCellsFreeMemoryEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemGetCellsFree(freeMems, startCell, maxCells);
-}
-
-
-static unsigned long long
-umlNodeGetFreeMemory(virConnectPtr conn)
-{
- unsigned long long freeMem;
-
- if (virNodeGetFreeMemoryEnsureACL(conn) < 0)
- return 0;
-
- if (virHostMemGetInfo(NULL, &freeMem) < 0)
- return 0;
-
- return freeMem;
-}
-
-
-static int
-umlNodeGetMemoryParameters(virConnectPtr conn,
- virTypedParameterPtr params,
- int *nparams,
- unsigned int flags)
-{
- if (virNodeGetMemoryParametersEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemGetParameters(params, nparams, flags);
-}
-
-
-static int
-umlNodeSetMemoryParameters(virConnectPtr conn,
- virTypedParameterPtr params,
- int nparams,
- unsigned int flags)
-{
- if (virNodeSetMemoryParametersEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemSetParameters(params, nparams, flags);
-}
-
-
-static int
-umlNodeGetCPUMap(virConnectPtr conn,
- unsigned char **cpumap,
- unsigned int *online,
- unsigned int flags)
-{
- if (virNodeGetCPUMapEnsureACL(conn) < 0)
- return -1;
-
- return virHostCPUGetMap(cpumap, online, flags);
-}
-
-
-static int
-umlNodeSuspendForDuration(virConnectPtr conn,
- unsigned int target,
- unsigned long long duration,
- unsigned int flags)
-{
- if (virNodeSuspendForDurationEnsureACL(conn) < 0)
- return -1;
-
- return virNodeSuspend(target, duration, flags);
-}
-
-
-static int
-umlNodeGetFreePages(virConnectPtr conn,
- unsigned int npages,
- unsigned int *pages,
- int startCell,
- unsigned int cellCount,
- unsigned long long *counts,
- unsigned int flags)
-{
- virCheckFlags(0, -1);
-
- if (virNodeGetFreePagesEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemGetFreePages(npages, pages, startCell, cellCount, counts);
-}
-
-
-static int
-umlNodeAllocPages(virConnectPtr conn,
- unsigned int npages,
- unsigned int *pageSizes,
- unsigned long long *pageCounts,
- int startCell,
- unsigned int cellCount,
- unsigned int flags)
-{
- bool add = !(flags & VIR_NODE_ALLOC_PAGES_SET);
-
- virCheckFlags(VIR_NODE_ALLOC_PAGES_SET, -1);
-
- if (virNodeAllocPagesEnsureACL(conn) < 0)
- return -1;
-
- return virHostMemAllocPages(npages, pageSizes, pageCounts,
- startCell, cellCount, add);
-}
-
-
-static int
-umlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
-{
- struct uml_driver *driver = dom->conn->privateData;
- int ret = -1;
- virDomainObjPtr vm;
-
- virCheckFlags(0, -1);
-
- if (!(vm = umlDomObjFromDomain(driver, dom->uuid)))
- return -1;
-
- if (virDomainHasManagedSaveImageEnsureACL(dom->conn, vm->def) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- virDomainObjEndAPI(&vm);
- return ret;
-}
-
-
-static virHypervisorDriver umlHypervisorDriver = {
- .name = "UML",
- .connectURIProbe = umlConnectURIProbe,
- .connectOpen = umlConnectOpen, /* 0.5.0 */
- .connectClose = umlConnectClose, /* 0.5.0 */
- .connectGetType = umlConnectGetType, /* 0.5.0 */
- .connectGetVersion = umlConnectGetVersion, /* 0.5.0 */
- .connectGetHostname = umlConnectGetHostname, /* 0.5.0 */
- .nodeGetInfo = umlNodeGetInfo, /* 0.5.0 */
- .connectGetCapabilities = umlConnectGetCapabilities, /* 0.5.0 */
- .connectListDomains = umlConnectListDomains, /* 0.5.0 */
- .connectNumOfDomains = umlConnectNumOfDomains, /* 0.5.0 */
- .connectListAllDomains = umlConnectListAllDomains, /* 0.9.13 */
- .domainCreateXML = umlDomainCreateXML, /* 0.5.0 */
- .domainLookupByID = umlDomainLookupByID, /* 0.5.0 */
- .domainLookupByUUID = umlDomainLookupByUUID, /* 0.5.0 */
- .domainLookupByName = umlDomainLookupByName, /* 0.5.0 */
- .domainShutdown = umlDomainShutdown, /* 0.5.0 */
- .domainShutdownFlags = umlDomainShutdownFlags, /* 0.9.10 */
- .domainDestroy = umlDomainDestroy, /* 0.5.0 */
- .domainDestroyFlags = umlDomainDestroyFlags, /* 0.9.4 */
- .domainGetOSType = umlDomainGetOSType, /* 0.5.0 */
- .domainGetMaxMemory = umlDomainGetMaxMemory, /* 0.5.0 */
- .domainSetMaxMemory = umlDomainSetMaxMemory, /* 0.5.0 */
- .domainSetMemory = umlDomainSetMemory, /* 0.5.0 */
- .domainGetInfo = umlDomainGetInfo, /* 0.5.0 */
- .domainGetState = umlDomainGetState, /* 0.9.2 */
- .domainGetXMLDesc = umlDomainGetXMLDesc, /* 0.5.0 */
- .connectListDefinedDomains = umlConnectListDefinedDomains, /* 0.5.0 */
- .connectNumOfDefinedDomains = umlConnectNumOfDefinedDomains, /* 0.5.0 */
- .domainCreate = umlDomainCreate, /* 0.5.0 */
- .domainCreateWithFlags = umlDomainCreateWithFlags, /* 0.8.2 */
- .domainDefineXML = umlDomainDefineXML, /* 0.5.0 */
- .domainDefineXMLFlags = umlDomainDefineXMLFlags, /* 1.2.12 */
- .domainUndefine = umlDomainUndefine, /* 0.5.0 */
- .domainUndefineFlags = umlDomainUndefineFlags, /* 0.9.4 */
- .domainAttachDevice = umlDomainAttachDevice, /* 0.8.4 */
- .domainAttachDeviceFlags = umlDomainAttachDeviceFlags, /* 0.8.4 */
- .domainDetachDevice = umlDomainDetachDevice, /* 0.8.4 */
- .domainDetachDeviceFlags = umlDomainDetachDeviceFlags, /* 0.8.4 */
- .domainGetAutostart = umlDomainGetAutostart, /* 0.5.0 */
- .domainSetAutostart = umlDomainSetAutostart, /* 0.5.0 */
- .domainBlockPeek = umlDomainBlockPeek, /* 0.5.0 */
- .nodeGetCPUStats = umlNodeGetCPUStats, /* 0.9.3 */
- .nodeGetMemoryStats = umlNodeGetMemoryStats, /* 0.9.3 */
- .nodeGetCellsFreeMemory = umlNodeGetCellsFreeMemory, /* 0.5.0 */
- .nodeGetFreeMemory = umlNodeGetFreeMemory, /* 0.5.0 */
- .nodeGetCPUMap = umlNodeGetCPUMap, /* 1.0.0 */
- .connectDomainEventRegister = umlConnectDomainEventRegister, /* 0.9.4 */
- .connectDomainEventDeregister = umlConnectDomainEventDeregister, /* 0.9.4 */
- .connectIsEncrypted = umlConnectIsEncrypted, /* 0.7.3 */
- .connectIsSecure = umlConnectIsSecure, /* 0.7.3 */
- .domainIsActive = umlDomainIsActive, /* 0.7.3 */
- .domainIsPersistent = umlDomainIsPersistent, /* 0.7.3 */
- .domainIsUpdated = umlDomainIsUpdated, /* 0.8.6 */
- .connectDomainEventRegisterAny = umlConnectDomainEventRegisterAny, /* 0.9.4 */
- .connectDomainEventDeregisterAny = umlConnectDomainEventDeregisterAny, /* 0.9.4 */
- .domainOpenConsole = umlDomainOpenConsole, /* 0.8.6 */
- .connectIsAlive = umlConnectIsAlive, /* 0.9.8 */
- .nodeSuspendForDuration = umlNodeSuspendForDuration, /* 0.9.8 */
- .nodeGetMemoryParameters = umlNodeGetMemoryParameters, /* 0.10.2 */
- .nodeSetMemoryParameters = umlNodeSetMemoryParameters, /* 0.10.2 */
- .nodeGetFreePages = umlNodeGetFreePages, /* 1.2.6 */
- .nodeAllocPages = umlNodeAllocPages, /* 1.2.9 */
- .domainHasManagedSaveImage = umlDomainHasManagedSaveImage, /* 1.2.13 */
-};
-
-static virConnectDriver umlConnectDriver = {
- .localOnly = true,
- .uriSchemes = (const char *[]){ "uml", NULL },
- .hypervisorDriver = ¨HypervisorDriver,
-};
-
-static virStateDriver umlStateDriver = {
- .name = "UML",
- .stateInitialize = umlStateInitialize,
- .stateAutoStart = umlStateAutoStart,
- .stateCleanup = umlStateCleanup,
- .stateReload = umlStateReload,
-};
-
-int umlRegister(void)
-{
- if (virRegisterConnectDriver(¨ConnectDriver,
- true) < 0)
- return -1;
- if (virRegisterStateDriver(¨StateDriver) < 0)
- return -1;
- return 0;
-}
diff --git a/src/uml/uml_driver.h b/src/uml/uml_driver.h
deleted file mode 100644
index 3a258f6658..0000000000
--- a/src/uml/uml_driver.h
+++ /dev/null
@@ -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 */
diff --git a/tests/domaincapsschemadata/basic.xml b/tests/domaincapsschemadata/basic.xml
deleted file mode 100644
index 7bf4e56ae0..0000000000
--- a/tests/domaincapsschemadata/basic.xml
+++ /dev/null
@@ -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>
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index ea4e57d118..7f52058bad 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -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);
diff --git a/tests/objectlocking.ml b/tests/objectlocking.ml
index 778e67cffd..6726d29e73 100644
--- a/tests/objectlocking.ml
+++ b/tests/objectlocking.ml
@@ -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";
diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c
index 7e9dced87e..0d753cd0ee 100644
--- a/tests/virdrivermoduletest.c
+++ b/tests/virdrivermoduletest.c
@@ -89,9 +89,6 @@ mymain(void)
#ifdef WITH_LXC
TEST("lxc");
#endif
-#ifdef WITH_UML
- TEST("uml");
-#endif
#ifdef WITH_VBOX
TEST("vbox");
#endif
diff --git a/tools/virsh.c b/tools/virsh.c
index 09fa0f8a67..8428e539f6 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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
--
2.19.2
5 years, 11 months