[libvirt] [PATCH] Fix compile error for stable 1.2.9
by Yang hongyang
Seems a backport miss. An extra member is passed to struct
virLXCBasicMountInfo.
Signed-off-by: Yang hongyang <hongyang.yang(a)easystack.cn>
---
src/lxc/lxc_container.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 28dabec..1c65fa9 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -760,7 +760,7 @@ typedef struct {
static const virLXCBasicMountInfo lxcBasicMounts[] = {
{ "proc", "/proc", "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, false, false },
- { "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false, false },
+ { "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false },
{ "sysfs", "/sys", "sysfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false },
{ "securityfs", "/sys/kernel/security", "securityfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, true, true },
#if WITH_SELINUX
--
1.7.1
1 year
[libvirt] Supporting vhost-net and macvtap in libvirt for QEMU
by Anthony Liguori
Disclaimer: I am neither an SR-IOV nor a vhost-net expert, but I've CC'd
people that are who can throw tomatoes at me for getting bits wrong :-)
I wanted to start a discussion about supporting vhost-net in libvirt.
vhost-net has not yet been merged into qemu but I expect it will be soon
so it's a good time to start this discussion.
There are two modes worth supporting for vhost-net in libvirt. The
first mode is where vhost-net backs to a tun/tap device. This is
behaves in very much the same way that -net tap behaves in qemu today.
Basically, the difference is that the virtio backend is in the kernel
instead of in qemu so there should be some performance improvement.
Current, libvirt invokes qemu with -net tap,fd=X where X is an already
open fd to a tun/tap device. I suspect that after we merge vhost-net,
libvirt could support vhost-net in this mode by just doing -net
vhost,fd=X. I think the only real question for libvirt is whether to
provide a user visible switch to use vhost or to just always use vhost
when it's available and it makes sense. Personally, I think the later
makes sense.
The more interesting invocation of vhost-net though is one where the
vhost-net device backs directly to a physical network card. In this
mode, vhost should get considerably better performance than the current
implementation. I don't know the syntax yet, but I think it's
reasonable to assume that it will look something like -net
tap,dev=eth0. The effect will be that eth0 is dedicated to the guest.
On most modern systems, there is a small number of network devices so
this model is not all that useful except when dealing with SR-IOV
adapters. In that case, each physical device can be exposed as many
virtual devices (VFs). There are a few restrictions here though. The
biggest is that currently, you can only change the number of VFs by
reloading a kernel module so it's really a parameter that must be set at
startup time.
I think there are a few ways libvirt could support vhost-net in this
second mode. The simplest would be to introduce a new tag similar to
<source network='br0'>. In fact, if you probed the device type for the
network parameter, you could probably do something like <source
network='eth0'> and have it Just Work.
Another model would be to have libvirt see an SR-IOV adapter as a
network pool whereas it handled all of the VF management. Considering
how inflexible SR-IOV is today, I'm not sure whether this is the best model.
Has anyone put any more thought into this problem or how this should be
modeled in libvirt? Michael, could you share your current thinking for
-net syntax?
--
Regards,
Anthony Liguori
1 year
[libvirt] [python] WIP-FYI: mypy annotations for libvirt-python
by Philipp Hahn
Hello,
Maybe you already have heads about mypy <http://mypy-lang.org/>, which
"is an experimental optional static type checker for Python that aims to
combine the benefits of dynamic (or "duck") typing and static typing".
I started to write a manual annotation file for the Python binding of
libvirt. I've attached my current version, so others can benefit from
it, too. It is far from complete, but it already helped my to find some
errors in my code.
(My latest version is also available at
<https://github.com/univention/typeshed/blob/libvirt/third_party/2and3/lib...>)
Long-term it probably would be better to teach the Python binding
"generator.py" to add the type information (PEP 484
<https://www.python.org/dev/peps/pep-0484/>) directly into the generated
"libvirt.py" file, but that's for another day.
If someone else is interested in helping with that, please feel free to
get in contact.
Philipp
--
Philipp Hahn
Open Source Software Engineer
Univention GmbH
be open.
Mary-Somerville-Str. 1
D-28359 Bremen
Tel.: +49 421 22232-0
Fax : +49 421 22232-99
hahn(a)univention.de
http://www.univention.de/
Geschäftsführer: Peter H. Ganten
HRB 20755 Amtsgericht Bremen
Steuer-Nr.: 71-597-02876
4 years, 7 months
[libvirt] [PATCH 0/3] Fix ppc64 CPU configuration for QEMU 2.11+
by Jiri Denemark
The original fix was both incomplete and too general. It only fixed
domain startup, but libvirt would still report empty list of supported
CPU models with recent QEMU for ppc64. On the other hand, while ppc64
QEMU ignores case when looking up CPU model names, x86_64 QEMU does
case sensitive lookup.
Jiri Denemark (3):
Revert "domcaps: Treat host models as case-insensitive strings"
util: Introduce virStringListSearch
qemu: Adapt to changed ppc64 CPU model names
src/conf/domain_capabilities.c | 2 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 28 +++++++++++++++++--
src/qemu/qemu_capabilities.h | 3 +-
src/qemu/qemu_process.c | 2 +-
src/util/virstring.c | 28 +++++++++++++++++++
src/util/virstring.h | 3 ++
.../qemu_2.12.0.ppc64.xml | 6 +++-
.../caps_2.12.0.ppc64.xml | 12 ++++----
9 files changed, 73 insertions(+), 12 deletions(-)
--
2.17.0
5 years, 1 month
[libvirt] [PATCH 0/4] util: Fixing libvirt errors on cavium/thunder-nicvf
by Radoslaw Biernacki
ThunderX is Cavium SoC. This platform contain SRIOV NIC.
Unlike other commonly known network devices it does not have VF functionality
duplicated in its PF. PF is purely management device (on HW level).
This creates several problems with existing libvirt code as in many places
libvirt assumes that each VF netdev has PF netdev assigned.
This patch series trying to address issues which can be easily fixed.
(mostly bug fixes found while working on full featured solution)
First patch in series is most important as it allows to unblock the netdev
detection and use <hostdev> on this platform.
More details about those issues can be found at:
https://bugs.linaro.org/show_bug.cgi?id=3778
https://bugs.launchpad.net/charm-nova-compute/+bug/1771662
Radoslaw Biernacki (4):
util: fixing wrong assumption that PF has to have netdev assigned
util: Code simplification
util: Fix for NULL dereference
util: Fixing invalid error checking from virPCIGetNetname()
src/qemu/qemu_domain_address.c | 11 ++---
src/util/virhostdev.c | 2 +-
src/util/virnetdev.c | 50 ++++----------------
3 files changed, 16 insertions(+), 47 deletions(-)
--
2.14.1
5 years, 10 months
[libvirt] [PATCH v3] qemu: Process RDMA GID state change event
by Yuval Shaia
This event is emitted on the monitor when a GID table in pvrdma device
is modified and the change needs to be propagate to the backend RDMA
device's GID table.
The control over the RDMA device's GID table is done by updating the
device's Ethernet function addresses.
Usually the first GID entry is determine by the MAC address, the second
by the first IPv6 address and the third by the IPv4 address. Other
entries can be added by adding more IP addresses. The opposite is the
same, i.e. whenever an address is removed, the corresponding GID entry
is removed.
The process is done by the network and RDMA stacks. Whenever an address
is added the ib_core driver is notified and calls the device driver's
add_gid function which in turn update the device.
To support this in pvrdma device we need to hook into the create_bind
and destroy_bind HW commands triggered by pvrdma driver in guest.
Whenever a changed is made to the pvrdma device's GID table a special
QMP messages is sent to be processed by libvirt to update the address of
the backend Ethernet device.
Signed-off-by: Yuval Shaia <yuval.shaia(a)oracle.com>
---
v1 -> v2:
* Address all comments from Michal Privoznik
v2 -> v3:
* Remove static initialization in processRdmaGidStatusChangedEvent
---
src/qemu/qemu_domain.c | 3 +++
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 44 ++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 27 +++++++++++++++++++
src/qemu/qemu_monitor.h | 27 +++++++++++++++++++
src/qemu/qemu_monitor_json.c | 36 +++++++++++++++++++++++++
src/qemu/qemu_process.c | 52 ++++++++++++++++++++++++++++++++++++
7 files changed, 190 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ba3fff607a..8da54c7ee9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -13479,6 +13479,9 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
case QEMU_PROCESS_EVENT_GUESTPANIC:
qemuMonitorEventPanicInfoFree(event->data);
break;
+ case QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED:
+ qemuMonitorEventRdmaGidStatusFree(event->data);
+ break;
case QEMU_PROCESS_EVENT_WATCHDOG:
case QEMU_PROCESS_EVENT_DEVICE_DELETED:
case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED:
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 80bd4bde91..64bceb9a98 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -487,6 +487,7 @@ typedef enum {
QEMU_PROCESS_EVENT_BLOCK_JOB,
QEMU_PROCESS_EVENT_MONITOR_EOF,
QEMU_PROCESS_EVENT_PR_DISCONNECT,
+ QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED,
QEMU_PROCESS_EVENT_LAST
} qemuProcessEventType;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a52e2495d5..5c6ab3c0ea 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4788,6 +4788,47 @@ processPRDisconnectEvent(virDomainObjPtr vm)
}
+static void
+processRdmaGidStatusChangedEvent(virDomainObjPtr vm,
+ qemuMonitorRdmaGidStatusChangedPrivatePtr info)
+{
+ unsigned int prefix_len;
+ virSocketAddr addr;
+ int rc;
+
+ if (!virDomainObjIsActive(vm))
+ return;
+
+ VIR_DEBUG("netdev=%s,gid_status=%d,subnet_prefix=0x%llx,interface_id=0x%llx",
+ info->netdev, info->gid_status, info->subnet_prefix,
+ info->interface_id);
+
+ if (info->subnet_prefix) {
+ prefix_len = 64;
+ uint32_t ipv6[4];
+ memcpy(&ipv6[0], &info->subnet_prefix, sizeof(info->subnet_prefix));
+ memcpy(&ipv6[2], &info->interface_id, sizeof(info->interface_id));
+ virSocketAddrSetIPv6AddrNetOrder(&addr, ipv6);
+ } else {
+ prefix_len = 24;
+ virSocketAddrSetIPv4AddrNetOrder(&addr, info->interface_id >> 32);
+ }
+
+ if (info->gid_status) {
+ VIR_DEBUG("Adding %s to %s", virSocketAddrFormat(&addr), info->netdev);
+ rc = virNetDevIPAddrAdd(info->netdev, &addr, NULL, prefix_len);
+ } else {
+ VIR_DEBUG("Removing %s from %s", virSocketAddrFormat(&addr),
+ info->netdev);
+ rc = virNetDevIPAddrDel(info->netdev, &addr, prefix_len);
+ }
+
+ if (rc < 0)
+ VIR_WARN("Fail to update address %s to %s", virSocketAddrFormat(&addr),
+ info->netdev);
+}
+
+
static void qemuProcessEventHandler(void *data, void *opaque)
{
struct qemuProcessEvent *processEvent = data;
@@ -4828,6 +4869,9 @@ static void qemuProcessEventHandler(void *data, void *opaque)
case QEMU_PROCESS_EVENT_PR_DISCONNECT:
processPRDisconnectEvent(vm);
break;
+ case QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED:
+ processRdmaGidStatusChangedEvent(vm, processEvent->data);
+ break;
case QEMU_PROCESS_EVENT_LAST:
break;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7f7013e115..4bf71dbf8c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1686,6 +1686,22 @@ qemuMonitorEmitPRManagerStatusChanged(qemuMonitorPtr mon,
}
+int
+qemuMonitorEmitRdmaGidStatusChanged(qemuMonitorPtr mon, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id)
+{
+ int ret = -1;
+ VIR_DEBUG("netdev=%s,gid_status=%d,subnet_prefix=0x%lx,interface_id=0x%lx",
+ netdev, gid_status, subnet_prefix, interface_id);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainRdmaGidStatusChanged, mon->vm, netdev,
+ gid_status, subnet_prefix, interface_id);
+
+ return ret;
+}
+
+
int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
@@ -4298,6 +4314,17 @@ qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info)
}
+void
+qemuMonitorEventRdmaGidStatusFree(qemuMonitorRdmaGidStatusChangedPrivatePtr info)
+{
+ if (!info)
+ return;
+
+ VIR_FREE(info->netdev);
+ VIR_FREE(info);
+}
+
+
int
qemuMonitorSetWatchdogAction(qemuMonitorPtr mon,
const char *action)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 48b142a4f4..b639a0a9d2 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -109,8 +109,22 @@ struct _qemuMonitorEventPanicInfo {
} data;
};
+
+typedef struct _qemuMonitorRdmaGidStatusChangedPrivate qemuMonitorRdmaGidStatusChangedPrivate;
+typedef qemuMonitorRdmaGidStatusChangedPrivate *qemuMonitorRdmaGidStatusChangedPrivatePtr;
+struct _qemuMonitorRdmaGidStatusChangedPrivate {
+ virObject parent;
+
+ char *netdev;
+ bool gid_status;
+ unsigned long long subnet_prefix;
+ unsigned long long interface_id;
+};
+
+
char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
+void qemuMonitorEventRdmaGidStatusFree(qemuMonitorRdmaGidStatusChangedPrivatePtr info);
typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
virDomainObjPtr vm,
@@ -281,6 +295,14 @@ typedef int (*qemuMonitorDomainPRManagerStatusChangedCallback)(qemuMonitorPtr mo
bool connected,
void *opaque);
+typedef int (*qemuMonitorDomainRdmaGidStatusChangedCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ const char *netdev,
+ bool gid_status,
+ uint64_t subnet_prefix,
+ uint64_t interface_id,
+ void *opaque);
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
@@ -314,6 +336,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
qemuMonitorDomainPRManagerStatusChangedCallback domainPRManagerStatusChanged;
+ qemuMonitorDomainRdmaGidStatusChangedCallback domainRdmaGidStatusChanged;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -448,6 +471,10 @@ int qemuMonitorEmitPRManagerStatusChanged(qemuMonitorPtr mon,
const char *prManager,
bool connected);
+int qemuMonitorEmitRdmaGidStatusChanged(qemuMonitorPtr mon, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3de298c9e2..8df9b426ba 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -91,6 +91,7 @@ static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr
static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleDumpCompleted(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandlePRManagerStatusChanged(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleRdmaGidStatusChanged(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -114,6 +115,7 @@ static qemuEventHandler eventHandlers[] = {
{ "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, },
{ "POWERDOWN", qemuMonitorJSONHandlePowerdown, },
{ "PR_MANAGER_STATUS_CHANGED", qemuMonitorJSONHandlePRManagerStatusChanged, },
+ { "RDMA_GID_STATUS_CHANGED", qemuMonitorJSONHandleRdmaGidStatusChanged, },
{ "RESET", qemuMonitorJSONHandleReset, },
{ "RESUME", qemuMonitorJSONHandleResume, },
{ "RTC_CHANGE", qemuMonitorJSONHandleRTCChange, },
@@ -1351,6 +1353,40 @@ static void qemuMonitorJSONHandlePRManagerStatusChanged(qemuMonitorPtr mon,
}
+static void qemuMonitorJSONHandleRdmaGidStatusChanged(qemuMonitorPtr mon,
+ virJSONValuePtr data)
+{
+ const char *netdev;
+ bool gid_status;
+ unsigned long long subnet_prefix, interface_id;
+
+ if (!(netdev = virJSONValueObjectGetString(data, "netdev"))) {
+ VIR_WARN("missing netdev in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetBoolean(data, "gid-status", &gid_status)) {
+ VIR_WARN("missing gid-status in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(data, "subnet-prefix",
+ &subnet_prefix)) {
+ VIR_WARN("missing subnet-prefix in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(data, "interface-id",
+ &interface_id)) {
+ VIR_WARN("missing interface-id in GID_STATUS_CHANGED event");
+ return;
+ }
+
+ qemuMonitorEmitRdmaGidStatusChanged(mon, netdev, gid_status, subnet_prefix,
+ interface_id);
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9cf971808c..6cf0ace5cf 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1703,6 +1703,57 @@ qemuProcessHandlePRManagerStatusChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
}
+static int
+qemuProcessHandleRdmaGidStatusChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm, const char *netdev,
+ bool gid_status, uint64_t subnet_prefix,
+ uint64_t interface_id, void *opaque)
+{
+ virQEMUDriverPtr driver = opaque;
+ struct qemuProcessEvent *processEvent = NULL;
+ qemuMonitorRdmaGidStatusChangedPrivatePtr rdmaGitStatusChangedPriv = NULL;
+ int ret = -1;
+
+ virObjectLock(vm);
+
+ VIR_DEBUG("netdev=%s,gid_status=%d,subnet_prefix=0x%lx,interface_id=0x%lx",
+ netdev, gid_status, subnet_prefix, interface_id);
+
+ if (VIR_ALLOC(rdmaGitStatusChangedPriv) < 0)
+ goto out_unlock;
+
+ if (VIR_STRDUP(rdmaGitStatusChangedPriv->netdev, netdev) < 0)
+ goto out_free;
+
+ rdmaGitStatusChangedPriv->gid_status = gid_status;
+ rdmaGitStatusChangedPriv->subnet_prefix = subnet_prefix;
+ rdmaGitStatusChangedPriv->interface_id = interface_id;
+
+ if (VIR_ALLOC(processEvent) < 0)
+ goto out_free;
+
+ processEvent->eventType = QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED;
+ processEvent->vm = virObjectRef(vm);
+ processEvent->data = rdmaGitStatusChangedPriv;
+
+ if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
+ qemuProcessEventFree(processEvent);
+ virObjectUnref(vm);
+ goto out_free;
+ }
+
+ ret = 0;
+ goto out_unlock;
+
+ out_free:
+ qemuMonitorEventRdmaGidStatusFree(rdmaGitStatusChangedPriv);
+
+ out_unlock:
+ virObjectUnlock(vm);
+ return ret;
+}
+
+
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuProcessHandleMonitorEOF,
.errorNotify = qemuProcessHandleMonitorError,
@@ -1732,6 +1783,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainBlockThreshold = qemuProcessHandleBlockThreshold,
.domainDumpCompleted = qemuProcessHandleDumpCompleted,
.domainPRManagerStatusChanged = qemuProcessHandlePRManagerStatusChanged,
+ .domainRdmaGidStatusChanged = qemuProcessHandleRdmaGidStatusChanged,
};
static void
--
2.17.2
5 years, 11 months
[libvirt] [PATCH v2 0/4] add disk driver metadata_cache_size option
by Nikolay Shirokovskiy
1st docs patch may need tweaks if merged now (if -blockdev will not be
available in 4.10)
diff from v1 [1]
===============
- support only -blockdev configurations
- add 'default' value for the attribute
- set QEMU_CAPS_QCOW2_L2_CACHE_SIZE only for recent qemu versions (see 2nd patch)
- factor out API changes to distinct patch
- fix xml2argv test to blockdev configuration
- factor out xml2argv test to distinct patch as it is not yet passing
- other misc changes
[1] https://www.redhat.com/archives/libvir-list/2018-November/msg00016.html
Nikolay Shirokovskiy (4):
xml: add disk driver metadata_cache_size option
qemu: caps: add QEMU_CAPS_QCOW2_L2_CACHE_SIZE
qemu: support metadata-cache-size for blockdev
DO NOT APPLY: add xml2argv test for metadata_cache_size
docs/formatdomain.html.in | 8 ++++
docs/schemas/domaincommon.rng | 11 +++++
src/conf/domain_conf.c | 17 ++++++++
src/conf/domain_conf.h | 9 ++++
src/qemu/qemu_block.c | 5 ++-
src/qemu/qemu_capabilities.c | 5 +++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 23 +++++++++++
src/qemu/qemu_domain.c | 2 +
src/util/virstoragefile.c | 1 +
src/util/virstoragefile.h | 1 +
.../qemuxml2argvdata/disk-metadata_cache_size.args | 39 ++++++++++++++++++
.../qemuxml2argvdata/disk-metadata_cache_size.xml | 42 +++++++++++++++++++
tests/qemuxml2argvtest.c | 2 +
.../disk-metadata_cache_size.xml | 48 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +
16 files changed, 215 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/disk-metadata_cache_size.args
create mode 100644 tests/qemuxml2argvdata/disk-metadata_cache_size.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-metadata_cache_size.xml
--
1.8.3.1
5 years, 11 months
[libvirt] [PATCH v2] qemu: Introduce caching whether /dev/kvm is accessible
by Marc Hartmayer
Introduce caching whether /dev/kvm is usable as the QEMU user:QEMU
group. This reduces the overhead of the QEMU capabilities cache
lookup. Before this patch there were many fork() calls used for
checking whether /dev/kvm is accessible. Now we store the result
whether /dev/kvm is accessible or not and we only need to re-run the
virFileAccessibleAs check if the ctime of /dev/kvm has changed.
Suggested-by: Daniel P. Berrangé <berrange(a)redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
---
src/qemu/qemu_capabilities.c | 54 ++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e228f52ec0bb..85516954149b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3238,6 +3238,10 @@ struct _virQEMUCapsCachePriv {
virArch hostArch;
unsigned int microcodeVersion;
char *kernelVersion;
+
+ /* cache whether /dev/kvm is usable as runUid:runGuid */
+ virTristateBool kvmUsable;
+ time_t kvmCtime;
};
typedef struct _virQEMUCapsCachePriv virQEMUCapsCachePriv;
typedef virQEMUCapsCachePriv *virQEMUCapsCachePrivPtr;
@@ -3824,6 +3828,52 @@ virQEMUCapsSaveFile(void *data,
}
+/* Determine whether '/dev/kvm' is usable as QEMU user:QEMU group. */
+static bool
+virQEMUCapsKVMUsable(virQEMUCapsCachePrivPtr priv)
+{
+ struct stat sb;
+ static const char *kvm_device = "/dev/kvm";
+ virTristateBool value;
+ virTristateBool cached_value = priv->kvmUsable;
+ time_t kvm_ctime;
+ time_t cached_kvm_ctime = priv->kvmCtime;
+
+ if (stat(kvm_device, &sb) < 0) {
+ virReportSystemError(errno,
+ _("Failed to stat %s"), kvm_device);
+ return false;
+ }
+ kvm_ctime = sb.st_ctime;
+
+ if (kvm_ctime != cached_kvm_ctime) {
+ VIR_DEBUG("%s has changed (%lld vs %lld)", kvm_device,
+ (long long)kvm_ctime, (long long)cached_kvm_ctime);
+ cached_value = VIR_TRISTATE_BOOL_ABSENT;
+ }
+
+ if (cached_value != VIR_TRISTATE_BOOL_ABSENT)
+ return cached_value == VIR_TRISTATE_BOOL_YES;
+
+ if (virFileAccessibleAs(kvm_device, R_OK | W_OK,
+ priv->runUid, priv->runGid) == 0) {
+ value = VIR_TRISTATE_BOOL_YES;
+ } else {
+ value = VIR_TRISTATE_BOOL_NO;
+ }
+
+ /* There is a race window between 'stat' and
+ * 'virFileAccessibleAs'. However, since we're only interested in
+ * detecting changes *after* the virFileAccessibleAs check, we can
+ * neglect this here.
+ */
+ priv->kvmCtime = kvm_ctime;
+ priv->kvmUsable = value;
+
+ return value == VIR_TRISTATE_BOOL_YES;
+}
+
+
static bool
virQEMUCapsIsValid(void *data,
void *privData)
@@ -3872,8 +3922,7 @@ virQEMUCapsIsValid(void *data,
return true;
}
- kvmUsable = virFileAccessibleAs("/dev/kvm", R_OK | W_OK,
- priv->runUid, priv->runGid) == 0;
+ kvmUsable = virQEMUCapsKVMUsable(priv);
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
kvmUsable) {
@@ -4684,6 +4733,7 @@ virQEMUCapsCacheNew(const char *libDir,
priv->runUid = runUid;
priv->runGid = runGid;
priv->microcodeVersion = microcodeVersion;
+ priv->kvmUsable = VIR_TRISTATE_BOOL_ABSENT;
if (uname(&uts) == 0 &&
virAsprintf(&priv->kernelVersion, "%s %s", uts.release, uts.version) < 0)
--
2.17.0
5 years, 11 months
[libvirt] [PATCH v3 0/4] rpc: fixing compilation error due to deprecated functions.
by Julio Faracco
After 0.8.0 release, libssh deprecated some functions like:
ssh_is_server_known() and ssh_write_knownhost(). They were replaced by
ssh_session_is_known_server() and ssh_session_update_known_hosts()
respectively. This serie creates the alias to keep the compatibility and
create an auxiliar enum to help it because
ssh_session_update_known_hosts() introduced new state returns.
v1-v2: Rebasing ssh_session_is_known_server() return states.
v2-v3: Only code syntax fixes.
Julio Faracco (4):
m4: checking if ssh_session_is_known_server() exists.
rpc: replacing ssh_is_server_known() by ssh_session_is_known_server().
m4: checking if ssh_session_update_known_hosts() exists.
rpc: replacing ssh_write_knownhost() by
ssh_session_update_known_hosts().
m4/virt-libssh.m4 | 12 ++++++++++++
src/rpc/virnetlibsshsession.c | 18 +++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
--
2.19.1
5 years, 11 months