[libvirt] [PATCH 0/5] libxl: various migration V3 improvements
by Jim Fehlig
Patch 5 fixes a long standing problem found by some very slow hosts in
xen's osstest
https://lists.xenproject.org/archives/html/xen-devel/2018-08/msg01945.html
While working on the fix, I discovered other problems in libxl's V3
migration protocol. E.g. a modify job on the migrating VM was not
handled properly across the phases on either src or dst host. Patches
1-4 fix this and other problems found along the way.
Jim Fehlig (5):
libxl: migration: defer removing VM until finish phase
libxl: fix logic in P2P migration
libxl: fix job handling across migration phases on src
libxl: fix job handling across migration phases on dst
libxl: join with thread receiving migration data
src/libxl/libxl_domain.h | 1 +
src/libxl/libxl_driver.c | 7 --
src/libxl/libxl_migration.c | 168 ++++++++++++++++++++++++------------
3 files changed, 114 insertions(+), 62 deletions(-)
--
2.18.0
6 years, 7 months
[libvirt] [PATCH] 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 | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 1ee5162..8dcc40b 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -80,18 +80,27 @@ 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_ERROR("create nwfilterThread failed.");
+ }
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
--
1.8.3.1
6 years, 7 months
[libvirt] [PATCH] rpm: increase min required Fedora to 27
by Fabiano Fidêncio
Fedora 26 has reached its EOL on May 29th 2018.
https://lists.fedoraproject.org/archives/list/announce@lists.fedoraprojec...
Signed-off-by: Fabiano Fidêncio <fidencio(a)redhat.com>
---
libvirt.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index cc2e662e27..b31947b0f4 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -4,7 +4,7 @@
# that's still supported by the vendor. It may work on other distros
# or versions, but no effort will be made to ensure that going forward.
%define min_rhel 7
-%define min_fedora 26
+%define min_fedora 27
%if (0%{?fedora} && 0%{?fedora} >= %{min_fedora}) || (0%{?rhel} && 0%{?rhel} >= %{min_rhel})
%define supported_platform 1
--
2.17.1
6 years, 7 months
[libvirt] [PATCH] 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: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/nwfilter/nwfilter_driver.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
mode change 100644 => 100755 src/nwfilter/nwfilter_driver.c
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
old mode 100644
new mode 100755
index ac3a964..2c099e2
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -81,17 +81,28 @@ static void nwfilterDriverUnlock(void)
#if HAVE_FIREWALLD
+static void nwfilterThread(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();
+
+ /* create thread handle the nwfilter reload, don't block the event_loop.*/
+ if (virThreadCreate(&thread, false, nwfilterThread, NULL) < 0) {
+ VIR_ERROR("create nwfilterThread failed.");
+ }
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
--
1.8.3.1
6 years, 7 months
[libvirt] [PATCH v3 0/3] libxl: implement virDomainPM* functions
by Marek Marczykowski-Górecki
Needed libxl_domain_suspend_only is supported in Xen >= 4.11. But wakeup should
work with older versions.
Marek Marczykowski-Górecki (3):
libxl: send lifecycle event on suspend
libxl: implement virDomainPM* functions
libxl: initialize domain state with real data
src/libxl/libxl_domain.c | 20 +++---
src/libxl/libxl_driver.c | 138 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 150 insertions(+), 8 deletions(-)
base-commit: 3ad77f853230f870efa396636e008292c7f2b1c0
--
git-series 0.9.1
6 years, 7 months
[libvirt] [PATCH] 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 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
mode change 100644 => 100755 src/nwfilter/nwfilter_driver.c
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
old mode 100644
new mode 100755
index ac3a964..2c099e2
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -81,17 +81,28 @@ static void nwfilterDriverUnlock(void)
#if HAVE_FIREWALLD
+static void nwfilterThread(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();
+
+ /* create thread handle the nwfilter reload, don't block the event_loop.*/
+ if (virThreadCreate(&thread, false, nwfilterThread, NULL) < 0) {
+ VIR_ERROR("create nwfilterThread failed.");
+ }
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
--
1.8.3.1
6 years, 7 months
[libvirt] [PATCH] util: netlink: Remove virNetDevPutExtraHeader and replace with nlmsg_append
by Shi Lei
This patch removes virNetDevPutExtraHeader and replaces
it with nlmsg_append directly.
Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/util/virnetdev.c | 44 ++++++++++++--------------------------------
1 file changed, 12 insertions(+), 32 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index c4dd354..5d4ad24 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -3163,28 +3163,6 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
# if HAVE_DECL_DEVLINK_CMD_ESWITCH_GET
-/**
- * virNetDevPutExtraHeader
- * reserve and prepare room for an extra header
- * This function sets to zero the room that is required to put the extra
- * header after the initial Netlink header. This function also increases
- * the nlmsg_len field.
- *
- * @nlh: pointer to Netlink header
- * @size: size of the extra header that we want to put
- *
- * Returns pointer to the start of the extended header
- */
-static void *
-virNetDevPutExtraHeader(struct nlmsghdr *nlh,
- size_t size)
-{
- char *ptr = (char *)nlh + nlh->nlmsg_len;
- size_t len = NLMSG_ALIGN(size);
- nlh->nlmsg_len += len;
- return ptr;
-}
-
/**
* virNetDevGetFamilyId:
@@ -3199,7 +3177,11 @@ virNetDevGetFamilyId(const char *family_name)
{
struct nl_msg *nl_msg = NULL;
struct nlmsghdr *resp = NULL;
- struct genlmsghdr* gmsgh = NULL;
+ struct genlmsghdr gmsgh = {
+ .cmd = CTRL_CMD_GETFAMILY,
+ .version = DEVLINK_GENL_VERSION,
+ .reserved = 0,
+ };
struct nlattr *tb[CTRL_ATTR_MAX + 1] = {NULL, };
unsigned int recvbuflen;
uint32_t family_id = 0;
@@ -3210,12 +3192,9 @@ virNetDevGetFamilyId(const char *family_name)
goto cleanup;
}
- if (!(gmsgh = virNetDevPutExtraHeader(nlmsg_hdr(nl_msg), sizeof(struct genlmsghdr))))
+ if (nlmsg_append(nl_msg, &gmsgh, sizeof(gmsgh), NLMSG_ALIGNTO) < 0)
goto cleanup;
- gmsgh->cmd = CTRL_CMD_GETFAMILY;
- gmsgh->version = DEVLINK_GENL_VERSION;
-
if (nla_put_string(nl_msg, CTRL_ATTR_FAMILY_NAME, family_name) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
@@ -3262,7 +3241,11 @@ virNetDevSwitchdevFeature(const char *ifname,
unsigned int recvbuflen;
struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {NULL, };
virPCIDevicePtr pci_device_ptr = NULL;
- struct genlmsghdr* gmsgh = NULL;
+ struct genlmsghdr gmsgh = {
+ .cmd = DEVLINK_CMD_ESWITCH_GET,
+ .version = DEVLINK_GENL_VERSION,
+ .reserved = 0,
+ };
const char *pci_name;
char *pfname = NULL;
int is_vf = -1;
@@ -3292,12 +3275,9 @@ virNetDevSwitchdevFeature(const char *ifname,
goto cleanup;
}
- if (!(gmsgh = virNetDevPutExtraHeader(nlmsg_hdr(nl_msg), sizeof(struct genlmsghdr))))
+ if (nlmsg_append(nl_msg, &gmsgh, sizeof(gmsgh), NLMSG_ALIGNTO) < 0)
goto cleanup;
- gmsgh->cmd = DEVLINK_CMD_ESWITCH_GET;
- gmsgh->version = DEVLINK_GENL_VERSION;
-
pci_name = virPCIDeviceGetName(pci_device_ptr);
if (nla_put(nl_msg, DEVLINK_ATTR_BUS_NAME, strlen("pci")+1, "pci") < 0 ||
--
2.17.1
6 years, 8 months
[libvirt] [PATCH] util: netdev: fix memleak of virNetDevIPRouteAdd
by Shi Lei
This patch fixes memleak for *resp* in virNetDevIPRouteAdd.
Signed-off-by: Shi Lei <shi_lei(a)massclouds.com>
---
src/util/virnetdevip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index 0f080a5..16570a5 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -283,7 +283,7 @@ virNetDevIPRouteAdd(const char *ifname,
virSocketAddrPtr gateway,
unsigned int metric)
{
- struct nlmsghdr *resp = NULL;
+ VIR_AUTOFREE(struct nlmsghdr *) resp = NULL;
unsigned int recvbuflen;
unsigned int ifindex;
struct rtmsg rtmsg;
--
2.17.1
6 years, 8 months
[libvirt] [PATCH v2 0/3] libxl: implement virDomainPM* functions
by Marek Marczykowski-Górecki
Needed libxl_domain_suspend_only is supported in Xen >= 4.11. But wakeup should
work with older versions.
Marek Marczykowski-Górecki (3):
libxl: send lifecycle event on suspend
libxl: implement virDomainPM* functions
libxl: initialize domain state with real data
src/libxl/libxl_domain.c | 20 +++---
src/libxl/libxl_driver.c | 132 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 144 insertions(+), 8 deletions(-)
base-commit: 3ad77f853230f870efa396636e008292c7f2b1c0
--
git-series 0.9.1
6 years, 8 months
[libvirt] [PATCH] qemuProcessBuildDestroyMemoryPathsImpl: Don't overwrite error
by Michal Privoznik
The qemuSecurityDomainSetPathLabel() function reports perfect
error itself. Do not overwrite it to something less meaningful.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_process.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 960c3ed011..eb9904b7ba 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3669,11 +3669,8 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
}
if (qemuSecurityDomainSetPathLabel(driver->securityManager,
- def, path, true) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to label %s"), path);
+ def, path, true) < 0)
return -1;
- }
} else {
if (virFileDeleteTree(path) < 0)
return -1;
--
2.16.4
6 years, 8 months