[libvirt] [PATCH] virsh: Honour user locale in cmdList
by Michal Privoznik
In 2e97450425e we've mistakenly removed gettext macro for
translating static strings. This results in table header being
printed in English regardless of user locale.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain-monitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index adc5bb1a7a..8962586d76 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1942,9 +1942,9 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
/* print table header in legacy mode */
if (optTable) {
if (optTitle)
- table = vshTableNew("Id", "Name", "State", "Title", NULL);
+ table = vshTableNew(_("Id"), _("Name"), _("State"), _("Title"), NULL);
else
- table = vshTableNew("Id", "Name", "State", NULL);
+ table = vshTableNew(_("Id"), _("Name"), _("State"), NULL);
if (!table)
goto cleanup;
--
2.16.4
6 years, 1 month
[libvirt] [PATCH] conf: fix starting a domain with cpuset=""
by Yi Wang
Domain fails to start when its config xml including:
<vcpu cpuset="" current="8">64</vcpu>
# virsh create vm.xml
error: Failed to create domain from vm.xml
error: invalid argument: Failed to parse bitmap ''
This patch fixes this.
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
Reviewed-by: Xi Xu <xu.xi8(a)zte.com.cn>
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8619962..bacafb2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18553,7 +18553,7 @@ virDomainVcpuParse(virDomainDefPtr def,
if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
tmp = virXMLPropString(vcpuNode, "cpuset");
- if (tmp) {
+ if (tmp && strlen(tmp) != 0) {
if (virBitmapParse(tmp, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
--
1.8.3.1
6 years, 1 month
[libvirt] [PATCH] qemu: Fix error reporting in qemuDomainSaveImageStartVM
by Jiri Denemark
When restoring a domain from a compressed image, we launch an
intermediate process for decompressing the saved data. If QEMU fails to
load the data for some reason, we force close the stdin/stdout file
descriptors of the intermediate process and wait for it to die. However,
virCommandWait can report various errors which would overwrite the real
error from QEMU. Thus instead of getting something useful:
internal error: process exited while connecting to monitor:
2018-09-17T15:17:29.998910Z qemu-system-x86_64: can't apply global
Skylake-Client-x86_64-cpu.osxsave=off: Property '.osxsave' not found
we could get an irrelevant error message:
internal error: Child process (lzop -dc --ignore-warn) unexpected
fatal signal 13
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9424994aa1..25cbccc5e6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6590,11 +6590,15 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
restored = true;
if (intermediatefd != -1) {
+ virErrorPtr orig_err = NULL;
+
if (!restored) {
/* if there was an error setting up qemu, the intermediate
* process will wait forever to write to stdout, so we
- * must manually kill it.
+ * must manually kill it and ignore any error related to
+ * the process
*/
+ orig_err = virSaveLastError();
VIR_FORCE_CLOSE(intermediatefd);
VIR_FORCE_CLOSE(*fd);
}
@@ -6604,6 +6608,11 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
restored = false;
}
VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf));
+
+ if (orig_err) {
+ virSetError(orig_err);
+ virFreeError(orig_err);
+ }
}
VIR_FORCE_CLOSE(intermediatefd);
--
2.19.0
6 years, 1 month
[libvirt] [PATCH] ctags: Generate tags for headers, i.e. function prototypes
by Erik Skultety
>From time to time it's handy to jump directly to a function prototype in
a header. However, generating tags for headers is disabled by default in
ctags, let's enable it by using --c-kinds=+p.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
.ctags | 1 +
1 file changed, 1 insertion(+)
diff --git a/.ctags b/.ctags
index 75e9753182..a4f17b589d 100644
--- a/.ctags
+++ b/.ctags
@@ -3,3 +3,4 @@
--exclude=*.html
--exclude=*.html.in
--langmap=c:+.h.in
+--c-kinds=+p
--
2.17.1
6 years, 1 month
[libvirt] [libvirt PATCH v5 0/1] Finish the conversion to virConfGetValue* functions
by Fabiano Fidêncio
This patchset finishes the conversion to virConfGetValue* functions,
started by Daniel Berrange a few months ago.
Please, mind that although we could make virConfGetValue* functions more
generic in order to support numbers and booleans as strings, that
doesn't seem the safest path to take. The side-effect of this is that we
will have to live with some specific code doing that as part of vmx and
xen_common.
Once this patchset gets merged,
https://wiki.libvirt.org/page/BiteSizedTasks#Finish_conversion_to_virConf...
can be removed.
- Changes since v1:
All the "values" from virConfGetValueString() are freed
- Changes since v2:
All comments from Ján Tomko have been addressed;
A few leaks were (possibly) found and they're addressed in the last
patch of the series;
- Changes since v3:
All comments from Ján Tomko have been addressed in order to lower the
non-whitespace changes in the first patch;
- Chages since v4:
All comments from Ján Tomko have been addressed (hopefully, they
actually were this time :-));
Fabiano Fidêncio (1):
xen_common: Convert to typesafe virConf acessors
src/xenconfig/xen_common.c | 163 +++++++++++++++++--------------------
1 file changed, 75 insertions(+), 88 deletions(-)
--
2.17.1
6 years, 1 month
[libvirt] Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function
by xiajidong@cmss.chinamobile.com
>From c013b053d7514ee66b841bc99900b06d1e9d4dfd Mon Sep 17 00:00:00 2001
From: xiajidong <xiajidong(a)cmss.chinamobile.com>
Date: Tue, 18 Sep 2018 08:04:20 -0400
Subject: [PATCH] libvirt-domain.c:virDomainMigrateCheckNotLocal function
return bool instead of int type
the function of virDomainMigrateCheckNotLocal return bool should be more in
line with specification,
and use return is better than goto.
Signed-off-by: xiajidong <xiajidong(a)cmss.chinamobile.com>
---
src/libvirt-domain.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 7690339..d741261 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -3290,25 +3290,25 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
}
-static int
+static bool
virDomainMigrateCheckNotLocal(const char *dconnuri)
{
virURIPtr tempuri = NULL;
- int ret = -1;
- if (!(tempuri = virURIParse(dconnuri)))
- goto cleanup;
+ if (!(tempuri = virURIParse(dconnuri))) {
+ virURIFree(tempuri);
+ return false;
+ }
if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
virReportInvalidArg(dconnuri, "%s",
_("Attempt to migrate guest to the same
host"));
- goto cleanup;
+ virURIFree(tempuri);
+ return false;
}
- ret = 0;
- cleanup:
virURIFree(tempuri);
- return ret;
+ return ture;
}
@@ -3428,7 +3428,7 @@ virDomainMigrateUnmanagedParams(virDomainPtr domain,
VIR_TYPED_PARAMS_DEBUG(params, nparams);
if ((flags & VIR_MIGRATE_PEER2PEER) &&
- virDomainMigrateCheckNotLocal(dconnuri) < 0)
+ !virDomainMigrateCheckNotLocal(dconnuri))
return -1;
if ((flags & VIR_MIGRATE_PEER2PEER) &&
--
1.8.3.1
6 years, 1 month
Re: [libvirt] [PATCH 2/2] hw/vfio/display: add ramfb support
by Alex Williamson
On Mon, 10 Sep 2018 08:43:40 +0200
Gerd Hoffmann <kraxel(a)redhat.com> wrote:
> So we have a boot display when using a vgpu as primary display.
>
> Use vfio-pci-ramfb instead of vfio-pci to enable it.
>
> Signed-off-by: Gerd Hoffmann <kraxel(a)redhat.com>
> ---
> include/hw/vfio/vfio-common.h | 2 ++
> hw/vfio/display.c | 12 ++++++++++++
> hw/vfio/pci.c | 15 +++++++++++++++
> 3 files changed, 29 insertions(+)
>
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index 821def0565..0d85a0a6f8 100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -26,6 +26,7 @@
> #include "qemu/queue.h"
> #include "qemu/notify.h"
> #include "ui/console.h"
> +#include "hw/display/ramfb.h"
> #ifdef CONFIG_LINUX
> #include <linux/vfio.h>
> #endif
> @@ -146,6 +147,7 @@ typedef struct VFIODMABuf {
>
> typedef struct VFIODisplay {
> QemuConsole *con;
> + RAMFBState *ramfb;
> struct {
> VFIORegion buffer;
> DisplaySurface *surface;
> diff --git a/hw/vfio/display.c b/hw/vfio/display.c
> index 59c0e5d1d7..3901f580c6 100644
> --- a/hw/vfio/display.c
> +++ b/hw/vfio/display.c
> @@ -124,6 +124,9 @@ static void vfio_display_dmabuf_update(void *opaque)
>
> primary = vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY);
> if (primary == NULL) {
> + if (dpy->ramfb) {
> + ramfb_display_update(dpy->con, dpy->ramfb);
> + }
> return;
> }
>
> @@ -181,6 +184,9 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp)
> vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
> &vfio_display_dmabuf_ops,
> vdev);
> + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0) {
> + vdev->dpy->ramfb = ramfb_setup(errp);
> + }
> return 0;
> }
>
> @@ -228,6 +234,9 @@ static void vfio_display_region_update(void *opaque)
> return;
> }
> if (!plane.drm_format || !plane.size) {
> + if (dpy->ramfb) {
> + ramfb_display_update(dpy->con, dpy->ramfb);
> + }
> return;
> }
> format = qemu_drm_format_to_pixman(plane.drm_format);
> @@ -300,6 +309,9 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev, Error **errp)
> vdev->dpy->con = graphic_console_init(DEVICE(vdev), 0,
> &vfio_display_region_ops,
> vdev);
> + if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0) {
> + vdev->dpy->ramfb = ramfb_setup(errp);
> + }
> return 0;
> }
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 866f0deeb7..7c0628756e 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -3258,9 +3258,24 @@ static const TypeInfo vfio_pci_dev_info = {
> },
> };
>
> +static void vfio_pci_ramfb_dev_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> +
> + dc->hotpluggable = false;
> +}
> +
> +static const TypeInfo vfio_pci_ramfb_dev_info = {
> + .name = "vfio-pci-ramfb",
> + .parent = "vfio-pci",
> + .instance_size = sizeof(VFIOPCIDevice),
> + .class_init = vfio_pci_ramfb_dev_class_init,
> +};
> +
> static void register_vfio_pci_dev_type(void)
> {
> type_register_static(&vfio_pci_dev_info);
> + type_register_static(&vfio_pci_ramfb_dev_info);
> }
>
> type_init(register_vfio_pci_dev_type)
My concern here is still all of the extra tooling that needs to be
added to management layers above QEMU for this device that exists only
because we can't hotplug the primary display in QEMU. What happens when
we can hotplug the primary display? Aren't disabling hotplug of a
vfio-pci device and supporting ramfb two separate things? I think
we're leaking current implementation issues out to the device options
when really we'd rather have a "ramfb" (or perhaps "console") option on
the vfio-pci device and the hotplug capability determined automatically
and available through introspection of the device. Thanks,
Alex
6 years, 1 month
[libvirt] [PATCH] Drop \n at the end of VIR_DEBUG messages
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/conf/capabilities.c | 2 +-
src/util/virrotatingfile.c | 4 ++--
tests/virnetsockettest.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 326bd15cee..85f538e8c4 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -691,7 +691,7 @@ virCapabilitiesDomainDataLookupInternal(virCapsPtr caps,
machinetype, machine->name, NULLSTR(machine->canonical));
continue;
}
- VIR_DEBUG("Match machine type machine %s\n", NULLSTR(machinetype));
+ VIR_DEBUG("Match machine type machine %s", NULLSTR(machinetype));
foundmachine = machine;
break;
diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c
index ca62a8e026..d7dc3bd1ce 100644
--- a/src/util/virrotatingfile.c
+++ b/src/util/virrotatingfile.c
@@ -484,7 +484,7 @@ virRotatingFileWriterAppend(virRotatingFileWriterPtr file,
if ((file->entry->pos == file->maxlen && len) ||
forceRollover) {
virRotatingFileWriterEntryPtr tmp;
- VIR_DEBUG("Hit max size %zu on %s (force=%d)\n",
+ VIR_DEBUG("Hit max size %zu on %s (force=%d)",
file->maxlen, file->basepath, forceRollover);
if (virRotatingFileWriterRollover(file) < 0)
@@ -571,7 +571,7 @@ virRotatingFileReaderConsume(virRotatingFileReaderPtr file,
{
ssize_t ret = 0;
- VIR_DEBUG("Consume %p %zu\n", buf, len);
+ VIR_DEBUG("Consume %p %zu", buf, len);
while (len) {
virRotatingFileReaderEntryPtr entry;
ssize_t got;
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 5927be1f80..7f52bf5c61 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -161,7 +161,7 @@ testSocketIncoming(virNetSocketPtr sock,
void *opaque)
{
virNetSocketPtr *retsock = opaque;
- VIR_DEBUG("Incoming sock=%p events=%d\n", sock, events);
+ VIR_DEBUG("Incoming sock=%p events=%d", sock, events);
*retsock = sock;
}
--
2.19.0
6 years, 1 month
[libvirt] [PATCH v2] qemu: fix deadlock if create qemuProcessReconnect thread failed
by Wang Yechao
qemuProcessReconnectHelper has hold the doms lock, if create
qemuProcessReconnect thread failed, it will get the doms lock
again to remove the dom from doms list.
add obj->inReconnetCtx flag to avoid deadlock.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
src/conf/domain_conf.h | 1 +
src/conf/virdomainobjlist.c | 6 ++++--
src/qemu/qemu_process.c | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e30a4b2..5bc5771 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2608,6 +2608,7 @@ struct _virDomainObj {
virDomainSnapshotObjPtr current_snapshot;
bool hasManagedSave;
+ bool inReconnectCtx;
void *privateData;
void (*privateDataFreeFunc)(void *);
diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c
index 805fe94..30300b4 100644
--- a/src/conf/virdomainobjlist.c
+++ b/src/conf/virdomainobjlist.c
@@ -397,11 +397,13 @@ virDomainObjListRemove(virDomainObjListPtr doms,
dom->removing = true;
virObjectRef(dom);
virObjectUnlock(dom);
- virObjectRWLockWrite(doms);
+ if (!dom->inReconnectCtx)
+ virObjectRWLockWrite(doms);
virObjectLock(dom);
virDomainObjListRemoveLocked(doms, dom);
virObjectUnref(dom);
- virObjectRWUnlock(doms);
+ if (!dom->inReconnectCtx)
+ virObjectRWUnlock(doms);
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index eb9904b..8c30850 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8029,6 +8029,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj,
*/
qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED,
QEMU_ASYNC_JOB_NONE, 0);
+ obj->inReconnectCtx = true;
qemuDomainRemoveInactiveJob(src->driver, obj);
virDomainObjEndAPI(&obj);
--
1.8.3.1
6 years, 1 month
[libvirt] [PATCH v2] nwfilter: fix deadlock when nwfilter reload
by Wang Yechao
user run "firewalld-cmd --reload"
nwfilterStateReload called in main thread
step 1. virRWLockWrite(&updateLock)
step 2. virNWFilterLoadAllConfigs
step 3. virRWLockUnlock(&updateLock);
lauch a vm: qemuDomainCreateXML runs in other thread
step 1. virRWLockRead(&updateLock);
step 2. qemuProcessStart
step 3. qemuProcessWaitForMonitor
step 4. ...
step 5 virRWLockUnlock(&updateLock);
if nwfilterStateReload called in the middle of step 1 and step 5 of
qemuDomainCreateXML, it can't get the updateLock and then block the event_loop,
so event_loop can't handle the qemu-monitor messages, cause deadlock
move nwfilterStateReload into thread to fix this problem.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
Reviewed-by: Wang Yi <wang.yi59(a)zte.com.cn>
---
src/nwfilter/nwfilter_driver.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 1ee5162..ab85072 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -80,18 +80,26 @@ static void nwfilterDriverUnlock(void)
}
#if HAVE_FIREWALLD
+static void nwfilterReloadThread(void *opaque ATTRIBUTE_UNUSED)
+{
+ nwfilterStateReload();
+}
static DBusHandlerResult
nwfilterFirewalldDBusFilter(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusMessage *message,
void *user_data ATTRIBUTE_UNUSED)
{
+ virThread thread;
+
if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,
"NameOwnerChanged") ||
dbus_message_is_signal(message, "org.fedoraproject.FirewallD1",
"Reloaded")) {
VIR_DEBUG("Reload in nwfilter_driver because of firewalld.");
- nwfilterStateReload();
+
+ if (virThreadCreate(&thread, false, nwfilterReloadThread, NULL) < 0)
+ VIR_WARN("create nwfilterReloadThread failed.");
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
--
1.8.3.1
6 years, 1 month