Debian: Add build structure for virt/libvirt

This change adds the necessary files for the libvirt package to be built
for Debian.
This change is the new approach for porting this package and will be
replacing an old change that will no longer be valid [1].

All the libvirt related packages (rpm) delivered on CentOS builds of
starlingx were verified to exist or have an equivalent package for the
Debian Bullseye (deb) distro [2], which is based on libvirt 7.0.0.

The upstream Debian packaging, patches and configuration will be used as
is, although the deb_patches directory will contain a patch to add few
starlingx specific files that are required, based on how stx-libvirt [3]
was previously built and delivered to CentOS.
This change will deprecate the starlingx-staging/stx-libvirt repository
and any future starlingx change to libvirt will now be placed here,
on top of debian/7.0.0-3 (bullseye) version.

Earlier (on CentOS) the base point was the libvirt 4.7.0 release and 17
starlingx specific commits were added to deliver new features or fix
bugs. Now, the base point will be the libvirt 7.0.0 release package
already prepared for Debian [4] and those 17 commits port will be
evaluated and done, in case they are still needed.

The patches dir will contain source code patches required for
stx-libvirt, that is, the code that was earlier added on top of 4.7.0
libvirt release to add StarlingX required functionalities.
The work done on this change is simply porting the code changes,
copying it and doing the minimum required updates when it is needed.
If more than one commit (from that list) can be placed on a single
patch, the patch description will contain all the necessary references.

The list of commits follow, where the "-" character indicates that the
commit was dropped now that we are based on 7.0.0:
-8c46e4 conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageVolDef
-e8c2ae storage: add support for new rbd_list2 method
-dee98c storage: split off code for calling rbd_list
-956103 Revert "qemu: hotplug: Prepare disk source in..."
-97d02f STX: po make: limit thread creation ability of libgomp
-6e8f91 STX: Revert "vsh: Fix broken build on mingw"
 0d92d8 STX: pci-sriov perform limited retry on netlink failures
 c49366 STX: Increase timeout for connecting to monitor
 dedd07 STX: Stop processing memory stats if balloon info hard fails
-e0f897 STX: Allow vcpu pinning with TCG
 d8b544 STX: Adding systemd dependencies against pmon.service
-7bf5a9 STX: Set initial cpu affinity of qemu threads
 28b73b STX: Fixed default libvirtd systemd service
 e4c5a6 STX: DPDK parms handling
 fdf5e7 STX: Drop migration poll times to 10mS
 fbc79d STX: System Logging: set group read permission on log files
 2721c7 STX: CPU pinning not working over live-migration

[1] https://review.opendev.org/c/starlingx/integ/+/824928
[2] https://packages.debian.org/source/bullseye/libvirt
[3] https://github.com/starlingx-staging/stx-libvirt
[4] https://salsa.debian.org/libvirt-team/libvirt/-/tree/debian/7.0.0-3/debian

Test Plan:
PASS: Build the libvirt packages
PASS: Build Debian ISO with libvirt packages
PASS: Bootstrap Debian ISO on AIO-SX
PASS: Ensure libvirt packages are installed (apt list --installed)
PASS: Lock/Unlock AIO-SX *
* Future tests regarding the libvirt/qemu runtime features will be done
once all the pieces are in place in the ISO.

Depends-On: https://review.opendev.org/c/starlingx/root/+/865021

Story: 2010317
Task: 46391

Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
Change-Id: Ib3da0e663336021fa2cfd6b400d1081fc0113348
This commit is contained in:
Thales Elero Cervi 2022-11-03 18:03:46 -03:00
parent 75a234904f
commit 1f37f8b5d4
15 changed files with 874 additions and 0 deletions

View File

@ -5,6 +5,13 @@ kdump-tools
puppet puppet
drbd-utils drbd-utils
parted parted
libvirt0
libvirt-clients
libvirt-daemon
libvirt-daemon-driver-lxc
libvirt-daemon-driver-qemu
libvirt-daemon-driver-storage-gluster
libvirt-login-shell
lvm2 lvm2
trident-installer trident-installer
iputils-arping iputils-arping

View File

@ -94,4 +94,5 @@ security/shim-unsigned
security/openscap security/openscap
storage-drivers/trident-installer storage-drivers/trident-installer
tools/kdump-tools tools/kdump-tools
virt/libvirt
virt/qemu virt/qemu

View File

@ -0,0 +1,76 @@
From 4e4452b3bba71265864d9c46f135418ffd6113a0 Mon Sep 17 00:00:00 2001
From: Thales Elero Cervi <thaleselero.cervi@windriver.com>
Date: Wed, 9 Nov 2022 09:07:21 -0300
Subject: [PATCH] STX: Customize Debian build files
Adds to libvirt Debian build instructions, starlingx specific files
based on how starlingx-staging/stx-libvirt was previously built and
delivered on CentOS, adding to the following:
* Enabling syslog for libvirtd
* Setting "auth_tcp" to "none"
* Logrotate files
* Qemu hook
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
debian/libvirt-daemon-system.install | 1 +
debian/rules | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/debian/libvirt-daemon-system.install b/debian/libvirt-daemon-system.install
index 04cf9052c..b2ce2ac75 100644
--- a/debian/libvirt-daemon-system.install
+++ b/debian/libvirt-daemon-system.install
@@ -2,6 +2,7 @@ etc/default/libvirt-guests
etc/default/libvirtd
etc/default/virtlockd
etc/default/virtlogd
+etc/libvirt/hooks/qemu
etc/libvirt/libvirtd.conf
etc/libvirt/qemu-lockd.conf
etc/libvirt/qemu.conf
diff --git a/debian/rules b/debian/rules
index a495870c4..a34132779 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,11 @@ DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
+SOURCE1 = libvirt.logrotate
+SOURCE2 = libvirt.lxc
+SOURCE3 = libvirt.qemu
+SOURCE4 = qemu
+
ARCHES_LXC = alpha amd64 arm64 armel armhf hppa i386 m68k mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64 x32
ARCHES_XEN = amd64 arm64 armhf i386
ARCHES_VBOX = amd64 i386
@@ -221,6 +226,25 @@ override_dh_auto_install:
$(DEB_DESTDIR)/etc/libvirt/nwfilter/ \
$(DEB_DESTDIR)/usr/share/libvirt/
+ # STX: Begin custom install
+ # Enable syslog for libvirtd (/var/log/libvirtd.log)
+ echo "log_outputs=\"3:syslog:libvirtd\"" >> $(DEB_DESTDIR)/etc/libvirt/libvirtd.conf
+
+ # Set auth_tcp to "none" for now to enable live migration.
+ # We'll need to set up proper authentication later.
+ sed -i '/#auth_tcp/a auth_tcp = "none"' $(DEB_DESTDIR)/etc/libvirt/libvirtd.conf
+
+ # Install logrotate files
+ install -p -D -m 644 $(SOURCE1) $(DEB_DESTDIR)/etc/logrotate.d/libvirtd
+ install -p -D -m 644 $(SOURCE2) $(DEB_DESTDIR)/etc/logrotate.d/libvirtd.lxc
+ install -p -D -m 644 $(SOURCE3) $(DEB_DESTDIR)/etc/logrotate.d/libvirtd.qemu
+
+ # Install hooks
+ mkdir -p $(DEB_DESTDIR)/etc/libvirt/hooks
+ install -m 0500 $(SOURCE4) $(DEB_DESTDIR)/etc/libvirt/hooks/qemu
+
+ # STX: End custom install
+
override_dh_install-arch:
dh_install
--
2.25.1

View File

@ -0,0 +1 @@
0001-STX-Customize-Debian-build-files.patch

View File

@ -0,0 +1,16 @@
---
debname: libvirt
debver: 7.0.0-3
dl_path:
name: libvirt-debian-7.0.0-3.tar.gz
url: https://salsa.debian.org/libvirt-team/libvirt/-/archive/debian/7.0.0-3/libvirt-debian-7.0.0-3.tar.gz
md5sum: 371673c35fda957748ce3a19a0cd8539
sha256sum: 6f6acf34b2ae20ec9cfa64e89c3245ccf44321c86cd5606abe718ca25e443b2f
src_files:
- libvirt/libvirt.logrotate
- libvirt/libvirt.lxc
- libvirt/libvirt.qemu
- libvirt/hooks/qemu
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,35 @@
From 2721c79b6cd8caf0f7d1796c2316567cd44b2caa Mon Sep 17 00:00:00 2001
From: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Date: Mon, 21 Mar 2016 17:46:41 -0400
Subject: [PATCH] STX: CPU pinning not working over live-migration
Commit carried over from pre-CentOS
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/conf/domain_conf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 01b718763..70d29475d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23184,10 +23184,14 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
goto error;
}
+ /* STX: Disable this check since it is problematic.
+ - Note that disabling this check is not critical since
+ this section is regenerated at destination.
for (i = 0; i < src->nconsoles; i++)
if (!virDomainConsoleDefCheckABIStability(src->consoles[i],
dst->consoles[i]))
goto error;
+ */
if (src->nhubs != dst->nhubs) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--
2.25.1

View File

@ -0,0 +1,47 @@
From fbc79d575f283055d5c19fce96e97f1e27038922 Mon Sep 17 00:00:00 2001
From: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Date: Mon, 21 Mar 2016 18:12:32 -0400
Subject: [PATCH] STX: System Logging: set group read permission on log files
Commit carried over from pre-CentOS
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/qemu/qemu_domain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0765dc72d..72cccd1e9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6339,7 +6339,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
if (ctxt->writefd < 0)
goto error;
} else {
- if ((ctxt->writefd = open(ctxt->path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR)) < 0) {
+ if ((ctxt->writefd = open(ctxt->path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP)) < 0) {
virReportSystemError(errno, _("failed to create logfile %s"),
ctxt->path);
goto error;
@@ -6506,7 +6506,7 @@ qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
vm->def->name, path, message, 0) < 0)
goto cleanup;
} else {
- if ((writefd = open(path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR)) < 0) {
+ if ((writefd = open(path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP)) < 0) {
virReportSystemError(errno, _("failed to create logfile %s"),
path);
goto cleanup;
@@ -11060,7 +11060,7 @@ virQEMUFileOpenAs(uid_t fallback_uid,
goto error;
}
} else {
- if ((fd = virFileOpenAs(path, oflags, S_IRUSR | S_IWUSR, uid, gid,
+ if ((fd = virFileOpenAs(path, oflags, S_IRUSR | S_IWUSR | S_IRGRP, uid, gid,
vfoflags | VIR_FILE_OPEN_NOFORK)) < 0) {
/* If we failed as root, and the error was permission-denied
(EACCES or EPERM), assume it's on a network-connected share
--
2.25.1

View File

@ -0,0 +1,29 @@
From fdf5e7a69587cebdccf1608f3de48fbdaa8ee7ef Mon Sep 17 00:00:00 2001
From: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Date: Mon, 21 Mar 2016 18:15:20 -0400
Subject: [PATCH] STX: Drop migration poll times to 10mS
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/qemu/qemu_migration.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5353c7ee0..741ab986a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1846,8 +1846,8 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr driver,
return -2;
}
} else {
- /* Poll every 50ms for progress & to allow cancellation */
- struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull };
+ /* Poll every 10ms for progress & to allow cancellation */
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 10 * 1000 * 1000ull };
virObjectUnlock(vm);
nanosleep(&ts, NULL);
--
2.25.1

View File

@ -0,0 +1,351 @@
From e4c5a64fb4134ce2a57fe5263824ed5e85ec97eb Mon Sep 17 00:00:00 2001
From: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Date: Tue, 22 Mar 2016 09:58:36 -0400
Subject: [PATCH] STX: DPDK parms handling
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Removed deprecated macros ]
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/conf/domain_conf.c | 152 ++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 25 +++++++
src/qemu/qemu.conf | 4 +-
src/qemu/qemu_command.c | 35 +++++++++
4 files changed, 214 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 70d29475d..e760e61fb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1195,6 +1195,14 @@ VIR_ENUM_IMPL(virDomainVsockModel,
"virtio-non-transitional",
);
+/* STX: DPDK Customization */
+VIR_ENUM_IMPL(virDomainDpdkProcess,
+ VIR_DOMAIN_DPDK_PROCTYPE_LAST,
+ "auto",
+ "primary",
+ "secondary",
+);
+
VIR_ENUM_IMPL(virDomainDiskDiscard,
VIR_DOMAIN_DISK_DISCARD_LAST,
"default",
@@ -1612,6 +1620,103 @@ virBlkioDeviceArrayClear(virBlkioDevicePtr devices,
VIR_FREE(devices[i].path);
}
+/**
+ * STX: virDomainDpdkParamsDefPtr
+ *
+ * this function parses a XML node:
+ *
+ * <dpdk>
+ * <process type='secondary'/>
+ * <file prefix='vs'/>
+ * <memory channels='4'/>
+ * <cpu list='0,2-3'/>
+ * </dpdk>
+ *
+ * and fills a virDpdkParams struct.
+ */
+static int
+virDomainDpdkParamsParseXML(xmlNodePtr ctxt,
+ virDomainDpdkParamsDefPtr dpdk)
+{
+ char *channels = NULL;
+ char *process_type = NULL;
+ char *file_prefix = NULL;
+ char *cpu_list = NULL;
+ xmlNodePtr cur;
+ int ret = -EINVAL;
+
+ cur = ctxt->children;
+ while (cur != NULL) {
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (!process_type && xmlStrEqual(cur->name, BAD_CAST "process")) {
+ process_type = virXMLPropString(cur, "type");
+ }
+ if (!file_prefix && xmlStrEqual(cur->name, BAD_CAST "file")) {
+ file_prefix = virXMLPropString(cur, "prefix");
+ }
+ if (!cpu_list && xmlStrEqual(cur->name, BAD_CAST "cpu")) {
+ cpu_list = virXMLPropString(cur, "list");
+ }
+ if (!channels && xmlStrEqual(cur->name, BAD_CAST "memory")) {
+ channels = virXMLPropString(cur, "channels");
+ }
+ }
+ cur = cur->next;
+ }
+
+ if (!process_type) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing DPDK process type"));
+ goto error;
+ }
+ if (!file_prefix) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing DPDK file prefix"));
+ goto error;
+ }
+ if (!cpu_list) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing DPDK CPU list"));
+ goto error;
+ }
+ if (!channels) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing DPDK memory channel count"));
+ goto error;
+ }
+
+ dpdk->process_type = virDomainDpdkProcessTypeFromString(process_type);
+ if (virStrToLong_ui(channels, NULL, 10, &dpdk->nchannels) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("could not parse DPDK memory channels %s"),
+ channels);
+ goto error;
+ }
+ if (virBitmapParse(cpu_list, &dpdk->cpumask, 128) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("could not parse DPDK CPU list %s"),
+ cpu_list);
+ goto error;
+ }
+ if (!(dpdk->file_prefix = g_strdup(file_prefix))) {
+ goto error;
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(process_type);
+ VIR_FREE(file_prefix);
+ VIR_FREE(cpu_list);
+ VIR_FREE(channels);
+
+ return ret;
+error:
+ virDomainDpdkParamsDefFree(dpdk);
+ ret = -EINVAL;
+ goto cleanup;
+}
+
/**
* virDomainBlkioDeviceParseXML
*
@@ -3221,6 +3326,16 @@ virDomainClockDefClear(virDomainClockDefPtr def)
VIR_FREE(def->timers);
}
+/* STX: DPDK Customization */
+void
+virDomainDpdkParamsDefFree(virDomainDpdkParamsDefPtr dpdk)
+{
+ if (!dpdk)
+ return;
+
+ virBitmapFree(dpdk->cpumask);
+ VIR_FREE(dpdk->file_prefix);
+}
static bool
virDomainIOThreadIDArrayHasPin(virDomainDefPtr def)
@@ -3397,6 +3512,10 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainVcpuDefFree(def->vcpus[i]);
VIR_FREE(def->vcpus);
+ /* STX: DPDK Customization */
+ virDomainDpdkParamsDefFree(def->dpdk);
+ VIR_FREE(def->dpdk);
+
/* hostdevs must be freed before nets (or any future "intelligent
* hostdevs") because the pointer to the hostdev is really
* pointing into the middle of the higher level device's object,
@@ -19786,6 +19905,15 @@ virDomainDefParseMemory(virDomainDefPtr def,
if (virXPathBoolean("boolean(./memoryBacking/discard)", ctxt))
def->mem.discard = VIR_TRISTATE_BOOL_YES;
+ /* STX: Extract dpdk parameters */
+ if ((node = virXPathNode("./dpdk", ctxt))) {
+ def->dpdk = (virDomainDpdkParamsDefPtr)calloc(1, sizeof(*(def->dpdk)));
+ if (def->dpdk == NULL)
+ goto error;
+ if (virDomainDpdkParamsParseXML(node, def->dpdk) < 0)
+ goto error;
+ }
+
return 0;
error:
@@ -28466,6 +28594,8 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
unsigned char *uuid;
char uuidstr[VIR_UUID_STRING_BUFLEN];
const char *type = NULL;
+ /* STX: DPDK Customization */
+ char *cpu_list = NULL;
int n;
size_t i;
@@ -28511,6 +28641,28 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
virBufferEscapeString(buf, "<description>%s</description>\n",
def->description);
+ /* STX: DPDK Customization */
+ if (def->dpdk) {
+ virBufferAsprintf(buf, " <dpdk>\n");
+ if (!(type = virDomainDpdkProcessTypeToString(def->dpdk->process_type))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected DPDK process type %d"),
+ def->dpdk->process_type);
+ return -1;
+ }
+ if (!(cpu_list = virBitmapFormat(def->dpdk->cpumask))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected CPU CPU list"));
+ return -1;
+ }
+ virBufferAsprintf(buf, " <process type='%s'/>\n", type);
+ virBufferAsprintf(buf, " <file prefix='%s'/>\n", def->dpdk->file_prefix);
+ virBufferAsprintf(buf, " <cpu list='%s'/>\n", cpu_list);
+ virBufferAsprintf(buf, " <memory channels='%u'/>\n", def->dpdk->nchannels);
+ virBufferAsprintf(buf, " </dpdk>\n");
+ VIR_FREE(cpu_list);
+ }
+
if (def->metadata) {
g_autoptr(xmlBuffer) xmlbuf = NULL;
int oldIndentTreeOutput = xmlIndentTreeOutput;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ec43bbe18..c5a0a16d3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2143,6 +2143,24 @@ struct _virDomainOSDef {
virDomainBIOSDef bios;
};
+/* STX: DPDK Customization */
+enum virDomainDpdkProcessType {
+ VIR_DOMAIN_DPDK_PROCTYPE_AUTO,
+ VIR_DOMAIN_DPDK_PROCTYPE_PRIMARY,
+ VIR_DOMAIN_DPDK_PROCTYPE_SECONDARY,
+
+ VIR_DOMAIN_DPDK_PROCTYPE_LAST
+};
+
+typedef struct _virDomainDpdkParamsDef virDomainDpdkParamsDef;
+typedef virDomainDpdkParamsDef *virDomainDpdkParamsDefPtr;
+struct _virDomainDpdkParamsDef {
+ enum virDomainDpdkProcessType process_type;
+ char *file_prefix;
+ unsigned nchannels;
+ virBitmapPtr cpumask;
+};
+
typedef enum {
VIR_DOMAIN_TIMER_NAME_PLATFORM = 0,
VIR_DOMAIN_TIMER_NAME_PIT,
@@ -2569,6 +2587,9 @@ struct _virDomainDef {
char *title;
char *description;
+ /* STX: DPDK Customization */
+ virDomainDpdkParamsDefPtr dpdk;
+
virDomainBlkiotune blkio;
virDomainMemtune mem;
@@ -3062,6 +3083,8 @@ int virDomainObjWaitUntil(virDomainObjPtr vm,
void virDomainPanicDefFree(virDomainPanicDefPtr panic);
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
+/* STX: DPDK Customization */
+void virDomainDpdkParamsDefFree(virDomainDpdkParamsDefPtr dpdk);
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
const char *virDomainInputDefGetPath(virDomainInputDefPtr input);
void virDomainInputDefFree(virDomainInputDefPtr def);
@@ -3711,6 +3734,8 @@ VIR_ENUM_DECL(virDomainRNGBackend);
VIR_ENUM_DECL(virDomainTPMModel);
VIR_ENUM_DECL(virDomainTPMBackend);
VIR_ENUM_DECL(virDomainTPMVersion);
+/* STX: DPDK Customization */
+VIR_ENUM_DECL(virDomainDpdkProcess);
VIR_ENUM_DECL(virDomainMemoryModel);
VIR_ENUM_DECL(virDomainMemoryBackingModel);
VIR_ENUM_DECL(virDomainMemorySource);
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 0c1054f19..754161254 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -516,11 +516,11 @@
# user = "+0" # Super user (uid=0)
# user = "100" # A user named "100" or a user with uid=100
#
-#user = "root"
+user = "root"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
-#group = "root"
+group = "root"
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6f970a312..4f2908085 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1873,6 +1873,35 @@ qemuCommandAddExtDevice(virCommandPtr cmd,
return 0;
}
+/* STX: DPDK Customization */
+static int
+qemuBuildDpdkArgStr(virCommandPtr cmd,
+ const virDomainDpdkParamsDefPtr dpdk)
+{
+ char *cpumask;
+
+ if (!dpdk) {
+ return 0;
+ }
+
+ cpumask = virBitmapToString(dpdk->cpumask);
+ if (!cpumask) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to format DPDK cpumask as string"));
+ return -1;
+ }
+
+ virCommandAddArgFormat(cmd, "-c %s", cpumask);
+ virCommandAddArgFormat(cmd, "-n %u", dpdk->nchannels);
+ virCommandAddArgFormat(cmd, "--proc-type=%s", "secondary");
+ virCommandAddArgFormat(cmd, "--file-prefix=%s", dpdk->file_prefix);
+ virCommandAddArg(cmd, "--");
+ virCommandAddArg(cmd, "-enable-dpdk");
+ VIR_FREE(cpumask);
+
+ return 0;
+}
+
static int
qemuBuildFloppyCommandLineControllerOptions(virCommandPtr cmd,
const virDomainDef *def,
@@ -9816,6 +9845,12 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
virCommandAddEnvXDG(cmd, priv->libDir);
}
+ /* STX: DPDK Customization */
+ if (def->dpdk) {
+ if (qemuBuildDpdkArgStr(cmd, def->dpdk) < 0)
+ return NULL;
+ }
+
if (qemuBuildNameCommandLine(cmd, cfg, def, qemuCaps) < 0)
return NULL;
--
2.25.1

View File

@ -0,0 +1,39 @@
From 28b73b8bcb7f010f3d7ff026056d1284b6172e8c Mon Sep 17 00:00:00 2001
From: Ludovic Beliveau <ludovic.beliveau@windriver.com>
Date: Tue, 29 Mar 2016 19:51:01 -0400
Subject: [PATCH] STX: Fixed default libvirtd systemd service
- 'Restart=no' (pmond will monitor the process)
- 'PIDFile=/var/run/libvirtd.pid' (pmond uses the pidfile to monitor the
processes)
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/remote/libvirtd.service.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index cc0d4e369..19e9526a5 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -32,7 +32,7 @@ EnvironmentFile=-@sysconfdir@/sysconfig/libvirtd
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
-Restart=on-failure
+Restart=no
# At least 1 FD per guest, often 2 (eg qemu monitor + qemu agent).
# eg if we want to support 4096 guests, we'll typically need 8192 FDs
# If changing this, also consider virtlogd.service & virtlockd.service
@@ -49,6 +49,7 @@ TasksMax=32768
# with program takes 12k per guest. After rounding up we will get 64M to
# support 4096 guests.
LimitMEMLOCK=64M
+PIDFile=/var/run/libvirtd.pid
[Install]
WantedBy=multi-user.target
--
2.25.1

View File

@ -0,0 +1,27 @@
From d8b544aca712c9a84839100a6d61506fc0f7a16e Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Sun, 2 Oct 2016 18:12:51 -0400
Subject: [PATCH] STX: Adding systemd dependencies against pmon.service
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Trimmed the shortlog ]
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/remote/libvirtd.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 19e9526a5..b12bad4d9 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -21,6 +21,7 @@ After=local-fs.target
After=remote-fs.target
After=systemd-logind.service
After=systemd-machined.service
+Before=pmon.service
After=xencommons.service
Conflicts=xendomains.service
Documentation=man:libvirtd(8)
--
2.25.1

View File

@ -0,0 +1,35 @@
From dedd074269d21f5eb5114705baac1ae43a166e8a Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Tue, 19 Dec 2017 16:50:34 -0500
Subject: [PATCH] STX: Stop processing memory stats if balloon fails
We were seeing deadlock on the second query because the VM
had already been destroyed. In that case, the first query
fails but unfortunately we ignore the return code and charge
ahead anyway and do the second query which then hangs. We
now respect the return code if it indicates failure on the
first query.
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Trimmed the shortlog ]
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/qemu/qemu_monitor_json.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8a75a2734..d2a21ebbd 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2260,6 +2260,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
int got = 0;
ret = qemuMonitorJSONGetBalloonInfo(mon, &mem);
+ if (ret < 0)
+ goto cleanup;
if (ret == 1 && (got < nr_stats)) {
stats[got].tag = VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON;
stats[got].val = mem;
--
2.25.1

View File

@ -0,0 +1,38 @@
From c49366803061c7fdac854cee5920bc91ce3552ba Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Fri, 2 Feb 2018 13:20:24 -0500
Subject: [PATCH] STX: Increase timeout for connecting to monitor
When launching a large number of VMs concurrently on a
single host, eg. 10, it can take a while
for them to zero memory and attach to the monitor. After
measuring many such delays in this concurrent launch
stress test, we conclude that an extra minute
of waiting should suffice.
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/qemu/qemu_process.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 202d86728..6dae07215 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2024,6 +2024,12 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
* 1GiB of guest RAM. */
timeout = vm->def->mem.total_memory / (1024 * 1024);
+ /* STX: When launching a number of large VMs concurrently on
+ * a single host, the above timeout may not be good enough.
+ * Pad the timeout to deal with delays seen under stress testing.
+ */
+ timeout = timeout + 60; /* Wait for a full extra minute */
+
ignore_value(virTimeMillisNow(&priv->monStart));
mon = qemuMonitorOpen(vm,
--
2.25.1

View File

@ -0,0 +1,163 @@
From 0d92d8a0f0b53c32490ce9623e1a402eb369a7d4 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Sun, 25 Feb 2018 11:32:54 -0500
Subject: [PATCH] STX: pci-sriov perform limited retry on netlink
We now also perform retries on other netlink errors that previously
would have just done an immediate bailout.
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
[ Trimmed shortlog ]
Signed-off-by: Thales Elero Cervi <thaleselero.cervi@windriver.com>
---
src/util/virnetdev.c | 100 +++++++++++++++++++++++++++----------------
1 file changed, 62 insertions(+), 38 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index a73e5f72f..f787b4919 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -36,6 +36,7 @@
# include <sys/ioctl.h>
#endif
#include <fcntl.h>
+#include <time.h>
#ifdef __linux__
# include <linux/sockios.h>
@@ -1533,6 +1534,8 @@ static struct nla_policy ifla_vfstats_policy[IFLA_VF_STATS_MAX+1] = {
[IFLA_VF_STATS_MULTICAST] = { .type = NLA_U64 },
};
+#define VIR_NET_DEV_NUM_RETRY 3
+#define VIR_NET_DEV_DELAY_NS 250000000
static int
virNetDevSetVfConfig(const char *ifname, int vf,
@@ -1540,6 +1543,7 @@ virNetDevSetVfConfig(const char *ifname, int vf,
bool *allowRetry)
{
int rc = -1;
+ int i;
char macstr[VIR_MAC_STRING_BUFLEN];
g_autofree struct nlmsghdr *resp = NULL;
struct nlmsgerr *err;
@@ -1602,50 +1606,53 @@ virNetDevSetVfConfig(const char *ifname, int vf,
nla_nest_end(nl_msg, vfinfo);
nla_nest_end(nl_msg, vfinfolist);
- if (virNetlinkCommand(nl_msg, &resp, &recvbuflen, 0, 0,
- NETLINK_ROUTE, 0) < 0)
- goto cleanup;
-
- if (recvbuflen < NLMSG_LENGTH(0) || resp == NULL)
- goto malformed_resp;
+ for (i=0; i<VIR_NET_DEV_NUM_RETRY; i++) {
+ if (virNetlinkCommand(nl_msg, &resp, &recvbuflen, 0, 0,
+ NETLINK_ROUTE, 0) < 0)
+ goto cleanup;
- switch (resp->nlmsg_type) {
- case NLMSG_ERROR:
- err = (struct nlmsgerr *)NLMSG_DATA(resp);
- if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
+ if (recvbuflen < NLMSG_LENGTH(0) || resp == NULL)
goto malformed_resp;
- /* if allowRetry is true and the error was EINVAL, then
- * silently return a failure so the caller can retry with a
- * different MAC address
- */
- if (err->error == -EINVAL && *allowRetry &&
- macaddr && !virMacAddrCmp(macaddr, &zeroMAC)) {
- goto cleanup;
- } else if (err->error) {
- /* other errors are permanent */
- virReportSystemError(-err->error,
- _("Cannot set interface MAC/vlanid to %s/%d "
- "for ifname %s vf %d"),
- (macaddr
- ? virMacAddrFormat(macaddr, macstr)
- : "(unchanged)"),
- vlanid,
- ifname ? ifname : "(unspecified)",
- vf);
- *allowRetry = false; /* no use retrying */
- goto cleanup;
- }
- break;
+ switch (resp->nlmsg_type) {
+ case NLMSG_ERROR:
+ err = (struct nlmsgerr *)NLMSG_DATA(resp);
+ if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err)))
+ goto malformed_resp;
- case NLMSG_DONE:
- break;
+ /* if allowRetry is true and the error was EINVAL, then
+ * silently return a failure so the caller can retry with a
+ * different MAC address
+ */
+ if (err->error == -EINVAL && *allowRetry &&
+ macaddr && !virMacAddrCmp(macaddr, &zeroMAC)) {
+ goto cleanup;
+ } else if (err->error) {
+ /* other errors are permanent */
+ virReportSystemError(-err->error,
+ _("Cannot set interface MAC/vlanid to %s/%d "
+ "for ifname %s vf %d"),
+ (macaddr
+ ? virMacAddrFormat(macaddr, macstr)
+ : "(unchanged)"),
+ vlanid,
+ ifname ? ifname : "(unspecified)",
+ vf);
+ *allowRetry = false; /* no use retrying */
+ /* STX: but we do attempt local retry here within this procedure
+ * goto cleanup; */
+ goto retry;
+ }
+ break;
- default:
- goto malformed_resp;
- }
+ case NLMSG_DONE:
+ break;
+
+ default:
+ goto malformed_resp;
+ }
- rc = 0;
+ rc = 0;
cleanup:
VIR_DEBUG("RTM_SETLINK %s vf %d MAC=%s vlanid=%d - %s",
ifname, vf,
@@ -1664,6 +1671,23 @@ virNetDevSetVfConfig(const char *ifname, int vf,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("allocated netlink buffer is too small"));
goto cleanup;
+
+ /*STX: local retry logic*/
+ retry:
+ VIR_ERROR(_("Retry: %u"), i);
+ {
+ static struct timespec delay = {
+ .tv_sec = 0,
+ .tv_nsec = VIR_NET_DEV_DELAY_NS };
+
+ if (nanosleep(&delay, NULL) < 0) {
+ virReportSystemError(errno, "%s", _("Failed to sleep"));
+ goto cleanup;
+ }
+ }
+
+ } /* End of local retry loop */
+ goto cleanup; /* we exhausted our local retries */
}
/**
--
2.25.1

View File

@ -0,0 +1,9 @@
0001-STX-CPU-pinning-not-working-over-live-migration.patch
0002-STX-System-Logging-set-group-read-permission-on-log.patch
0003-STX-Drop-migration-poll-times-to-10mS.patch
0004-STX-DPDK-parms-handling.patch
0005-STX-Fixed-default-libvirtd-systemd-service.patch
0006-STX-Adding-systemd-dependencies-against-pmon.service.patch
0007-STX-Stop-processing-memory-stats-if-balloon-info.patch
0008-STX-Increase-timeout-for-connecting-to-monitor.patch
0009-STX-pci-sriov-perform-limited-retry-on-netlink.patch