[libvirt] RFC Parallels driver renaming
by Maxim Nestratov
Hi all,
You probably already know that our Parallels business devision
responsible for Parallels Cloud Server, which is supported currently in
libvirt as a "parallels" driver, was recently renamed to Odin [1].
As a part of this change our Parallels Cloud Server product name was
also changed to Virtuozzo [2]. That said, we need to address this change
in all publicly available products and projects and libvirt is not an
exception.
Thus, I intend to do the following renaming:
1. connection uri from "parallels" to "vz",
2. driver directory and source files from "parallels" to "vz",
3. internal names (function prefixes, variable and other names) from
"parallels", "prl" to "vz".
I would like to request for comments about proposed renamings, if they
are affordable? If so, I will send the patch series shortly.
Maxim Nestratov
---
[1] http://www.odin.com/odin/
[2] http://www.odin.com/products/virtuozzo/#tab4
9 years, 7 months
[libvirt] [PATCH] tests: Remove redundant aarch64 tests
by Cole Robinson
My commit 7b9de914 added some aarch64 CPU test cases. I wanted to test
two different code paths but inadvertently added two of the same test
cases.
The second code path (using <cpu><model>host</model</cpu>) isn't easily
exercised via the qemu tests anyways, I'll need to look elsewhere.
Regardless, remove the redundant tests for now
---
.../qemuxml2argv-aarch64-cpu-model-host.args | 5 ----
.../qemuxml2argv-aarch64-cpu-model-host.xml | 28 ----------------------
tests/qemuxml2argvtest.c | 3 ---
.../qemuxml2argv-aarch64-cpu-passthrough.xml | 27 ---------------------
tests/qemuxml2xmltest.c | 2 --
5 files changed, 65 deletions(-)
delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.args
delete mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.xml
delete mode 100644 tests/qemuxml2xmloutdata/qemuxml2argv-aarch64-cpu-passthrough.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.args
deleted file mode 100644
index 72e6526..0000000
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.args
+++ /dev/null
@@ -1,5 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-aarch64 -S -M virt -cpu host -m 1024 -smp 1 -nographic \
--nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
--boot c -usb -drive file=/aarch64.raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.xml
deleted file mode 100644
index 53d528f..0000000
--- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-model-host.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<domain type='kvm'>
- <name>aarch64test</name>
- <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
- <memory unit='KiB'>1048576</memory>
- <currentMemory unit='KiB'>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='aarch64' machine='virt'>hvm</type>
- <boot dev='hd'/>
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <cpu mode='host-passthrough'/>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <disk type='file' device='disk'>
- <source file='/aarch64.raw'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
-</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 97c7fba..aa15822 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1538,9 +1538,6 @@ mymain(void)
DO_TEST("aarch64-cpu-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
- DO_TEST("aarch64-cpu-model-host", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
- QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
- QEMU_CAPS_CPU_HOST, QEMU_CAPS_KVM);
DO_TEST("aarch64-gic", QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
QEMU_CAPS_KVM);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2argv-aarch64-cpu-passthrough.xml b/tests/qemuxml2xmloutdata/qemuxml2argv-aarch64-cpu-passthrough.xml
deleted file mode 100644
index 4cdf387..0000000
--- a/tests/qemuxml2xmloutdata/qemuxml2argv-aarch64-cpu-passthrough.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<domain type="kvm">
- <name>aarch64test</name>
- <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
- <memory>1048576</memory>
- <currentMemory>1048576</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch="aarch64" machine="virt">hvm</type>
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <cpu mode='host-passthrough'/>
- <clock offset="utc"/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- <devices>
- <emulator>/usr/bin/qemu-system-aarch64</emulator>
- <disk type='file' device='disk'>
- <source file='/aarch64.raw'/>
- <target dev='vda' bus='virtio'/>
- </disk>
- </devices>
-</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b611afd..d418776 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -614,8 +614,6 @@ mymain(void)
DO_TEST("memory-hotplug-nonuma");
DO_TEST("memory-hotplug-dimm");
- DO_TEST("aarch64-cpu-model-host");
-
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
2.4.0
9 years, 7 months
[libvirt] [PATCH 0/4] Enable support for s390 crypto key mgmt operations
by akrowiak@linux.vnet.ibm.com
From: Tony Krowiak <akrowiak(a)linux.vnet.ibm.com>
The IBM System z Central Processor Assist for Cryptographic Functions (CPACF)
hardware provides a set of CPU instructions for use in clear-key encryption,
pseudo random number generation, hash functions, and protected-key encryption.
The CPACF protected key cryptographic functions operate with a protected key
which is encrypted under a unique wrapping key that is stored in the Hardware
System Area (HSA) of the machine and can only be accessed by firmware. The
wrapping key cannot be accessed by the operating system or application
programs. There are two wrapping keys: One for wrapping AES keys and one for
wrapping DES/TDES keys. This patch set enables the support for encrypting
clear keys under the AES and DES/TDES wrapping keys for guests started on hosts
running on s390 hardware that supports key wrapping.
Tony Krowiak (4):
libvirt: docs: XML to enable/disable protected key mgmt ops
libvirt: conf: parse XML for protected key management ops
libvirt: qemu: enable/disable protected key management ops
libvirt: tests: test protected key mgmt ops support
9 years, 7 months
[libvirt] [PATCH] cpu_conf: properly escape characters for model and vendor
by Pavel Hrdina
We should escape strings for those two elements to be consistent along
the whole XML.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1197580
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/cpu_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index e959ecc..34725c0 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -547,14 +547,14 @@ virCPUDefFormatBuf(virBufferPtr buf,
virBufferAsprintf(buf, " vendor_id='%s'", def->vendor_id);
}
if (formatModel && def->model) {
- virBufferAsprintf(buf, ">%s</model>\n", def->model);
+ virBufferEscapeString(buf, ">%s</model>\n", def->model);
} else {
virBufferAddLit(buf, "/>\n");
}
}
if (formatModel && def->vendor)
- virBufferAsprintf(buf, "<vendor>%s</vendor>\n", def->vendor);
+ virBufferEscapeString(buf, "<vendor>%s</vendor>\n", def->vendor);
if (def->sockets && def->cores && def->threads) {
virBufferAddLit(buf, "<topology");
--
2.3.6
9 years, 7 months
[libvirt] [PATCH v2] processSerialChangedEvent: Close agent monitor early
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=890648
So, imagine you've issued an API that involves guest agent. For
instance, you want to query guest's IP addresses. So the API acquires
QUERY_JOB, locks the guest agent and issues the agent command.
However, for some reason, guest agent replies to initial ping
correctly, but then crashes tragically while executing real command
(in this case guest-network-get-interfaces). Since initial ping went
well, libvirt thinks guest agent is accessible and awaits reply to the
real command. But it will never come. What will is a monitor event.
Our handler (processSerialChangedEvent) will try to acquire
MODIFY_JOB, which will fail obviously because the other thread that's
executing the API already holds a job. So the event handler exits
early, and the QUERY_JOB is never released nor ended.
The way how to solve this is to put flag somewhere in the monitor
internals. The flag is called @running and agent commands are issued
iff the flag is set. The flag itself is set when we connect to the
agent socket. And unset whenever we see DISCONNECT event from the
agent. Moreover, we must wake up all the threads waiting for the
agent. This is done by signalizing the condition they're waiting on.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
- introduced @running flag to produce prettier error message
src/qemu/qemu_agent.c | 53 ++++++++++++++++++++++++++++++++++++++++++--------
src/qemu/qemu_agent.h | 2 ++
src/qemu/qemu_driver.c | 8 ++++++++
3 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 3f6a9bf..fc23c41 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -92,6 +92,7 @@ struct _qemuAgent {
int watch;
bool connectPending;
+ bool running;
virDomainObjPtr vm;
@@ -772,6 +773,7 @@ qemuAgentOpen(virDomainObjPtr vm,
goto cleanup;
}
+ mon->running = true;
VIR_DEBUG("New mon %p fd =%d watch=%d", mon, mon->fd, mon->watch);
return mon;
@@ -788,6 +790,36 @@ qemuAgentOpen(virDomainObjPtr vm,
}
+static void
+qemuAgentNotifyCloseLocked(qemuAgentPtr mon)
+{
+ if (mon) {
+ mon->running = false;
+
+ /* If there is somebody waiting for a message
+ * wake him up. No message will arrive anyway. */
+ if (mon->msg && !mon->msg->finished) {
+ mon->msg->finished = 1;
+ virCondSignal(&mon->notify);
+ }
+ }
+}
+
+
+void
+qemuAgentNotifyClose(qemuAgentPtr mon)
+{
+ if (!mon)
+ return;
+
+ VIR_DEBUG("mon=%p", mon);
+
+ virObjectLock(mon);
+ qemuAgentNotifyCloseLocked(mon);
+ virObjectUnlock(mon);
+}
+
+
void qemuAgentClose(qemuAgentPtr mon)
{
if (!mon)
@@ -803,12 +835,7 @@ void qemuAgentClose(qemuAgentPtr mon)
VIR_FORCE_CLOSE(mon->fd);
}
- /* If there is somebody waiting for a message
- * wake him up. No message will arrive anyway. */
- if (mon->msg && !mon->msg->finished) {
- mon->msg->finished = 1;
- virCondSignal(&mon->notify);
- }
+ qemuAgentNotifyCloseLocked(mon);
virObjectUnlock(mon);
virObjectUnref(mon);
@@ -1087,6 +1114,12 @@ qemuAgentCommand(qemuAgentPtr mon,
*reply = NULL;
+ if (!mon->running) {
+ virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
+ _("Guest agent disappeared while executing command"));
+ return -1;
+ }
+
if (qemuAgentGuestSync(mon) < 0)
return -1;
@@ -1112,8 +1145,12 @@ qemuAgentCommand(qemuAgentPtr mon,
if (await_event && !needReply) {
VIR_DEBUG("Woken up by event %d", await_event);
} else {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Missing monitor reply object"));
+ if (mon->running)
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing monitor reply object"));
+ else
+ virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s",
+ _("Guest agent disappeared while executing command"));
ret = -1;
}
} else {
diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h
index 1cd5749..988228b 100644
--- a/src/qemu/qemu_agent.h
+++ b/src/qemu/qemu_agent.h
@@ -49,6 +49,8 @@ qemuAgentPtr qemuAgentOpen(virDomainObjPtr vm,
void qemuAgentClose(qemuAgentPtr mon);
+void qemuAgentNotifyClose(qemuAgentPtr mon);
+
typedef enum {
QEMU_AGENT_EVENT_NONE = 0,
QEMU_AGENT_EVENT_SHUTDOWN,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 537797e..f40ccae 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4480,6 +4480,14 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
VIR_DEBUG("Changing serial port state %s in domain %p %s",
devAlias, vm, vm->def->name);
+ if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED &&
+ virDomainObjIsActive(vm) && priv->agent) {
+ /* Close agent monitor early, so that other threads
+ * waiting for the agent to reply can finish and our
+ * job we acquire below can succeed. */
+ qemuAgentNotifyClose(priv->agent);
+ }
+
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
--
2.3.6
9 years, 7 months
[libvirt] storage volume download/upload
by Vasiliy Tolstov
As i see in some cases, for example in case of lvm storage pool
libvirt spawns libvirt_iohelper to upload or download data to volume.
But in case of big data contains zeroes this is wast bw of network.
May be we can use gzip or lz4 for compression stream?
How the best do this not breaking exiting software?
May be add new parameter to libvirt_iohelper with compression method
and compression level? In my cases of 20-160 Gb data and used only 4-5
Gb this provide major benefit....
Thanks!
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
jabber: vase(a)selfip.ru
9 years, 7 months
[libvirt] [RFC PATCH] network: add an option to disable dnsmasq's bind-dynamic
by Cédric Bosdonnat
When building vlans on top of veth networks, dnsmasq doesn't catch
DNS requests on the vlans interfaces. Allowing to disable the
bind-dynamic helps this use case.
---
src/conf/network_conf.c | 12 ++++++++++++
src/conf/network_conf.h | 1 +
src/network/bridge_driver.c | 3 ++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index f4a9df0..63e26e1 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1987,6 +1987,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
xmlNodePtr forwardNode = NULL;
char *ipv6nogwStr = NULL;
char *trustGuestRxFilters = NULL;
+ char *binddynamicStr = NULL;
xmlNodePtr save = ctxt->node;
xmlNodePtr bandwidthNode = NULL;
xmlNodePtr vlanNode;
@@ -2049,6 +2050,16 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
VIR_FREE(trustGuestRxFilters);
}
+ /* Default for binddynamic is on */
+ def->binddynamic = true;
+ binddynamicStr = virXPathString("string(./@binddynamic)", ctxt);
+ if (binddynamicStr) {
+ if (STRNEQ(binddynamicStr, "no")) {
+ def->binddynamic = false;
+ }
+ VIR_FREE(binddynamicStr);
+ }
+
/* Parse network domain information */
def->domain = virXPathString("string(./domain[1]/@name)", ctxt);
tmp = virXPathString("string(./domain[1]/@localOnly)", ctxt);
@@ -2326,6 +2337,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
VIR_FREE(ipNodes);
VIR_FREE(portGroupNodes);
VIR_FREE(ipv6nogwStr);
+ VIR_FREE(binddynamicStr);
VIR_FREE(trustGuestRxFilters);
ctxt->node = save;
return NULL;
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index f69d999..163581e 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -253,6 +253,7 @@ struct _virNetworkDef {
virNetDevBandwidthPtr bandwidth;
virNetDevVlan vlan;
int trustGuestRxFilters; /* enum virTristateBool */
+ bool binddynamic; /* to force off bind_dynamic option of dnsmasq */
};
typedef struct _virNetworkObj virNetworkObj;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index d195085..5dddc4b 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -988,7 +988,8 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
/* dnsmasq will *always* listen on localhost unless told otherwise */
virBufferAddLit(&configbuf, "except-interface=lo\n");
- if (dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC)) {
+ if (network->def->binddynamic &&
+ dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC)) {
/* using --bind-dynamic with only --interface (no
* --listen-address) prevents dnsmasq from responding to dns
* queries that arrive on some interface other than our bridge
--
2.1.4
9 years, 7 months
[libvirt] [PATCH] caps: Don't default to i686 of KVM on x86_64
by Cole Robinson
My commit 747761a79 (v1.2.15 only) dropped this bit of logic when filling
in a default arch in the XML:
- /* First try to find one matching host arch */
- for (i = 0; i < caps->nguests; i++) {
- if (caps->guests[i]->ostype == ostype) {
- for (j = 0; j < caps->guests[i]->arch.ndomains; j++) {
- if (caps->guests[i]->arch.domains[j]->type == domain &&
- caps->guests[i]->arch.id == caps->host.arch)
- return caps->guests[i]->arch.id;
- }
- }
- }
That attempt to match host.arch is important, otherwise we end up
defaulting to i686 on x86_64 host for KVM, which is not intended.
Duplicate it in the centralized CapsLookup function.
Additionally add some testcases that would have caught this.
https://bugzilla.redhat.com/show_bug.cgi?id=1219191
---
src/conf/capabilities.c | 63 +++++++++++++++-------
.../qemuxml2argv-default-kvm-host-arch.args | 4 ++
.../qemuxml2argv-default-kvm-host-arch.xml | 11 ++++
tests/qemuxml2argvtest.c | 1 +
.../qemuxml2xmlout-default-kvm-host-arch.xml | 21 ++++++++
tests/qemuxml2xmltest.c | 1 +
tests/testutilsqemu.c | 12 +++++
7 files changed, 94 insertions(+), 19 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 922741f..c43bfb3 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -607,25 +607,13 @@ virCapsDomainDataCompare(virCapsGuestPtr guest,
return true;
}
-/**
- * virCapabilitiesDomainDataLookup:
- * @caps: capabilities to query
- * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
- * @arch: Architecture to search for
- * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT
- * @emulator: Emulator path to search for
- * @machinetype: Machine type to search for
- *
- * Search capabilities for the passed values, and if found return
- * virCapabilitiesDomainDataLookup filled in with the default values
- */
-virCapsDomainDataPtr
-virCapabilitiesDomainDataLookup(virCapsPtr caps,
- int ostype,
- virArch arch,
- int domaintype,
- const char *emulator,
- const char *machinetype)
+static virCapsDomainDataPtr
+virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
+ int ostype,
+ virArch arch,
+ int domaintype,
+ const char *emulator,
+ const char *machinetype)
{
virCapsGuestPtr foundguest = NULL;
virCapsGuestDomainPtr founddomain = NULL;
@@ -730,6 +718,43 @@ virCapabilitiesDomainDataLookup(virCapsPtr caps,
return ret;
}
+/**
+ * virCapabilitiesDomainDataLookup:
+ * @caps: capabilities to query
+ * @ostype: guest operating system type, of enum VIR_DOMAIN_OSTYPE
+ * @arch: Architecture to search for
+ * @domaintype: domain type to search for, of enum VIR_DOMAIN_VIRT
+ * @emulator: Emulator path to search for
+ * @machinetype: Machine type to search for
+ *
+ * Search capabilities for the passed values, and if found return
+ * virCapabilitiesDomainDataLookup filled in with the default values
+ */
+virCapsDomainDataPtr
+virCapabilitiesDomainDataLookup(virCapsPtr caps,
+ int ostype,
+ virArch arch,
+ int domaintype,
+ const char *emulator,
+ const char *machinetype)
+{
+ virCapsDomainDataPtr ret;
+
+ if (arch == VIR_ARCH_NONE) {
+ /* Prefer host arch if its available */
+ ret = virCapabilitiesDomainDataLookupInternal(caps, ostype,
+ caps->host.arch,
+ domaintype,
+ emulator, machinetype);
+ if (ret)
+ return ret;
+ }
+
+ return virCapabilitiesDomainDataLookupInternal(caps, ostype,
+ arch, domaintype,
+ emulator, machinetype);
+}
+
static int
virCapabilitiesFormatNUMATopology(virBufferPtr buf,
size_t ncells,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
new file mode 100644
index 0000000..102691f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.args
@@ -0,0 +1,4 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/kvm -S -machine pc,accel=kvm -m 4096 -smp 4 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -net none \
+-serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
new file mode 100644
index 0000000..66dead0
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-default-kvm-host-arch.xml
@@ -0,0 +1,11 @@
+<domain type='kvm'>
+ <name>kvm</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type>hvm</type>
+ <boot dev='hd'/>
+ </os>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 97c7fba..b27e3a4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -599,6 +599,7 @@ mymain(void)
DO_TEST_FAILURE("machine-xen-vmport-opt", QEMU_CAPS_MACHINE_OPT,
QEMU_CAPS_MACHINE_VMPORT_OPT);
DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT);
+ DO_TEST("default-kvm-host-arch", QEMU_CAPS_MACHINE_OPT);
DO_TEST("boot-cdrom", NONE);
DO_TEST("boot-network", NONE);
DO_TEST("boot-floppy", NONE);
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
new file mode 100644
index 0000000..30fa66d
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-default-kvm-host-arch.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+ <name>kvm</name>
+ <uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>4</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/kvm</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b611afd..a21a299 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -346,6 +346,7 @@ mymain(void)
DO_TEST("minimal");
DO_TEST("machine-core-on");
DO_TEST("machine-core-off");
+ DO_TEST_DIFFERENT("default-kvm-host-arch");
DO_TEST("boot-cdrom");
DO_TEST("boot-network");
DO_TEST("boot-floppy");
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 14743be..d067bca 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -354,6 +354,18 @@ virCapsPtr testQemuCapsInit(void)
NULL) == NULL)
goto cleanup;
+ if ((machines = testQemuAllocMachines(&nmachines)) == NULL)
+ goto cleanup;
+
+ if (virCapabilitiesAddGuestDomain(guest,
+ VIR_DOMAIN_VIRT_KVM,
+ "/usr/bin/qemu-kvm",
+ NULL,
+ nmachines,
+ machines) == NULL)
+ goto cleanup;
+ machines = NULL;
+
if ((machines = testQemuAllocNewerMachines(&nmachines)) == NULL)
goto cleanup;
--
2.4.0
9 years, 7 months
[libvirt] [PATCH] processSerialChangedEvent: Close agent monitor early
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=890648
So, imagine you've issued an API that involves guest agent. For
instance, you want to query guest's IP addresses. So the API acquires
QUERY_JOB, locks the guest agent and issues the agemt command.
However, for some reason, guest agent replies to initial ping
correctly, but then crashes tragically while executing real command
(in this case guest-network-get-interfaces). Since initial ping went
well, libvirt thinks guest agent is accessible and awaits reply to the
real command. But it will never come. What will is a monitor event.
Our handler (processSerialChangedEvent) will try to acquire
MODIFY_JOB, which will fail obviously because the other thread that's
executing the API already holds a job. So the event handler exits
early, and the QUERY_JOB is never released nor ended.
I don't understand why, but qemu should in fact instead of sending a
event on the monitor close the socket. But leave that for a different
discussion. Since qemu is not doing that, we must work around it and
close and unregister the agent's FD from the even loop ourselves. This
will wake up all callers stuck in waiting for agent's reply.
Hopefully, it will make them finish the job too and even handler can
acquire its job later.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d173aa1..becb6ae 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4480,6 +4480,14 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
VIR_DEBUG("Changing serial port state %s in domain %p %s",
devAlias, vm, vm->def->name);
+ if (newstate == VIR_DOMAIN_CHR_DEVICE_STATE_DISCONNECTED &&
+ virDomainObjIsActive(vm) && priv->agent) {
+ /* Close agent monitor early, so that other threads
+ * waiting for the agent to reply can finish and our
+ * job we acquire below can succeed. */
+ qemuAgentClose(priv->agent);
+ }
+
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
@@ -4508,7 +4516,6 @@ processSerialChangedEvent(virQEMUDriverPtr driver,
}
} else {
if (priv->agent) {
- qemuAgentClose(priv->agent);
priv->agent = NULL;
priv->agentError = false;
}
--
2.3.6
9 years, 7 months
[libvirt] [PATCH] libxl: include a XLU_Config in _libxlDriverConfig
by Olaf Hering
Upcoming changes for vscsi will use libxlutil.so to prepare the
configuration for libxl. The helpers needs a xlu struct for logging.
Provide one and reuse the existing output as log target.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
Cc: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 6 ++++++
src/libxl/libxl_conf.h | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 53f327b..f9bb5ed 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1454,6 +1454,12 @@ libxlDriverConfigNew(void)
goto error;
}
+ cfg->xlu = xlu_cfg_init(cfg->logger_file, "libvirt");
+ if (!cfg->xlu) {
+ VIR_ERROR(_("cannot create xlu for libxenlight, disabling driver"));
+ goto error;
+ }
+
if (libxl_ctx_alloc(&cfg->ctx, LIBXL_VERSION, 0, cfg->logger)) {
VIR_ERROR(_("cannot initialize libxenlight context, probably not "
"running in a Xen Dom0, disabling driver"));
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 5ba1a71..bdc68d4 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -27,6 +27,12 @@
# define LIBXL_CONF_H
# include <libxl.h>
+#ifdef HAVE_LIBXLUTIL_H
+# include <libxlutil.h>
+#else
+typedef struct XLU_Config XLU_Config;
+XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename);
+#endif
# include "internal.h"
# include "libvirt_internal.h"
@@ -91,6 +97,7 @@ struct _libxlDriverConfig {
/* log stream for driver-wide libxl ctx */
FILE *logger_file;
xentoollog_logger *logger;
+ XLU_Config *xlu;
/* libxl ctx for driver wide ops; getVersion, getNodeInfo, ... */
libxl_ctx *ctx;
9 years, 7 months