[PATCH] network: refactor networkSetIPv6Sysctls() for proper g_autofree usage
by Laine Stump
This function used the same char* three times for different purposes,
freeing it after each use. Since we don't want to ever manually free
an autofree'd pointer, modify it to use three separate char*, and make
them all g_autofree.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
This was suggested by Jan in
https://www.redhat.com/archives/libvir-list/2020-July/msg00805.html
pushing this patch along with the patch 5 referenced there will permit
pushing patch 06/15 of that series unmodified.
src/network/bridge_driver.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index dd8f34e543..6d341dba7c 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2248,7 +2248,9 @@ static int
networkSetIPv6Sysctls(virNetworkObjPtr obj)
{
virNetworkDefPtr def = virNetworkObjGetDef(obj);
- char *field = NULL;
+ g_autofree char *disable_ipv6 = NULL;
+ g_autofree char *accept_ra = NULL;
+ g_autofree char *autoconf = NULL;
int ret = -1;
bool enableIPv6 = !!virNetworkDefGetIPByIndex(def, AF_INET6, 0);
@@ -2256,10 +2258,10 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
* network. But also unset it if there *are* ipv6 addresses, as we
* can't be sure of its default value.
*/
- field = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/disable_ipv6",
- def->bridge);
+ disable_ipv6 = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/disable_ipv6",
+ def->bridge);
- if (access(field, W_OK) < 0 && errno == ENOENT) {
+ if (access(disable_ipv6, W_OK) < 0 && errno == ENOENT) {
if (!enableIPv6)
VIR_DEBUG("ipv6 appears to already be disabled on %s",
def->bridge);
@@ -2267,13 +2269,12 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
goto cleanup;
}
- if (virFileWriteStr(field, enableIPv6 ? "0" : "1", 0) < 0) {
+ if (virFileWriteStr(disable_ipv6, enableIPv6 ? "0" : "1", 0) < 0) {
virReportSystemError(errno,
_("cannot write to %s to enable/disable IPv6 "
- "on bridge %s"), field, def->bridge);
+ "on bridge %s"), disable_ipv6, def->bridge);
goto cleanup;
}
- VIR_FREE(field);
/* The rest of the ipv6 sysctl tunables should always be set the
* same, whether or not we're using ipv6 on this bridge.
@@ -2282,30 +2283,29 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
/* Prevent guests from hijacking the host network by sending out
* their own router advertisements.
*/
- field = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/accept_ra",
- def->bridge);
+ accept_ra = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/accept_ra",
+ def->bridge);
- if (virFileWriteStr(field, "0", 0) < 0) {
+ if (virFileWriteStr(accept_ra, "0", 0) < 0) {
virReportSystemError(errno,
- _("cannot disable %s"), field);
+ _("cannot disable %s"), accept_ra);
goto cleanup;
}
- VIR_FREE(field);
/* All interfaces used as a gateway (which is what this is, by
* definition), must always have autoconf=0.
*/
- field = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/autoconf", def->bridge);
+ autoconf = g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/autoconf",
+ def->bridge);
- if (virFileWriteStr(field, "0", 0) < 0) {
+ if (virFileWriteStr(autoconf, "0", 0) < 0) {
virReportSystemError(errno,
- _("cannot disable %s"), field);
+ _("cannot disable %s"), autoconf);
goto cleanup;
}
ret = 0;
cleanup:
- VIR_FREE(field);
return ret;
}
--
2.25.4
4 years, 5 months
[PATCH] security: Remove the superfluous break
by Yi Wang
From: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Remove the superfuous break, as there is a 'return' before it.
Signed-off-by: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/security/security_apparmor.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 3f6a213..eea37dc 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -699,7 +699,6 @@ AppArmorSetMemoryLabel(virSecurityManagerPtr mgr,
return -1;
}
return reload_profile(mgr, def, mem->nvdimmPath, true);
- break;
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
--
2.9.5
4 years, 5 months
[PATCH] qemu: Remove superfluous breaks
by Yi Wang
From: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Remove superfluous breaks, as there is a "return" before them.
Signed-off-by: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/qemu/qemu_firmware.c | 1 -
src/qemu/qemu_hostdev.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index bd251c0..2edc0ef 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -1111,7 +1111,6 @@ qemuFirmwareEnableFeatures(virQEMUDriverPtr driver,
_("domain has SMM turned off "
"but chosen firmware requires it"));
return -1;
- break;
case VIR_TRISTATE_SWITCH_ABSENT:
VIR_DEBUG("Enabling SMM feature");
def->features[VIR_DOMAIN_FEATURE_SMM] = VIR_TRISTATE_SWITCH_ON;
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index fb63da2..d39f9d7 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -202,7 +202,6 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support legacy PCI passthrough"));
return false;
- break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
--
2.9.5
4 years, 5 months
[PATCH] conf: Remove superfluous breaks
by Yi Wang
From: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Remove superfluous breaks, as there is a "return" before them.
Signed-off-by: Liao Pingfang <liao.pingfang(a)zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
src/conf/domain_conf.c | 6 ------
src/conf/network_conf.c | 12 ------------
src/conf/nwfilter_params.c | 4 ----
3 files changed, 22 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bcebfc6..355aa74 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1840,7 +1840,6 @@ const char *virDomainInputDefGetPath(virDomainInputDefPtr input)
case VIR_DOMAIN_INPUT_TYPE_KBD:
case VIR_DOMAIN_INPUT_TYPE_LAST:
return NULL;
- break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
return input->source.evdev;
@@ -2728,7 +2727,6 @@ virDomainChrSourceDefIsEqual(const virDomainChrSourceDef *src,
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_PIPE:
return STREQ_NULLABLE(src->data.file.path, tgt->data.file.path);
- break;
case VIR_DOMAIN_CHR_TYPE_NMDM:
return STREQ_NULLABLE(src->data.nmdm.master, tgt->data.nmdm.master) &&
STREQ_NULLABLE(src->data.nmdm.slave, tgt->data.nmdm.slave);
@@ -8425,7 +8423,6 @@ virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode,
_("Invalid hostdev protocol '%s'"),
virDomainHostdevSubsysSCSIHostProtocolTypeToString(hostsrc->protocol));
return -1;
- break;
}
return 0;
@@ -18139,13 +18136,11 @@ virDomainChrEquals(virDomainChrDefPtr src,
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_XEN:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
return STREQ_NULLABLE(src->target.name, tgt->target.name);
- break;
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
if (!src->target.addr || !tgt->target.addr)
return src->target.addr == tgt->target.addr;
return memcmp(src->target.addr, tgt->target.addr,
sizeof(*src->target.addr)) == 0;
- break;
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE:
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST:
@@ -18163,7 +18158,6 @@ virDomainChrEquals(virDomainChrDefPtr src,
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
return src->target.port == tgt->target.port;
- break;
case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
/* shouldn't happen */
break;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 0fd68a7..4221623 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3682,48 +3682,36 @@ virNetworkDefUpdateSection(virNetworkDefPtr def,
switch (section) {
case VIR_NETWORK_SECTION_BRIDGE:
return virNetworkDefUpdateBridge(def, command, parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_DOMAIN:
return virNetworkDefUpdateDomain(def, command, parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_IP:
return virNetworkDefUpdateIP(def, command, parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_IP_DHCP_HOST:
return virNetworkDefUpdateIPDHCPHost(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_IP_DHCP_RANGE:
return virNetworkDefUpdateIPDHCPRange(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_FORWARD:
return virNetworkDefUpdateForward(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_FORWARD_INTERFACE:
return virNetworkDefUpdateForwardInterface(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_FORWARD_PF:
return virNetworkDefUpdateForwardPF(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_PORTGROUP:
return virNetworkDefUpdatePortGroup(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_DNS_HOST:
return virNetworkDefUpdateDNSHost(def, command,
parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_DNS_TXT:
return virNetworkDefUpdateDNSTxt(def, command, parentIndex, ctxt, flags);
- break;
case VIR_NETWORK_SECTION_DNS_SRV:
return virNetworkDefUpdateDNSSrv(def, command, parentIndex, ctxt, flags);
- break;
default:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("can't update unrecognized section of network"));
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index b0d60ab..f2ec080 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -169,10 +169,8 @@ virNWFilterVarValueGetCardinality(const virNWFilterVarValue *val)
switch (val->valType) {
case NWFILTER_VALUE_TYPE_SIMPLE:
return 1;
- break;
case NWFILTER_VALUE_TYPE_ARRAY:
return val->u.array.nValues;
- break;
case NWFILTER_VALUE_TYPE_LAST:
return 0;
}
@@ -853,10 +851,8 @@ virNWFilterVarAccessEqual(const virNWFilterVarAccess *a,
case VIR_NWFILTER_VAR_ACCESS_ELEMENT:
return (a->u.index.idx == b->u.index.idx &&
a->u.index.intIterId == b->u.index.intIterId);
- break;
case VIR_NWFILTER_VAR_ACCESS_ITERATOR:
return a->u.iterId == b->u.iterId;
- break;
case VIR_NWFILTER_VAR_ACCESS_LAST:
break;
}
--
2.9.5
4 years, 5 months
[PATCH v2 1/2] qemu: add support for shmem-{plain, doorbell} role
by Wang Xin
Role(master or peer) controls how the domain behaves on migration.
For more details about migration with ivshmem, see
https://git.qemu.org/?p=qemu.git;a=blob_plain;f=docs/system/ivshmem.rst;h...
It's a optional attribute in libvirt, and qemu will choose default
role for ivshmem device if the user is not specified.
With device property 'role', the value can be 'master' or 'peer'.
- 'master' (means 'master=on' in qemu), the guest will copy
the shared memory on migration to the destination host.
- 'peer' (means 'master=off' in qemu), the migration is disabled.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
Signed-off-by: Yang Hang <yanghang44(a)huawei.com>
Signed-off-by: Wang Xin <wangxinxin.wang(a)huawei.com>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f5ee97de81..d4d90ad44d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -9141,7 +9141,7 @@ qemu-kvm -net nic,model=? /dev/null
<pre>
...
<devices>
- <shmem name='my_shmem0'>
+ <shmem name='my_shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
</shmem>
@@ -9159,9 +9159,15 @@ qemu-kvm -net nic,model=? /dev/null
<dt><code>shmem</code></dt>
<dd>
The <code>shmem</code> element has one mandatory attribute,
- <code>name</code> to identify the shared memory. This attribute cannot
- be directory specific to <code>.</code> or <code>..</code> as well as
- it cannot involve path separator <code>/</code>.
+ <code>name</code> to identify the shared memory. Optional attribute
+ <code>role</code> can be set to values "master" or "peer". The former
+ will mean that upon migration, the data in the shared memory is migrated
+ with the domain. There should be only one "master" per shared memory object.
+ Migration with "peer" role is disabled. If migration of such domain is required,
+ the shmem device needs to be unplugged before migration and plugged in at the
+ destination upon successful migration. This attribute cannot be directory
+ specific to <code>.</code> or <code>..</code> as well as it cannot involve path
+ separator <code>/</code>.
</dd>
<dt><code>model</code></dt>
<dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a810f569c6..09d4ad3e96 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4417,6 +4417,14 @@
<param name="pattern">[^/]*</param>
</data>
</attribute>
+ <optional>
+ <attribute name="role">
+ <choice>
+ <value>master</value>
+ <value>peer</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
<optional>
<element name="model">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7ecd2818b9..6e67c7ebe0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1325,6 +1325,13 @@ VIR_ENUM_IMPL(virDomainShmemModel,
"ivshmem-doorbell",
);
+VIR_ENUM_IMPL(virDomainShmemRole,
+ VIR_DOMAIN_SHMEM_ROLE_LAST,
+ "default",
+ "master",
+ "peer",
+);
+
VIR_ENUM_IMPL(virDomainLaunchSecurity,
VIR_DOMAIN_LAUNCH_SECURITY_LAST,
"",
@@ -15357,6 +15364,19 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
goto cleanup;
}
+ if (def->model != VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
+ tmp = virXMLPropString(node, "role");
+ if (tmp) {
+ if ((def->role = virDomainShmemRoleTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Unknown shmem role type '%s'"), tmp);
+ goto cleanup;
+ }
+
+ VIR_FREE(tmp);
+ }
+ }
+
if (virParseScaledValue("./size[1]", NULL, ctxt,
&def->size, 1, ULLONG_MAX, false) < 0)
goto cleanup;
@@ -18579,6 +18599,9 @@ virDomainShmemDefEquals(virDomainShmemDefPtr src,
if (src->model != dst->model)
return false;
+ if (src->role != dst->role)
+ return false;
+
if (src->server.enabled != dst->server.enabled)
return false;
@@ -23758,6 +23781,15 @@ virDomainShmemDefCheckABIStability(virDomainShmemDefPtr src,
return false;
}
+ if (src->role != dst->role) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target shared memory role '%s' does not match "
+ "source role '%s'"),
+ virDomainShmemRoleTypeToString(dst->role),
+ virDomainShmemRoleTypeToString(src->role));
+ return false;
+ }
+
if (src->model != dst->model) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target shared memory model '%s' does not match "
@@ -27408,8 +27440,12 @@ virDomainShmemDefFormat(virBufferPtr buf,
virDomainShmemDefPtr def,
unsigned int flags)
{
- virBufferEscapeString(buf, "<shmem name='%s'>\n", def->name);
+ virBufferEscapeString(buf, "<shmem name='%s'", def->name);
+ if (def->role)
+ virBufferEscapeString(buf, " role='%s'",
+ virDomainShmemRoleTypeToString(def->role));
+ virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
virBufferAsprintf(buf, "<model type='%s'/>\n",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 241149af24..855c144ddb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1771,10 +1771,19 @@ typedef enum {
VIR_DOMAIN_SHMEM_MODEL_LAST
} virDomainShmemModel;
+typedef enum {
+ VIR_DOMAIN_SHMEM_ROLE_DEFAULT,
+ VIR_DOMAIN_SHMEM_ROLE_MASTER,
+ VIR_DOMAIN_SHMEM_ROLE_PEER,
+
+ VIR_DOMAIN_SHMEM_ROLE_LAST
+} virDomainShmemRole;
+
struct _virDomainShmemDef {
char *name;
unsigned long long size;
int model; /* enum virDomainShmemModel */
+ int role; /* enum virDomainShmemRole */
struct {
bool enabled;
virDomainChrSourceDef chr;
@@ -3624,6 +3633,7 @@ VIR_ENUM_DECL(virDomainMemoryAllocation);
VIR_ENUM_DECL(virDomainIOMMUModel);
VIR_ENUM_DECL(virDomainVsockModel);
VIR_ENUM_DECL(virDomainShmemModel);
+VIR_ENUM_DECL(virDomainShmemRole);
VIR_ENUM_DECL(virDomainLaunchSecurity);
/* from libvirt.h */
VIR_ENUM_DECL(virDomainState);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 73b72c9e10..3f28943575 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -597,6 +597,8 @@ virDomainShmemDefInsert;
virDomainShmemDefRemove;
virDomainShmemModelTypeFromString;
virDomainShmemModelTypeToString;
+virDomainShmemRoleTypeFromString;
+virDomainShmemRoleTypeToString;
virDomainShutdownReasonTypeFromString;
virDomainShutdownReasonTypeToString;
virDomainShutoffReasonTypeFromString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 839c93bfb4..0655d8359d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8539,11 +8539,24 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
virBufferAdd(&buf, virDomainShmemModelTypeToString(shmem->model), -1);
virBufferAsprintf(&buf, ",id=%s", shmem->info.alias);
- if (shmem->server.enabled)
+ if (shmem->server.enabled) {
virBufferAsprintf(&buf, ",chardev=char%s", shmem->info.alias);
- else
+ } else {
virBufferAsprintf(&buf, ",memdev=shmmem-%s", shmem->info.alias);
+ switch ((virDomainShmemRole) shmem->role) {
+ case VIR_DOMAIN_SHMEM_ROLE_MASTER:
+ virBufferAddLit(&buf, ",master=on");
+ break;
+ case VIR_DOMAIN_SHMEM_ROLE_PEER:
+ virBufferAddLit(&buf, ",master=off");
+ break;
+ case VIR_DOMAIN_SHMEM_ROLE_DEFAULT:
+ case VIR_DOMAIN_SHMEM_ROLE_LAST:
+ break;
+ }
+ }
+
if (shmem->msi.vectors)
virBufferAsprintf(&buf, ",vectors=%u", shmem->msi.vectors);
if (shmem->msi.ioeventfd) {
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 78e64344f6..5ae85c7ae7 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1261,10 +1261,22 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
}
}
- if (vm->def->nshmems) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("migration with shmem device is not supported"));
- return false;
+ for (i = 0; i < vm->def->nshmems; i++) {
+ virDomainShmemDefPtr shmem = vm->def->shmems[i];
+
+ if (shmem->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("migration with legacy shmem device is not supported"));
+ return false;
+ }
+ if (shmem->role == VIR_DOMAIN_SHMEM_ROLE_PEER) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain's shmem device '%s' has role='%s', "
+ "try unplugging it first"),
+ shmem->name,
+ virDomainShmemRoleTypeToString(shmem->role));
+ return false;
+ }
}
for (i = 0; i < vm->def->nnets; i++) {
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
index 68f592fb21..338017aa28 100644
--- a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain-detach.xml
@@ -1,4 +1,4 @@
-<shmem name='shmem0'>
+<shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain.xml
index 6bd96ff167..780e49de23 100644
--- a/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain.xml
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ivshmem-plain.xml
@@ -1,3 +1,3 @@
-<shmem name='shmem0'>
+<shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
</shmem>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
index a6930bfa69..8013264989 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-doorbell.xml
@@ -45,7 +45,7 @@
<alias name='input1'/>
</input>
<memballoon model='none'/>
- <shmem name='shmem0'>
+ <shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
index 757b6b0980..0490310760 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+ivshmem-plain.xml
@@ -45,7 +45,7 @@
<alias name='input1'/>
</input>
<memballoon model='none'/>
- <shmem name='shmem0'>
+ <shmem name='shmem0' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/>
diff --git a/tests/qemuxml2argvdata/shmem-plain-doorbell.args b/tests/qemuxml2argvdata/shmem-plain-doorbell.args
index 6ed86b7448..aa41d5391a 100644
--- a/tests/qemuxml2argvdata/shmem-plain-doorbell.args
+++ b/tests/qemuxml2argvdata/shmem-plain-doorbell.args
@@ -30,10 +30,10 @@ size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0x3 \
-object memory-backend-file,id=shmmem-shmem1,mem-path=/dev/shm/shmem1,\
size=134217728,share=yes \
--device ivshmem-plain,id=shmem1,memdev=shmmem-shmem1,bus=pci.0,addr=0x5 \
+-device ivshmem-plain,id=shmem1,memdev=shmmem-shmem1,master=off,bus=pci.0,addr=0x5 \
-object memory-backend-file,id=shmmem-shmem2,mem-path=/dev/shm/shmem2,\
size=268435456,share=yes \
--device ivshmem-plain,id=shmem2,memdev=shmmem-shmem2,bus=pci.0,addr=0x4 \
+-device ivshmem-plain,id=shmem2,memdev=shmmem-shmem2,master=on,bus=pci.0,addr=0x4 \
-device ivshmem-doorbell,id=shmem3,chardev=charshmem3,ioeventfd=on,bus=pci.0,\
addr=0x6 \
-chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
diff --git a/tests/qemuxml2argvdata/shmem-plain-doorbell.xml b/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
index e248d637a5..7c76e0fbba 100644
--- a/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
+++ b/tests/qemuxml2argvdata/shmem-plain-doorbell.xml
@@ -22,11 +22,11 @@
<shmem name='shmem0'>
<model type='ivshmem-plain'/>
</shmem>
- <shmem name='shmem1'>
+ <shmem name='shmem1' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>128</size>
</shmem>
- <shmem name='shmem2'>
+ <shmem name='shmem2' role='master'>
<model type='ivshmem-plain'/>
<size unit='M'>256</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml b/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
index c5dd0f4598..64c0a7d753 100644
--- a/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
+++ b/tests/qemuxml2xmloutdata/shmem-plain-doorbell.xml
@@ -26,12 +26,12 @@
<size unit='M'>4</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</shmem>
- <shmem name='shmem1'>
+ <shmem name='shmem1' role='peer'>
<model type='ivshmem-plain'/>
<size unit='M'>128</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</shmem>
- <shmem name='shmem2'>
+ <shmem name='shmem2' role='master'>
<model type='ivshmem-plain'/>
<size unit='M'>256</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c17e3303b0..6cb2718767 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1135,7 +1135,8 @@ mymain(void)
DO_TEST("tap-vhost", NONE);
DO_TEST("tap-vhost-incorrect", NONE);
DO_TEST("shmem", NONE);
- DO_TEST("shmem-plain-doorbell", NONE);
+ DO_TEST("shmem-plain-doorbell",
+ QEMU_CAPS_DEVICE_IVSHMEM_PLAIN, QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL);
DO_TEST("smbios", NONE);
DO_TEST("smbios-multiple-type2", NONE);
DO_TEST("smbios-type-fwcfg", NONE);
--
2.26.0.windows.1
4 years, 5 months
[PATCH 0/5] trivial qemuProcessQMPPtr related cleanups
by Daniel Henrique Barboza
Hi,
These are some simple cleanups related to the qemuProcessQMPPtr
pointer I ended up making while trying to understand how and when
qemuProcessQMPFree() is called.
Daniel Henrique Barboza (5):
qemu_process.h: register AUTOPTR_CLEANUP_FUNC for qemuProcessQMPPtr
qemu_process.c: modernize qemuProcessQMPNew()
qemu_driver.c: modernize qemuConnectCPUModelBaseline()
qemu_driver.c: modernize qemuConnectCPUModelComparison()
qemu_capabilities.c: use g_autoptr() in virQEMUCapsInitQMPSingle()
src/qemu/qemu_capabilities.c | 3 +--
src/qemu/qemu_driver.c | 41 ++++++++++++++----------------------
src/qemu/qemu_process.c | 13 ++++--------
src/qemu/qemu_process.h | 1 +
4 files changed, 22 insertions(+), 36 deletions(-)
--
2.26.2
4 years, 5 months
Plans for the next release
by Jiri Denemark
Hi all,
We are getting close to the next release of libvirt. Because I am on
vacation next week, I think we will have a little bit longer freeze
period (although mainly extended by a weekend).
So to aim for the release at the beginning of August I suggest entering
the freeze just before the upcoming weekend starts, i.e., on Friday July
24 (in late evening) and I think we can skip RC2 this time and just push
the release on August 1 or 2.
Normal freeze period would start on Monday with RC2 on Thursday and a
final release on August 1, which is pretty similar in terms of frozen
work days.
I hope this works for everyone.
Jirka
4 years, 5 months
[libvirt PATCH 0/9] remote: introduce a custom netcat impl for ssh tunnelling
by Daniel P. Berrangé
We have long had a problem with use of netcat for ssh tunnelling because
there's no guarantee the UNIX socket path the client builds will match
the UNIX socket path the remote host uses. We don't even allow session
mode SSH tunnelling for this reason. We also can't easily auto-spawn
libvirtd in session mode.
With the introduction of modular daemons we also have potential for two
completely different UNIX socket paths even for system mode, and the
client can't know which to use.
The solution to all these problems is to introduce a custom netcat impl.
Instead passing the UNIX socket path, we pass the libvirt driver URI.
The custom netcat then decides which socket path to use based on the
remote build host environment.
We still have to support netcat for interoperability with legacy libvirt
versions, but we can default to the new virt-nc.
Daniel P. Berrangé (9):
rpc: merge logic for generating remote SSH shell script
remote: split off enums into separate source file
remote: split out function for parsing URI scheme
remote: parse the remote transport string earlier
remote: split out function for constructing socket path
remote: extract logic for determining daemon to connect to
remote: introduce virtd-nc helper binary
rpc: switch order of args in virNetClientNewSSH
rpc: use new virt-nc binary for remote tunnelling
build-aux/syntax-check.mk | 2 +-
docs/uri.html.in | 18 ++
po/POTFILES.in | 2 +
src/libvirt_remote.syms | 1 +
src/remote/Makefile.inc.am | 32 +++
src/remote/remote_driver.c | 323 +++++----------------------
src/remote/remote_nc.c | 424 ++++++++++++++++++++++++++++++++++++
src/remote/remote_sockets.c | 277 +++++++++++++++++++++++
src/remote/remote_sockets.h | 70 ++++++
src/rpc/virnetclient.c | 151 ++++++++-----
src/rpc/virnetclient.h | 29 ++-
src/rpc/virnetsocket.c | 37 +---
src/rpc/virnetsocket.h | 4 +-
tests/virnetsockettest.c | 12 +-
14 files changed, 1018 insertions(+), 364 deletions(-)
create mode 100644 src/remote/remote_nc.c
create mode 100644 src/remote/remote_sockets.c
create mode 100644 src/remote/remote_sockets.h
--
2.26.2
4 years, 5 months
[PATCH 00/10] Fix device names reported by 'write_threshold' event and add support for monitoring 'mirror'
by Peter Krempa
Allow monitoring the 'mirror' image write threshold and also report
correct aliases. Clean up some leftovers and improve docs while at it.
Peter Krempa (10):
virDomainSetBlockThreshold: Document values of '@dev' better
qemuDomainDiskBackingStoreGetName: Remove unused argument
qemuDomainDiskBackingStoreGetName: Eliminate temp variable
qemuProcessHandleBlockThreshold: Report correct indexes
virDomainSetBlockThreshold: Clarify values of @dev the event is fired
for
qemuDomainDiskLookupByNodename: Remove unused 'idx'
virStorageSourceFindByNodeName: Remove unused 'idx' argument
qemuDomainDiskLookupByNodename: Look also for 'mirror' node names
qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
virDomainSetBlockThreshold: Mention that the event can be registered
for <mirror>
src/libvirt-domain.c | 13 +++++++++++
src/qemu/qemu_domain.c | 49 +++++++++++++++++++--------------------
src/qemu/qemu_domain.h | 4 +---
src/qemu/qemu_process.c | 28 +++++++++++++++-------
src/util/virstoragefile.c | 16 +++----------
src/util/virstoragefile.h | 3 +--
6 files changed, 61 insertions(+), 52 deletions(-)
--
2.26.2
4 years, 5 months
[PATCH 0/5] qemu: Fix handling of bitmaps for active layer block commit and block copy
by Peter Krempa
See patch 3 for explanation.
Peter Krempa (5):
qemu: blockjob: Don't base bitmap handling of active-layer block
commit on QEMU_CAPS_BLOCKDEV_REOPEN
qemu: blockjob: Actually delete temporary bitmap on failed active
commit
qemu: block: Remove 'active-write' bitmap even if there are no bitmaps
to merge
qemuDomainBlockPivot: Rename 'actions' to 'bitmapactions'
qemuDomainBlockPivot: Ignore failures of creating active layer bitmap
src/qemu/qemu_block.c | 3 ++-
src/qemu/qemu_blockjob.c | 16 ++++++++++++---
src/qemu/qemu_driver.c | 20 ++++++++-----------
.../qemublocktestdata/bitmapblockcommit/empty | 9 +++++++++
.../bitmapblockcopy/empty-deep-out.json | 9 +++++++++
.../bitmapblockcopy/empty-shallow-out.json | 9 +++++++++
6 files changed, 50 insertions(+), 16 deletions(-)
--
2.26.2
4 years, 5 months