From 4045070f10f01f317ba25faccfcf2b43fdc80169 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:19:19 +0000 Subject: import libvirt-3.9.0-14.el7 --- diff --git a/.gitignore b/.gitignore index 1d9289f..b62ce7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libvirt-3.2.0.tar.xz +SOURCES/libvirt-3.9.0.tar.xz diff --git a/.libvirt.metadata b/.libvirt.metadata index e2e8aba..0db550c 100644 --- a/.libvirt.metadata +++ b/.libvirt.metadata @@ -1 +1 @@ -47d4b443fdf1e268589529018c436bbc4b413a7c SOURCES/libvirt-3.2.0.tar.xz +7aae5bfdbc859234833464a7faaa2a1cc0c2775e SOURCES/libvirt-3.9.0.tar.xz diff --git a/SOURCES/libvirt-Add-VIR_DOMAIN_JOB_OPERATION-typed-parameter.patch b/SOURCES/libvirt-Add-VIR_DOMAIN_JOB_OPERATION-typed-parameter.patch deleted file mode 100644 index adafe29..0000000 --- a/SOURCES/libvirt-Add-VIR_DOMAIN_JOB_OPERATION-typed-parameter.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 16dad808f19120275bc57e952968840417e0d091 Mon Sep 17 00:00:00 2001 -Message-Id: <16dad808f19120275bc57e952968840417e0d091@dist-git> -From: Jiri Denemark -Date: Wed, 26 Apr 2017 11:59:59 +0200 -Subject: [PATCH] Add VIR_DOMAIN_JOB_OPERATION typed parameter - -The parameter is reported by virDomainGetJobStats API and -VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event and it can be used to identify -the operation (migration, snapshot, ...) to which the reported -statistics belong. - -https://bugzilla.redhat.com/show_bug.cgi?id=1441563 - -Signed-off-by: Jiri Denemark -(cherry picked from commit b1c79d785f9385eb4ebd5e71d1d44e67f744f4d9) -Signed-off-by: Jiri Denemark ---- - include/libvirt/libvirt-domain.h | 25 +++++++++++++++++++++++++ - tools/virsh-domain.c | 29 +++++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+) - -diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index 501996bc8..c9e96a6c9 100644 ---- a/include/libvirt/libvirt-domain.h -+++ b/include/libvirt/libvirt-domain.h -@@ -3117,6 +3117,31 @@ int virDomainGetJobStats(virDomainPtr domain, - unsigned int flags); - int virDomainAbortJob(virDomainPtr dom); - -+typedef enum { -+ VIR_DOMAIN_JOB_OPERATION_UNKNOWN = 0, -+ VIR_DOMAIN_JOB_OPERATION_START = 1, -+ VIR_DOMAIN_JOB_OPERATION_SAVE = 2, -+ VIR_DOMAIN_JOB_OPERATION_RESTORE = 3, -+ VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN = 4, -+ VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT = 5, -+ VIR_DOMAIN_JOB_OPERATION_SNAPSHOT = 6, -+ VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = 7, -+ VIR_DOMAIN_JOB_OPERATION_DUMP = 8, -+ -+# ifdef VIR_ENUM_SENTINELS -+ VIR_DOMAIN_JOB_OPERATION_LAST -+# endif -+} virDomainJobOperation; -+ -+/** -+ * VIR_DOMAIN_JOB_OPERATION: -+ * -+ * virDomainGetJobStats field: the operation which started the job as -+ * VIR_TYPED_PARAM_INT. The values correspond to the items in -+ * virDomainJobOperation enum. -+ */ -+# define VIR_DOMAIN_JOB_OPERATION "operation" -+ - /** - * VIR_DOMAIN_JOB_TIME_ELAPSED: - * -diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c -index 4b6c13ce4..bc0ded686 100644 ---- a/tools/virsh-domain.c -+++ b/tools/virsh-domain.c -@@ -5754,6 +5754,26 @@ virshDomainJobToString(int type) - return str ? _(str) : _("unknown"); - } - -+VIR_ENUM_DECL(virshDomainJobOperation); -+VIR_ENUM_IMPL(virshDomainJobOperation, -+ VIR_DOMAIN_JOB_OPERATION_LAST, -+ N_("Unknown"), -+ N_("Start"), -+ N_("Save"), -+ N_("Restore"), -+ N_("Incoming migration"), -+ N_("Outgoing migration"), -+ N_("Snapshot"), -+ N_("Snapshot revert"), -+ N_("Dump")) -+ -+static const char * -+virshDomainJobOperationToString(int op) -+{ -+ const char *str = virshDomainJobOperationTypeToString(op); -+ return str ? _(str) : _("unknown"); -+} -+ - static bool - cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) - { -@@ -5767,6 +5787,7 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) - unsigned long long value; - unsigned int flags = 0; - int ivalue; -+ int op; - int rc; - - if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) -@@ -5836,6 +5857,14 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) - goto cleanup; - } - -+ op = VIR_DOMAIN_JOB_OPERATION_UNKNOWN; -+ if ((rc = virTypedParamsGetInt(params, nparams, -+ VIR_DOMAIN_JOB_OPERATION, &op)) < 0) -+ goto save_error; -+ -+ vshPrint(ctl, "%-17s %-12s\n", _("Operation:"), -+ virshDomainJobOperationToString(op)); -+ - vshPrint(ctl, "%-17s %-12llu ms\n", _("Time elapsed:"), info.timeElapsed); - if ((rc = virTypedParamsGetULLong(params, nparams, - VIR_DOMAIN_JOB_TIME_ELAPSED_NET, --- -2.12.2 - diff --git a/SOURCES/libvirt-Add-support-for-CPU-cache-specification.patch b/SOURCES/libvirt-Add-support-for-CPU-cache-specification.patch deleted file mode 100644 index 2906ff9..0000000 --- a/SOURCES/libvirt-Add-support-for-CPU-cache-specification.patch +++ /dev/null @@ -1,389 +0,0 @@ -From a5cb43154905e2708bf90988bd2aa5f2fca6b935 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Mon, 24 Apr 2017 15:40:07 +0200 -Subject: [PATCH] Add support for CPU cache specification - -This patch introduces - - - - - -sub element of /domain/cpu. Currently only a single element is -allowed. - -Signed-off-by: Jiri Denemark -(cherry picked from commit a646a6016a7c62688988f7cfaa22e1340c2ce761) - -https://bugzilla.redhat.com/show_bug.cgi?id=1428952 - -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 35 ++++++++++++ - docs/schemas/cputypes.rng | 21 ++++++++ - docs/schemas/domaincommon.rng | 3 ++ - src/conf/cpu_conf.c | 62 ++++++++++++++++++++++ - src/conf/cpu_conf.h | 19 +++++++ - src/libvirt_private.syms | 2 + - .../generic-cpu-cache-disable.xml | 20 +++++++ - .../generic-cpu-cache-emulate.xml | 20 +++++++ - .../generic-cpu-cache-passthrough.xml | 20 +++++++ - tests/genericxml2xmltest.c | 4 ++ - 10 files changed, 206 insertions(+) - create mode 100644 tests/genericxml2xmlindata/generic-cpu-cache-disable.xml - create mode 100644 tests/genericxml2xmlindata/generic-cpu-cache-emulate.xml - create mode 100644 tests/genericxml2xmlindata/generic-cpu-cache-passthrough.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index aae5e9c07..aee1e1442 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -1198,6 +1198,7 @@ - <model fallback='allow'>core2duo</model> - <vendor>Intel</vendor> - <topology sockets='1' cores='2' threads='1'/> -+ <cache level='3' mode='emulate'/> - <feature policy='disable' name='lahf_lm'/> - </cpu> - ... -@@ -1211,6 +1212,7 @@ - -
- <cpu mode='host-passthrough'>
-+  <cache mode='passthrough'/>
-   <feature policy='disable' name='lahf_lm'/>
- ...
- -@@ -1431,6 +1433,39 @@ - Since 0.8.5 the policy - attribute can be omitted and will default to require. - -+ -+
cache
-+
Since 3.3.0 the cache -+ element describes the virtual CPU cache. If the element is missing, -+ the hypervisor will use a sensible default. -+ -+
-+
level
-+
This optional attribute specifies which cache level is described -+ by the element. Missing attribute means the element describes all -+ CPU cache levels at once. Mixing cache elements with -+ the level attribute set and those without the -+ attribute is forbidden.
-+ -+
mode
-+
-+ The following values are supported: -+
-+
emulate
-+
The hypervisor will provide a fake CPU cache data.
-+ -+
passthrough
-+
The real CPU cache data reported by the host CPU will be -+ passed through to the virtual CPU.
-+ -+
disable
-+
The virtual CPU will report no CPU cache of the specified -+ level (or no cache at all if the level attribute -+ is missing).
-+
-+
-+
-+
- - -

-diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng -index 8189114e3..3eef16abc 100644 ---- a/docs/schemas/cputypes.rng -+++ b/docs/schemas/cputypes.rng -@@ -142,4 +142,25 @@ - - - -+ -+ -+ -+ -+ -+ 1 -+ 2 -+ 3 -+ -+ -+ -+ -+ -+ emulate -+ passthrough -+ disable -+ -+ -+ -+ -+ - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index edc225fe5..d5c28ee3c 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -4545,6 +4545,9 @@ - - - -+ -+ -+ - - - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index 623b1699f..1b098c476 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -62,6 +62,12 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST, - "disable", - "forbid") - -+VIR_ENUM_IMPL(virCPUCacheMode, VIR_CPU_CACHE_MODE_LAST, -+ "emulate", -+ "passthrough", -+ "disable") -+ -+ - void - virCPUDefFreeFeatures(virCPUDefPtr def) - { -@@ -92,6 +98,7 @@ virCPUDefFree(virCPUDefPtr def) - return; - - virCPUDefFreeModel(def); -+ VIR_FREE(def->cache); - VIR_FREE(def); - } - -@@ -204,7 +211,18 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu) - copy->threads = cpu->threads; - copy->arch = cpu->arch; - -+ if (cpu->cache) { -+ if (VIR_ALLOC(copy->cache) < 0) -+ goto error; -+ -+ *copy->cache = *cpu->cache; -+ } -+ - return copy; -+ -+ error: -+ virCPUDefFree(copy); -+ return NULL; - } - - -@@ -489,6 +507,41 @@ virCPUDefParseXML(xmlNodePtr node, - def->features[i].policy = policy; - } - -+ if (virXPathInt("count(./cache)", ctxt, &n) < 0) { -+ goto cleanup; -+ } else if (n > 1) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("at most one CPU cache element may be specified")); -+ goto cleanup; -+ } else if (n == 1) { -+ int level = -1; -+ char *strmode; -+ int mode; -+ -+ if (virXPathBoolean("boolean(./cache[1]/@level)", ctxt) == 1 && -+ (virXPathInt("string(./cache[1]/@level)", ctxt, &level) < 0 || -+ level < 1 || level > 3)) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("invalid CPU cache level, must be in range [1,3]")); -+ goto cleanup; -+ } -+ -+ if (!(strmode = virXPathString("string(./cache[1]/@mode)", ctxt)) || -+ (mode = virCPUCacheModeTypeFromString(strmode)) < 0) { -+ VIR_FREE(strmode); -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("missing or invalid CPU cache mode")); -+ goto cleanup; -+ } -+ VIR_FREE(strmode); -+ -+ if (VIR_ALLOC(def->cache) < 0) -+ goto cleanup; -+ -+ def->cache->level = level; -+ def->cache->mode = mode; -+ } -+ - cleanup: - ctxt->node = oldnode; - VIR_FREE(fallback); -@@ -662,6 +715,15 @@ virCPUDefFormatBuf(virBufferPtr buf, - virBufferAddLit(buf, "/>\n"); - } - -+ if (def->cache) { -+ virBufferAddLit(buf, "cache->level != -1) -+ virBufferAsprintf(buf, "level='%d' ", def->cache->level); -+ virBufferAsprintf(buf, "mode='%s'", -+ virCPUCacheModeTypeToString(def->cache->mode)); -+ virBufferAddLit(buf, "/>\n"); -+ } -+ - for (i = 0; i < def->nfeatures; i++) { - virCPUFeatureDefPtr feature = def->features + i; - -diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index 3e02deed4..09438b68b 100644 ---- a/src/conf/cpu_conf.h -+++ b/src/conf/cpu_conf.h -@@ -103,6 +103,24 @@ struct _virCPUFeatureDef { - }; - - -+typedef enum { -+ VIR_CPU_CACHE_MODE_EMULATE, -+ VIR_CPU_CACHE_MODE_PASSTHROUGH, -+ VIR_CPU_CACHE_MODE_DISABLE, -+ -+ VIR_CPU_CACHE_MODE_LAST -+} virCPUCacheMode; -+ -+VIR_ENUM_DECL(virCPUCacheMode); -+ -+typedef struct _virCPUCacheDef virCPUCacheDef; -+typedef virCPUCacheDef *virCPUCacheDefPtr; -+struct _virCPUCacheDef { -+ int level; /* -1 for unspecified */ -+ virCPUCacheMode mode; -+}; -+ -+ - typedef struct _virCPUDef virCPUDef; - typedef virCPUDef *virCPUDefPtr; - struct _virCPUDef { -@@ -121,6 +139,7 @@ struct _virCPUDef { - size_t nfeatures; - size_t nfeatures_max; - virCPUFeatureDefPtr features; -+ virCPUCacheDefPtr cache; - }; - - -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index b551cb86a..9a334311d 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -67,6 +67,8 @@ virCapabilitiesSetNetPrefix; - - - # conf/cpu_conf.h -+virCPUCacheModeTypeFromString; -+virCPUCacheModeTypeToString; - virCPUDefAddFeature; - virCPUDefCopy; - virCPUDefCopyModel; -diff --git a/tests/genericxml2xmlindata/generic-cpu-cache-disable.xml b/tests/genericxml2xmlindata/generic-cpu-cache-disable.xml -new file mode 100644 -index 000000000..25f65cc6e ---- /dev/null -+++ b/tests/genericxml2xmlindata/generic-cpu-cache-disable.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/genericxml2xmlindata/generic-cpu-cache-emulate.xml b/tests/genericxml2xmlindata/generic-cpu-cache-emulate.xml -new file mode 100644 -index 000000000..6ea57cbf6 ---- /dev/null -+++ b/tests/genericxml2xmlindata/generic-cpu-cache-emulate.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/genericxml2xmlindata/generic-cpu-cache-passthrough.xml b/tests/genericxml2xmlindata/generic-cpu-cache-passthrough.xml -new file mode 100644 -index 000000000..8d4c186c9 ---- /dev/null -+++ b/tests/genericxml2xmlindata/generic-cpu-cache-passthrough.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c -index 488190270..ab1ebce9f 100644 ---- a/tests/genericxml2xmltest.c -+++ b/tests/genericxml2xmltest.c -@@ -100,6 +100,10 @@ mymain(void) - - DO_TEST("vcpus-individual"); - -+ DO_TEST("cpu-cache-emulate"); -+ DO_TEST("cpu-cache-passthrough"); -+ DO_TEST("cpu-cache-disable"); -+ - virObjectUnref(caps); - virObjectUnref(xmlopt); - --- -2.12.2 - diff --git a/SOURCES/libvirt-Add-support-for-virtio-net.tx_queue_size.patch b/SOURCES/libvirt-Add-support-for-virtio-net.tx_queue_size.patch deleted file mode 100644 index 7e04950..0000000 --- a/SOURCES/libvirt-Add-support-for-virtio-net.tx_queue_size.patch +++ /dev/null @@ -1,317 +0,0 @@ -From 9b3184784e1243a81a4b8de350fb0434a1ad1f28 Mon Sep 17 00:00:00 2001 -Message-Id: <9b3184784e1243a81a4b8de350fb0434a1ad1f28@dist-git> -From: Michal Privoznik -Date: Fri, 18 Aug 2017 09:35:54 +0200 -Subject: [PATCH] Add support for virtio-net.tx_queue_size - -RHEL-7.5: https://bugzilla.redhat.com/show_bug.cgi?id=1462653 -RHEL-7.4.z: https://bugzilla.redhat.com/show_bug.cgi?id=1482514 - -Just like I've added support for setting rx_queue_size (in -c56cdf259 and friends), qemu just gained support for setting tx -ring size. - -Signed-off-by: Michal Privoznik -(cherry picked from commit 2074ef6cd4a2e033813ec091487d027a85f73509) -Signed-off-by: Michal Privoznik - -Conflicts: - src/qemu/qemu_capabilities.c: - src/qemu/qemu_capabilities.h: Context because of some caps - missing -Signed-off-by: Michal Privoznik -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 15 ++++++++++++++- - docs/schemas/domaincommon.rng | 5 +++++ - src/conf/domain_conf.c | 16 ++++++++++++++++ - src/conf/domain_conf.h | 1 + - src/qemu/qemu_capabilities.c | 2 ++ - src/qemu/qemu_capabilities.h | 1 + - src/qemu/qemu_command.c | 8 ++++++++ - src/qemu/qemu_domain.c | 16 +++++++++++----- - ...e.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} | 4 ++-- - ...ize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} | 2 +- - tests/qemuxml2argvtest.c | 5 +++-- - ...e.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} | 2 +- - tests/qemuxml2xmltest.c | 2 +- - 13 files changed, 66 insertions(+), 13 deletions(-) - rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.args => qemuxml2argv-net-virtio-rxtxqueuesize.args} (83%) - rename tests/qemuxml2argvdata/{qemuxml2argv-net-virtio-rxqueuesize.xml => qemuxml2argv-net-virtio-rxtxqueuesize.xml} (93%) - rename tests/qemuxml2xmloutdata/{qemuxml2xmlout-net-virtio-rxqueuesize.xml => qemuxml2xmlout-net-virtio-rxtxqueuesize.xml} (96%) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index dc8e7d2dc7..024debe862 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -5038,7 +5038,7 @@ qemu-kvm -net nic,model=? /dev/null - <source network='default'/> - <target dev='vnet1'/> - <model type='virtio'/> -- <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256'> -+ <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256' tx_queue_size='256'> - <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/> - <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/> - </driver> -@@ -5168,6 +5168,19 @@ qemu-kvm -net nic,model=? /dev/null - In general you should leave this option alone, unless you - are very certain you know what you are doing. - -+

tx_queue_size
-+
-+ The optional tx_queue_size attribute controls -+ the size of virtio ring for each queue as described above. -+ The default value is hypervisor dependent and may change -+ across its releases. Moreover, some hypervisors may pose -+ some restrictions on actual value. For instance, QEMU -+ v2.9 requires value to be a power of two from [256, 1024] range. -+ Since 3.7.0 (QEMU and KVM only)

-+ -+ In general you should leave this option alone, unless you -+ are very certain you know what you are doing. -+
-
virtio options
-
- For virtio interfaces, -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 78023ff4af..bb077ed5a0 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -2619,6 +2619,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index d8ca25da38..806582fb8f 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -9721,6 +9721,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - char *event_idx = NULL; - char *queues = NULL; - char *rx_queue_size = NULL; -+ char *tx_queue_size = NULL; - char *str = NULL; - char *filter = NULL; - char *internal = NULL; -@@ -9894,6 +9895,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - event_idx = virXMLPropString(cur, "event_idx"); - queues = virXMLPropString(cur, "queues"); - rx_queue_size = virXMLPropString(cur, "rx_queue_size"); -+ tx_queue_size = virXMLPropString(cur, "tx_queue_size"); - } else if (xmlStrEqual(cur->name, BAD_CAST "filterref")) { - if (filter) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -10291,6 +10293,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - } - def->driver.virtio.rx_queue_size = q; - } -+ if (tx_queue_size) { -+ unsigned int q; -+ if (virStrToLong_uip(tx_queue_size, NULL, 10, &q) < 0) { -+ virReportError(VIR_ERR_XML_DETAIL, -+ _("'tx_queue_size' attribute must be positive number: %s"), -+ tx_queue_size); -+ goto error; -+ } -+ def->driver.virtio.tx_queue_size = q; -+ } - if ((str = virXPathString("string(./driver/host/@csum)", ctxt))) { - if ((val = virTristateSwitchTypeFromString(str)) <= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -@@ -10488,6 +10500,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - VIR_FREE(event_idx); - VIR_FREE(queues); - VIR_FREE(rx_queue_size); -+ VIR_FREE(tx_queue_size); - VIR_FREE(str); - VIR_FREE(filter); - VIR_FREE(type); -@@ -22264,6 +22277,9 @@ virDomainVirtioNetDriverFormat(char **outstr, - if (def->driver.virtio.rx_queue_size) - virBufferAsprintf(&buf, " rx_queue_size='%u'", - def->driver.virtio.rx_queue_size); -+ if (def->driver.virtio.tx_queue_size) -+ virBufferAsprintf(&buf, " tx_queue_size='%u'", -+ def->driver.virtio.tx_queue_size); - - virDomainVirtioOptionsFormat(&buf, def->virtio); - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 4c33b0d15e..7372a52856 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -967,6 +967,7 @@ struct _virDomainNetDef { - virTristateSwitch event_idx; - unsigned int queues; /* Multiqueue virtio-net */ - unsigned int rx_queue_size; -+ unsigned int tx_queue_size; - struct { - virTristateSwitch csum; - virTristateSwitch gso; -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index f22c11941c..6f8b1ac735 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -376,6 +376,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, - "intel-iommu.device-iotlb", /* 260 */ - "virtio.iommu_platform", - "virtio.ats", -+ "virtio-net.tx_queue_size", - ); - - -@@ -1642,6 +1643,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = { - { "tx", QEMU_CAPS_VIRTIO_TX_ALG }, - { "event_idx", QEMU_CAPS_VIRTIO_NET_EVENT_IDX }, - { "rx_queue_size", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE }, -+ { "tx_queue_size", QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE }, - { "host_mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU }, - }; - -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index c28c80d40a..281fe7d483 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -415,6 +415,7 @@ typedef enum { - QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, /* intel-iommu.device-iotlb */ - QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, /* virtio-*-pci.iommu_platform */ - QEMU_CAPS_VIRTIO_PCI_ATS, /* virtio-*-pci.ats */ -+ QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE, /* virtio-net-*.tx_queue_size */ - - QEMU_CAPS_LAST /* this must always be the last item */ - } virQEMUCapsFlags; -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index a4184b7378..f16029aa83 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -3788,6 +3788,14 @@ qemuBuildNicDevStr(virDomainDefPtr def, - } - virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size); - } -+ if (usingVirtio && net->driver.virtio.tx_queue_size) { -+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("virtio tx_queue_size option is not supported with this QEMU binary")); -+ goto error; -+ } -+ virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size); -+ } - - if (usingVirtio && net->mtu) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index c9c668b892..a41657099f 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -3121,11 +3121,17 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, - goto cleanup; - } - -- if (STREQ_NULLABLE(net->model, "virtio") && -- net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("rx_queue_size has to be a power of two")); -- goto cleanup; -+ if (STREQ_NULLABLE(net->model, "virtio")) { -+ if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("rx_queue_size has to be a power of two")); -+ goto cleanup; -+ } -+ if (net->driver.virtio.tx_queue_size & (net->driver.virtio.tx_queue_size - 1)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("tx_queue_size has to be a power of two")); -+ goto cleanup; -+ } - } - - if (net->mtu && -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args -similarity index 83% -rename from tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args -rename to tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args -index 7d275a723d..68b87b4ffe 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.args -@@ -19,7 +19,7 @@ QEMU_AUDIO_DRV=none \ - -usb \ - -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ - -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ ---device virtio-net-pci,rx_queue_size=512,vlan=0,id=net0,mac=00:11:22:33:44:55,\ --bus=pci.0,addr=0x3 \ -+-device virtio-net-pci,rx_queue_size=512,tx_queue_size=1024,vlan=0,id=net0,\ -+mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \ - -net user,vlan=0,name=hostnet0 \ - -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml -similarity index 93% -rename from tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml -rename to tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml -index cfb4742fc6..14d357bba3 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxtxqueuesize.xml -@@ -22,7 +22,7 @@ - - - -- -+ - - - -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index 5ca27f105d..827fe90239 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -1145,8 +1145,9 @@ mymain(void) - QEMU_CAPS_VIRTIO_S390); - DO_TEST("net-virtio-ccw", - QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); -- DO_TEST("net-virtio-rxqueuesize", -- QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE); -+ DO_TEST("net-virtio-rxtxqueuesize", -+ QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, -+ QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE); - DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE); - DO_TEST("net-eth", NONE); - DO_TEST("net-eth-ifname", NONE); -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml -similarity index 96% -rename from tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml -rename to tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml -index 5b41936063..34e1e40012 100644 ---- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxqueuesize.xml -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-virtio-rxtxqueuesize.xml -@@ -29,7 +29,7 @@ - - - -- -+ -
- - -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index f2abad00cf..62bce8d240 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -523,7 +523,7 @@ mymain(void) - DO_TEST("net-eth-ifname", NONE); - DO_TEST("net-eth-hostip", NONE); - DO_TEST("net-virtio-network-portgroup", NONE); -- DO_TEST("net-virtio-rxqueuesize", NONE); -+ DO_TEST("net-virtio-rxtxqueuesize", NONE); - DO_TEST("net-hostdev", NONE); - DO_TEST("net-hostdev-vfio", NONE); - DO_TEST("net-midonet", NONE); --- -2.14.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-controllers.patch b/SOURCES/libvirt-Add-virtio-related-options-to-controllers.patch deleted file mode 100644 index f494336..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-controllers.patch +++ /dev/null @@ -1,126 +0,0 @@ -From e0bb36c4d7c60336d2aba94013c2946e1594959b Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:03 +0200 -Subject: [PATCH] Add virtio-related options to controllers -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit c85217cf8a81879d065b9d13e876eec141f63f6f) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 6 ++++++ - docs/schemas/domaincommon.rng | 1 + - src/conf/domain_conf.c | 10 ++++++++++ - src/conf/domain_conf.h | 1 + - tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 2 ++ - 5 files changed, 20 insertions(+) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index bb7a85a1a1..2b26f090cd 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -3597,6 +3597,12 @@ - iothread value. The iothread value - must be within the range 1 to the domain iothreads value. -
-+
virtio options
-+
-+ For virtio controllers, -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
- -

- USB companion controllers have an optional -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index f838dc55fd..2108d23df7 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -2019,6 +2019,7 @@ - - - -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index a4b4f70855..2e5eeb1172 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1873,6 +1873,7 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def) - return; - - virDomainDeviceInfoClear(&def->info); -+ VIR_FREE(def->virtio); - - VIR_FREE(def); - } -@@ -9037,6 +9038,9 @@ virDomainControllerDefParseXML(xmlNodePtr node, - cur = cur->next; - } - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - /* node is parsed differently from target attributes because - * someone thought it should be a subelement instead... - */ -@@ -19214,6 +19218,10 @@ virDomainControllerDefCheckABIStability(virDomainControllerDefPtr src, - } - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -21504,6 +21512,8 @@ virDomainControllerDriverFormat(virBufferPtr buf, - if (def->iothread) - virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); - -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, " - - -+ -

- - - -+ -
- - --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-disks.patch b/SOURCES/libvirt-Add-virtio-related-options-to-disks.patch deleted file mode 100644 index abd2ba2..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-disks.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 51a842ccdf1c02ec00ba96217658b0db31a6addb Mon Sep 17 00:00:00 2001 -Message-Id: <51a842ccdf1c02ec00ba96217658b0db31a6addb@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:02 +0200 -Subject: [PATCH] Add virtio-related options to disks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit 1bc2cb3b3205dca7174147ac970e2b82c8af69da) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 5 +++++ - docs/schemas/domaincommon.rng | 1 + - src/conf/domain_conf.c | 15 +++++++++++++++ - src/conf/domain_conf.h | 1 + - tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 2 +- - 5 files changed, 23 insertions(+), 1 deletion(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 2556f383fc..bb7a85a1a1 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -3008,6 +3008,11 @@ - bus and "pci" or "ccw" address types. - Since 1.2.8 (QEMU 2.1) - -+
  • -+ For virtio disks, -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
  • - - -
    backenddomain
    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index f571af6706..f838dc55fd 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -1716,6 +1716,7 @@ - - - -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 4768d02029..a4b4f70855 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1745,6 +1745,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def) - VIR_FREE(def->product); - VIR_FREE(def->domain_name); - VIR_FREE(def->blkdeviotune.group_name); -+ VIR_FREE(def->virtio); - virDomainDeviceInfoClear(&def->info); - virObjectUnref(def->privateData); - -@@ -4440,6 +4441,10 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, - } - } - -+ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO && -+ virDomainCheckVirtioOptions(disk->virtio) < 0) -+ return -1; -+ - if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && - virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0) - return -1; -@@ -8420,6 +8425,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, - } - } - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - /* Disk volume types will have authentication information handled in - * virStorageTranslateDiskSourcePool - */ -@@ -19146,6 +19154,10 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -21307,6 +21319,9 @@ virDomainDiskDefFormat(virBufferPtr buf, - virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); - if (def->detect_zeroes) - virBufferAsprintf(&driverBuf, " detect_zeroes='%s'", detect_zeroes); -+ -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, " 0 specific thread # */ - int detect_zeroes; /* enum virDomainDiskDetectZeroes */ - char *domain_name; /* backend domain name */ -+ virDomainVirtioOptionsPtr virtio; - }; - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -index b16a9847fe..6dd82de648 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -@@ -15,7 +15,7 @@ - - /usr/bin/qemu-system-x86_64 - -- -+ - - -
    --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-filesystems.patch b/SOURCES/libvirt-Add-virtio-related-options-to-filesystems.patch deleted file mode 100644 index 2576cd7..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-filesystems.patch +++ /dev/null @@ -1,127 +0,0 @@ -From c828a666c154dece5bce0530c6a53d72d91ca3a1 Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:04 +0200 -Subject: [PATCH] Add virtio-related options to filesystems -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit b10c22d9fa11e2a67eca04592688bd701700f77f) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 5 +++++ - docs/schemas/domaincommon.rng | 1 + - src/conf/domain_conf.c | 10 ++++++++++ - src/conf/domain_conf.h | 1 + - tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 3 ++- - 5 files changed, 19 insertions(+), 1 deletion(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 2b26f090cd..8d3f916a19 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -3293,6 +3293,11 @@ - or "handle", but no formats. Virtuozzo driver supports - a type of "ploop" with a format of "ploop". - -+
  • -+ For virtio-backed devices, -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
  • - - - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 2108d23df7..5e526b6100 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -2202,6 +2202,7 @@ - immediate - - -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 2e5eeb1172..5c7ffc0419 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1905,6 +1905,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) - virStorageSourceFree(def->src); - VIR_FREE(def->dst); - virDomainDeviceInfoClear(&def->info); -+ VIR_FREE(def->virtio); - - VIR_FREE(def); - } -@@ -9451,6 +9452,9 @@ virDomainFSDefParseXML(xmlNodePtr node, - goto error; - } - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - def->src->path = source; - source = NULL; - def->dst = target; -@@ -19246,6 +19250,10 @@ virDomainFsDefCheckABIStability(virDomainFSDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -21713,6 +21721,8 @@ virDomainFSDefFormat(virBufferPtr buf, - - } - -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, " - - -+ - - -
    - - -- -+ - - -
    --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-input-devices.patch b/SOURCES/libvirt-Add-virtio-related-options-to-input-devices.patch deleted file mode 100644 index 6e235e0..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-input-devices.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 00aaab7312b72b5ef1785793f97849a69f425b83 Mon Sep 17 00:00:00 2001 -Message-Id: <00aaab7312b72b5ef1785793f97849a69f425b83@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:07 +0200 -Subject: [PATCH] Add virtio-related options to input devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit cc0933d3501229cdc8cf183a52a14c9b1c8de666) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 7 +++++++ - docs/schemas/domaincommon.rng | 5 +++++ - src/conf/domain_conf.c | 18 ++++++++++++++++++ - src/conf/domain_conf.h | 1 + - tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 4 ++++ - 5 files changed, 35 insertions(+) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 6be015f866..dc8e7d2dc7 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -5712,6 +5712,13 @@ qemu-kvm -net nic,model=? /dev/null - event device passed through to guests. (KVM only) -

    - -+

    -+ The subelement driver can be used to tune the virtio -+ options of the device: -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+

    -+ -

    Hub devices

    - -

    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index ee49d6eb58..78023ff4af 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3936,6 +3936,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index a0de639e51..d8ca25da38 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1400,6 +1400,7 @@ void virDomainInputDefFree(virDomainInputDefPtr def) - - virDomainDeviceInfoClear(&def->info); - VIR_FREE(def->source.evdev); -+ VIR_FREE(def->virtio); - VIR_FREE(def); - } - -@@ -11587,6 +11588,9 @@ virDomainInputDefParseXML(const virDomainDef *dom, - goto error; - } - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - cleanup: - VIR_FREE(evdev); - VIR_FREE(type); -@@ -19328,6 +19332,10 @@ virDomainInputDefCheckABIStability(virDomainInputDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -23404,6 +23412,7 @@ virDomainInputDefFormat(virBufferPtr buf, - const char *type = virDomainInputTypeToString(def->type); - const char *bus = virDomainInputBusTypeToString(def->bus); - virBuffer childbuf = VIR_BUFFER_INITIALIZER; -+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER; - - /* don't format keyboard into migratable XML for backward compatibility */ - if (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE && -@@ -23427,6 +23436,15 @@ virDomainInputDefFormat(virBufferPtr buf, - type, bus); - - virBufferAdjustIndent(&childbuf, virBufferGetIndent(buf, false) + 2); -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ if (virBufferCheckError(&driverBuf) < 0) -+ return -1; -+ -+ if (virBufferUse(&driverBuf)) { -+ virBufferAddLit(&childbuf, "\n"); -+ } - virBufferEscapeString(&childbuf, "\n", def->source.evdev); - if (virDomainDeviceInfoFormat(&childbuf, &def->info, flags) < 0) - return -1; -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index b79fb50c79..4c33b0d15e 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -1282,6 +1282,7 @@ struct _virDomainInputDef { - char *evdev; - } source; - virDomainDeviceInfo info; -+ virDomainVirtioOptionsPtr virtio; - }; - - typedef enum { -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -index 85d1145263..773038a320 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -@@ -54,15 +54,19 @@ -

    - - -+ -
    - - -+ -
    - - -+ -
    - - -+ - -
    - --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-interfaces.patch b/SOURCES/libvirt-Add-virtio-related-options-to-interfaces.patch deleted file mode 100644 index fcede1c..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-interfaces.patch +++ /dev/null @@ -1,334 +0,0 @@ -From 7667b332ec942112270da554ded58658a78860b9 Mon Sep 17 00:00:00 2001 -Message-Id: <7667b332ec942112270da554ded58658a78860b9@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:00 +0200 -Subject: [PATCH] Add virtio-related options to interfaces -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - - - - - - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit fd518643402d8233ceffe4ef28279bcce53284f6) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 19 ++++ - docs/schemas/domaincommon.rng | 12 ++ - src/conf/domain_conf.c | 121 +++++++++++++++++++++ - src/conf/domain_conf.h | 10 ++ - .../qemuxml2argv-virtio-options.xml | 1 + - 5 files changed, 163 insertions(+) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index e8a3367bac..23546daae9 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -3448,6 +3448,19 @@ - - - -+

    Virtio-related options

    -+ -+

    -+ QEMU's virtio devices have some attributes related to the virtio transport under -+ the driver element: -+ The iommu attribute enables the use of emulated IOMMU -+ by the device. The attribute ats controls the Address -+ Translation Service support for PCIe devices. This is needed to make use -+ of IOTLB support (see IOMMU device). -+ Possible values are on or off. -+ Since 3.5.0 -+

    -+ -

    Controllers

    - -

    -@@ -5139,6 +5152,12 @@ qemu-kvm -net nic,model=? /dev/null - In general you should leave this option alone, unless you - are very certain you know what you are doing. - -+

    virtio options
    -+
    -+ For virtio interfaces, -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
    - -

    - Offloading options for the host and guest can be configured using -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 1b66362f17..9e68bbc52d 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -2632,6 +2632,7 @@ - - - -+ - - - -@@ -4952,6 +4953,17 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 4652e1c72b..bba50cf3fd 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -1112,6 +1112,46 @@ virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt) - return &xmlopt->ns; - } - -+static int -+virDomainVirtioOptionsParseXML(xmlXPathContextPtr ctxt, -+ virDomainVirtioOptionsPtr *virtio) -+{ -+ char *str = NULL; -+ int ret = -1; -+ int val; -+ virDomainVirtioOptionsPtr res; -+ -+ if (VIR_ALLOC(*virtio) < 0) -+ return -1; -+ -+ res = *virtio; -+ -+ if ((str = virXPathString("string(./driver/@iommu)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("invalid iommu value")); -+ goto cleanup; -+ } -+ res->iommu = val; -+ } -+ VIR_FREE(str); -+ -+ if ((str = virXPathString("string(./driver/@ats)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("invalid ats value")); -+ goto cleanup; -+ } -+ res->ats = val; -+ } -+ -+ ret = 0; -+ -+ cleanup: -+ VIR_FREE(str); -+ return ret; -+} -+ - - virSaveCookieCallbacksPtr - virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt) -@@ -1953,6 +1993,7 @@ virDomainNetDefClear(virDomainNetDefPtr def) - VIR_FREE(def->ifname); - VIR_FREE(def->ifname_guest); - VIR_FREE(def->ifname_guest_actual); -+ VIR_FREE(def->virtio); - - virNetDevIPInfoClear(&def->guestIP); - virNetDevIPInfoClear(&def->hostIP); -@@ -4313,6 +4354,28 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr dev, - - - static int -+virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio) -+{ -+ if (!virtio) -+ return 0; -+ -+ if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("iommu driver option is only supported " -+ "for virtio devices")); -+ return -1; -+ } -+ if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("ats driver option is only supported " -+ "for virtio devices")); -+ return -1; -+ } -+ return 0; -+} -+ -+ -+static int - virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, - const virDomainDef *def, - virCapsPtr caps ATTRIBUTE_UNUSED, -@@ -4410,6 +4473,13 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev, - } - } - -+ if (dev->type == VIR_DOMAIN_DEVICE_NET) { -+ virDomainNetDefPtr net = dev->data.net; -+ if (STRNEQ_NULLABLE(net->model, "virtio") && -+ virDomainCheckVirtioOptions(net->virtio) < 0) -+ return -1; -+ } -+ - return 0; - } - -@@ -5208,6 +5278,24 @@ virDomainDefValidate(virDomainDefPtr def, - } - - -+static void -+virDomainVirtioOptionsFormat(virBufferPtr buf, -+ virDomainVirtioOptionsPtr virtio) -+{ -+ if (!virtio) -+ return; -+ -+ if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(buf, " iommu='%s'", -+ virTristateSwitchTypeToString(virtio->iommu)); -+ } -+ if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(buf, " ats='%s'", -+ virTristateSwitchTypeToString(virtio->ats)); -+ } -+} -+ -+ - /* Generate a string representation of a device address - * @info address Device address to stringify - */ -@@ -10354,6 +10442,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - goto error; - } - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - cleanup: - ctxt->node = oldnode; - VIR_FREE(macaddr); -@@ -18979,6 +19070,30 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src, - - - static bool -+virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptionsPtr src, -+ virDomainVirtioOptionsPtr dst) -+{ -+ if (src->iommu != dst->iommu) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target device iommu option '%s' does not " -+ "match source '%s'"), -+ virTristateSwitchTypeToString(dst->iommu), -+ virTristateSwitchTypeToString(src->iommu)); -+ return false; -+ } -+ if (src->ats != dst->ats) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target device ats option '%s' does not " -+ "match source '%s'"), -+ virTristateSwitchTypeToString(dst->ats), -+ virTristateSwitchTypeToString(src->ats)); -+ return false; -+ } -+ return true; -+} -+ -+ -+static bool - virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src, - virDomainDiskDefPtr dst) - { -@@ -19137,6 +19252,10 @@ virDomainNetDefCheckABIStability(virDomainNetDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -22074,6 +22193,8 @@ virDomainVirtioNetDriverFormat(char **outstr, - virBufferAsprintf(&buf, " rx_queue_size='%u'", - def->driver.virtio.rx_queue_size); - -+ virDomainVirtioOptionsFormat(&buf, def->virtio); -+ - if (virBufferCheckError(&buf) < 0) - return -1; - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index e6c20a9e1e..603d35bd50 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -156,6 +156,9 @@ typedef virDomainTPMDef *virDomainTPMDefPtr; - typedef struct _virDomainIOMMUDef virDomainIOMMUDef; - typedef virDomainIOMMUDef *virDomainIOMMUDefPtr; - -+typedef struct _virDomainVirtioOptions virDomainVirtioOptions; -+typedef virDomainVirtioOptions *virDomainVirtioOptionsPtr; -+ - /* Flags for the 'type' field in virDomainDeviceDef */ - typedef enum { - VIR_DOMAIN_DEVICE_NONE = 0, -@@ -1040,6 +1043,7 @@ struct _virDomainNetDef { - int linkstate; - unsigned int mtu; - virNetDevCoalescePtr coalesce; -+ virDomainVirtioOptionsPtr virtio; - }; - - typedef enum { -@@ -2215,6 +2219,12 @@ struct _virDomainIOMMUDef { - virTristateSwitch eim; - virTristateSwitch iotlb; - }; -+ -+struct _virDomainVirtioOptions { -+ virTristateSwitch iommu; -+ virTristateSwitch ats; -+}; -+ - /* - * Guest VM main configuration - * -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -index c88cf649b1..3357bc6d1b 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -@@ -47,6 +47,7 @@ - - - -+ -

    - - --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-rng-devices.patch b/SOURCES/libvirt-Add-virtio-related-options-to-rng-devices.patch deleted file mode 100644 index a2777a9..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-rng-devices.patch +++ /dev/null @@ -1,146 +0,0 @@ -From b452148f1570656d9b42efbdbff396cf5cafa9c7 Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:05 +0200 -Subject: [PATCH] Add virtio-related options to rng devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit f65db1be1200b656094180ecfdb63f8bd0158cab) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 11 +++++++++++ - docs/schemas/domaincommon.rng | 5 +++++ - src/conf/domain_conf.c | 19 +++++++++++++++++++ - src/conf/domain_conf.h | 1 + - .../qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 1 + - 5 files changed, 37 insertions(+) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 8d3f916a19..2e5c669c4a 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -7061,6 +7061,17 @@ qemu-kvm -net nic,model=? /dev/null - - - -+
    driver
    -+
    -+ The subelement driver can be used to tune the device: -+
    -+
    virtio options
    -+
    -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
    -+
    -+
    - - - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 5e526b6100..7e80275029 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -4912,6 +4912,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 5c7ffc0419..059c006b69 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -12922,6 +12922,9 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt, - if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) - goto error; - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - cleanup: - VIR_FREE(model); - VIR_FREE(backend); -@@ -19637,6 +19640,10 @@ virDomainRNGDefCheckABIStability(virDomainRNGDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -23132,6 +23139,7 @@ virDomainRNGDefFormat(virBufferPtr buf, - { - const char *model = virDomainRNGModelTypeToString(def->model); - const char *backend = virDomainRNGBackendTypeToString(def->backend); -+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER; - - virBufferAsprintf(buf, "\n", model); - virBufferAdjustIndent(buf, 2); -@@ -23160,6 +23168,16 @@ virDomainRNGDefFormat(virBufferPtr buf, - break; - } - -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ if (virBufferCheckError(&driverBuf) < 0) -+ return -1; -+ -+ if (virBufferUse(&driverBuf)) { -+ virBufferAddLit(buf, "\n"); -+ } -+ - if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) { - if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) - return -1; -@@ -23188,6 +23206,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def) - } - - virDomainDeviceInfoClear(&def->info); -+ VIR_FREE(def->virtio); - VIR_FREE(def); - } - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index fdd852c29d..8cb9d5d0b1 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2020,6 +2020,7 @@ struct _virDomainRNGDef { - } source; - - virDomainDeviceInfo info; -+ virDomainVirtioOptionsPtr virtio; - }; - - typedef enum { -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -index 33da214611..b7b95014cd 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -@@ -80,6 +80,7 @@ - - - /dev/random -+ -
    - - --- -2.13.1 - diff --git a/SOURCES/libvirt-Add-virtio-related-options-to-video.patch b/SOURCES/libvirt-Add-virtio-related-options-to-video.patch deleted file mode 100644 index 1f0f3e4..0000000 --- a/SOURCES/libvirt-Add-virtio-related-options-to-video.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 6abf3f12df5173dc12af69827fbee98811f83959 Mon Sep 17 00:00:00 2001 -Message-Id: <6abf3f12df5173dc12af69827fbee98811f83959@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:49:06 +0200 -Subject: [PATCH] Add virtio-related options to video -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit f5384fb4029a59624e728a2e0d37e6a62efbdc52) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 12 ++++++++++ - docs/schemas/domaincommon.rng | 5 ++++ - src/conf/domain_conf.c | 27 ++++++++++++++++++++-- - src/conf/domain_conf.h | 1 + - .../qemuxml2argv-virtio-options.xml | 1 + - 5 files changed, 44 insertions(+), 2 deletions(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 2e5c669c4a..6be015f866 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -6133,6 +6133,18 @@ qemu-kvm -net nic,model=? /dev/null - The optional address sub-element can be used to - tie the video device to a particular PCI slot. - -+ -+
    driver
    -+
    -+ The subelement driver can be used to tune the device: -+
    -+
    virtio options
    -+
    -+ Virtio-specific options can also be -+ set. (Since 3.5.0) -+
    -+
    -+
    - - -

    Consoles, serial, parallel & channel devices

    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 7e80275029..ee49d6eb58 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3165,6 +3165,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 059c006b69..a0de639e51 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -2339,6 +2339,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def) - virDomainDeviceInfoClear(&def->info); - - VIR_FREE(def->accel); -+ VIR_FREE(def->virtio); - VIR_FREE(def); - } - -@@ -13499,11 +13500,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) - - static virDomainVideoDefPtr - virDomainVideoDefParseXML(xmlNodePtr node, -+ xmlXPathContextPtr ctxt, - const virDomainDef *dom, - unsigned int flags) - { - virDomainVideoDefPtr def; - xmlNodePtr cur; -+ xmlNodePtr saved = ctxt->node; - char *type = NULL; - char *heads = NULL; - char *vram = NULL; -@@ -13512,6 +13515,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, - char *vgamem = NULL; - char *primary = NULL; - -+ ctxt->node = node; -+ - if (VIR_ALLOC(def) < 0) - return NULL; - -@@ -13613,7 +13618,12 @@ virDomainVideoDefParseXML(xmlNodePtr node, - if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) - goto error; - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - cleanup: -+ ctxt->node = saved; -+ - VIR_FREE(type); - VIR_FREE(ram); - VIR_FREE(vram); -@@ -14412,7 +14422,7 @@ virDomainDeviceDefParse(const char *xmlStr, - goto error; - break; - case VIR_DOMAIN_DEVICE_VIDEO: -- if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags))) -+ if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags))) - goto error; - break; - case VIR_DOMAIN_DEVICE_HOSTDEV: -@@ -18347,7 +18357,7 @@ virDomainDefParseXML(xmlDocPtr xml, - virDomainVideoDefPtr video; - ssize_t insertAt = -1; - -- if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags))) -+ if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags))) - goto error; - - if (video->primary) { -@@ -19414,6 +19424,10 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, - } - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -23332,6 +23346,7 @@ virDomainVideoDefFormat(virBufferPtr buf, - unsigned int flags) - { - const char *model = virDomainVideoTypeToString(def->type); -+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER; - - if (!model) { - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -23341,6 +23356,14 @@ virDomainVideoDefFormat(virBufferPtr buf, - - virBufferAddLit(buf, " - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index bba50cf3fd..4768d02029 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -2292,6 +2292,7 @@ void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def) - return; - - virDomainDeviceInfoClear(&def->info); -+ VIR_FREE(def->virtio); - - VIR_FREE(def); - } -@@ -12970,6 +12971,9 @@ virDomainMemballoonDefParseXML(xmlNodePtr node, - else if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) - goto error; - -+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) -+ goto error; -+ - cleanup: - VIR_FREE(model); - VIR_FREE(deflate); -@@ -19582,6 +19586,10 @@ virDomainMemballoonDefCheckABIStability(virDomainMemballoonDefPtr src, - return false; - } - -+ if (src->virtio && dst->virtio && -+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) -+ return false; -+ - if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) - return false; - -@@ -22934,6 +22942,22 @@ virDomainMemballoonDefFormat(virBufferPtr buf, - return -1; - } - -+ if (def->virtio) { -+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER; -+ -+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio); -+ -+ if (virBufferCheckError(&driverBuf) < 0) { -+ virBufferFreeAndReset(&childrenBuf); -+ return -1; -+ } -+ if (virBufferUse(&driverBuf)) { -+ virBufferAddLit(&childrenBuf, "\n"); -+ } -+ } -+ - if (!virBufferUse(&childrenBuf)) { - virBufferAddLit(buf, "/>\n"); - } else { -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 603d35bd50..f1f9208b91 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -1609,6 +1609,7 @@ struct _virDomainMemballoonDef { - virDomainDeviceInfo info; - int period; /* seconds between collections */ - int autodeflate; /* enum virTristateSwitch */ -+ virDomainVirtioOptionsPtr virtio; - }; - - struct _virDomainNVRAMDef { -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -index 3357bc6d1b..b16a9847fe 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml -@@ -73,6 +73,7 @@ - - -
    -+ - - - /dev/random --- -2.13.1 - diff --git a/SOURCES/libvirt-audit-Fix-the-output-message-for-shmem.patch b/SOURCES/libvirt-audit-Fix-the-output-message-for-shmem.patch deleted file mode 100644 index c3e819a..0000000 --- a/SOURCES/libvirt-audit-Fix-the-output-message-for-shmem.patch +++ /dev/null @@ -1,70 +0,0 @@ -From c71f920357ffb17cd13aaf9a12e8d77d1b29b08c Mon Sep 17 00:00:00 2001 -Message-Id: -From: Martin Kletzander -Date: Mon, 5 Jun 2017 17:02:03 +0200 -Subject: [PATCH] audit: Fix the output message for shmem - -After some discussion on and off the linux-audit mailing list, we -should use different fields for the audit messages. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1218603 - -Signed-off-by: Martin Kletzander -(cherry picked from commit 6d12a1cb2fb0e0152a19518423dceafa7cf088fb) -Signed-off-by: Martin Kletzander -Signed-off-by: Jiri Denemark ---- - src/conf/domain_audit.c | 24 +++++++++++++----------- - 1 file changed, 13 insertions(+), 11 deletions(-) - -diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c -index 2d9ff5e3ff..1e667af73c 100644 ---- a/src/conf/domain_audit.c -+++ b/src/conf/domain_audit.c -@@ -983,15 +983,13 @@ virDomainAuditShmem(virDomainObjPtr vm, - char uuidstr[VIR_UUID_STRING_BUFLEN]; - char *vmname = virAuditEncode("vm", vm->def->name); - const char *srcpath = virDomainAuditChardevPath(&def->server.chr); -- char *src = virAuditEncode("server", VIR_AUDIT_STR(srcpath)); -- char *shmem = virAuditEncode("shmem", VIR_AUDIT_STR(def->name)); - const char *virt = virDomainVirtTypeToString(vm->def->virtType); -- char *size = NULL; -+ char *shmpath = NULL; - - virUUIDFormat(vm->def->uuid, uuidstr); - -- if (!vmname || !src || !shmem || -- virAsprintfQuiet(&size, "%llu", def->size) < 0) { -+ if (!vmname || -+ virAsprintfQuiet(&shmpath, "/dev/shm/%s", def->name) < 0) { - VIR_WARN("OOM while encoding audit message"); - goto cleanup; - } -@@ -1002,14 +1000,18 @@ virDomainAuditShmem(virDomainObjPtr vm, - virt = "?"; - } - -- VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, -- "virt=%s resrc=shmem reason=%s %s uuid=%s size=%s %s %s", -- virt, reason, vmname, uuidstr, size, shmem, src); -+ if (def->server.enabled) { -+ VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, -+ "virt=%s resrc=ivshmem-socket reason=%s %s uuid=%s path=%s", -+ virt, reason, vmname, uuidstr, VIR_AUDIT_STR(srcpath)); -+ } else { -+ VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success, -+ "virt=%s resrc=shmem reason=%s %s uuid=%s size=%llu path=%s", -+ virt, reason, vmname, uuidstr, def->size, VIR_AUDIT_STR(shmpath)); -+ } - - cleanup: - VIR_FREE(vmname); -- VIR_FREE(src); -- VIR_FREE(size); -- VIR_FREE(shmem); -+ VIR_FREE(shmpath); - return; - } --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Add-check-for-non-scsi_host-parent-during-vport-delete.patch b/SOURCES/libvirt-conf-Add-check-for-non-scsi_host-parent-during-vport-delete.patch deleted file mode 100644 index 66afa80..0000000 --- a/SOURCES/libvirt-conf-Add-check-for-non-scsi_host-parent-during-vport-delete.patch +++ /dev/null @@ -1,46 +0,0 @@ -From aa337656da6b3e44ccaae85ec64538dee80000cf Mon Sep 17 00:00:00 2001 -Message-Id: -From: John Ferlan -Date: Thu, 13 Apr 2017 10:38:35 -0400 -Subject: [PATCH] conf: Add check for non scsi_host parent during vport delete - -https://bugzilla.redhat.com/show_bug.cgi?id=1420740 - -If the parent is not a scsi_host, then we can just happily return since -we won't be removing a vport. - -Fixes a bug with the following output: - -$ virsh pool-destroy host4_hba_pool -error: Failed to destroy pool host4_hba_pool -error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool - -$ - -(cherry picked from commit 84f178bdc7ab38011cc1f76759b0a41335285a4f) -Signed-off-by: John Ferlan ---- - src/conf/node_device_conf.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index 7d0baa9d1..cc3fad8b9 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn, - if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name))) - goto cleanup; - -+ /* If the parent is not a scsi_host, then this is a pool backed -+ * directly to an HBA and there's no vHBA to remove - so we're done */ -+ if (!STRPREFIX(vhba_parent, "scsi_host")) { -+ ret = 0; -+ goto cleanup; -+ } -+ - if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0) - goto cleanup; - } --- -2.12.2 - diff --git a/SOURCES/libvirt-conf-Add-infrastructure-for-disk-source-private-data-XML.patch b/SOURCES/libvirt-conf-Add-infrastructure-for-disk-source-private-data-XML.patch new file mode 100644 index 0000000..2015326 --- /dev/null +++ b/SOURCES/libvirt-conf-Add-infrastructure-for-disk-source-private-data-XML.patch @@ -0,0 +1,510 @@ +From 996dfd6322782e72583384381ffebf91ef1d3e27 Mon Sep 17 00:00:00 2001 +Message-Id: <996dfd6322782e72583384381ffebf91ef1d3e27@dist-git> +From: Peter Krempa +Date: Thu, 14 Dec 2017 14:31:51 +0100 +Subject: [PATCH] conf: Add infrastructure for disk source private data XML + +VM drivers may need to store additional private data to the status XML +so that it can be restored after libvirtd restart. Since not everything +is needed add a callback infrastructure, where VM drivers can add only +stuff they need. + +Note that the private data is formatted as a sub-element +of the or sub-element. This is done since +storing it out of band (in the VM private data) would require a complex +matching process to allow to put the data into correct place. + +(cherry picked from commit aed3d038a6565f3b0e916bdb004ca90b302b200d) + + Conflicts: + tests/qemublocktest.c: This file does not exist downstream yet. + +https://bugzilla.redhat.com/show_bug.cgi?id=1523261 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 136 ++++++++++++++++++++++++++++++++++---------- + src/conf/domain_conf.h | 17 +++++- + src/conf/snapshot_conf.c | 18 +++--- + src/network/bridge_driver.c | 2 +- + src/qemu/qemu_domain.c | 2 +- + tests/virstoragetest.c | 2 +- + 6 files changed, 134 insertions(+), 43 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 2d54037b71..ad9c16a1e0 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -8550,11 +8550,43 @@ virDomainDiskSourceEncryptionParse(xmlNodePtr node, + } + + ++static int ++virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt, ++ virStorageSourcePtr src, ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) ++{ ++ xmlNodePtr saveNode = ctxt->node; ++ xmlNodePtr node; ++ int ret = -1; ++ ++ if (!(flags & VIR_DOMAIN_DEF_PARSE_STATUS) || ++ !xmlopt || !xmlopt->privateData.storageParse) ++ return 0; ++ ++ if (!(node = virXPathNode("./privateData", ctxt))) ++ return 0; ++ ++ ctxt->node = node; ++ ++ if (xmlopt->privateData.storageParse(ctxt, src) < 0) ++ goto cleanup; ++ ++ ret = 0; ++ ++ cleanup: ++ ctxt->node = saveNode; ++ ++ return ret; ++} ++ ++ + int + virDomainDiskSourceParse(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virStorageSourcePtr src, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { + int ret = -1; + xmlNodePtr saveNode = ctxt->node; +@@ -8593,6 +8625,9 @@ virDomainDiskSourceParse(xmlNodePtr node, + if (virDomainDiskSourceEncryptionParse(node, &src->encryption) < 0) + goto cleanup; + ++ if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0) ++ goto cleanup; ++ + /* People sometimes pass a bogus '' source path when they mean to omit the + * source element completely (e.g. CDROM without media). This is just a + * little compatibility check to help those broken apps */ +@@ -8610,7 +8645,8 @@ virDomainDiskSourceParse(xmlNodePtr node, + static int + virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, + virStorageSourcePtr src, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { + virStorageSourcePtr backingStore = NULL; + xmlNodePtr save_ctxt = ctxt->node; +@@ -8668,8 +8704,8 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, + goto cleanup; + } + +- if (virDomainDiskSourceParse(source, ctxt, backingStore, flags) < 0 || +- virDomainDiskBackingStoreParse(ctxt, backingStore, flags) < 0) ++ if (virDomainDiskSourceParse(source, ctxt, backingStore, flags, xmlopt) < 0 || ++ virDomainDiskBackingStoreParse(ctxt, backingStore, flags, xmlopt) < 0) + goto cleanup; + + VIR_STEAL_PTR(src->backingStore, backingStore); +@@ -8771,7 +8807,8 @@ static int + virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, + xmlNodePtr cur, + xmlXPathContextPtr ctxt, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { + xmlNodePtr mirrorNode; + char *mirrorFormat = NULL; +@@ -8809,7 +8846,8 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, + goto cleanup; + } + +- if (virDomainDiskSourceParse(mirrorNode, ctxt, def->mirror, flags) < 0) ++ if (virDomainDiskSourceParse(mirrorNode, ctxt, def->mirror, ++ flags, xmlopt) < 0) + goto cleanup; + } else { + /* For back-compat reasons, we handle a file name +@@ -9235,7 +9273,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, + if (!source && virXMLNodeNameEqual(cur, "source")) { + sourceNode = cur; + +- if (virDomainDiskSourceParse(cur, ctxt, def->src, flags) < 0) ++ if (virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlopt) < 0) + goto error; + + /* If we've already found an as a child of and +@@ -9316,7 +9354,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, + } else if (!def->mirror && + virXMLNodeNameEqual(cur, "mirror") && + !(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) { +- if (virDomainDiskDefMirrorParse(def, cur, ctxt, flags) < 0) ++ if (virDomainDiskDefMirrorParse(def, cur, ctxt, flags, xmlopt) < 0) + goto error; + } else if (!authdef && + virXMLNodeNameEqual(cur, "auth")) { +@@ -9587,7 +9625,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, + product = NULL; + + if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) { +- if (virDomainDiskBackingStoreParse(ctxt, def->src, flags) < 0) ++ if (virDomainDiskBackingStoreParse(ctxt, def->src, flags, xmlopt) < 0) + goto error; + } + +@@ -22349,12 +22387,43 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf, + } + + ++static int ++virDomainDiskSourceFormatPrivateData(virBufferPtr buf, ++ virStorageSourcePtr src, ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) ++{ ++ virBuffer childBuf = VIR_BUFFER_INITIALIZER; ++ int ret = -1; ++ ++ if (!(flags & VIR_DOMAIN_DEF_FORMAT_STATUS) || ++ !xmlopt || !xmlopt->privateData.storageFormat) ++ return 0; ++ ++ virBufferSetChildIndent(&childBuf, buf); ++ ++ if (xmlopt->privateData.storageFormat(src, &childBuf) < 0) ++ goto cleanup; ++ ++ if (virXMLFormatElement(buf, "privateData", NULL, &childBuf) < 0) ++ goto cleanup; ++ ++ ret = 0; ++ ++ cleanup: ++ virBufferFreeAndReset(&childBuf); ++ ++ return ret; ++} ++ ++ + static int + virDomainDiskSourceFormatInternal(virBufferPtr buf, + virStorageSourcePtr src, + int policy, + unsigned int flags, +- bool skipSeclabels) ++ bool skipSeclabels, ++ virDomainXMLOptionPtr xmlopt) + { + const char *startupPolicy = NULL; + virBuffer attrBuf = VIR_BUFFER_INITIALIZER; +@@ -22436,6 +22505,9 @@ virDomainDiskSourceFormatInternal(virBufferPtr buf, + virStorageEncryptionFormat(&childBuf, src->encryption) < 0) + return -1; + ++ if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0) ++ return -1; ++ + if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0) + goto error; + } +@@ -22453,15 +22525,18 @@ int + virDomainDiskSourceFormat(virBufferPtr buf, + virStorageSourcePtr src, + int policy, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { +- return virDomainDiskSourceFormatInternal(buf, src, policy, flags, false); ++ return virDomainDiskSourceFormatInternal(buf, src, policy, flags, false, xmlopt); + } + + + static int + virDomainDiskBackingStoreFormat(virBufferPtr buf, +- virStorageSourcePtr backingStore) ++ virStorageSourcePtr backingStore, ++ virDomainXMLOptionPtr xmlopt, ++ unsigned int flags) + { + const char *format; + +@@ -22490,9 +22565,9 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, + + virBufferAsprintf(buf, "\n", format); + /* We currently don't output seclabels for backing chain element */ +- if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, 0, true) < 0 || +- virDomainDiskBackingStoreFormat(buf, +- backingStore->backingStore) < 0) ++ if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, flags, true, xmlopt) < 0 || ++ virDomainDiskBackingStoreFormat(buf, backingStore->backingStore, ++ xmlopt, flags) < 0) + return -1; + + virBufferAdjustIndent(buf, -2); +@@ -22510,7 +22585,8 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, + static int + virDomainDiskDefFormat(virBufferPtr buf, + virDomainDiskDefPtr def, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { + const char *type = virStorageTypeToString(def->src->type); + const char *device = virDomainDiskDeviceTypeToString(def->device); +@@ -22623,13 +22699,14 @@ virDomainDiskDefFormat(virBufferPtr buf, + } + + if (virDomainDiskSourceFormat(buf, def->src, def->startupPolicy, +- flags) < 0) ++ flags, xmlopt) < 0) + return -1; + + /* Don't format backingStore to inactive XMLs until the code for + * persistent storage of backing chains is ready. */ + if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && +- virDomainDiskBackingStoreFormat(buf, def->src->backingStore) < 0) ++ virDomainDiskBackingStoreFormat(buf, def->src->backingStore, ++ xmlopt, flags) < 0) + return -1; + + virBufferEscapeString(buf, "\n", def->domain_name); +@@ -22666,7 +22743,7 @@ virDomainDiskDefFormat(virBufferPtr buf, + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + virBufferEscapeString(buf, "\n", formatStr); +- if (virDomainDiskSourceFormat(buf, def->mirror, 0, 0) < 0) ++ if (virDomainDiskSourceFormat(buf, def->mirror, 0, 0, xmlopt) < 0) + return -1; + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +@@ -25897,7 +25974,8 @@ int + virDomainDefFormatInternal(virDomainDefPtr def, + virCapsPtr caps, + unsigned int flags, +- virBufferPtr buf) ++ virBufferPtr buf, ++ virDomainXMLOptionPtr xmlopt) + { + unsigned char *uuid; + char uuidstr[VIR_UUID_STRING_BUFLEN]; +@@ -25952,10 +26030,10 @@ virDomainDefFormatInternal(virDomainDefPtr def, + * but no leading indentation before the starting element. + * Thankfully, libxml maps what looks like globals into + * thread-local uses, so we are thread-safe. */ +- xmlIndentTreeOutput = 1; +- xmlbuf = xmlBufferCreate(); +- if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, +- virBufferGetIndent(buf, false) / 2, 1) < 0) { ++ xmlIndentTreeOutput = 1; ++ xmlbuf = xmlBufferCreate(); ++ if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, ++ virBufferGetIndent(buf, false) / 2, 1) < 0) { + xmlBufferFree(xmlbuf); + xmlIndentTreeOutput = oldIndentTreeOutput; + goto error; +@@ -26528,7 +26606,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, + def->emulator); + + for (n = 0; n < def->ndisks; n++) +- if (virDomainDiskDefFormat(buf, def->disks[n], flags) < 0) ++ if (virDomainDiskDefFormat(buf, def->disks[n], flags, xmlopt) < 0) + goto error; + + for (n = 0; n < def->ncontrollers; n++) +@@ -26715,7 +26793,7 @@ virDomainDefFormat(virDomainDefPtr def, virCapsPtr caps, unsigned int flags) + virBuffer buf = VIR_BUFFER_INITIALIZER; + + virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS, NULL); +- if (virDomainDefFormatInternal(def, caps, flags, &buf) < 0) ++ if (virDomainDefFormatInternal(def, caps, flags, &buf, NULL) < 0) + return NULL; + + return virBufferContentAndReset(&buf); +@@ -26750,7 +26828,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt, + xmlopt->privateData.format(&buf, obj) < 0) + goto error; + +- if (virDomainDefFormatInternal(obj->def, caps, flags, &buf) < 0) ++ if (virDomainDefFormatInternal(obj->def, caps, flags, &buf, xmlopt) < 0) + goto error; + + virBufferAdjustIndent(&buf, -2); +@@ -27704,7 +27782,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src, + + switch ((virDomainDeviceType) src->type) { + case VIR_DOMAIN_DEVICE_DISK: +- rc = virDomainDiskDefFormat(&buf, src->data.disk, flags); ++ rc = virDomainDiskDefFormat(&buf, src->data.disk, flags, xmlopt); + break; + case VIR_DOMAIN_DEVICE_LEASE: + rc = virDomainLeaseDefFormat(&buf, src->data.lease); +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 698d3280fe..5e67c9a9c1 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2626,6 +2626,12 @@ typedef int (*virDomainXMLPrivateDataParseFunc)(xmlXPathContextPtr, + virDomainObjPtr, + virDomainDefParserConfigPtr); + ++typedef int (*virDomainXMLPrivateDataStorageSourceParseFunc)(xmlXPathContextPtr ctxt, ++ virStorageSourcePtr src); ++typedef int (*virDomainXMLPrivateDataStorageSourceFormatFunc)(virStorageSourcePtr src, ++ virBufferPtr buf); ++ ++ + typedef struct _virDomainXMLPrivateDataCallbacks virDomainXMLPrivateDataCallbacks; + typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr; + struct _virDomainXMLPrivateDataCallbacks { +@@ -2639,6 +2645,8 @@ struct _virDomainXMLPrivateDataCallbacks { + virDomainXMLPrivateDataNewFunc chrSourceNew; + virDomainXMLPrivateDataFormatFunc format; + virDomainXMLPrivateDataParseFunc parse; ++ virDomainXMLPrivateDataStorageSourceParseFunc storageParse; ++ virDomainXMLPrivateDataStorageSourceFormatFunc storageFormat; + }; + + typedef bool (*virDomainABIStabilityDomain)(const virDomainDef *src, +@@ -2963,12 +2971,14 @@ char *virDomainObjFormat(virDomainXMLOptionPtr xmlopt, + int virDomainDefFormatInternal(virDomainDefPtr def, + virCapsPtr caps, + unsigned int flags, +- virBufferPtr buf); ++ virBufferPtr buf, ++ virDomainXMLOptionPtr xmlopt); + + int virDomainDiskSourceFormat(virBufferPtr buf, + virStorageSourcePtr src, + int policy, +- unsigned int flags); ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt); + + int virDomainNetDefFormat(virBufferPtr buf, + virDomainNetDefPtr def, +@@ -3017,7 +3027,8 @@ virDomainDiskRemoveByName(virDomainDefPtr def, const char *name); + int virDomainDiskSourceParse(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virStorageSourcePtr src, +- unsigned int flags); ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt); + + int virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net); + virDomainNetDefPtr virDomainNetFind(virDomainDefPtr def, const char *device); +diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c +index f0e852c92b..d7b086242b 100644 +--- a/src/conf/snapshot_conf.c ++++ b/src/conf/snapshot_conf.c +@@ -110,7 +110,8 @@ static int + virDomainSnapshotDiskDefParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt, + virDomainSnapshotDiskDefPtr def, +- unsigned int flags) ++ unsigned int flags, ++ virDomainXMLOptionPtr xmlopt) + { + int ret = -1; + char *snapshot = NULL; +@@ -155,7 +156,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, + } + + if ((cur = virXPathNode("./source", ctxt)) && +- virDomainDiskSourceParse(cur, ctxt, def->src, flags) < 0) ++ virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlopt) < 0) + goto cleanup; + + if ((driver = virXPathString("string(./driver/@type)", ctxt))) { +@@ -348,8 +349,8 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, + goto cleanup; + def->ndisks = n; + for (i = 0; i < def->ndisks; i++) { +- if (virDomainSnapshotDiskDefParseXML(nodes[i], ctxt, +- &def->disks[i], flags) < 0) ++ if (virDomainSnapshotDiskDefParseXML(nodes[i], ctxt, &def->disks[i], ++ flags, xmlopt) < 0) + goto cleanup; + } + VIR_FREE(nodes); +@@ -663,7 +664,8 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, + + static void + virDomainSnapshotDiskDefFormat(virBufferPtr buf, +- virDomainSnapshotDiskDefPtr disk) ++ virDomainSnapshotDiskDefPtr disk, ++ virDomainXMLOptionPtr xmlopt) + { + int type = disk->src->type; + +@@ -686,7 +688,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, + if (disk->src->format > 0) + virBufferEscapeString(buf, "\n", + virStorageFileFormatTypeToString(disk->src->format)); +- virDomainDiskSourceFormat(buf, disk->src, 0, 0); ++ virDomainDiskSourceFormat(buf, disk->src, 0, 0, xmlopt); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); +@@ -740,13 +742,13 @@ virDomainSnapshotDefFormat(const char *domain_uuid, + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); + for (i = 0; i < def->ndisks; i++) +- virDomainSnapshotDiskDefFormat(&buf, &def->disks[i]); ++ virDomainSnapshotDiskDefFormat(&buf, &def->disks[i], xmlopt); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); + } + + if (def->dom) { +- if (virDomainDefFormatInternal(def->dom, caps, flags, &buf) < 0) ++ if (virDomainDefFormatInternal(def->dom, caps, flags, &buf, xmlopt) < 0) + goto error; + } else if (domain_uuid) { + virBufferAddLit(&buf, "\n"); +diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c +index fcaa66df91..334da7a85d 100644 +--- a/src/network/bridge_driver.c ++++ b/src/network/bridge_driver.c +@@ -233,7 +233,7 @@ networkRunHook(virNetworkObjPtr obj, + goto cleanup; + if (virNetworkDefFormatBuf(&buf, def, 0) < 0) + goto cleanup; +- if (dom && virDomainDefFormatInternal(dom, NULL, 0, &buf) < 0) ++ if (dom && virDomainDefFormatInternal(dom, NULL, 0, &buf, NULL) < 0) + goto cleanup; + + virBufferAdjustIndent(&buf, -2); +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 9dd9db049b..625bcb20d5 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -5245,7 +5245,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, + format: + ret = virDomainDefFormatInternal(def, caps, + virDomainDefFormatConvertXMLFlags(flags), +- buf); ++ buf, driver->xmlopt); + + cleanup: + virDomainDefFree(copy); +diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c +index e1d8751728..bdd0829c21 100644 +--- a/tests/virstoragetest.c ++++ b/tests/virstoragetest.c +@@ -693,7 +693,7 @@ testBackingParse(const void *args) + goto cleanup; + } + +- if (virDomainDiskSourceFormat(&buf, src, 0, 0) < 0 || ++ if (virDomainDiskSourceFormat(&buf, src, 0, 0, NULL) < 0 || + !(xml = virBufferContentAndReset(&buf))) { + fprintf(stderr, "failed to format disk source xml\n"); + goto cleanup; +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Add-save-cookie-callbacks-to-xmlopt.patch b/SOURCES/libvirt-conf-Add-save-cookie-callbacks-to-xmlopt.patch deleted file mode 100644 index d7101a8..0000000 --- a/SOURCES/libvirt-conf-Add-save-cookie-callbacks-to-xmlopt.patch +++ /dev/null @@ -1,427 +0,0 @@ -From 7cf2eee78e7e0e08eb1203f7fdb5705aba6b0e42 Mon Sep 17 00:00:00 2001 -Message-Id: <7cf2eee78e7e0e08eb1203f7fdb5705aba6b0e42@dist-git> -From: Jiri Denemark -Date: Fri, 2 Jun 2017 00:44:46 +0200 -Subject: [PATCH] conf: Add save cookie callbacks to xmlopt - -virDomainXMLOption gains driver specific callbacks for parsing and -formatting save cookies. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 25af7e950a9e35a6cffeed32bbcdd95dd7e01035) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/bhyve/bhyve_domain.c | 2 +- - src/conf/domain_conf.c | 16 +++++++++++++++- - src/conf/domain_conf.h | 7 ++++++- - src/conf/snapshot_conf.c | 11 ++++++++++- - src/conf/snapshot_conf.h | 2 ++ - src/libvirt_private.syms | 1 + - src/libxl/libxl_conf.c | 2 +- - src/lxc/lxc_conf.c | 2 +- - src/openvz/openvz_driver.c | 2 +- - src/phyp/phyp_driver.c | 2 +- - src/qemu/qemu_capabilities.c | 2 +- - src/qemu/qemu_conf.c | 3 ++- - src/security/virt-aa-helper.c | 2 +- - src/test/test_driver.c | 2 +- - src/uml/uml_driver.c | 2 +- - src/vbox/vbox_common.c | 2 +- - src/vmware/vmware_driver.c | 3 ++- - src/vmx/vmx.c | 2 +- - src/vz/vz_driver.c | 2 +- - src/xen/xen_driver.c | 2 +- - src/xenapi/xenapi_driver.c | 2 +- - tests/bhyveargv2xmltest.c | 2 +- - tests/testutils.c | 2 +- - 23 files changed, 54 insertions(+), 21 deletions(-) - -diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c -index 0a99550afa..20c82937b5 100644 ---- a/src/bhyve/bhyve_domain.c -+++ b/src/bhyve/bhyve_domain.c -@@ -144,7 +144,7 @@ virBhyveDriverCreateXMLConf(bhyveConnPtr driver) - virBhyveDriverDomainDefParserConfig.priv = driver; - return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig, - &virBhyveDriverPrivateDataCallbacks, -- NULL, NULL); -+ NULL, NULL, NULL); - } - - virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = { -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 395dcc0531..b473ce6b1e 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -79,6 +79,9 @@ struct _virDomainXMLOption { - - /* ABI stability callbacks */ - virDomainABIStability abi; -+ -+ /* Private data for save image stored in snapshot XML */ -+ virSaveCookieCallbacks saveCookie; - }; - - #define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \ -@@ -1054,7 +1057,8 @@ virDomainXMLOptionPtr - virDomainXMLOptionNew(virDomainDefParserConfigPtr config, - virDomainXMLPrivateDataCallbacksPtr priv, - virDomainXMLNamespacePtr xmlns, -- virDomainABIStabilityPtr abi) -+ virDomainABIStabilityPtr abi, -+ virSaveCookieCallbacksPtr saveCookie) - { - virDomainXMLOptionPtr xmlopt; - -@@ -1076,6 +1080,9 @@ virDomainXMLOptionNew(virDomainDefParserConfigPtr config, - if (abi) - xmlopt->abi = *abi; - -+ if (saveCookie) -+ xmlopt->saveCookie = *saveCookie; -+ - /* Technically this forbids to use one of Xerox's MAC address prefixes in - * our hypervisor drivers. This shouldn't ever be a problem. - * -@@ -1106,6 +1113,13 @@ virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt) - } - - -+virSaveCookieCallbacksPtr -+virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt) -+{ -+ return &xmlopt->saveCookie; -+} -+ -+ - void - virBlkioDeviceArrayClear(virBlkioDevicePtr devices, - int ndevices) -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index d64ef1b6e9..706d106ad9 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -55,6 +55,7 @@ - # include "virgic.h" - # include "virperf.h" - # include "virtypedparam.h" -+# include "virsavecookie.h" - - /* forward declarations of all device types, required by - * virDomainDeviceDef -@@ -2549,7 +2550,11 @@ struct _virDomainABIStability { - virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config, - virDomainXMLPrivateDataCallbacksPtr priv, - virDomainXMLNamespacePtr xmlns, -- virDomainABIStabilityPtr abi); -+ virDomainABIStabilityPtr abi, -+ virSaveCookieCallbacksPtr saveCookie); -+ -+virSaveCookieCallbacksPtr -+virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt); - - void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac); - -diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c -index e3bba985d7..6330f7d1f9 100644 ---- a/src/conf/snapshot_conf.c -+++ b/src/conf/snapshot_conf.c -@@ -102,6 +102,7 @@ void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def) - virDomainSnapshotDiskDefClear(&def->disks[i]); - VIR_FREE(def->disks); - virDomainDefFree(def->dom); -+ virObjectUnref(def->cookie); - VIR_FREE(def); - } - -@@ -214,6 +215,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, - char *memorySnapshot = NULL; - char *memoryFile = NULL; - bool offline = !!(flags & VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE); -+ virSaveCookieCallbacksPtr saveCookie = virDomainXMLOptionGetSaveCookie(xmlopt); - - if (VIR_ALLOC(def) < 0) - goto cleanup; -@@ -365,6 +367,9 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, - def->current = active != 0; - } - -+ if (!offline && virSaveCookieParse(ctxt, &def->cookie, saveCookie) < 0) -+ goto cleanup; -+ - ret = def; - - cleanup: -@@ -691,7 +696,7 @@ char * - virDomainSnapshotDefFormat(const char *domain_uuid, - virDomainSnapshotDefPtr def, - virCapsPtr caps, -- virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED, -+ virDomainXMLOptionPtr xmlopt, - unsigned int flags, - int internal) - { -@@ -751,6 +756,10 @@ virDomainSnapshotDefFormat(const char *domain_uuid, - virBufferAddLit(&buf, "\n"); - } - -+ if (virSaveCookieFormatBuf(&buf, def->cookie, -+ virDomainXMLOptionGetSaveCookie(xmlopt)) < 0) -+ goto error; -+ - if (internal) - virBufferAsprintf(&buf, "%d\n", def->current); - -diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h -index 2ce526fa6b..1d663c77bc 100644 ---- a/src/conf/snapshot_conf.h -+++ b/src/conf/snapshot_conf.h -@@ -76,6 +76,8 @@ struct _virDomainSnapshotDef { - - virDomainDefPtr dom; - -+ virObjectPtr cookie; -+ - /* Internal use. */ - bool current; /* At most one snapshot in the list should have this set */ - }; -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index b4769080e8..88e3f4b8ac 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -533,6 +533,7 @@ virDomainWatchdogActionTypeToString; - virDomainWatchdogModelTypeFromString; - virDomainWatchdogModelTypeToString; - virDomainXMLOptionGetNamespace; -+virDomainXMLOptionGetSaveCookie; - virDomainXMLOptionNew; - - -diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c -index dd345c22cf..28d31db158 100644 ---- a/src/libxl/libxl_conf.c -+++ b/src/libxl/libxl_conf.c -@@ -2147,5 +2147,5 @@ libxlCreateXMLConf(void) - { - return virDomainXMLOptionNew(&libxlDomainDefParserConfig, - &libxlDomainXMLPrivateDataCallbacks, -- NULL, NULL); -+ NULL, NULL, NULL); - } -diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c -index b46fbc58ff..8adc408c32 100644 ---- a/src/lxc/lxc_conf.c -+++ b/src/lxc/lxc_conf.c -@@ -213,7 +213,7 @@ lxcDomainXMLConfInit(void) - return virDomainXMLOptionNew(&virLXCDriverDomainDefParserConfig, - &virLXCDriverPrivateDataCallbacks, - &virLXCDriverDomainXMLNamespace, -- NULL); -+ NULL, NULL); - } - - -diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c -index 44a6631a99..4392aa64c0 100644 ---- a/src/openvz/openvz_driver.c -+++ b/src/openvz/openvz_driver.c -@@ -1493,7 +1493,7 @@ static virDrvOpenStatus openvzConnectOpen(virConnectPtr conn, - goto cleanup; - - if (!(driver->xmlopt = virDomainXMLOptionNew(&openvzDomainDefParserConfig, -- NULL, NULL, NULL))) -+ NULL, NULL, NULL, NULL))) - goto cleanup; - - if (openvzLoadDomains(driver) < 0) -diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c -index e85f66ffab..32cb681c75 100644 ---- a/src/phyp/phyp_driver.c -+++ b/src/phyp/phyp_driver.c -@@ -1199,7 +1199,7 @@ phypConnectOpen(virConnectPtr conn, - goto failure; - - if (!(phyp_driver->xmlopt = virDomainXMLOptionNew(&virPhypDriverDomainDefParserConfig, -- NULL, NULL, NULL))) -+ NULL, NULL, NULL, NULL))) - goto failure; - - conn->privateData = phyp_driver; -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 72d3f25763..29bb9949af 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -5027,7 +5027,7 @@ virQEMUCapsInitQMPCommandRun(virQEMUCapsInitQMPCommandPtr cmd, - goto ignore; - } - -- if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL)) || -+ if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) || - !(cmd->vm = virDomainObjNew(xmlopt))) - goto cleanup; - -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 76eed25277..96956b7779 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -908,7 +908,8 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver) - return virDomainXMLOptionNew(&virQEMUDriverDomainDefParserConfig, - &virQEMUDriverPrivateDataCallbacks, - &virQEMUDriverDomainXMLNamespace, -- &virQEMUDriverDomainABIStability); -+ &virQEMUDriverDomainABIStability, -+ NULL); - } - - -diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c -index 48201d5b8c..97436e5dc7 100644 ---- a/src/security/virt-aa-helper.c -+++ b/src/security/virt-aa-helper.c -@@ -667,7 +667,7 @@ get_definition(vahControl * ctl, const char *xmlStr) - goto exit; - } - -- if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL))) { -+ if (!(ctl->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL))) { - vah_error(ctl, 0, _("Failed to create XML config object")); - goto exit; - } -diff --git a/src/test/test_driver.c b/src/test/test_driver.c -index c8085dd797..4fd14ddee6 100644 ---- a/src/test/test_driver.c -+++ b/src/test/test_driver.c -@@ -414,7 +414,7 @@ testDriverNew(void) - goto error; - } - -- if (!(ret->xmlopt = virDomainXMLOptionNew(NULL, NULL, &ns, NULL)) || -+ if (!(ret->xmlopt = virDomainXMLOptionNew(NULL, NULL, &ns, NULL, NULL)) || - !(ret->eventState = virObjectEventStateNew()) || - !(ret->domains = virDomainObjListNew()) || - !(ret->networks = virNetworkObjListNew())) -diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c -index ae75daa596..f91ee2961e 100644 ---- a/src/uml/uml_driver.c -+++ b/src/uml/uml_driver.c -@@ -533,7 +533,7 @@ umlStateInitialize(bool privileged, - goto out_of_memory; - - if (!(uml_driver->xmlopt = virDomainXMLOptionNew(¨DriverDomainDefParserConfig, -- &privcb, NULL, NULL))) -+ &privcb, NULL, NULL, NULL))) - goto error; - - if ((uml_driver->inotifyFD = inotify_init()) < 0) { -diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c -index c739031660..4a79c43a1a 100644 ---- a/src/vbox/vbox_common.c -+++ b/src/vbox/vbox_common.c -@@ -139,7 +139,7 @@ vboxDriverObjNew(void) - - if (!(driver->caps = vboxCapsInit()) || - !(driver->xmlopt = virDomainXMLOptionNew(&vboxDomainDefParserConfig, -- NULL, NULL, NULL))) -+ NULL, NULL, NULL, NULL))) - goto cleanup; - - return driver; -diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c -index 24e97a4969..525c85edc8 100644 ---- a/src/vmware/vmware_driver.c -+++ b/src/vmware/vmware_driver.c -@@ -114,7 +114,8 @@ vmwareDomainXMLConfigInit(void) - virDomainXMLPrivateDataCallbacks priv = { .alloc = vmwareDataAllocFunc, - .free = vmwareDataFreeFunc }; - -- return virDomainXMLOptionNew(&vmwareDomainDefParserConfig, &priv, NULL, NULL); -+ return virDomainXMLOptionNew(&vmwareDomainDefParserConfig, &priv, -+ NULL, NULL, NULL); - } - - static virDrvOpenStatus -diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c -index 3289a20026..96507f10f3 100644 ---- a/src/vmx/vmx.c -+++ b/src/vmx/vmx.c -@@ -591,7 +591,7 @@ virDomainXMLOptionPtr - virVMXDomainXMLConfInit(void) - { - return virDomainXMLOptionNew(&virVMXDomainDefParserConfig, NULL, -- &virVMXDomainXMLNamespace, NULL); -+ &virVMXDomainXMLNamespace, NULL, NULL); - } - - char * -diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c -index f0b6722a6e..532a6841f3 100644 ---- a/src/vz/vz_driver.c -+++ b/src/vz/vz_driver.c -@@ -326,7 +326,7 @@ vzDriverObjNew(void) - if (!(driver->caps = vzBuildCapabilities()) || - !(driver->xmlopt = virDomainXMLOptionNew(&vzDomainDefParserConfig, - &vzDomainXMLPrivateDataCallbacksPtr, -- NULL, NULL)) || -+ NULL, NULL, NULL)) || - !(driver->domains = virDomainObjListNew()) || - !(driver->domainEventState = virObjectEventStateNew()) || - (vzInitVersion(driver) < 0) || -diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c -index 0c160f8370..ab74ba9928 100644 ---- a/src/xen/xen_driver.c -+++ b/src/xen/xen_driver.c -@@ -401,7 +401,7 @@ virDomainXMLOptionPtr - xenDomainXMLConfInit(void) - { - return virDomainXMLOptionNew(&xenDomainDefParserConfig, -- NULL, NULL, NULL); -+ NULL, NULL, NULL, NULL); - } - - -diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c -index 5623ddb507..c94fd422f9 100644 ---- a/src/xenapi/xenapi_driver.c -+++ b/src/xenapi/xenapi_driver.c -@@ -200,7 +200,7 @@ xenapiConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, - } - - if (!(privP->xmlopt = virDomainXMLOptionNew(&xenapiDomainDefParserConfig, -- NULL, NULL, NULL))) { -+ NULL, NULL, NULL, NULL))) { - xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, - _("Failed to create XML conf object")); - goto error; -diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c -index 5d7261a45b..43ef76a594 100644 ---- a/tests/bhyveargv2xmltest.c -+++ b/tests/bhyveargv2xmltest.c -@@ -131,7 +131,7 @@ mymain(void) - return EXIT_FAILURE; - - if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, -- NULL, NULL)) == NULL) -+ NULL, NULL, NULL)) == NULL) - return EXIT_FAILURE; - - # define DO_TEST_FULL(name, flags) \ -diff --git a/tests/testutils.c b/tests/testutils.c -index b7dc8d8408..0823469068 100644 ---- a/tests/testutils.c -+++ b/tests/testutils.c -@@ -1136,7 +1136,7 @@ virDomainXMLOptionPtr virTestGenericDomainXMLConfInit(void) - { - return virDomainXMLOptionNew(&virTestGenericDomainDefParserConfig, - &virTestGenericPrivateDataCallbacks, -- NULL, NULL); -+ NULL, NULL, NULL); - } - - --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Add-support-for-cputune-cachetune.patch b/SOURCES/libvirt-conf-Add-support-for-cputune-cachetune.patch new file mode 100644 index 0000000..5ff1f1b --- /dev/null +++ b/SOURCES/libvirt-conf-Add-support-for-cputune-cachetune.patch @@ -0,0 +1,794 @@ +From ba1ce05bd6e49217cd8c89b75e741e518d2b9292 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:30 +0100 +Subject: [PATCH] conf: Add support for cputune/cachetune + +More info in the documentation, this is basically the XML parsing/formatting +support, schemas, tests and documentation for the new cputune/cachetune element +that will get used by following patches. + +Signed-off-by: Martin Kletzander +(cherry picked from commit 7387e3fea44e28118e1f72841d79503849e15985) +Signed-off-by: Martin Kletzander + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Downstream changes: + +- Rename test XML files due to ab7a2fe230bb742cc4bc7f8d1475201b97fe49ab + +Signed-off-by: Martin Kletzander +--- + docs/formatdomain.html.in | 54 ++++ + docs/schemas/domaincommon.rng | 32 +++ + src/conf/domain_conf.c | 295 ++++++++++++++++++++- + src/conf/domain_conf.h | 13 + + .../genericxml2xmlindata/generic-cachetune-cdp.xml | 36 +++ + .../generic-cachetune-colliding-allocs.xml | 30 +++ + .../generic-cachetune-colliding-tunes.xml | 32 +++ + .../generic-cachetune-colliding-types.xml | 30 +++ + .../generic-cachetune-small.xml | 29 ++ + tests/genericxml2xmlindata/generic-cachetune.xml | 33 +++ + tests/genericxml2xmltest.c | 10 + + 11 files changed, 592 insertions(+), 2 deletions(-) + create mode 100644 tests/genericxml2xmlindata/generic-cachetune-cdp.xml + create mode 100644 tests/genericxml2xmlindata/generic-cachetune-colliding-allocs.xml + create mode 100644 tests/genericxml2xmlindata/generic-cachetune-colliding-tunes.xml + create mode 100644 tests/genericxml2xmlindata/generic-cachetune-colliding-types.xml + create mode 100644 tests/genericxml2xmlindata/generic-cachetune-small.xml + create mode 100644 tests/genericxml2xmlindata/generic-cachetune.xml + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 0cfbf051b7..f33261d05c 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -689,6 +689,10 @@ + <iothread_quota>-1</iothread_quota> + <vcpusched vcpus='0-4,^3' scheduler='fifo' priority='1'/> + <iothreadsched iothreads='2' scheduler='batch'/> ++ <cachetune vcpus='0-3'> ++ <cache id='0' level='3' type='both' size='3' unit='MiB'/> ++ <cache id='1' level='3' type='both' size='3' unit='MiB'/> ++ </cachetune> + </cputune> + ... + </domain> +@@ -834,6 +838,56 @@ + Since 1.2.13 + + ++
    cachetuneSince 4.1.0
    ++
    ++ Optional cachetune element can control allocations for CPU ++ caches using the resctrl on the host. Whether or not is this supported ++ can be gathered from capabilities where some limitations like minimum ++ size and required granularity are reported as well. The required ++ attribute vcpus specifies to which vCPUs this allocation ++ applies. A vCPU can only be member of one cachetune element ++ allocations. Supported subelements are: ++
    ++
    cache
    ++
    ++ This element controls the allocation of CPU cache and has the ++ following attributes: ++
    ++
    level
    ++
    ++ Host cache level from which to allocate. ++
    ++
    id
    ++
    ++ Host cache id from which to allocate. ++
    ++
    type
    ++
    ++ Type of allocation. Can be code for code ++ (instructions), data for data or both ++ for both code and data (unified). Currently the allocation can ++ be done only with the same type as the host supports, meaning ++ you cannot request both for host with CDP ++ (code/data prioritization) enabled. ++
    ++
    size
    ++
    ++ The size of the region to allocate. The value by default is in ++ bytes, but the unit attribute can be used to scale ++ the value. ++
    ++
    unit (optional)
    ++
    ++ If specified it is the unit such as KiB, MiB, GiB, or TiB ++ (described in the memory element ++ for Memory Allocation) ++ in which size is specified, defaults to bytes. ++
    ++
    ++
    ++
    ++ ++
    + + + +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 05709afc0c..564674b659 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -900,6 +900,38 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ both ++ code ++ data ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index ad9c16a1e0..181b035647 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -2886,6 +2886,19 @@ virDomainLoaderDefFree(virDomainLoaderDefPtr loader) + VIR_FREE(loader); + } + ++ ++static void ++virDomainCachetuneDefFree(virDomainCachetuneDefPtr cachetune) ++{ ++ if (!cachetune) ++ return; ++ ++ virObjectUnref(cachetune->alloc); ++ virBitmapFree(cachetune->vcpus); ++ VIR_FREE(cachetune); ++} ++ ++ + void virDomainDefFree(virDomainDefPtr def) + { + size_t i; +@@ -3058,6 +3071,10 @@ void virDomainDefFree(virDomainDefPtr def) + virDomainShmemDefFree(def->shmems[i]); + VIR_FREE(def->shmems); + ++ for (i = 0; i < def->ncachetunes; i++) ++ virDomainCachetuneDefFree(def->cachetunes[i]); ++ VIR_FREE(def->cachetunes); ++ + VIR_FREE(def->keywrap); + + if (def->namespaceData && def->ns.free) +@@ -18233,6 +18250,194 @@ virDomainDefParseBootOptions(virDomainDefPtr def, + } + + ++static int ++virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt, ++ xmlNodePtr node, ++ virResctrlAllocPtr alloc) ++{ ++ xmlNodePtr oldnode = ctxt->node; ++ unsigned int level; ++ unsigned int cache; ++ int type; ++ unsigned long long size; ++ char *tmp = NULL; ++ int ret = -1; ++ ++ ctxt->node = node; ++ ++ tmp = virXMLPropString(node, "id"); ++ if (!tmp) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Missing cachetune attribute 'id'")); ++ goto cleanup; ++ } ++ if (virStrToLong_uip(tmp, NULL, 10, &cache) < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid cachetune attribute 'id' value '%s'"), ++ tmp); ++ goto cleanup; ++ } ++ VIR_FREE(tmp); ++ ++ tmp = virXMLPropString(node, "level"); ++ if (!tmp) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Missing cachetune attribute 'level'")); ++ goto cleanup; ++ } ++ if (virStrToLong_uip(tmp, NULL, 10, &level) < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid cachetune attribute 'level' value '%s'"), ++ tmp); ++ goto cleanup; ++ } ++ VIR_FREE(tmp); ++ ++ tmp = virXMLPropString(node, "type"); ++ if (!tmp) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Missing cachetune attribute 'type'")); ++ goto cleanup; ++ } ++ type = virCacheTypeFromString(tmp); ++ if (type < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid cachetune attribute 'type' value '%s'"), ++ tmp); ++ goto cleanup; ++ } ++ VIR_FREE(tmp); ++ ++ if (virDomainParseScaledValue("./@size", "./@unit", ++ ctxt, &size, 1024, ++ ULLONG_MAX, true) < 0) ++ goto cleanup; ++ ++ if (virResctrlAllocSetSize(alloc, level, type, cache, size) < 0) ++ goto cleanup; ++ ++ ret = 0; ++ cleanup: ++ ctxt->node = oldnode; ++ VIR_FREE(tmp); ++ return ret; ++} ++ ++ ++static int ++virDomainCachetuneDefParse(virDomainDefPtr def, ++ xmlXPathContextPtr ctxt, ++ xmlNodePtr node, ++ unsigned int flags) ++{ ++ xmlNodePtr oldnode = ctxt->node; ++ xmlNodePtr *nodes = NULL; ++ virBitmapPtr vcpus = NULL; ++ virResctrlAllocPtr alloc = virResctrlAllocNew(); ++ virDomainCachetuneDefPtr tmp_cachetune = NULL; ++ char *tmp = NULL; ++ char *vcpus_str = NULL; ++ char *alloc_id = NULL; ++ ssize_t i = 0; ++ int n; ++ int ret = -1; ++ ++ ctxt->node = node; ++ ++ if (!alloc) ++ goto cleanup; ++ ++ if (VIR_ALLOC(tmp_cachetune) < 0) ++ goto cleanup; ++ ++ vcpus_str = virXMLPropString(node, "vcpus"); ++ if (!vcpus_str) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Missing cachetune attribute 'vcpus'")); ++ goto cleanup; ++ } ++ if (virBitmapParse(vcpus_str, &vcpus, VIR_DOMAIN_CPUMASK_LEN) < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid cachetune attribute 'vcpus' value '%s'"), ++ vcpus_str); ++ goto cleanup; ++ } ++ ++ /* We need to limit the bitmap to number of vCPUs. If there's nothing left, ++ * then we can just clean up and return 0 immediately */ ++ virBitmapShrink(vcpus, def->maxvcpus); ++ if (virBitmapIsAllClear(vcpus)) { ++ ret = 0; ++ goto cleanup; ++ } ++ ++ if ((n = virXPathNodeSet("./cache", ctxt, &nodes)) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Cannot extract cache nodes under cachetune")); ++ goto cleanup; ++ } ++ ++ for (i = 0; i < n; i++) { ++ if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc) < 0) ++ goto cleanup; ++ } ++ ++ if (virResctrlAllocIsEmpty(alloc)) { ++ ret = 0; ++ goto cleanup; ++ } ++ ++ for (i = 0; i < def->ncachetunes; i++) { ++ if (virBitmapOverlaps(def->cachetunes[i]->vcpus, vcpus)) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("Overlapping vcpus in cachetunes")); ++ goto cleanup; ++ } ++ } ++ ++ /* We need to format it back because we need to be consistent in the naming ++ * even when users specify some "sub-optimal" string there. */ ++ VIR_FREE(vcpus_str); ++ vcpus_str = virBitmapFormat(vcpus); ++ if (!vcpus_str) ++ goto cleanup; ++ ++ if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) ++ alloc_id = virXMLPropString(node, "id"); ++ ++ if (!alloc_id) { ++ /* The number of allocations is limited and the directory structure is flat, ++ * not hierarchical, so we need to have all same allocations in one ++ * directory, so it's nice to have it named appropriately. For now it's ++ * 'vcpus_...' but it's designed in order for it to be changeable in the ++ * future (it's part of the status XML). */ ++ if (virAsprintf(&alloc_id, "vcpus_%s", vcpus_str) < 0) ++ goto cleanup; ++ } ++ ++ if (virResctrlAllocSetID(alloc, alloc_id) < 0) ++ goto cleanup; ++ ++ VIR_STEAL_PTR(tmp_cachetune->vcpus, vcpus); ++ VIR_STEAL_PTR(tmp_cachetune->alloc, alloc); ++ ++ if (VIR_APPEND_ELEMENT(def->cachetunes, def->ncachetunes, tmp_cachetune) < 0) ++ goto cleanup; ++ ++ ret = 0; ++ cleanup: ++ ctxt->node = oldnode; ++ virDomainCachetuneDefFree(tmp_cachetune); ++ virObjectUnref(alloc); ++ virBitmapFree(vcpus); ++ VIR_FREE(alloc_id); ++ VIR_FREE(vcpus_str); ++ VIR_FREE(nodes); ++ VIR_FREE(tmp); ++ return ret; ++} ++ ++ + static virDomainDefPtr + virDomainDefParseXML(xmlDocPtr xml, + xmlNodePtr root, +@@ -18785,6 +18990,18 @@ virDomainDefParseXML(xmlDocPtr xml, + } + VIR_FREE(nodes); + ++ if ((n = virXPathNodeSet("./cputune/cachetune", ctxt, &nodes)) < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("cannot extract cachetune nodes")); ++ goto error; ++ } ++ ++ for (i = 0; i < n; i++) { ++ if (virDomainCachetuneDefParse(def, ctxt, nodes[i], flags) < 0) ++ goto error; ++ } ++ VIR_FREE(nodes); ++ + if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu) < 0) + goto error; + +@@ -25736,9 +25953,80 @@ virDomainSchedulerFormat(virBufferPtr buf, + } + + ++static int ++virDomainCachetuneDefFormatHelper(unsigned int level, ++ virCacheType type, ++ unsigned int cache, ++ unsigned long long size, ++ void *opaque) ++{ ++ const char *unit; ++ virBufferPtr buf = opaque; ++ unsigned long long short_size = virFormatIntPretty(size, &unit); ++ ++ virBufferAsprintf(buf, ++ "\n", ++ cache, level, virCacheTypeToString(type), ++ short_size, unit); ++ ++ return 0; ++} ++ ++ ++static int ++virDomainCachetuneDefFormat(virBufferPtr buf, ++ virDomainCachetuneDefPtr cachetune, ++ unsigned int flags) ++{ ++ virBuffer childrenBuf = VIR_BUFFER_INITIALIZER; ++ char *vcpus = NULL; ++ int ret = -1; ++ ++ virBufferSetChildIndent(&childrenBuf, buf); ++ virResctrlAllocForeachSize(cachetune->alloc, ++ virDomainCachetuneDefFormatHelper, ++ &childrenBuf); ++ ++ ++ if (virBufferCheckError(&childrenBuf) < 0) ++ goto cleanup; ++ ++ if (!virBufferUse(&childrenBuf)) { ++ ret = 0; ++ goto cleanup; ++ } ++ ++ vcpus = virBitmapFormat(cachetune->vcpus); ++ if (!vcpus) ++ goto cleanup; ++ ++ virBufferAsprintf(buf, "alloc); ++ if (!alloc_id) ++ goto cleanup; ++ ++ virBufferAsprintf(buf, " id='%s'", alloc_id); ++ } ++ virBufferAddLit(buf, ">\n"); ++ ++ virBufferAddBuffer(buf, &childrenBuf); ++ virBufferAddLit(buf, "\n"); ++ ++ ret = 0; ++ cleanup: ++ virBufferFreeAndReset(&childrenBuf); ++ VIR_FREE(vcpus); ++ return ret; ++} ++ ++ + static int + virDomainCputuneDefFormat(virBufferPtr buf, +- virDomainDefPtr def) ++ virDomainDefPtr def, ++ unsigned int flags) + { + size_t i; + virBuffer childrenBuf = VIR_BUFFER_INITIALIZER; +@@ -25837,6 +26125,9 @@ virDomainCputuneDefFormat(virBufferPtr buf, + def->iothreadids[i]->iothread_id); + } + ++ for (i = 0; i < def->ncachetunes; i++) ++ virDomainCachetuneDefFormat(&childrenBuf, def->cachetunes[i], flags); ++ + if (virBufferCheckError(&childrenBuf) < 0) + return -1; + +@@ -26174,7 +26465,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, + } + } + +- if (virDomainCputuneDefFormat(buf, def) < 0) ++ if (virDomainCputuneDefFormat(buf, def, flags) < 0) + goto error; + + if (virDomainNumatuneFormatXML(buf, def->numa) < 0) +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 5e67c9a9c1..ed7b587bed 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -56,6 +56,7 @@ + # include "virperf.h" + # include "virtypedparam.h" + # include "virsavecookie.h" ++# include "virresctrl.h" + + /* forward declarations of all device types, required by + * virDomainDeviceDef +@@ -2190,6 +2191,15 @@ struct _virDomainCputune { + }; + + ++typedef struct _virDomainCachetuneDef virDomainCachetuneDef; ++typedef virDomainCachetuneDef *virDomainCachetuneDefPtr; ++ ++struct _virDomainCachetuneDef { ++ virBitmapPtr vcpus; ++ virResctrlAllocPtr alloc; ++}; ++ ++ + typedef struct _virDomainVcpuDef virDomainVcpuDef; + typedef virDomainVcpuDef *virDomainVcpuDefPtr; + +@@ -2318,6 +2328,9 @@ struct _virDomainDef { + + virDomainCputune cputune; + ++ virDomainCachetuneDefPtr *cachetunes; ++ size_t ncachetunes; ++ + virDomainNumaPtr numa; + virDomainResourceDefPtr resource; + virDomainIdMapDef idmap; +diff --git a/tests/genericxml2xmlindata/generic-cachetune-cdp.xml b/tests/genericxml2xmlindata/generic-cachetune-cdp.xml +new file mode 100644 +index 0000000000..9718f06098 +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune-cdp.xml +@@ -0,0 +1,36 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmlindata/generic-cachetune-colliding-allocs.xml b/tests/genericxml2xmlindata/generic-cachetune-colliding-allocs.xml +new file mode 100644 +index 0000000000..82c9176cba +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune-colliding-allocs.xml +@@ -0,0 +1,30 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmlindata/generic-cachetune-colliding-tunes.xml b/tests/genericxml2xmlindata/generic-cachetune-colliding-tunes.xml +new file mode 100644 +index 0000000000..a0f37028c9 +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune-colliding-tunes.xml +@@ -0,0 +1,32 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmlindata/generic-cachetune-colliding-types.xml b/tests/genericxml2xmlindata/generic-cachetune-colliding-types.xml +new file mode 100644 +index 0000000000..c229eccee4 +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune-colliding-types.xml +@@ -0,0 +1,30 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmlindata/generic-cachetune-small.xml b/tests/genericxml2xmlindata/generic-cachetune-small.xml +new file mode 100644 +index 0000000000..ab2d9cf885 +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune-small.xml +@@ -0,0 +1,29 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmlindata/generic-cachetune.xml b/tests/genericxml2xmlindata/generic-cachetune.xml +new file mode 100644 +index 0000000000..645cab7771 +--- /dev/null ++++ b/tests/genericxml2xmlindata/generic-cachetune.xml +@@ -0,0 +1,33 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 4 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i686 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c +index 0377a05e9c..4ced5c349c 100644 +--- a/tests/genericxml2xmltest.c ++++ b/tests/genericxml2xmltest.c +@@ -130,6 +130,16 @@ mymain(void) + DO_TEST_FULL("chardev-reconnect-invalid-mode", 0, false, + TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + ++ DO_TEST("cachetune"); ++ DO_TEST("cachetune-small"); ++ DO_TEST("cachetune-cdp"); ++ DO_TEST_FULL("cachetune-colliding-allocs", false, true, ++ TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); ++ DO_TEST_FULL("cachetune-colliding-tunes", false, true, ++ TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); ++ DO_TEST_FULL("cachetune-colliding-types", false, true, ++ TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); ++ + virObjectUnref(caps); + virObjectUnref(xmlopt); + +-- +2.16.1 + diff --git a/SOURCES/libvirt-conf-Add-target-type-and-model-for-pl011.patch b/SOURCES/libvirt-conf-Add-target-type-and-model-for-pl011.patch new file mode 100644 index 0000000..fd6612b --- /dev/null +++ b/SOURCES/libvirt-conf-Add-target-type-and-model-for-pl011.patch @@ -0,0 +1,952 @@ +From 623a617e8199a9c7abd1903399fdbeccf4e85add Mon Sep 17 00:00:00 2001 +Message-Id: <623a617e8199a9c7abd1903399fdbeccf4e85add@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:14 +0100 +Subject: [PATCH] conf: Add target type and model for pl011 + +We can finally introduce a specific target model for the pl011 device +used by mach-virt guests, which means isa-serial will no longer show +up to confuse users. + +We make sure migration works in both directions by interpreting the +isa-serial target type, or the lack of target type, appropriately +when parsing the guest XML, and skipping the newly-introduced type +when formatting if for migration. We also verify that pl011 is not +used for non-mach-virt guests and add a bunch of test cases. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1512929 + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit eccdcb81fcfd1641960d397c82986b4517841794) +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 13 ++++--- + docs/schemas/domaincommon.rng | 2 + + src/conf/domain_conf.c | 3 ++ + src/conf/domain_conf.h | 2 + + src/qemu/qemu_command.c | 9 ++++- + src/qemu/qemu_domain.c | 26 +++++++++++++ + src/qemu/qemu_domain_address.c | 1 + + .../qemuxml2argv-mach-virt-console-native.args | 1 + + .../qemuxml2argv-mach-virt-console-native.xml | 17 +++++++++ + .../qemuxml2argv-mach-virt-console-virtio.args | 24 ++++++++++++ + .../qemuxml2argv-mach-virt-console-virtio.xml | 19 ++++++++++ + ...muxml2argv-mach-virt-serial+console-native.args | 1 + + ...emuxml2argv-mach-virt-serial+console-native.xml | 18 +++++++++ + .../qemuxml2argv-mach-virt-serial-compat.args | 1 + + .../qemuxml2argv-mach-virt-serial-compat.xml | 19 ++++++++++ + ...muxml2argv-mach-virt-serial-invalid-machine.xml | 21 +++++++++++ + .../qemuxml2argv-mach-virt-serial-native.args | 23 +++++++++++ + .../qemuxml2argv-mach-virt-serial-native.xml | 16 ++++++++ + .../qemuxml2argv-mach-virt-serial-pci.args | 26 +++++++++++++ + .../qemuxml2argv-mach-virt-serial-pci.xml | 18 +++++++++ + .../qemuxml2argv-mach-virt-serial-usb.args | 27 +++++++++++++ + .../qemuxml2argv-mach-virt-serial-usb.xml | 21 +++++++++++ + tests/qemuxml2argvtest.c | 27 +++++++++++++ + .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 4 +- + .../qemuxml2xmlout-mach-virt-console-native.xml | 1 + + .../qemuxml2xmlout-mach-virt-console-virtio.xml | 27 +++++++++++++ + ...uxml2xmlout-mach-virt-serial+console-native.xml | 1 + + .../qemuxml2xmlout-mach-virt-serial-compat.xml | 31 +++++++++++++++ + .../qemuxml2xmlout-mach-virt-serial-native.xml | 1 + + .../qemuxml2xmlout-mach-virt-serial-pci.xml | 44 ++++++++++++++++++++++ + .../qemuxml2xmlout-mach-virt-serial-usb.xml | 41 ++++++++++++++++++++ + tests/qemuxml2xmltest.c | 26 +++++++++++++ + 32 files changed, 503 insertions(+), 8 deletions(-) + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.xml + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-native.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 0634f3396a..87389f4e73 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -6463,8 +6463,9 @@ qemu-kvm -net nic,model=? /dev/null + with x86 guests), usb-serial (usable whenever USB support + is available) and pci-serial (usable whenever PCI support + is available); since 3.10.0, +- spapr-vio-serial (usable with ppc64/pseries guests) +- is available as well. ++ spapr-vio-serial (usable with ppc64/pseries guests) and ++ system-serial (usable with aarch64/virt guests) are ++ available as well. +

    + +

    +@@ -6476,7 +6477,8 @@ qemu-kvm -net nic,model=? /dev/null + target type); pci-serial + (usable with the pci-serial target type); + spapr-vty (usable with the spapr-vio-serial +- target type). ++ target type); pl011 (usable with the ++ system-serial target type). +

    + +

    +@@ -6485,12 +6487,13 @@ qemu-kvm -net nic,model=? /dev/null +

    + +

    +- All of the target types support configuring the guest-visible device ++ Most target types support configuring the guest-visible device + address as documented above; more + specifically, acceptable address types are isa (for + isa-serial), usb (for usb-serial), + pci (for pci-serial) and spapr-vio +- (for spapr-vio-serial). ++ (for spapr-vio-serial). The system-serial ++ target type doesn't support specifying an address. +

    + +

    +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 027d9ae7a1..957eae2832 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -3572,6 +3572,7 @@ + usb-serial + pci-serial + spapr-vio-serial ++ system-serial + + + +@@ -3584,6 +3585,7 @@ + usb-serial + pci-serial + spapr-vty ++ pl011 + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 97c7a66b5b..32089df3c2 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -446,6 +446,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, + "usb-serial", + "pci-serial", + "spapr-vio-serial", ++ "system-serial", + ); + + VIR_ENUM_IMPL(virDomainChrChannelTarget, +@@ -474,6 +475,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, + "usb-serial", + "pci-serial", + "spapr-vty", ++ "pl011", + ); + + VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, +@@ -4063,6 +4065,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + switch ((virDomainChrSerialTargetType) def->serials[0]->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { + + /* Create a stub console to match the serial port. +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 979e8cca00..d6febf3059 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1078,6 +1078,7 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM, + + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST + } virDomainChrSerialTargetType; +@@ -1111,6 +1112,7 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011, + + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST + } virDomainChrSerialTargetModel; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 056dafea39..483eee6056 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -9230,6 +9230,7 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + return QEMU_CAPS_DEVICE_SPAPR_VTY; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; +@@ -9261,10 +9262,13 @@ qemuChrIsPlatformDevice(const virDomainDef *def, + virDomainChrDefPtr chr) + { + if (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) { +- /* TARGET_TYPE_ISA here really means 'the default platform device' */ ++ ++ /* pl011 (used on mach-virt) is a platform device */ + if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && +- chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) ++ chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM && ++ chr->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011) { + return true; ++ } + } + + /* If we got all the way here and we're still stuck with the default +@@ -10365,6 +10369,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + break; + ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + /* Except from _LAST, which is just a guard value and will never +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 17c898896d..2fc173fa45 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3468,6 +3468,7 @@ qemuDomainChrSerialTargetTypeToAddressType(int targetType) + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + break; +@@ -3489,6 +3490,8 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel) + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: ++ return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; +@@ -3525,6 +3528,16 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) + } + break; + ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Target type '%s' cannot have an " ++ "associated address"), ++ virDomainChrSerialTargetTypeToString(chr->targetType)); ++ return -1; ++ } ++ break; ++ + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + break; +@@ -3536,6 +3549,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + + expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel); + +@@ -3592,6 +3606,12 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, + isCompatible = false; + } + ++ if (!qemuDomainIsVirt(def) && ++ (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM || ++ dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011)) { ++ isCompatible = false; ++ } ++ + if (!isCompatible) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Serial device with target type '%s' and " +@@ -4243,6 +4263,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } else if (qemuDomainIsPSeries(def)) { + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; ++ } else if (qemuDomainIsVirt(def)) { ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; + } + } + +@@ -4262,6 +4284,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY; + break; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011; ++ break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ +@@ -5178,6 +5203,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, + if (flags & VIR_DOMAIN_XML_MIGRATABLE) { + switch ((virDomainChrSerialTargetType) serial->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + serial->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + serial->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE; + break; +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index f62bb2f97e..db9656a3a5 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -784,6 +784,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + return 0; +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args +new file mode 120000 +index 0000000000..1a90484d3b +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.args +@@ -0,0 +1 @@ ++qemuxml2argv-mach-virt-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml +new file mode 100644 +index 0000000000..6aba864d0b +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-native.xml +@@ -0,0 +1,17 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args +new file mode 100644 +index 0000000000..2a862bff18 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.args +@@ -0,0 +1,24 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-aarch64 \ ++-name guest \ ++-S \ ++-M virt \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-no-acpi \ ++-boot c \ ++-device virtio-serial,id=virtio-serial0 \ ++-chardev pty,id=charconsole0 \ ++-device virtconsole,chardev=charconsole0,id=console0 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml +new file mode 100644 +index 0000000000..92704504c8 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-console-virtio.xml +@@ -0,0 +1,19 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.args +new file mode 120000 +index 0000000000..1a90484d3b +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.args +@@ -0,0 +1 @@ ++qemuxml2argv-mach-virt-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.xml +new file mode 100644 +index 0000000000..549b764e98 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial+console-native.xml +@@ -0,0 +1,18 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args +new file mode 120000 +index 0000000000..1a90484d3b +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.args +@@ -0,0 +1 @@ ++qemuxml2argv-mach-virt-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml +new file mode 100644 +index 0000000000..9e6be3ffeb +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-compat.xml +@@ -0,0 +1,19 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.xml +new file mode 100644 +index 0000000000..a8de76abf9 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-invalid-machine.xml +@@ -0,0 +1,21 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-x86_64 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args +new file mode 100644 +index 0000000000..f4bfce376a +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.args +@@ -0,0 +1,23 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-aarch64 \ ++-name guest \ ++-S \ ++-M virt \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-no-acpi \ ++-boot c \ ++-chardev pty,id=charserial0 \ ++-serial chardev:charserial0 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml +new file mode 100644 +index 0000000000..817f606eea +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-native.xml +@@ -0,0 +1,16 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args +new file mode 100644 +index 0000000000..334194efe1 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.args +@@ -0,0 +1,26 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-aarch64 \ ++-name guest \ ++-S \ ++-M virt \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-no-acpi \ ++-boot c \ ++-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \ ++-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \ ++-device pcie-root-port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \ ++-chardev pty,id=charserial0 \ ++-device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml +new file mode 100644 +index 0000000000..29aa7664b1 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-pci.xml +@@ -0,0 +1,18 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args +new file mode 100644 +index 0000000000..44c4027acc +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.args +@@ -0,0 +1,27 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-aarch64 \ ++-name guest \ ++-S \ ++-M virt \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-no-acpi \ ++-boot c \ ++-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ ++addr=0x1 \ ++-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \ ++-device qemu-xhci,id=usb,bus=pci.1,addr=0x0 \ ++-chardev pty,id=charserial0 \ ++-device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml +new file mode 100644 +index 0000000000..35f192a3e5 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-mach-virt-serial-usb.xml +@@ -0,0 +1,21 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 2b3bbd1b8b..656b8c0995 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -1898,6 +1898,33 @@ mymain(void) + QEMU_CAPS_NODEFCONFIG); + DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); + ++ DO_TEST("mach-virt-serial-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial+console-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial-compat", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial-pci", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_OBJECT_GPEX, ++ QEMU_CAPS_PCI_MULTIFUNCTION, ++ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, ++ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, ++ QEMU_CAPS_DEVICE_PCI_BRIDGE, ++ QEMU_CAPS_DEVICE_PCI_SERIAL); ++ DO_TEST("mach-virt-serial-usb", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_OBJECT_GPEX, ++ QEMU_CAPS_PCI_MULTIFUNCTION, ++ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, ++ QEMU_CAPS_DEVICE_QEMU_XHCI, ++ QEMU_CAPS_DEVICE_USB_SERIAL); ++ DO_TEST("mach-virt-console-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-console-virtio", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE); ++ + DO_TEST("disk-ide-drive-split", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_IDE_CD); +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml +index e5496424b3..9796d7f637 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml +@@ -71,7 +71,9 @@ +

    + + +- ++ ++ ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml +new file mode 120000 +index 0000000000..a4768fcf86 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-native.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-mach-virt-serial-compat.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.xml +new file mode 100644 +index 0000000000..3e46cd2012 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-console-virtio.xml +@@ -0,0 +1,27 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-native.xml +new file mode 120000 +index 0000000000..a4768fcf86 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial+console-native.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-mach-virt-serial-compat.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml +new file mode 100644 +index 0000000000..3d7325a8db +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-compat.xml +@@ -0,0 +1,31 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml +new file mode 120000 +index 0000000000..a4768fcf86 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-native.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-mach-virt-serial-compat.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml +new file mode 100644 +index 0000000000..4bcf69a3d1 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-pci.xml +@@ -0,0 +1,44 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-aarch64 ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++ ++
    ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml +new file mode 100644 +index 0000000000..01c2a52555 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-mach-virt-serial-usb.xml +@@ -0,0 +1,41 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-aarch64 ++ ++
    ++ ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c +index f76bd5a68d..bd18507bb6 100644 +--- a/tests/qemuxml2xmltest.c ++++ b/tests/qemuxml2xmltest.c +@@ -788,6 +788,32 @@ mymain(void) + DO_TEST("pseries-console-virtio", + QEMU_CAPS_NODEFCONFIG); + ++ DO_TEST("mach-virt-serial-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial+console-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial-compat", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-serial-pci", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_OBJECT_GPEX, ++ QEMU_CAPS_PCI_MULTIFUNCTION, ++ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, ++ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, ++ QEMU_CAPS_DEVICE_PCI_BRIDGE, ++ QEMU_CAPS_DEVICE_PCI_SERIAL); ++ DO_TEST("mach-virt-serial-usb", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_OBJECT_GPEX, ++ QEMU_CAPS_PCI_MULTIFUNCTION, ++ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, ++ QEMU_CAPS_DEVICE_QEMU_XHCI, ++ QEMU_CAPS_DEVICE_USB_SERIAL); ++ DO_TEST("mach-virt-console-native", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST("mach-virt-console-virtio", ++ QEMU_CAPS_NODEFCONFIG); ++ + DO_TEST("balloon-device-auto", NONE); + DO_TEST("balloon-device-period", NONE); + DO_TEST("channel-virtio-auto", NONE); +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Add-target-type-and-model-for-spapr-vty.patch b/SOURCES/libvirt-conf-Add-target-type-and-model-for-spapr-vty.patch new file mode 100644 index 0000000..610c5a2 --- /dev/null +++ b/SOURCES/libvirt-conf-Add-target-type-and-model-for-spapr-vty.patch @@ -0,0 +1,1042 @@ +From fd981b46a6729b5d5dac4923b860f888b0c193b9 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:12 +0100 +Subject: [PATCH] conf: Add target type and model for spapr-vty + +We can finally introduce a specific target model for the spapr-vty +device used by pSeries guests, which means isa-serial will no longer +show up to confuse users. + +We make sure migration works in both directions by interpreting the +isa-serial target type, or the lack of target type, appropriately +when parsing the guest XML, and skipping the newly-introduced type +when formatting if for migration. We also verify that spapr-vty is +not used for non-pSeries guests and add a bunch of test cases. + +This commit is best viewed with 'git show -w'. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1511421 + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit c498a8921e447715189c8c6d22b7ca24cc810830) +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 13 ++-- + docs/schemas/domaincommon.rng | 2 + + src/conf/domain_conf.c | 6 +- + src/conf/domain_conf.h | 2 + + src/qemu/qemu_command.c | 67 +++++++++------------ + src/qemu/qemu_domain.c | 69 ++++++++++++++++++---- + src/qemu/qemu_domain_address.c | 1 + + .../qemuxml2argv-pseries-basic.args | 2 +- + .../qemuxml2argv-pseries-console-native.args | 1 + + .../qemuxml2argv-pseries-console-native.xml | 17 ++++++ + .../qemuxml2argv-pseries-console-virtio.args | 23 ++++++++ + .../qemuxml2argv-pseries-console-virtio.xml | 19 ++++++ + .../qemuxml2argv-pseries-cpu-compat-power9.args | 2 +- + .../qemuxml2argv-pseries-cpu-compat.args | 2 +- + .../qemuxml2argv-pseries-cpu-exact.args | 2 +- + .../qemuxml2argv-pseries-cpu-le.args | 2 +- + .../qemuxml2argv-pseries-panic-missing.args | 2 +- + .../qemuxml2argv-pseries-panic-no-address.args | 2 +- + ...qemuxml2argv-pseries-serial+console-native.args | 1 + + .../qemuxml2argv-pseries-serial+console-native.xml | 18 ++++++ + .../qemuxml2argv-pseries-serial-compat.args | 1 + + .../qemuxml2argv-pseries-serial-compat.xml | 19 ++++++ + ...qemuxml2argv-pseries-serial-invalid-machine.xml | 19 ++++++ + .../qemuxml2argv-pseries-serial-native.args | 22 +++++++ + .../qemuxml2argv-pseries-serial-native.xml | 16 +++++ + .../qemuxml2argv-pseries-usb-default.args | 2 +- + .../qemuxml2argv-pseries-usb-kbd.args | 2 +- + .../qemuxml2argv-pseries-usb-multi.args | 2 +- + .../qemuxml2argv-pseries-vio-user-assigned.args | 4 +- + .../qemuxml2argvdata/qemuxml2argv-pseries-vio.args | 4 +- + tests/qemuxml2argvtest.c | 16 +++++ + .../qemuxml2xmlout-panic-pseries.xml | 4 +- + .../qemuxml2xmlout-pseries-console-native.xml | 1 + + .../qemuxml2xmlout-pseries-console-virtio.xml | 31 ++++++++++ + .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 4 +- + .../qemuxml2xmlout-pseries-cpu-compat.xml | 4 +- + .../qemuxml2xmlout-pseries-cpu-exact.xml | 4 +- + .../qemuxml2xmlout-pseries-panic-missing.xml | 4 +- + .../qemuxml2xmlout-pseries-panic-no-address.xml | 4 +- + ...emuxml2xmlout-pseries-serial+console-native.xml | 1 + + .../qemuxml2xmlout-pseries-serial-compat.xml | 1 + + .../qemuxml2xmlout-pseries-serial-native.xml | 35 +++++++++++ + tests/qemuxml2xmltest.c | 15 +++++ + 43 files changed, 386 insertions(+), 82 deletions(-) + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml + create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native.xml + create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index cf1167b9c6..0634f3396a 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -6462,7 +6462,9 @@ qemu-kvm -net nic,model=? /dev/null + since 1.0.2, isa-serial (usable + with x86 guests), usb-serial (usable whenever USB support + is available) and pci-serial (usable whenever PCI support +- is available). ++ is available); since 3.10.0, ++ spapr-vio-serial (usable with ppc64/pseries guests) ++ is available as well. +

    + +

    +@@ -6472,7 +6474,9 @@ qemu-kvm -net nic,model=? /dev/null + isa-serial (usable with the isa-serial target + type); usb-serial (usable with the usb-serial + target type); pci-serial +- (usable with the pci-serial target type). ++ (usable with the pci-serial target type); ++ spapr-vty (usable with the spapr-vio-serial ++ target type). +

    + +

    +@@ -6484,8 +6488,9 @@ qemu-kvm -net nic,model=? /dev/null + All of the target types support configuring the guest-visible device + address as documented above; more + specifically, acceptable address types are isa (for +- isa-serial), usb (for usb-serial) +- and pci (for pci-serial). ++ isa-serial), usb (for usb-serial), ++ pci (for pci-serial) and spapr-vio ++ (for spapr-vio-serial). +

    + +

    +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 3630e539e6..027d9ae7a1 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -3571,6 +3571,7 @@ + isa-serial + usb-serial + pci-serial ++ spapr-vio-serial + + + +@@ -3582,6 +3583,7 @@ + isa-serial + usb-serial + pci-serial ++ spapr-vty + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 692b9d9414..97c7a66b5b 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -444,7 +444,9 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, + "none", + "isa-serial", + "usb-serial", +- "pci-serial") ++ "pci-serial", ++ "spapr-vio-serial", ++); + + VIR_ENUM_IMPL(virDomainChrChannelTarget, + VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST, +@@ -471,6 +473,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, + "isa-serial", + "usb-serial", + "pci-serial", ++ "spapr-vty", + ); + + VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, +@@ -4059,6 +4062,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + + switch ((virDomainChrSerialTargetType) def->serials[0]->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { + + /* Create a stub console to match the serial port. +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 9dfe9388cd..979e8cca00 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1077,6 +1077,7 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, + + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST + } virDomainChrSerialTargetType; +@@ -1109,6 +1110,7 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, + + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST + } virDomainChrSerialTargetModel; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index f8d5d317cd..91083dc73d 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -9227,6 +9227,8 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) + return QEMU_CAPS_DEVICE_USB_SERIAL; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + return QEMU_CAPS_DEVICE_PCI_SERIAL; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: ++ return QEMU_CAPS_DEVICE_SPAPR_VTY; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: +@@ -10354,52 +10356,39 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + virBuffer cmd = VIR_BUFFER_INITIALIZER; + virQEMUCapsFlags caps; + +- if (qemuDomainIsPSeries(def)) { +- if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && +- serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { +- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("spapr-vty not supported in this QEMU binary")); +- goto error; +- } ++ switch ((virDomainChrSerialTargetModel) serial->targetModel) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + +- virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", +- serial->info.alias); +- } +- } else { +- switch ((virDomainChrSerialTargetModel) serial->targetModel) { +- case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: +- case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: ++ caps = qemuChrSerialTargetModelToCaps(serial->targetModel); + +- caps = qemuChrSerialTargetModelToCaps(serial->targetModel); +- +- if (caps && !virQEMUCapsGet(qemuCaps, caps)) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +- _("'%s' is not supported in this QEMU binary"), +- virDomainChrSerialTargetModelTypeToString(serial->targetModel)); +- goto error; +- } +- break; +- +- case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: +- break; +- +- case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: +- case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: +- /* Except from _LAST, which is just a guard value and will never +- * be used, all of the above are platform devices, which means +- * qemuBuildSerialCommandLine() will have taken the appropriate +- * branch and we will not have ended up here. */ +- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +- _("Invalid target model for serial device")); ++ if (caps && !virQEMUCapsGet(qemuCaps, caps)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("'%s' is not supported in this QEMU binary"), ++ virDomainChrSerialTargetModelTypeToString(serial->targetModel)); + goto error; + } ++ break; + +- virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s", +- virDomainChrSerialTargetModelTypeToString(serial->targetModel), +- serial->info.alias, serial->info.alias); ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: ++ break; ++ ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: ++ /* Except from _LAST, which is just a guard value and will never ++ * be used, all of the above are platform devices, which means ++ * qemuBuildSerialCommandLine() will have taken the appropriate ++ * branch and we will not have ended up here. */ ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Invalid target model for serial device")); ++ goto error; + } + ++ virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s", ++ virDomainChrSerialTargetModelTypeToString(serial->targetModel), ++ serial->info.alias, serial->info.alias); ++ + if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0) + goto error; + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 7b5bc97de6..17c898896d 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3466,6 +3466,8 @@ qemuDomainChrSerialTargetTypeToAddressType(int targetType) + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + break; +@@ -3485,6 +3487,8 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel) + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: ++ return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; +@@ -3495,8 +3499,7 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel) + + + static int +-qemuDomainChrTargetDefValidate(const virDomainDef *def, +- const virDomainChrDef *chr) ++qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) + { + int expected; + +@@ -3508,11 +3511,7 @@ qemuDomainChrTargetDefValidate(const virDomainDef *def, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: +- +- /* Hack required until we have a proper type for pSeries +- * serial consoles */ +- if (qemuDomainIsPSeries(def)) +- return 0; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + + expected = qemuDomainChrSerialTargetTypeToAddressType(chr->targetType); + +@@ -3536,6 +3535,7 @@ qemuDomainChrTargetDefValidate(const virDomainDef *def, + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + + expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel); + +@@ -3573,7 +3573,7 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, + if (qemuDomainChrSourceDefValidate(dev->source) < 0) + return -1; + +- if (qemuDomainChrTargetDefValidate(def, dev) < 0) ++ if (qemuDomainChrTargetDefValidate(dev) < 0) + return -1; + + if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL && +@@ -3583,6 +3583,26 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, + return -1; + } + ++ if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { ++ bool isCompatible = true; ++ ++ if (!qemuDomainIsPSeries(def) && ++ (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO || ++ dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY)) { ++ isCompatible = false; ++ } ++ ++ if (!isCompatible) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Serial device with target type '%s' and " ++ "target model '%s' not compatible with guest " ++ "architecture or machine type"), ++ virDomainChrSerialTargetTypeToString(dev->targetType), ++ virDomainChrSerialTargetModelTypeToString(dev->targetModel)); ++ return -1; ++ } ++ } ++ + return 0; + } + +@@ -4222,10 +4242,7 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + if (ARCH_IS_X86(def->os.arch)) { + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; + } else if (qemuDomainIsPSeries(def)) { +- /* Setting TYPE_ISA here is just a temporary hack to reduce test +- * suite churn. Later on we will have a proper serial type for +- * pSeries and this line will be updated accordingly. */ +- chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; + } + } + +@@ -4242,6 +4259,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL; + break; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY; ++ break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ +@@ -5147,6 +5167,31 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, + goto cleanup; + } + ++ for (i = 0; i < def->nserials; i++) { ++ virDomainChrDefPtr serial = def->serials[i]; ++ ++ /* Historically, the native console type for some machine types ++ * was not set at all, which means it defaulted to ISA even ++ * though that was not even remotely accurate. To ensure migration ++ * towards older libvirt versions works for such guests, we switch ++ * it back to the default here */ ++ if (flags & VIR_DOMAIN_XML_MIGRATABLE) { ++ switch ((virDomainChrSerialTargetType) serial->targetType) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: ++ serial->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; ++ serial->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE; ++ break; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ /* Nothing to do */ ++ break; ++ } ++ } ++ } ++ + /* Replace the CPU definition updated according to QEMU with the one + * used for starting the domain. The updated def will be sent + * separately for backward compatibility. +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index 989c0e6c93..2319e503eb 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -782,6 +782,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + return 0; +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args +index 97a7057ba0..789d9f679e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args +@@ -20,4 +20,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args +new file mode 120000 +index 0000000000..d6c830ecdf +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.args +@@ -0,0 +1 @@ ++qemuxml2argv-pseries-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml +new file mode 100644 +index 0000000000..9f37bf0dec +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-native.xml +@@ -0,0 +1,17 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args +new file mode 100644 +index 0000000000..343018fb3e +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.args +@@ -0,0 +1,23 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-ppc64 \ ++-name guest \ ++-S \ ++-M pseries \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-boot c \ ++-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x1 \ ++-chardev pty,id=charconsole0 \ ++-device virtconsole,chardev=charconsole0,id=console0 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml +new file mode 100644 +index 0000000000..0190ab63ac +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-console-virtio.xml +@@ -0,0 +1,19 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args +index af93d63dc9..9bb375aeba 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat-power9.args +@@ -21,4 +21,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args +index 7740e2f5a9..5174aa760e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args +@@ -21,4 +21,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args +index d2c99a7fa3..3790deca8c 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-exact.args +@@ -21,4 +21,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args +index 97a7057ba0..789d9f679e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-le.args +@@ -20,4 +20,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args +index 97a7057ba0..789d9f679e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args +@@ -20,4 +20,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args +index 97a7057ba0..789d9f679e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args +@@ -20,4 +20,4 @@ server,nowait \ + -boot c \ + -usb \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args +new file mode 120000 +index 0000000000..d6c830ecdf +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.args +@@ -0,0 +1 @@ ++qemuxml2argv-pseries-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml +new file mode 100644 +index 0000000000..2733baa980 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial+console-native.xml +@@ -0,0 +1,18 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args +new file mode 120000 +index 0000000000..d6c830ecdf +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.args +@@ -0,0 +1 @@ ++qemuxml2argv-pseries-serial-native.args +\ No newline at end of file +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml +new file mode 100644 +index 0000000000..2e182edbd0 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-compat.xml +@@ -0,0 +1,19 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml +new file mode 100644 +index 0000000000..5482146a57 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-invalid-machine.xml +@@ -0,0 +1,19 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-x86_64 ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args +new file mode 100644 +index 0000000000..f72b8b6259 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.args +@@ -0,0 +1,22 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-ppc64 \ ++-name guest \ ++-S \ ++-M pseries \ ++-m 512 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-boot c \ ++-chardev pty,id=charserial0 \ ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml +new file mode 100644 +index 0000000000..6cec4bc9d3 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-serial-native.xml +@@ -0,0 +1,16 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args +index a92b1e01b1..37c0594032 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args +@@ -20,4 +20,4 @@ server,nowait \ + -boot c \ + -device pci-ohci,id=usb,bus=pci.0,addr=0x1 \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args +index caaccdbb8e..838b80453a 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-kbd.args +@@ -20,5 +20,5 @@ server,nowait \ + -boot c \ + -device pci-ohci,id=usb,bus=pci.0,addr=0x1 \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 \ ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \ + -device usb-kbd,id=input0,bus=usb.0,port=1 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args +index b9bd905a5d..56bc1d67ef 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args +@@ -21,4 +21,4 @@ server,nowait \ + -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1 \ + -device pci-ohci,id=usb1,bus=pci.0,addr=0x2 \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args +index 63cf3c1830..0fcfbe3796 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args +@@ -25,6 +25,6 @@ server,nowait \ + -device scsi-disk,bus=scsi1.0,channel=0,scsi-id=0,lun=0,\ + drive=drive-scsi1-0-0-0,id=scsi1-0-0-0 \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x20000000 \ ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x20000000 \ + -chardev pty,id=charserial1 \ +--device spapr-vty,chardev=charserial1,reg=0x30001000 ++-device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args +index 0294067bc8..8a9bdcc4cd 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args ++++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args +@@ -25,6 +25,6 @@ server,nowait \ + -device scsi-disk,bus=scsi1.0,channel=0,scsi-id=0,lun=0,\ + drive=drive-scsi1-0-0-0,id=scsi1-0-0-0 \ + -chardev pty,id=charserial0 \ +--device spapr-vty,chardev=charserial0,reg=0x30000000 \ ++-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \ + -chardev pty,id=charserial1 \ +--device spapr-vty,chardev=charserial1,reg=0x30001000 ++-device spapr-vty,chardev=charserial1,id=serial1,reg=0x30001000 +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 747ad24663..4b63dd141d 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -1875,6 +1875,22 @@ mymain(void) + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + ++ DO_TEST("pseries-serial-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-serial+console-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-serial-compat", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-console-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-console-virtio", ++ QEMU_CAPS_NODEFCONFIG); ++ DO_TEST_PARSE_ERROR("pseries-serial-invalid-machine", NONE); ++ + DO_TEST("disk-ide-drive-split", + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_IDE_CD); +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +index 496df0696c..484fe4cfa6 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +@@ -22,8 +22,8 @@ + + + +- +- ++ ++ + +

    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml +new file mode 120000 +index 0000000000..b0e645fc03 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-native.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-pseries-serial-native.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml +new file mode 100644 +index 0000000000..48760f2824 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-console-virtio.xml +@@ -0,0 +1,31 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ ++
    ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +index 9d4c5efe67..404bb0c768 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +@@ -25,8 +25,8 @@ + + + +- +- ++ ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +index 6059859abd..1891fa5f48 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +@@ -25,8 +25,8 @@ + + + +- +- ++ ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +index f3216523ed..f08f3e005f 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +@@ -26,8 +26,8 @@ + + + +- +- ++ ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +index 496df0696c..484fe4cfa6 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +@@ -22,8 +22,8 @@ + + + +- +- ++ ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +index 496df0696c..484fe4cfa6 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +@@ -22,8 +22,8 @@ + + + +- +- ++ ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native.xml +new file mode 120000 +index 0000000000..b0e645fc03 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial+console-native.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-pseries-serial-native.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml +new file mode 120000 +index 0000000000..b0e645fc03 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-compat.xml +@@ -0,0 +1 @@ ++qemuxml2xmlout-pseries-serial-native.xml +\ No newline at end of file +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml +new file mode 100644 +index 0000000000..fae7c54d5b +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-serial-native.xml +@@ -0,0 +1,35 @@ ++ ++ guest ++ 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 ++ 524288 ++ 524288 ++ 1 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-ppc64 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
    ++ ++ ++ ++
    ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c +index 6687997900..ad429ead4d 100644 +--- a/tests/qemuxml2xmltest.c ++++ b/tests/qemuxml2xmltest.c +@@ -766,6 +766,21 @@ mymain(void) + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + ++ DO_TEST("pseries-serial-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-serial+console-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-serial-compat", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-console-native", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY); ++ DO_TEST("pseries-console-virtio", ++ QEMU_CAPS_NODEFCONFIG); ++ + DO_TEST("balloon-device-auto", NONE); + DO_TEST("balloon-device-period", NONE); + DO_TEST("channel-virtio-auto", NONE); +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Check-CPU-cache-for-ABI-stability.patch b/SOURCES/libvirt-conf-Check-CPU-cache-for-ABI-stability.patch deleted file mode 100644 index 13fcb60..0000000 --- a/SOURCES/libvirt-conf-Check-CPU-cache-for-ABI-stability.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b768a8cb9fbd84a96f576d1dd7468f664200683f Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Wed, 10 May 2017 13:05:16 +0200 -Subject: [PATCH] conf: Check CPU cache for ABI stability - -Signed-off-by: Jiri Denemark -Reviewed-by: Daniel P. Berrange -(cherry picked from commit 1e9cf6e09ce242c94731bd21707dd3bcd41f854f) - -https://bugzilla.redhat.com/show_bug.cgi?id=1449595 - -Signed-off-by: Jiri Denemark ---- - src/conf/cpu_conf.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index 1b098c476..a4be5742e 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -915,6 +915,16 @@ virCPUDefIsEqual(virCPUDefPtr src, - } - } - -+ if ((src->cache && !dst->cache) || -+ (!src->cache && dst->cache) || -+ (src->cache && dst->cache && -+ (src->cache->level != dst->cache->level || -+ src->cache->mode != dst->cache->mode))) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("Target CPU cache does not match source")); -+ goto cleanup; -+ } -+ - identical = true; - - cleanup: --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-Check-virDomainChrSourceDefFormat-return-value.patch b/SOURCES/libvirt-conf-Check-virDomainChrSourceDefFormat-return-value.patch new file mode 100644 index 0000000..0193671 --- /dev/null +++ b/SOURCES/libvirt-conf-Check-virDomainChrSourceDefFormat-return-value.patch @@ -0,0 +1,123 @@ +From 73650fdd9de90d6f5a6f4a3c6c19d60368411b07 Mon Sep 17 00:00:00 2001 +Message-Id: <73650fdd9de90d6f5a6f4a3c6c19d60368411b07@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:02 +0100 +Subject: [PATCH] conf: Check virDomainChrSourceDefFormat() return value + +The function can fail, but none of the caller were accounting +for that. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 2cd323e382b4abfffda52fe49d1b50a087716e01) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index cf1bd030a0..346edaa6bd 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -24045,7 +24045,9 @@ virDomainChrDefFormat(virBufferPtr buf, + if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) + return -1; + virBufferAddLit(buf, ">\n"); +- virDomainChrSourceDefFormat(buf, def->source, flags); ++ ++ if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0) ++ return -1; + + if (virDomainChrTargetDefFormat(buf, def, flags) < 0) + return -1; +@@ -24066,13 +24068,14 @@ virDomainSmartcardDefFormat(virBufferPtr buf, + const char *mode = virDomainSmartcardTypeToString(def->type); + virBuffer childBuf = VIR_BUFFER_INITIALIZER; + size_t i; ++ int ret = -1; + + virBufferSetChildIndent(&childBuf, buf); + + if (!mode) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smartcard type %d"), def->type); +- return -1; ++ goto cleanup; + } + + switch (def->type) { +@@ -24089,23 +24092,25 @@ virDomainSmartcardDefFormat(virBufferPtr buf, + break; + + case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: +- virDomainChrSourceDefFormat(&childBuf, def->data.passthru, flags); ++ if (virDomainChrSourceDefFormat(&childBuf, def->data.passthru, flags) < 0) ++ goto cleanup; + break; + + default: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smartcard type %d"), def->type); +- return -1; ++ goto cleanup; + } + virDomainDeviceInfoFormat(&childBuf, &def->info, flags); + + if (virBufferCheckError(&childBuf) < 0) +- return -1; ++ goto cleanup; + + virBufferAsprintf(buf, "type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH && +- virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) +- return -1; ++ virDomainChrAttrsDefFormat(buf, def->data.passthru, false) < 0) { ++ goto cleanup; ++ } + + if (virBufferUse(&childBuf)) { + virBufferAddLit(buf, ">\n"); +@@ -24114,7 +24119,12 @@ virDomainSmartcardDefFormat(virBufferPtr buf, + } else { + virBufferAddLit(buf, "/>\n"); + } +- return 0; ++ ++ ret = 0; ++ ++ cleanup: ++ virBufferFreeAndReset(&childBuf); ++ return ret; + } + + static int +@@ -24416,7 +24426,8 @@ virDomainRNGDefFormat(virBufferPtr buf, + return -1; + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); +- virDomainChrSourceDefFormat(buf, def->source.chardev, flags); ++ if (virDomainChrSourceDefFormat(buf, def->source.chardev, flags) < 0) ++ return -1; + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + +@@ -25261,7 +25272,10 @@ virDomainRedirdevDefFormat(virBufferPtr buf, + return -1; + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); +- virDomainChrSourceDefFormat(buf, def->source, flags); ++ ++ if (virDomainChrSourceDefFormat(buf, def->source, flags) < 0) ++ return -1; ++ + virDomainDeviceInfoFormat(buf, &def->info, + flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT); + virBufferAdjustIndent(buf, -2); +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Don-t-assign-value-from-.TypeFromString-directly-to-enum.patch b/SOURCES/libvirt-conf-Don-t-assign-value-from-.TypeFromString-directly-to-enum.patch deleted file mode 100644 index 6d2a136..0000000 --- a/SOURCES/libvirt-conf-Don-t-assign-value-from-.TypeFromString-directly-to-enum.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 8c00ca78eed4ffdb9238b89b58eb5975baf5e339 Mon Sep 17 00:00:00 2001 -Message-Id: <8c00ca78eed4ffdb9238b89b58eb5975baf5e339@dist-git> -From: Peter Krempa -Date: Fri, 19 May 2017 12:24:11 +0200 -Subject: [PATCH] conf: Don't assign value from ..TypeFromString directly to - enum - -Enums are unsigned, so it's impossible to check whether the helper -returned -1 for invalid conversions. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452454 -(cherry picked from commit 85d62624c5d02c38e00a275dc2b2957584454908) - -Signed-off-by: Jiri Denemark ---- - src/conf/domain_conf.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 1653aa61d..a918ecd59 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -14065,6 +14065,7 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, - xmlNodePtr save = ctxt->node; - xmlNodePtr node; - virDomainMemoryDefPtr def; -+ int val; - - ctxt->node = memdevNode; - -@@ -14084,12 +14085,14 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, - } - VIR_FREE(tmp); - -- tmp = virXMLPropString(memdevNode, "access"); -- if (tmp && -- (def->access = virDomainMemoryAccessTypeFromString(tmp)) <= 0) { -- virReportError(VIR_ERR_XML_ERROR, -- _("invalid access mode '%s'"), tmp); -- goto error; -+ if ((tmp = virXMLPropString(memdevNode, "access"))) { -+ if ((val = virDomainMemoryAccessTypeFromString(tmp)) <= 0) { -+ virReportError(VIR_ERR_XML_ERROR, -+ _("invalid access mode '%s'"), tmp); -+ goto error; -+ } -+ -+ def->access = val; - } - VIR_FREE(tmp); - --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-Don-t-inline-virDomainNetTypeSharesHostView.patch b/SOURCES/libvirt-conf-Don-t-inline-virDomainNetTypeSharesHostView.patch new file mode 100644 index 0000000..76a771b --- /dev/null +++ b/SOURCES/libvirt-conf-Don-t-inline-virDomainNetTypeSharesHostView.patch @@ -0,0 +1,136 @@ +From 0597400171b44e0d180196b2c04da72f8b1f225f Mon Sep 17 00:00:00 2001 +Message-Id: <0597400171b44e0d180196b2c04da72f8b1f225f@dist-git> +From: Jiri Denemark +Date: Thu, 2 Nov 2017 19:58:00 +0100 +Subject: [PATCH] conf: Don't inline virDomainNetTypeSharesHostView + +When coverage build is enabled, gcc complains about it: + +In file included from qemu/qemu_agent.h:29:0, + from qemu/qemu_driver.c:47: +qemu/qemu_driver.c: In function 'qemuDomainSetInterfaceParameters': +./conf/domain_conf.h:3397:1: error: inlining failed in call to +'virDomainNetTypeSharesHostView': call is unlikely and code size would +grow [-Werror=inline] + virDomainNetTypeSharesHostView(const virDomainNetDef *net) + ^ + +Signed-off-by: Jiri Denemark +(cherry picked from commit bce925dadaf8fe4693abee88fb68aa7ede9d209e) + +https://bugzilla.redhat.com/show_bug.cgi?id=1472263 + +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 36 ++++++++++++++++++++++++++++++++++++ + src/conf/domain_conf.h | 37 +++---------------------------------- + src/libvirt_private.syms | 1 + + 3 files changed, 40 insertions(+), 34 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 77c20c6972..394afb0d80 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -28082,3 +28082,39 @@ virDomainGenerateMachineName(const char *drivername, + virBufferCheckError(&buf); + return virBufferContentAndReset(&buf); + } ++ ++ ++/** ++ * virDomainNetTypeSharesHostView: ++ * @net: interface ++ * ++ * Some types of interfaces "share" the host view. For instance, ++ * for macvtap interface, every domain RX is the host RX too. And ++ * every domain TX is host TX too. IOW, for some types of ++ * interfaces guest and host are on the same side of RX/TX ++ * barrier. This is important so that we set up QoS correctly and ++ * report proper stats. ++ */ ++bool ++virDomainNetTypeSharesHostView(const virDomainNetDef *net) ++{ ++ virDomainNetType actualType = virDomainNetGetActualType(net); ++ switch (actualType) { ++ case VIR_DOMAIN_NET_TYPE_DIRECT: ++ case VIR_DOMAIN_NET_TYPE_ETHERNET: ++ return true; ++ case VIR_DOMAIN_NET_TYPE_USER: ++ case VIR_DOMAIN_NET_TYPE_VHOSTUSER: ++ case VIR_DOMAIN_NET_TYPE_SERVER: ++ case VIR_DOMAIN_NET_TYPE_CLIENT: ++ case VIR_DOMAIN_NET_TYPE_MCAST: ++ case VIR_DOMAIN_NET_TYPE_NETWORK: ++ case VIR_DOMAIN_NET_TYPE_BRIDGE: ++ case VIR_DOMAIN_NET_TYPE_INTERNAL: ++ case VIR_DOMAIN_NET_TYPE_HOSTDEV: ++ case VIR_DOMAIN_NET_TYPE_UDP: ++ case VIR_DOMAIN_NET_TYPE_LAST: ++ break; ++ } ++ return false; ++} +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 38de70b154..171f340785 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -3382,40 +3382,9 @@ virDomainGenerateMachineName(const char *drivername, + int id, + const char *name, + bool privileged); +-/** +- * virDomainNetTypeSharesHostView: +- * @net: interface +- * +- * Some types of interfaces "share" the host view. For instance, +- * for macvtap interface, every domain RX is the host RX too. And +- * every domain TX is host TX too. IOW, for some types of +- * interfaces guest and host are on the same side of RX/TX +- * barrier. This is important so that we set up QoS correctly and +- * report proper stats. +- */ +-static inline bool +-virDomainNetTypeSharesHostView(const virDomainNetDef *net) +-{ +- virDomainNetType actualType = virDomainNetGetActualType(net); +- switch (actualType) { +- case VIR_DOMAIN_NET_TYPE_DIRECT: +- case VIR_DOMAIN_NET_TYPE_ETHERNET: +- return true; +- case VIR_DOMAIN_NET_TYPE_USER: +- case VIR_DOMAIN_NET_TYPE_VHOSTUSER: +- case VIR_DOMAIN_NET_TYPE_SERVER: +- case VIR_DOMAIN_NET_TYPE_CLIENT: +- case VIR_DOMAIN_NET_TYPE_MCAST: +- case VIR_DOMAIN_NET_TYPE_NETWORK: +- case VIR_DOMAIN_NET_TYPE_BRIDGE: +- case VIR_DOMAIN_NET_TYPE_INTERNAL: +- case VIR_DOMAIN_NET_TYPE_HOSTDEV: +- case VIR_DOMAIN_NET_TYPE_UDP: +- case VIR_DOMAIN_NET_TYPE_LAST: +- break; +- } +- return false; +-} ++ ++bool ++virDomainNetTypeSharesHostView(const virDomainNetDef *net); + + bool + virDomainDefLifecycleActionAllowed(virDomainLifecycle type, +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 448d962b2d..811d9053e6 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -444,6 +444,7 @@ virDomainNetInsert; + virDomainNetRemove; + virDomainNetRemoveHostdev; + virDomainNetTypeFromString; ++virDomainNetTypeSharesHostView; + virDomainNetTypeToString; + virDomainNostateReasonTypeFromString; + virDomainNostateReasonTypeToString; +-- +2.15.0 + diff --git a/SOURCES/libvirt-conf-Drop-virDomainChrDeviceType.targetTypeAttr.patch b/SOURCES/libvirt-conf-Drop-virDomainChrDeviceType.targetTypeAttr.patch new file mode 100644 index 0000000..ecce040 --- /dev/null +++ b/SOURCES/libvirt-conf-Drop-virDomainChrDeviceType.targetTypeAttr.patch @@ -0,0 +1,737 @@ +From 77bc396146f85ba8f767fd51f0238037cb9784cc Mon Sep 17 00:00:00 2001 +Message-Id: <77bc396146f85ba8f767fd51f0238037cb9784cc@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:59 +0100 +Subject: [PATCH] conf: Drop virDomainChrDeviceType.targetTypeAttr + +This attribute was used to decide whether to format the type +attribute of the element, but the logic didn't take into +account all possible cases and as such could lead to unexpected +results. Moreover, it's one more thing to keep track of, and can +easily fall out of sync with other attributes. + +Now that we have VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE, we can +use that value to signal that no specific target type has been +configured for the serial device and as such the attribute should +not be formatted at all. All other values are now formatted. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 4fb8ff9987b7e34d331c4af8f573db11579a0e88) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 11 ++++------- + src/conf/domain_conf.h | 1 - + src/vz/vz_sdk.c | 3 +-- + tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml | 4 ++-- + tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml | 4 ++-- + tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml | 2 +- + tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml | 2 +- + .../qemuhotplug-console-compat-2-live+console-virtio.xml | 4 ++-- + .../qemuhotplug-console-compat-2-live.xml | 4 ++-- + .../qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml | 4 ++-- + tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 4 ++-- + .../qemuxml2xmlout-bios-nvram-os-interleave.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml | 4 ++-- + .../qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml | 2 +- + .../qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml | 4 ++-- + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml | 2 +- + .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 2 +- + .../qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml | 2 +- + .../qemuxml2xmlout-pseries-panic-missing.xml | 2 +- + .../qemuxml2xmlout-pseries-panic-no-address.xml | 2 +- + .../qemuxml2xmlout-q35-virt-manager-basic.xml | 2 +- + .../qemuxml2xmlout-serial-spiceport-nospice.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml | 2 +- + .../qemuxml2xmlout-serial-target-port-auto.xml | 6 +++--- + .../qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml | 4 ++-- + .../qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml | 2 +- + tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml | 2 +- + 43 files changed, 56 insertions(+), 61 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 3a5ecd3a9d..586a840672 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -11499,8 +11499,7 @@ virDomainChrDefaultTargetType(int devtype) + } + + static int +-virDomainChrTargetTypeFromString(virDomainChrDefPtr def, +- int devtype, ++virDomainChrTargetTypeFromString(int devtype, + const char *targetType) + { + int ret = -1; +@@ -11528,8 +11527,6 @@ virDomainChrTargetTypeFromString(virDomainChrDefPtr def, + break; + } + +- def->targetTypeAttr = true; +- + return ret; + } + +@@ -11546,7 +11543,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def, + char *stateStr = NULL; + + if ((def->targetType = +- virDomainChrTargetTypeFromString(def, def->deviceType, ++ virDomainChrTargetTypeFromString(def->deviceType, + targetType)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown target type '%s' specified for character device"), +@@ -16466,7 +16463,7 @@ virDomainChrEquals(virDomainChrDefPtr src, + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: +- if (src->targetTypeAttr != tgt->targetTypeAttr) ++ if (src->targetType != tgt->targetType) + return false; + + ATTRIBUTE_FALLTHROUGH; +@@ -24026,7 +24023,7 @@ virDomainChrDefFormat(virBufferPtr buf, + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: +- if (def->targetTypeAttr) { ++ if (def->targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + virBufferAsprintf(buf, + "\n", + virDomainChrTargetTypeToString(def->deviceType, +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 9502573b34..bbb056cf21 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1199,7 +1199,6 @@ struct _virDomainChrSourceDef { + struct _virDomainChrDef { + int deviceType; /* enum virDomainChrDeviceType */ + +- bool targetTypeAttr; + int targetType; /* enum virDomainChrConsoleTargetType || + enum virDomainChrChannelTargetType || + enum virDomainChrSerialTargetType according to deviceType */ +diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c +index 3910deeb3a..c8de1b9598 100644 +--- a/src/vz/vz_sdk.c ++++ b/src/vz/vz_sdk.c +@@ -1191,7 +1191,6 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainChrDefPtr chr) + int ret = -1; + + chr->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; +- chr->targetTypeAttr = false; + pret = PrlVmDev_GetIndex(serialPort, &serialPortIndex); + prlsdkCheckRetGoto(pret, cleanup); + chr->target.port = serialPortIndex; +@@ -2864,7 +2863,7 @@ static int prlsdkCheckSerialUnsupportedParams(virDomainChrDefPtr chr) + return -1; + } + +- if (chr->targetTypeAttr) { ++ if (chr->targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Specified character device target type is not " + "supported by vz driver.")); +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml +index f512844427..7c106f145c 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-console-compat.xml +@@ -28,7 +28,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml +index aac814d59f..e76d0211dc 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-dev.xml +@@ -29,7 +29,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml +index 64819a48ae..ed67ada0d8 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-file.xml +@@ -29,7 +29,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +index e00afe317f..420771dc9c 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-many.xml +@@ -28,11 +28,11 @@ +
    + + +- ++ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml +index f512844427..7c106f145c 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-pty.xml +@@ -28,7 +28,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml +index c35a4ca73a..3fe61ffa05 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp-telnet.xml +@@ -30,7 +30,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml +index 0d218f5482..3fc9fd39b0 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-tcp.xml +@@ -30,7 +30,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +index f7069d541f..5b4af3fe95 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-udp.xml +@@ -30,11 +30,11 @@ + + + +- ++ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml +index 14fc8fc7c9..6bb291ff7f 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-unix.xml +@@ -29,7 +29,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml +index 95aa1c7b9b..41954fc85d 100644 +--- a/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml ++++ b/tests/qemuargv2xmldata/qemuargv2xml-serial-vc.xml +@@ -28,7 +28,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml +index 4e1dd49c22..427f431cce 100644 +--- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml ++++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live+console-virtio.xml +@@ -72,13 +72,13 @@ + + + +- ++ + + + + + +- ++ + + + +diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +index c56d13ef4a..144f6eff7a 100644 +--- a/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml ++++ b/tests/qemuhotplugtestdomains/qemuhotplug-console-compat-2-live.xml +@@ -72,13 +72,13 @@ + + + +- ++ + + + + + +- ++ + + + +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml +index a95e29ad8a..e6c4adb6f3 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml ++++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-tlsx509-chardev-notls.xml +@@ -29,12 +29,12 @@ + + + +- ++ + + + + +- ++ + + + +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +index c760098fe0..f9724d320e 100644 +--- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml ++++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +@@ -110,10 +110,10 @@ +
    + + +- ++ + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml +index 033e86d3a3..5ee73b527e 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-bios-nvram-os-interleave.xml +@@ -33,7 +33,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml +index 840bf69f61..ad77f62d9e 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-chardev-label.xml +@@ -25,13 +25,13 @@ + + + +- ++ + + + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml +index e76f857aee..cd9d75c4b7 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat-auto.xml +@@ -27,7 +27,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml +index 8dc361dfc6..0c0bd7b348 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat.xml +@@ -28,7 +28,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml +index 858b2c6750..305c53eab7 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-compat2.xml +@@ -31,7 +31,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml +index f9f9abd2df..b38b3ce987 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-console-virtio-many.xml +@@ -30,7 +30,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml +index 1c55017678..06192fbb4a 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-driver.xml +@@ -47,7 +47,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +index 95b6e2df1a..a6eaa38079 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +@@ -104,10 +104,10 @@ +
    + + +- ++ + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +index 7fe69bd6cb..e6ad234240 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +@@ -55,7 +55,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +index b631e5b515..66448ec3dd 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +@@ -44,7 +44,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml +index fd5fdbece5..b1240b8ed1 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml +@@ -57,7 +57,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml +index 4571b6a829..4f7ad323ed 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-mtu.xml +@@ -54,7 +54,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +index 7fb49feb0f..a563b6dddf 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +@@ -22,7 +22,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +index f020056219..59587b3c32 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml +@@ -25,7 +25,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +index 3cbce9fe6a..a39e1fd015 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml +@@ -25,7 +25,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +index d69b387686..666eede1a5 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml +@@ -26,7 +26,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +index 7fb49feb0f..a563b6dddf 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +@@ -22,7 +22,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +index 7fb49feb0f..a563b6dddf 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +@@ -22,7 +22,7 @@ + + + +- ++ +
    + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml +index c4ccd98aac..27baaa3f14 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml +@@ -79,7 +79,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml +index 79c4ebc734..63462e6f94 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport-nospice.xml +@@ -28,7 +28,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +index 9527b2d15f..c90bbeb7d5 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +@@ -28,7 +28,7 @@ + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml +index 71516a31a9..a8790b5098 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-target-port-auto.xml +@@ -27,13 +27,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml +index 18f51e5383..a8af87b53b 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-tcp-tlsx509-chardev.xml +@@ -29,12 +29,12 @@ + + + +- ++ + + + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +index 3a95b6088c..6d847de3a2 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost-incorrect.xml +@@ -40,7 +40,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +index 759b844395..30989658f4 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-tap-vhost.xml +@@ -47,7 +47,7 @@ +
    + + +- ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml +index 8c27470ddf..72cbcc4cb5 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vhost_queues.xml +@@ -46,7 +46,7 @@ +
    + + +- ++ + + + +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Fix-memory-leak-for-distances-in-virDomainNumaFree.patch b/SOURCES/libvirt-conf-Fix-memory-leak-for-distances-in-virDomainNumaFree.patch new file mode 100644 index 0000000..3747582 --- /dev/null +++ b/SOURCES/libvirt-conf-Fix-memory-leak-for-distances-in-virDomainNumaFree.patch @@ -0,0 +1,35 @@ +From 8e0151c7b6ce80dc8145511848155e6170ce2bf6 Mon Sep 17 00:00:00 2001 +Message-Id: <8e0151c7b6ce80dc8145511848155e6170ce2bf6@dist-git> +From: John Ferlan +Date: Mon, 4 Dec 2017 13:38:53 +0100 +Subject: [PATCH] conf: Fix memory leak for distances in virDomainNumaFree + +https://bugzilla.redhat.com/show_bug.cgi?id=1454889 + +Commit id '74119a03f' neglected to clean up @distances when +the numa definition is cleaned up. + +(cherry picked from commit 9f0ccc717ba9026c30ce38951a354dd66fa12e3b) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + src/conf/numa_conf.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c +index 8fc3b0a196..466b64d5fa 100644 +--- a/src/conf/numa_conf.c ++++ b/src/conf/numa_conf.c +@@ -362,6 +362,9 @@ virDomainNumaFree(virDomainNumaPtr numa) + for (i = 0; i < numa->nmem_nodes; i++) { + virBitmapFree(numa->mem_nodes[i].cpumask); + virBitmapFree(numa->mem_nodes[i].nodeset); ++ ++ if (numa->mem_nodes[i].ndistances > 0) ++ VIR_FREE(numa->mem_nodes[i].distances); + } + VIR_FREE(numa->mem_nodes); + +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Fix-message-when-maximum-vCPU-count-is-less-than-current.patch b/SOURCES/libvirt-conf-Fix-message-when-maximum-vCPU-count-is-less-than-current.patch new file mode 100644 index 0000000..69ef6d6 --- /dev/null +++ b/SOURCES/libvirt-conf-Fix-message-when-maximum-vCPU-count-is-less-than-current.patch @@ -0,0 +1,37 @@ +From 73e3efc5dae126514b00a8538664609810cadbc4 Mon Sep 17 00:00:00 2001 +Message-Id: <73e3efc5dae126514b00a8538664609810cadbc4@dist-git> +From: Peter Krempa +Date: Mon, 13 Nov 2017 13:48:09 +0100 +Subject: [PATCH] conf: Fix message when maximum vCPU count is less than + current + +Reword the message and drop the numbers (which were reversed) from it +so that it actually makes sense. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509151 +(cherry picked from commit 50712e14f40ffdac8a71ce9ef091e4e7bd822585) +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 3b337d1a64..ca5d0bcc54 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -1505,9 +1505,9 @@ virDomainDefSetVcpus(virDomainDefPtr def, + size_t i; + + if (vcpus > def->maxvcpus) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +- _("maxvcpus must not be less than current vcpus (%u < %zu)"), +- vcpus, def->maxvcpus); ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("maximum vCPU count must not be less than current " ++ "vCPU count")); + return -1; + } + +-- +2.15.0 + diff --git a/SOURCES/libvirt-conf-Format-cache-banks-in-capabilities-with-virFormatIntPretty.patch b/SOURCES/libvirt-conf-Format-cache-banks-in-capabilities-with-virFormatIntPretty.patch new file mode 100644 index 0000000..a1d532b --- /dev/null +++ b/SOURCES/libvirt-conf-Format-cache-banks-in-capabilities-with-virFormatIntPretty.patch @@ -0,0 +1,166 @@ +From 5a978253cced5135a6dd01c730faea2fd21a5dc9 Mon Sep 17 00:00:00 2001 +Message-Id: <5a978253cced5135a6dd01c730faea2fd21a5dc9@dist-git> +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:18 +0100 +Subject: [PATCH] conf: Format cache banks in capabilities with + virFormatIntPretty + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Signed-off-by: Martin Kletzander +Reviewed-by: John Ferlan +(cherry picked from commit 63d95a19cc72d120d40092c1e97235d7b9d4eb29) +Signed-off-by: Martin Kletzander +--- + src/conf/capabilities.c | 50 ++++++++++++++-------- + tests/vircaps2xmldata/vircaps-x86_64-caches.xml | 2 +- + .../vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml | 4 +- + .../vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml | 4 +- + tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml | 4 +- + 5 files changed, 39 insertions(+), 25 deletions(-) + +diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c +index 1f7d8cdb31..798c9bdaea 100644 +--- a/src/conf/capabilities.c ++++ b/src/conf/capabilities.c +@@ -883,7 +883,8 @@ virCapabilitiesFormatCaches(virBufferPtr buf, + for (i = 0; i < ncaches; i++) { + virCapsHostCacheBankPtr bank = caches[i]; + char *cpus_str = virBitmapFormat(bank->cpus); +- bool kilos = !(bank->size % 1024); ++ const char *unit = NULL; ++ unsigned long long short_size = virFormatIntPretty(bank->size, &unit); + + if (!cpus_str) + return -1; +@@ -897,34 +898,47 @@ virCapabilitiesFormatCaches(virBufferPtr buf, + "size='%llu' unit='%s' cpus='%s'", + bank->id, bank->level, + virCacheTypeToString(bank->type), +- bank->size >> (kilos * 10), +- kilos ? "KiB" : "B", +- cpus_str); ++ short_size, unit, cpus_str); + VIR_FREE(cpus_str); + + virBufferSetChildIndent(&controlBuf, buf); + for (j = 0; j < bank->ncontrols; j++) { +- bool min_kilos = !(bank->controls[j]->granularity % 1024); ++ const char *min_unit; ++ virResctrlInfoPtr controls = bank->controls[j]; ++ unsigned long long gran_short_size = controls->granularity; ++ unsigned long long min_short_size = controls->min; + +- /* Only use KiB if both values are divisible */ +- if (bank->controls[j]->min) +- min_kilos = min_kilos && !(bank->controls[j]->min % 1024); ++ gran_short_size = virFormatIntPretty(gran_short_size, &unit); ++ min_short_size = virFormatIntPretty(min_short_size, &min_unit); + +- virBufferAsprintf(&controlBuf, +- "controls[j]->granularity >> (min_kilos * 10)); ++ /* Only use the smaller unit if they are different */ ++ if (min_short_size) { ++ unsigned long long gran_div; ++ unsigned long long min_div; + +- if (bank->controls[j]->min) { +- virBufferAsprintf(&controlBuf, +- " min='%llu'", +- bank->controls[j]->min >> (min_kilos * 10)); ++ gran_div = controls->granularity / gran_short_size; ++ min_div = controls->min / min_short_size; ++ ++ if (min_div > gran_div) { ++ min_short_size *= min_div / gran_div; ++ } else if (min_div < gran_div) { ++ unit = min_unit; ++ gran_short_size *= gran_div / min_div; ++ } + } + ++ virBufferAsprintf(&controlBuf, ++ "\n", +- min_kilos ? "KiB" : "B", +- virCacheTypeToString(bank->controls[j]->scope), +- bank->controls[j]->max_allocation); ++ unit, ++ virCacheTypeToString(controls->scope), ++ controls->max_allocation); + } + + if (virBufferCheckError(&controlBuf) < 0) +diff --git a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml +index fe0be6d08f..0c6f3769a2 100644 +--- a/tests/vircaps2xmldata/vircaps-x86_64-caches.xml ++++ b/tests/vircaps2xmldata/vircaps-x86_64-caches.xml +@@ -29,7 +29,7 @@ + + + +- ++ + + + +diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml +index 7361537bfb..443917c62d 100644 +--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml ++++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml +@@ -41,11 +41,11 @@ + + + +- ++ + + + +- ++ + + + +diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml +index 4e91c87de3..0cd25e59a9 100644 +--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml ++++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml +@@ -22,8 +22,8 @@ + + + +- +- ++ ++ + + + +diff --git a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml +index eb02ad3322..7629259294 100644 +--- a/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml ++++ b/tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml +@@ -41,10 +41,10 @@ + + + +- ++ + + +- ++ + + + +-- +2.16.1 + diff --git a/SOURCES/libvirt-conf-Improve-error-handling-in-virDomainChrDefFormat.patch b/SOURCES/libvirt-conf-Improve-error-handling-in-virDomainChrDefFormat.patch new file mode 100644 index 0000000..d3f07fc --- /dev/null +++ b/SOURCES/libvirt-conf-Improve-error-handling-in-virDomainChrDefFormat.patch @@ -0,0 +1,54 @@ +From f2dd85b3b81cd5c0842ffb55554c1a9cb5e8764b Mon Sep 17 00:00:00 2001 +Message-Id: +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:01 +0100 +Subject: [PATCH] conf: Improve error handling in virDomainChrDefFormat() + +We don't need to store the return value since we never modify it. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit be956c4e38770dd61998815bbea4b7c2fc38a7d6) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index d68a5f415c..cf1bd030a0 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -24028,8 +24028,6 @@ virDomainChrDefFormat(virBufferPtr buf, + const char *elementName = virDomainChrDeviceTypeToString(def->deviceType); + bool tty_compat; + +- int ret = 0; +- + if (!elementName) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected char device type %d"), +@@ -24050,14 +24048,14 @@ virDomainChrDefFormat(virBufferPtr buf, + virDomainChrSourceDefFormat(buf, def->source, flags); + + if (virDomainChrTargetDefFormat(buf, def, flags) < 0) +- return -1; ++ return -1; + + virDomainDeviceInfoFormat(buf, &def->info, flags); + + virBufferAdjustIndent(buf, -2); + virBufferAsprintf(buf, "\n", elementName); + +- return ret; ++ return 0; + } + + static int +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Improve-virDomainChrTargetDefFormat.patch b/SOURCES/libvirt-conf-Improve-virDomainChrTargetDefFormat.patch new file mode 100644 index 0000000..5d75d47 --- /dev/null +++ b/SOURCES/libvirt-conf-Improve-virDomainChrTargetDefFormat.patch @@ -0,0 +1,89 @@ +From 6e8cb0e122f7c269d1252ed7d55a7c82ae0062eb Mon Sep 17 00:00:00 2001 +Message-Id: <6e8cb0e122f7c269d1252ed7d55a7c82ae0062eb@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:03 +0100 +Subject: [PATCH] conf: Improve virDomainChrTargetDefFormat() + +Make the switch statement type-aware, avoid calling +virDomainChrTargetTypeToString() more than once and check its +return value before using it. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 46084f2aa1e9188709fcd7abc5c41fe165b2b19b) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 29 ++++++++++++++++++++++------- + 1 file changed, 22 insertions(+), 7 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 346edaa6bd..2489705d6b 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -23945,7 +23945,7 @@ virDomainChrTargetDefFormat(virBufferPtr buf, + const char *targetType = virDomainChrTargetTypeToString(def->deviceType, + def->targetType); + +- switch (def->deviceType) { ++ switch ((virDomainChrDeviceType) def->deviceType) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: { + if (!targetType) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +@@ -23992,28 +23992,43 @@ virDomainChrTargetDefFormat(virBufferPtr buf, + } + + case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: ++ if (!targetType) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Could not format console target type")); ++ return -1; ++ } ++ + virBufferAsprintf(buf, + "\n", +- virDomainChrTargetTypeToString(def->deviceType, +- def->targetType), +- def->target.port); ++ targetType, def->target.port); + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: ++ if (!targetType) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Could not format serial target type")); ++ return -1; ++ } ++ + if (def->targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + virBufferAsprintf(buf, + "\n", +- virDomainChrTargetTypeToString(def->deviceType, +- def->targetType), ++ targetType, + def->target.port); + break; + } + ATTRIBUTE_FALLTHROUGH; + +- default: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: + virBufferAsprintf(buf, "\n", + def->target.port); + break; ++ ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("unexpected char device type %d"), ++ def->deviceType); ++ return -1; + } + + return 0; +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Introduce-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE.patch b/SOURCES/libvirt-conf-Introduce-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE.patch new file mode 100644 index 0000000..18c006d --- /dev/null +++ b/SOURCES/libvirt-conf-Introduce-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE.patch @@ -0,0 +1,159 @@ +From 4f4db541098163a2061cd63ce6bfb83ce2ed38b5 Mon Sep 17 00:00:00 2001 +Message-Id: <4f4db541098163a2061cd63ce6bfb83ce2ed38b5@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:58 +0100 +Subject: [PATCH] conf: Introduce VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE + +This is the first step in getting rid of the assumption that +isa-serial is the default target type for serial devices. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 6385c8c14233388d929ed62717684e7352543416) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 8 +++++--- + src/conf/domain_conf.h | 3 ++- + src/qemu/qemu_command.c | 13 +++++++++++++ + src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ + src/qemu/qemu_domain_address.c | 1 + + 5 files changed, 42 insertions(+), 4 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 41674a85af..3a5ecd3a9d 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -441,6 +441,7 @@ VIR_ENUM_IMPL(virDomainChrDeviceState, VIR_DOMAIN_CHR_DEVICE_STATE_LAST, + + VIR_ENUM_IMPL(virDomainChrSerialTarget, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST, ++ "none", + "isa-serial", + "usb-serial", + "pci-serial") +@@ -4025,7 +4026,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + + /* modify it to be a serial port */ + def->serials[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; +- def->serials[0]->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; ++ def->serials[0]->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + def->serials[0]->target.port = 0; + } else { + /* if the console source doesn't match */ +@@ -4049,7 +4050,8 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + def->serials[0]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { + + switch ((virDomainChrSerialTargetType) def->serials[0]->targetType) { +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { + + /* Create a stub console to match the serial port. + * console[0] either does not exist +@@ -11485,7 +11487,7 @@ virDomainChrDefaultTargetType(int devtype) + return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: +- return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; ++ return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: + case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 09635763a1..9502573b34 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1073,7 +1073,8 @@ typedef enum { + } virDomainChrDeviceType; + + typedef enum { +- VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA = 0, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE = 0, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 3d970ed9d1..d593e60198 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -9255,6 +9255,14 @@ qemuChrIsPlatformDevice(const virDomainDef *def, + return true; + } + ++ /* If we got all the way here and we're still stuck with the default ++ * target type for a serial device, it means we have no clue what kind of ++ * device we're talking about and we must treat it as a platform device. */ ++ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && ++ chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { ++ return true; ++ } ++ + return false; + } + +@@ -10378,7 +10386,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + } + break; + ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ /* Except from _LAST, which is just a guard value and will never ++ * be used, all of the above are platform devices, which means ++ * qemuBuildSerialCommandLine() will have taken the appropriate ++ * branch and we will not have ended up here. */ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid target type for serial device")); + goto error; +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index b15d994774..e43f7496c2 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -4095,6 +4095,27 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; + } + ++ /* Historically, isa-serial and the default matched, so in order to ++ * maintain backwards compatibility we map them here. The actual default ++ * will be picked below based on the architecture and machine type. */ ++ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && ++ chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) { ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE; ++ } ++ ++ /* Set the default serial type */ ++ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && ++ chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { ++ if (ARCH_IS_X86(def->os.arch)) { ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; ++ } else if (qemuDomainIsPSeries(def)) { ++ /* Setting TYPE_ISA here is just a temporary hack to reduce test ++ * suite churn. Later on we will have a proper serial type for ++ * pSeries and this line will be updated accordingly. */ ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; ++ } ++ } ++ + /* clear auto generated unix socket path for inactive definitions */ + if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { + if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index 7f4ac0f45a..989c0e6c93 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -782,6 +782,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + return 0; + } +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Introduce-virCPUDefFindFeature.patch b/SOURCES/libvirt-conf-Introduce-virCPUDefFindFeature.patch deleted file mode 100644 index 2ffc775..0000000 --- a/SOURCES/libvirt-conf-Introduce-virCPUDefFindFeature.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 2d9d40cfec0aa5db556ca62395671dc340b6bf93 Mon Sep 17 00:00:00 2001 -Message-Id: <2d9d40cfec0aa5db556ca62395671dc340b6bf93@dist-git> -From: Jiri Denemark -Date: Mon, 9 Oct 2017 16:20:43 +0200 -Subject: [PATCH] conf: Introduce virCPUDefFindFeature - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 3276416904393a06df664c5d849ee805d07688d8) - -Conflicts: - src/conf/cpu_conf.h - context, two more new function prototypes - in the header file upstream - -https://bugzilla.redhat.com/show_bug.cgi?id=1508549 - -Signed-off-by: Jiri Denemark ---- - src/conf/cpu_conf.c | 40 +++++++++++++++++++++++++++------------- - src/conf/cpu_conf.h | 4 ++++ - src/libvirt_private.syms | 1 + - 3 files changed, 32 insertions(+), 13 deletions(-) - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index da40e9ba97..e570dffcd2 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -773,24 +773,22 @@ virCPUDefUpdateFeatureInternal(virCPUDefPtr def, - int policy, - bool update) - { -- size_t i; -+ virCPUFeatureDefPtr feat; - - if (def->type == VIR_CPU_TYPE_HOST) - policy = -1; - -- for (i = 0; i < def->nfeatures; i++) { -- if (STREQ(name, def->features[i].name)) { -- if (update) { -- def->features[i].policy = policy; -- return 0; -- } -- -- virReportError(VIR_ERR_INTERNAL_ERROR, -- _("CPU feature '%s' specified more than once"), -- name); -- -- return -1; -+ if ((feat = virCPUDefFindFeature(def, name))) { -+ if (update) { -+ feat->policy = policy; -+ return 0; - } -+ -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("CPU feature '%s' specified more than once"), -+ name); -+ -+ return -1; - } - - if (VIR_RESIZE_N(def->features, def->nfeatures_max, -@@ -822,6 +820,22 @@ virCPUDefAddFeature(virCPUDefPtr def, - return virCPUDefUpdateFeatureInternal(def, name, policy, false); - } - -+ -+virCPUFeatureDefPtr -+virCPUDefFindFeature(virCPUDefPtr def, -+ const char *name) -+{ -+ size_t i; -+ -+ for (i = 0; i < def->nfeatures; i++) { -+ if (STREQ(name, def->features[i].name)) -+ return def->features + i; -+ } -+ -+ return NULL; -+} -+ -+ - bool - virCPUDefIsEqual(virCPUDefPtr src, - virCPUDefPtr dst, -diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index b44974f47e..1978814d36 100644 ---- a/src/conf/cpu_conf.h -+++ b/src/conf/cpu_conf.h -@@ -218,4 +218,8 @@ virCPUDefUpdateFeature(virCPUDefPtr cpu, - const char *name, - int policy); - -+virCPUFeatureDefPtr -+virCPUDefFindFeature(virCPUDefPtr def, -+ const char *name); -+ - #endif /* __VIR_CPU_CONF_H__ */ -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index 9c596e3f1c..62ebb8180e 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -74,6 +74,7 @@ virCPUDefCopy; - virCPUDefCopyModel; - virCPUDefCopyModelFilter; - virCPUDefCopyWithoutModel; -+virCPUDefFindFeature; - virCPUDefFormat; - virCPUDefFormatBuf; - virCPUDefFormatBufFull; --- -2.15.0 - diff --git a/SOURCES/libvirt-conf-Introduce-virDomainChrTargetDefFormat.patch b/SOURCES/libvirt-conf-Introduce-virDomainChrTargetDefFormat.patch new file mode 100644 index 0000000..b4d2573 --- /dev/null +++ b/SOURCES/libvirt-conf-Introduce-virDomainChrTargetDefFormat.patch @@ -0,0 +1,115 @@ +From 10d833e6bb2798e23beb01ac50d6588bec15b8ad Mon Sep 17 00:00:00 2001 +Message-Id: <10d833e6bb2798e23beb01ac50d6588bec15b8ad@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:00 +0100 +Subject: [PATCH] conf: Introduce virDomainChrTargetDefFormat() + +Move formatting of the element for char devices out of +virDomainChrDefFormat() and into its own function. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 00b7f81fa8f4e32a722ee2ccbb1862f03be062c0) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 67 ++++++++++++++++++++++++++++++-------------------- + 1 file changed, 40 insertions(+), 27 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 586a840672..d68a5f415c 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -23936,38 +23936,15 @@ virDomainChrSourceDefFormat(virBufferPtr buf, + return -1; + } + ++ + static int +-virDomainChrDefFormat(virBufferPtr buf, +- virDomainChrDefPtr def, +- unsigned int flags) ++virDomainChrTargetDefFormat(virBufferPtr buf, ++ const virDomainChrDef *def, ++ unsigned int flags) + { +- const char *elementName = virDomainChrDeviceTypeToString(def->deviceType); + const char *targetType = virDomainChrTargetTypeToString(def->deviceType, + def->targetType); +- bool tty_compat; + +- int ret = 0; +- +- if (!elementName) { +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("unexpected char device type %d"), +- def->deviceType); +- return -1; +- } +- +- virBufferAsprintf(buf, "<%s", elementName); +- virBufferAdjustIndent(buf, 2); +- tty_compat = (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && +- def->target.port == 0 && +- def->source->type == VIR_DOMAIN_CHR_TYPE_PTY && +- !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && +- def->source->data.file.path); +- if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) +- return -1; +- virBufferAddLit(buf, ">\n"); +- virDomainChrSourceDefFormat(buf, def->source, flags); +- +- /* Format block */ + switch (def->deviceType) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: { + if (!targetType) { +@@ -24039,6 +24016,42 @@ virDomainChrDefFormat(virBufferPtr buf, + break; + } + ++ return 0; ++} ++ ++ ++static int ++virDomainChrDefFormat(virBufferPtr buf, ++ virDomainChrDefPtr def, ++ unsigned int flags) ++{ ++ const char *elementName = virDomainChrDeviceTypeToString(def->deviceType); ++ bool tty_compat; ++ ++ int ret = 0; ++ ++ if (!elementName) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("unexpected char device type %d"), ++ def->deviceType); ++ return -1; ++ } ++ ++ virBufferAsprintf(buf, "<%s", elementName); ++ virBufferAdjustIndent(buf, 2); ++ tty_compat = (def->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && ++ def->target.port == 0 && ++ def->source->type == VIR_DOMAIN_CHR_TYPE_PTY && ++ !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && ++ def->source->data.file.path); ++ if (virDomainChrAttrsDefFormat(buf, def->source, tty_compat) < 0) ++ return -1; ++ virBufferAddLit(buf, ">\n"); ++ virDomainChrSourceDefFormat(buf, def->source, flags); ++ ++ if (virDomainChrTargetDefFormat(buf, def, flags) < 0) ++ return -1; ++ + virDomainDeviceInfoFormat(buf, &def->info, flags); + + virBufferAdjustIndent(buf, -2); +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Introduce-virSaveCookie.patch b/SOURCES/libvirt-conf-Introduce-virSaveCookie.patch deleted file mode 100644 index fedfc8b..0000000 --- a/SOURCES/libvirt-conf-Introduce-virSaveCookie.patch +++ /dev/null @@ -1,290 +0,0 @@ -From 5785b4ff7c33f5e2eb16530f20b6b45d8809aae7 Mon Sep 17 00:00:00 2001 -Message-Id: <5785b4ff7c33f5e2eb16530f20b6b45d8809aae7@dist-git> -From: Jiri Denemark -Date: Fri, 2 Jun 2017 00:44:06 +0200 -Subject: [PATCH] conf: Introduce virSaveCookie - -The code will be used by snapshots and domain save/restore code to store -additional data for a saved running domain. It is analogous to migration -cookies, but simple and one way only. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit e37daa1fb69ec30042cbc38d489217edb656bc30) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - po/POTFILES.in | 1 + - src/Makefile.am | 1 + - src/conf/virsavecookie.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++ - src/conf/virsavecookie.h | 62 ++++++++++++++++++++ - src/libvirt_private.syms | 7 +++ - 5 files changed, 215 insertions(+) - create mode 100644 src/conf/virsavecookie.c - create mode 100644 src/conf/virsavecookie.h - -diff --git a/po/POTFILES.in b/po/POTFILES.in -index 064abd5bbb..cf64115719 100644 ---- a/po/POTFILES.in -+++ b/po/POTFILES.in -@@ -47,6 +47,7 @@ src/conf/virdomainobjlist.c - src/conf/virinterfaceobj.c - src/conf/virnodedeviceobj.c - src/conf/virnwfilterobj.c -+src/conf/virsavecookie.c - src/conf/virsecretobj.c - src/conf/virstorageobj.c - src/cpu/cpu.c -diff --git a/src/Makefile.am b/src/Makefile.am -index 75e4344198..53550280bf 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -336,6 +336,7 @@ DOMAIN_CONF_SOURCES = \ - conf/domain_conf.c conf/domain_conf.h \ - conf/domain_audit.c conf/domain_audit.h \ - conf/domain_nwfilter.c conf/domain_nwfilter.h \ -+ conf/virsavecookie.c conf/virsavecookie.h \ - conf/snapshot_conf.c conf/snapshot_conf.h \ - conf/numa_conf.c conf/numa_conf.h \ - conf/virdomainobjlist.c conf/virdomainobjlist.h -diff --git a/src/conf/virsavecookie.c b/src/conf/virsavecookie.c -new file mode 100644 -index 0000000000..502c04d0f4 ---- /dev/null -+++ b/src/conf/virsavecookie.c -@@ -0,0 +1,144 @@ -+/** -+ * virsavecookie.c: Save cookie handling -+ * -+ * Copyright (C) 2017 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see -+ * . -+ */ -+ -+#include -+ -+#include "virerror.h" -+#include "virlog.h" -+#include "virobject.h" -+#include "virbuffer.h" -+#include "virxml.h" -+#include "virsavecookie.h" -+ -+#define VIR_FROM_THIS VIR_FROM_CONF -+ -+VIR_LOG_INIT("conf.savecookie"); -+ -+ -+static int -+virSaveCookieParseNode(xmlXPathContextPtr ctxt, -+ virObjectPtr *obj, -+ virSaveCookieCallbacksPtr saveCookie) -+{ -+ *obj = NULL; -+ -+ if (!xmlStrEqual(ctxt->node->name, BAD_CAST "cookie")) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("XML does not contain expected 'cookie' element")); -+ return -1; -+ } -+ -+ if (!saveCookie || !saveCookie->parse) -+ return 0; -+ -+ return saveCookie->parse(ctxt, obj); -+} -+ -+ -+int -+virSaveCookieParse(xmlXPathContextPtr ctxt, -+ virObjectPtr *obj, -+ virSaveCookieCallbacksPtr saveCookie) -+{ -+ xmlNodePtr node = ctxt->node; -+ int ret = -1; -+ -+ *obj = NULL; -+ -+ if (!(ctxt->node = virXPathNode("./cookie", ctxt))) { -+ ret = 0; -+ goto cleanup; -+ } -+ -+ ret = virSaveCookieParseNode(ctxt, obj, saveCookie); -+ -+ cleanup: -+ ctxt->node = node; -+ return ret; -+} -+ -+ -+int -+virSaveCookieParseString(const char *xml, -+ virObjectPtr *obj, -+ virSaveCookieCallbacksPtr saveCookie) -+{ -+ xmlDocPtr doc = NULL; -+ xmlXPathContextPtr ctxt = NULL; -+ int ret = -1; -+ -+ *obj = NULL; -+ -+ if (!xml) { -+ ret = 0; -+ goto cleanup; -+ } -+ -+ if (!(doc = virXMLParseStringCtxt(xml, _("(save cookie)"), &ctxt))) -+ goto cleanup; -+ -+ ret = virSaveCookieParseNode(ctxt, obj, saveCookie); -+ -+ cleanup: -+ xmlXPathFreeContext(ctxt); -+ xmlFreeDoc(doc); -+ return ret; -+} -+ -+ -+int -+virSaveCookieFormatBuf(virBufferPtr buf, -+ virObjectPtr obj, -+ virSaveCookieCallbacksPtr saveCookie) -+{ -+ if (!obj || !saveCookie || !saveCookie->format) -+ return 0; -+ -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ -+ if (saveCookie->format(buf, obj) < 0) -+ return -1; -+ -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ -+ return 0; -+} -+ -+ -+char * -+virSaveCookieFormat(virObjectPtr obj, -+ virSaveCookieCallbacksPtr saveCookie) -+{ -+ virBuffer buf = VIR_BUFFER_INITIALIZER; -+ -+ if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0) -+ goto error; -+ -+ if (virBufferCheckError(&buf) < 0) -+ goto error; -+ -+ return virBufferContentAndReset(&buf); -+ -+ error: -+ virBufferFreeAndReset(&buf); -+ return NULL; -+} -diff --git a/src/conf/virsavecookie.h b/src/conf/virsavecookie.h -new file mode 100644 -index 0000000000..4aed18466c ---- /dev/null -+++ b/src/conf/virsavecookie.h -@@ -0,0 +1,62 @@ -+/** -+ * virsavecookie.h: Save cookie handling -+ * -+ * Copyright (C) 2017 Red Hat, Inc. -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see -+ * . -+ */ -+#ifndef __VIR_SAVE_COOKIE_H__ -+# define __VIR_SAVE_COOKIE_H__ -+ -+# include -+ -+# include "internal.h" -+# include "virobject.h" -+# include "virbuffer.h" -+ -+ -+typedef int (*virSaveCookieParseFunc)(xmlXPathContextPtr ctxt, -+ virObjectPtr *obj); -+typedef int (*virSaveCookieFormatFunc)(virBufferPtr buf, -+ virObjectPtr obj); -+ -+typedef struct _virSaveCookieCallbacks virSaveCookieCallbacks; -+typedef virSaveCookieCallbacks *virSaveCookieCallbacksPtr; -+struct _virSaveCookieCallbacks { -+ virSaveCookieParseFunc parse; -+ virSaveCookieFormatFunc format; -+}; -+ -+ -+int -+virSaveCookieParse(xmlXPathContextPtr ctxt, -+ virObjectPtr *obj, -+ virSaveCookieCallbacksPtr saveCookie); -+ -+int -+virSaveCookieParseString(const char *xml, -+ virObjectPtr *obj, -+ virSaveCookieCallbacksPtr saveCookie); -+ -+int -+virSaveCookieFormatBuf(virBufferPtr buf, -+ virObjectPtr obj, -+ virSaveCookieCallbacksPtr saveCookie); -+ -+char * -+virSaveCookieFormat(virObjectPtr obj, -+ virSaveCookieCallbacksPtr saveCookie); -+ -+#endif /*__VIR_SAVE_COOKIE_H__ */ -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index a578dfba34..b4769080e8 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -971,6 +971,13 @@ virNWFilterObjTestUnassignDef; - virNWFilterObjUnlock; - - -+# conf/virsavecookie.h -+virSaveCookieFormat; -+virSaveCookieFormatBuf; -+virSaveCookieParse; -+virSaveCookieParseString; -+ -+ - # conf/virsecretobj.h - virSecretLoadAllConfigs; - virSecretObjDeleteConfig; --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Make-error-reporting-in-virCPUDefIsEqual-optional.patch b/SOURCES/libvirt-conf-Make-error-reporting-in-virCPUDefIsEqual-optional.patch deleted file mode 100644 index 7e24d8f..0000000 --- a/SOURCES/libvirt-conf-Make-error-reporting-in-virCPUDefIsEqual-optional.patch +++ /dev/null @@ -1,213 +0,0 @@ -From c1ad40f4ad3813ff3013efba80983f62113fc092 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Wed, 31 May 2017 16:42:42 +0200 -Subject: [PATCH] conf: Make error reporting in virCPUDefIsEqual optional - -The function will be used in paths where mismatching CPU defs are not an -error. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 25ec7f6fe959f2811bb014a8c1f0c92bdf9ca13d) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/conf/cpu_conf.c | 83 +++++++++++++++++++++++--------------------------- - src/conf/cpu_conf.h | 3 +- - src/conf/domain_conf.c | 2 +- - 3 files changed, 41 insertions(+), 47 deletions(-) - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index a4be5742e3..ffb2e83d67 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -811,7 +811,8 @@ virCPUDefAddFeature(virCPUDefPtr def, - - bool - virCPUDefIsEqual(virCPUDefPtr src, -- virCPUDefPtr dst) -+ virCPUDefPtr dst, -+ bool reportError) - { - bool identical = false; - size_t i; -@@ -819,98 +820,89 @@ virCPUDefIsEqual(virCPUDefPtr src, - if (!src && !dst) - return true; - -+#define MISMATCH(fmt, ...) \ -+ if (reportError) \ -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, fmt, __VA_ARGS__) -+ - if ((src && !dst) || (!src && dst)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("Target CPU does not match source")); -+ MISMATCH("%s", _("Target CPU does not match source")); - goto cleanup; - } - - if (src->type != dst->type) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU type %s does not match source %s"), -- virCPUTypeToString(dst->type), -- virCPUTypeToString(src->type)); -+ MISMATCH(_("Target CPU type %s does not match source %s"), -+ virCPUTypeToString(dst->type), -+ virCPUTypeToString(src->type)); - goto cleanup; - } - - if (src->mode != dst->mode) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU mode %s does not match source %s"), -- virCPUModeTypeToString(dst->mode), -- virCPUModeTypeToString(src->mode)); -+ MISMATCH(_("Target CPU mode %s does not match source %s"), -+ virCPUModeTypeToString(dst->mode), -+ virCPUModeTypeToString(src->mode)); - goto cleanup; - } - - if (src->arch != dst->arch) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU arch %s does not match source %s"), -- virArchToString(dst->arch), -- virArchToString(src->arch)); -+ MISMATCH(_("Target CPU arch %s does not match source %s"), -+ virArchToString(dst->arch), -+ virArchToString(src->arch)); - goto cleanup; - } - - if (STRNEQ_NULLABLE(src->model, dst->model)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU model %s does not match source %s"), -- NULLSTR(dst->model), NULLSTR(src->model)); -+ MISMATCH(_("Target CPU model %s does not match source %s"), -+ NULLSTR(dst->model), NULLSTR(src->model)); - goto cleanup; - } - - if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU vendor %s does not match source %s"), -- NULLSTR(dst->vendor), NULLSTR(src->vendor)); -+ MISMATCH(_("Target CPU vendor %s does not match source %s"), -+ NULLSTR(dst->vendor), NULLSTR(src->vendor)); - goto cleanup; - } - - if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU vendor id %s does not match source %s"), -- NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id)); -+ MISMATCH(_("Target CPU vendor id %s does not match source %s"), -+ NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id)); - goto cleanup; - } - - if (src->sockets != dst->sockets) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU sockets %d does not match source %d"), -- dst->sockets, src->sockets); -+ MISMATCH(_("Target CPU sockets %d does not match source %d"), -+ dst->sockets, src->sockets); - goto cleanup; - } - - if (src->cores != dst->cores) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU cores %d does not match source %d"), -- dst->cores, src->cores); -+ MISMATCH(_("Target CPU cores %d does not match source %d"), -+ dst->cores, src->cores); - goto cleanup; - } - - if (src->threads != dst->threads) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU threads %d does not match source %d"), -- dst->threads, src->threads); -+ MISMATCH(_("Target CPU threads %d does not match source %d"), -+ dst->threads, src->threads); - goto cleanup; - } - - if (src->nfeatures != dst->nfeatures) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU feature count %zu does not match source %zu"), -- dst->nfeatures, src->nfeatures); -+ MISMATCH(_("Target CPU feature count %zu does not match source %zu"), -+ dst->nfeatures, src->nfeatures); - goto cleanup; - } - - for (i = 0; i < src->nfeatures; i++) { - if (STRNEQ(src->features[i].name, dst->features[i].name)) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU feature %s does not match source %s"), -- dst->features[i].name, src->features[i].name); -+ MISMATCH(_("Target CPU feature %s does not match source %s"), -+ dst->features[i].name, src->features[i].name); - goto cleanup; - } - - if (src->features[i].policy != dst->features[i].policy) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target CPU feature policy %s does not match source %s"), -- virCPUFeaturePolicyTypeToString(dst->features[i].policy), -- virCPUFeaturePolicyTypeToString(src->features[i].policy)); -+ MISMATCH(_("Target CPU feature policy %s does not match source %s"), -+ virCPUFeaturePolicyTypeToString(dst->features[i].policy), -+ virCPUFeaturePolicyTypeToString(src->features[i].policy)); - goto cleanup; - } - } -@@ -920,11 +912,12 @@ virCPUDefIsEqual(virCPUDefPtr src, - (src->cache && dst->cache && - (src->cache->level != dst->cache->level || - src->cache->mode != dst->cache->mode))) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("Target CPU cache does not match source")); -+ MISMATCH("%s", _("Target CPU cache does not match source")); - goto cleanup; - } - -+#undef MISMATCH -+ - identical = true; - - cleanup: -diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index 09438b68b4..b0d891552a 100644 ---- a/src/conf/cpu_conf.h -+++ b/src/conf/cpu_conf.h -@@ -189,7 +189,8 @@ virCPUDefParseXML(xmlNodePtr node, - - bool - virCPUDefIsEqual(virCPUDefPtr src, -- virCPUDefPtr dst); -+ virCPUDefPtr dst, -+ bool reportError); - - char * - virCPUDefFormat(virCPUDefPtr def, -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index bab85c6362..2197330a22 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -20042,7 +20042,7 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src, - goto error; - } - -- if (!virCPUDefIsEqual(src->cpu, dst->cpu)) -+ if (!virCPUDefIsEqual(src->cpu, dst->cpu, true)) - goto error; - - if (!virSysinfoIsEqual(src->sysinfo, dst->sysinfo)) --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Make-virDomainSnapshotDefFormat-easier-to-read.patch b/SOURCES/libvirt-conf-Make-virDomainSnapshotDefFormat-easier-to-read.patch deleted file mode 100644 index 5ed7558..0000000 --- a/SOURCES/libvirt-conf-Make-virDomainSnapshotDefFormat-easier-to-read.patch +++ /dev/null @@ -1,113 +0,0 @@ -From d1adb920ad7f460e32b1cc68e68120b3c655bc18 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Thu, 1 Jun 2017 15:57:55 +0200 -Subject: [PATCH] conf: Make virDomainSnapshotDefFormat easier to read - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 00968dca967f4bf9d4f496e5c971bff3f8147ed8) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/conf/snapshot_conf.c | 30 +++++++++++++++++++++--------- - 1 file changed, 21 insertions(+), 9 deletions(-) - -diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c -index b6cba5ac38..7daa9b22ad 100644 ---- a/src/conf/snapshot_conf.c -+++ b/src/conf/snapshot_conf.c -@@ -686,11 +686,13 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, - virBufferAddLit(buf, "\n"); - } - --char *virDomainSnapshotDefFormat(const char *domain_uuid, -- virDomainSnapshotDefPtr def, -- virCapsPtr caps, -- unsigned int flags, -- int internal) -+ -+char * -+virDomainSnapshotDefFormat(const char *domain_uuid, -+ virDomainSnapshotDefPtr def, -+ virCapsPtr caps, -+ unsigned int flags, -+ int internal) - { - virBuffer buf = VIR_BUFFER_INITIALIZER; - size_t i; -@@ -702,12 +704,14 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, - - virBufferAddLit(&buf, "\n"); - virBufferAdjustIndent(&buf, 2); -+ - virBufferEscapeString(&buf, "%s\n", def->name); - if (def->description) - virBufferEscapeString(&buf, "%s\n", - def->description); - virBufferAsprintf(&buf, "%s\n", - virDomainSnapshotStateTypeToString(def->state)); -+ - if (def->parent) { - virBufferAddLit(&buf, "\n"); - virBufferAdjustIndent(&buf, 2); -@@ -715,14 +719,17 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, - virBufferAdjustIndent(&buf, -2); - virBufferAddLit(&buf, "\n"); - } -+ - virBufferAsprintf(&buf, "%lld\n", - def->creationTime); -+ - if (def->memory) { - virBufferAsprintf(&buf, "memory)); - virBufferEscapeString(&buf, " file='%s'", def->file); - virBufferAddLit(&buf, "/>\n"); - } -+ - if (def->ndisks) { - virBufferAddLit(&buf, "\n"); - virBufferAdjustIndent(&buf, 2); -@@ -731,11 +738,10 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, - virBufferAdjustIndent(&buf, -2); - virBufferAddLit(&buf, "\n"); - } -+ - if (def->dom) { -- if (virDomainDefFormatInternal(def->dom, caps, flags, &buf) < 0) { -- virBufferFreeAndReset(&buf); -- return NULL; -- } -+ if (virDomainDefFormatInternal(def->dom, caps, flags, &buf) < 0) -+ goto error; - } else if (domain_uuid) { - virBufferAddLit(&buf, "\n"); - virBufferAdjustIndent(&buf, 2); -@@ -743,8 +749,10 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, - virBufferAdjustIndent(&buf, -2); - virBufferAddLit(&buf, "\n"); - } -+ - if (internal) - virBufferAsprintf(&buf, "%d\n", def->current); -+ - virBufferAdjustIndent(&buf, -2); - virBufferAddLit(&buf, "\n"); - -@@ -752,6 +760,10 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, - return NULL; - - return virBufferContentAndReset(&buf); -+ -+ error: -+ virBufferFreeAndReset(&buf); -+ return NULL; - } - - /* Snapshot Obj functions */ --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Parse-and-format-virDomainChrSerialTargetModel.patch b/SOURCES/libvirt-conf-Parse-and-format-virDomainChrSerialTargetModel.patch new file mode 100644 index 0000000..560296f --- /dev/null +++ b/SOURCES/libvirt-conf-Parse-and-format-virDomainChrSerialTargetModel.patch @@ -0,0 +1,253 @@ +From f39b12fb966c2dfe7841a299f00ff5c6fa68095e Mon Sep 17 00:00:00 2001 +Message-Id: +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:07 +0100 +Subject: [PATCH] conf: Parse and format virDomainChrSerialTargetModel + +This information will be used to select, and store in the guest +configuration in order to guarantee ABI stability, the concrete +(hypervisor-specific) model for serial devices. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 5ad9d9afd4738ea716a6f820bbb53eecf5604a2f) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 16 ++++++++-- + docs/schemas/domaincommon.rng | 15 +++++++++ + src/conf/domain_conf.c | 72 ++++++++++++++++++++++++++++++++++++++++++- + src/conf/domain_conf.h | 12 ++++++++ + 4 files changed, 112 insertions(+), 3 deletions(-) + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index f57a124056..cf1167b9c6 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -6447,7 +6447,9 @@ qemu-kvm -net nic,model=? /dev/null + <devices> + <!-- USB serial port --> + <serial type='pty'> +- <target type='usb-serial' port='0'/> ++ <target type='usb-serial' port='0'> ++ <model name='usb-serial'/> ++ </target> + <address type='usb' bus='0' port='1'/> + </serial> + </devices> +@@ -6463,6 +6465,16 @@ qemu-kvm -net nic,model=? /dev/null + is available). +

    + ++

    ++ Since 3.10.0, the target ++ element can have an optional model subelement; ++ valid values for its name attribute are: ++ isa-serial (usable with the isa-serial target ++ type); usb-serial (usable with the usb-serial ++ target type); pci-serial ++ (usable with the pci-serial target type). ++

    ++ +

    + If any of the attributes is not specified by the user, libvirt will + choose a value suitable for most users. +@@ -6489,7 +6501,7 @@ qemu-kvm -net nic,model=? /dev/null + <!-- Serial console --> + <console type='pty'> + <source path='/dev/pts/2'/> +- <target type='serial' port='0'/> ++ <target type='serial' port='0'/> + </console> + </devices> + ... +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 367861c1ea..3630e539e6 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -3575,6 +3575,18 @@ + + + ++ ++ ++ ++ ++ isa-serial ++ usb-serial ++ pci-serial ++ ++ ++ ++ ++ + + + +@@ -3589,6 +3601,9 @@ + + + ++ ++ ++ + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 44d9bbe01d..692b9d9414 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -465,6 +465,14 @@ VIR_ENUM_IMPL(virDomainChrConsoleTarget, + "sclp", + "sclplm") + ++VIR_ENUM_IMPL(virDomainChrSerialTargetModel, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST, ++ "none", ++ "isa-serial", ++ "usb-serial", ++ "pci-serial", ++); ++ + VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, + "parallel", + "serial", +@@ -11530,14 +11538,42 @@ virDomainChrTargetTypeFromString(int devtype, + return ret; + } + ++static int ++virDomainChrTargetModelFromString(int devtype, ++ const char *targetModel) ++{ ++ int ret = -1; ++ ++ if (!targetModel) ++ return 0; ++ ++ switch ((virDomainChrDeviceType) devtype) { ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: ++ ret = virDomainChrSerialTargetModelTypeFromString(targetModel); ++ break; ++ ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: ++ /* Target model not supported yet */ ++ ret = 0; ++ break; ++ } ++ ++ return ret; ++} ++ + static int + virDomainChrDefParseTargetXML(virDomainChrDefPtr def, + xmlNodePtr cur, + unsigned int flags) + { + int ret = -1; ++ xmlNodePtr child; + unsigned int port; + char *targetType = virXMLPropString(cur, "type"); ++ char *targetModel = NULL; + char *addrStr = NULL; + char *portStr = NULL; + char *stateStr = NULL; +@@ -11551,6 +11587,24 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def, + goto error; + } + ++ child = cur->children; ++ while (child != NULL) { ++ if (child->type == XML_ELEMENT_NODE && ++ virXMLNodeNameEqual(child, "model")) { ++ targetModel = virXMLPropString(child, "name"); ++ } ++ child = child->next; ++ } ++ ++ if ((def->targetModel = ++ virDomainChrTargetModelFromString(def->deviceType, ++ targetModel)) < 0) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("unknown target model '%s' specified for character device"), ++ targetModel); ++ goto error; ++ } ++ + switch (def->deviceType) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: + switch (def->targetType) { +@@ -11639,6 +11693,7 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr def, + ret = 0; + error: + VIR_FREE(targetType); ++ VIR_FREE(targetModel); + VIR_FREE(addrStr); + VIR_FREE(portStr); + VIR_FREE(stateStr); +@@ -24019,8 +24074,23 @@ virDomainChrTargetDefFormat(virBufferPtr buf, + } + + virBufferAsprintf(buf, +- "port='%d'/>\n", ++ "port='%d'", + def->target.port); ++ ++ if (def->targetModel != VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE) { ++ virBufferAddLit(buf, ">\n"); ++ ++ virBufferAdjustIndent(buf, 2); ++ virBufferAsprintf(buf, ++ "\n", ++ virDomainChrSerialTargetModelTypeToString(def->targetModel)); ++ virBufferAdjustIndent(buf, -2); ++ ++ virBufferAddLit(buf, "\n"); ++ } else { ++ virBufferAddLit(buf, "/>\n"); ++ } ++ + break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index bbb056cf21..9dfe9388cd 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1104,6 +1104,17 @@ typedef enum { + VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LAST + } virDomainChrConsoleTargetType; + ++typedef enum { ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE = 0, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, ++ ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST ++} virDomainChrSerialTargetModel; ++ ++VIR_ENUM_DECL(virDomainChrSerialTargetModel); ++ + typedef enum { + VIR_DOMAIN_CHR_TYPE_NULL, + VIR_DOMAIN_CHR_TYPE_VC, +@@ -1202,6 +1213,7 @@ struct _virDomainChrDef { + int targetType; /* enum virDomainChrConsoleTargetType || + enum virDomainChrChannelTargetType || + enum virDomainChrSerialTargetType according to deviceType */ ++ int targetModel; /* enum virDomainChrSerialTargetModel */ + + union { + int port; /* parallel, serial, console */ +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Pass-xmlopt-to-virDomainSnapshotDefFormat.patch b/SOURCES/libvirt-conf-Pass-xmlopt-to-virDomainSnapshotDefFormat.patch deleted file mode 100644 index d546c53..0000000 --- a/SOURCES/libvirt-conf-Pass-xmlopt-to-virDomainSnapshotDefFormat.patch +++ /dev/null @@ -1,251 +0,0 @@ -From 49f9421cddc176e39cbb062f26e80ec93341ef0d Mon Sep 17 00:00:00 2001 -Message-Id: <49f9421cddc176e39cbb062f26e80ec93341ef0d@dist-git> -From: Jiri Denemark -Date: Fri, 2 Jun 2017 00:27:33 +0200 -Subject: [PATCH] conf: Pass xmlopt to virDomainSnapshotDefFormat - -This will be used later when a save cookie will become part of the -snapshot XML using new driver specific parser/formatter functions. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 957cd268a98043fe061227a8e829c622a6fb4b86) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/conf/snapshot_conf.c | 1 + - src/conf/snapshot_conf.h | 1 + - src/esx/esx_driver.c | 2 +- - src/qemu/qemu_domain.c | 4 +++- - src/qemu/qemu_domain.h | 1 + - src/qemu/qemu_driver.c | 16 ++++++++++++---- - src/test/test_driver.c | 1 + - src/vbox/vbox_common.c | 4 ++-- - src/vz/vz_driver.c | 1 + - tests/domainsnapshotxml2xmltest.c | 1 + - 10 files changed, 24 insertions(+), 8 deletions(-) - -diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c -index 7daa9b22ad..e3bba985d7 100644 ---- a/src/conf/snapshot_conf.c -+++ b/src/conf/snapshot_conf.c -@@ -691,6 +691,7 @@ char * - virDomainSnapshotDefFormat(const char *domain_uuid, - virDomainSnapshotDefPtr def, - virCapsPtr caps, -+ virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED, - unsigned int flags, - int internal) - { -diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h -index da904f9460..2ce526fa6b 100644 ---- a/src/conf/snapshot_conf.h -+++ b/src/conf/snapshot_conf.h -@@ -114,6 +114,7 @@ void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def); - char *virDomainSnapshotDefFormat(const char *domain_uuid, - virDomainSnapshotDefPtr def, - virCapsPtr caps, -+ virDomainXMLOptionPtr xmlopt, - unsigned int flags, - int internal); - int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot, -diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c -index 166d4bcfcc..c4e1f58a0b 100644 ---- a/src/esx/esx_driver.c -+++ b/src/esx/esx_driver.c -@@ -4282,7 +4282,7 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, - - virUUIDFormat(snapshot->domain->uuid, uuid_string); - -- xml = virDomainSnapshotDefFormat(uuid_string, &def, priv->caps, -+ xml = virDomainSnapshotDefFormat(uuid_string, &def, priv->caps, priv->xmlopt, - virDomainDefFormatConvertXMLFlags(flags), - 0); - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 11be085801..09903bdd5f 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -4794,6 +4794,7 @@ int - qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, - virDomainSnapshotObjPtr snapshot, - virCapsPtr caps, -+ virDomainXMLOptionPtr xmlopt, - char *snapshotDir) - { - char *newxml = NULL; -@@ -4804,7 +4805,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, - - virUUIDFormat(vm->def->uuid, uuidstr); - newxml = virDomainSnapshotDefFormat( -- uuidstr, snapshot->def, caps, -+ uuidstr, snapshot->def, caps, xmlopt, - virDomainDefFormatConvertXMLFlags(QEMU_DOMAIN_FORMAT_LIVE_FLAGS), - 1); - if (newxml == NULL) -@@ -4965,6 +4966,7 @@ qemuDomainSnapshotDiscard(virQEMUDriverPtr driver, - } else { - parentsnap->def->current = true; - if (qemuDomainSnapshotWriteMetadata(vm, parentsnap, driver->caps, -+ driver->xmlopt, - cfg->snapshotDir) < 0) { - VIR_WARN("failed to set parent snapshot '%s' as current", - snap->def->parent); -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index 2994398a9e..4db92fac8a 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -557,6 +557,7 @@ const char *qemuFindQemuImgBinary(virQEMUDriverPtr driver); - int qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, - virDomainSnapshotObjPtr snapshot, - virCapsPtr caps, -+ virDomainXMLOptionPtr xmlopt, - char *snapshotDir); - - int qemuDomainSnapshotForEachQcow2(virQEMUDriverPtr driver, -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 354329fe64..2688c3eec7 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -14650,7 +14650,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, - if (update_current) { - vm->current_snapshot->def->current = false; - if (qemuDomainSnapshotWriteMetadata(vm, vm->current_snapshot, -- driver->caps, -+ driver->caps, driver->xmlopt, - cfg->snapshotDir) < 0) - goto endjob; - vm->current_snapshot = NULL; -@@ -14700,6 +14700,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, - endjob: - if (snapshot && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) { - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, -+ driver->xmlopt, - cfg->snapshotDir) < 0) { - /* if writing of metadata fails, error out rather than trying - * to silently carry on without completing the snapshot */ -@@ -15037,7 +15038,8 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, - - virUUIDFormat(snapshot->domain->uuid, uuidstr); - -- xml = virDomainSnapshotDefFormat(uuidstr, snap->def, driver->caps, -+ xml = virDomainSnapshotDefFormat(uuidstr, snap->def, -+ driver->caps, driver->xmlopt, - virDomainDefFormatConvertXMLFlags(flags), - 0); - -@@ -15219,7 +15221,8 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, - if (vm->current_snapshot) { - vm->current_snapshot->def->current = false; - if (qemuDomainSnapshotWriteMetadata(vm, vm->current_snapshot, -- driver->caps, cfg->snapshotDir) < 0) -+ driver->caps, driver->xmlopt, -+ cfg->snapshotDir) < 0) - goto endjob; - vm->current_snapshot = NULL; - /* XXX Should we restore vm->current_snapshot after this point -@@ -15459,6 +15462,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, - cleanup: - if (ret == 0) { - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, -+ driver->xmlopt, - cfg->snapshotDir) < 0) - ret = -1; - else -@@ -15495,6 +15499,7 @@ struct _virQEMUSnapReparent { - virDomainSnapshotObjPtr parent; - virDomainObjPtr vm; - virCapsPtr caps; -+ virDomainXMLOptionPtr xmlopt; - int err; - virDomainSnapshotObjPtr last; - }; -@@ -15523,7 +15528,8 @@ qemuDomainSnapshotReparentChildren(void *payload, - if (!snap->sibling) - rep->last = snap; - -- rep->err = qemuDomainSnapshotWriteMetadata(rep->vm, snap, rep->caps, -+ rep->err = qemuDomainSnapshotWriteMetadata(rep->vm, snap, -+ rep->caps, rep->xmlopt, - rep->cfg->snapshotDir); - return 0; - } -@@ -15594,6 +15600,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, - if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) { - snap->def->current = true; - if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->caps, -+ driver->xmlopt, - cfg->snapshotDir) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to set snapshot '%s' as current"), -@@ -15611,6 +15618,7 @@ qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, - rep.err = 0; - rep.last = NULL; - rep.caps = driver->caps; -+ rep.xmlopt = driver->xmlopt; - virDomainSnapshotForEachChild(snap, - qemuDomainSnapshotReparentChildren, - &rep); -diff --git a/src/test/test_driver.c b/src/test/test_driver.c -index 39df646260..c8085dd797 100644 ---- a/src/test/test_driver.c -+++ b/src/test/test_driver.c -@@ -6348,6 +6348,7 @@ testDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, - virUUIDFormat(snapshot->domain->uuid, uuidstr); - - xml = virDomainSnapshotDefFormat(uuidstr, snap->def, privconn->caps, -+ privconn->xmlopt, - virDomainDefFormatConvertXMLFlags(flags), - 0); - -diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c -index dcc64b579c..c739031660 100644 ---- a/src/vbox/vbox_common.c -+++ b/src/vbox/vbox_common.c -@@ -5115,7 +5115,7 @@ vboxSnapshotRedefine(virDomainPtr dom, - VIR_FREE(currentSnapshotXmlFilePath); - if (virAsprintf(¤tSnapshotXmlFilePath, "%s%s.xml", machineLocationPath, snapshotMachineDesc->currentSnapshot) < 0) - goto cleanup; -- char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, data->caps, VIR_DOMAIN_DEF_FORMAT_SECURE, 0); -+ char *snapshotContent = virDomainSnapshotDefFormat(NULL, def, data->caps, data->xmlopt, VIR_DOMAIN_DEF_FORMAT_SECURE, 0); - if (snapshotContent == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get snapshot content")); -@@ -6037,7 +6037,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, - - virUUIDFormat(dom->uuid, uuidstr); - memcpy(def->dom->uuid, dom->uuid, VIR_UUID_BUFLEN); -- ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps, -+ ret = virDomainSnapshotDefFormat(uuidstr, def, data->caps, data->xmlopt, - virDomainDefFormatConvertXMLFlags(flags), - 0); - -diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c -index 26c4f48459..f0b6722a6e 100644 ---- a/src/vz/vz_driver.c -+++ b/src/vz/vz_driver.c -@@ -2309,6 +2309,7 @@ vzDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, unsigned int flags) - virUUIDFormat(snapshot->domain->uuid, uuidstr); - - xml = virDomainSnapshotDefFormat(uuidstr, snap->def, privconn->driver->caps, -+ privconn->driver->xmlopt, - virDomainDefFormatConvertXMLFlags(flags), - 0); - -diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c -index f5fec47520..df204f9f16 100644 ---- a/tests/domainsnapshotxml2xmltest.c -+++ b/tests/domainsnapshotxml2xmltest.c -@@ -101,6 +101,7 @@ testCompareXMLToXMLFiles(const char *inxml, - goto cleanup; - - if (!(actual = virDomainSnapshotDefFormat(uuid, def, driver.caps, -+ driver.xmlopt, - VIR_DOMAIN_DEF_FORMAT_SECURE, - internal))) - goto cleanup; --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Properly-parse-backingStore.patch b/SOURCES/libvirt-conf-Properly-parse-backingStore.patch new file mode 100644 index 0000000..5e9b08e --- /dev/null +++ b/SOURCES/libvirt-conf-Properly-parse-backingStore.patch @@ -0,0 +1,200 @@ +From fee89d5de8520422225dc06fa95cc2dad66d7ebe Mon Sep 17 00:00:00 2001 +Message-Id: +From: Peter Krempa +Date: Mon, 13 Nov 2017 13:25:01 +0100 +Subject: [PATCH] conf: Properly parse + +The terminator would not be parsed properly since the XPath selector was +looking for an populated element, and also the code did not bother +assigning the terminating virStorageSourcePtr to the backingStore +property of the parent. + +Some tests would catch it if there wasn't bigger fallout from the change +to backing store termination in a693fdba0111. Fix them properly now. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509110 +(cherry picked from commit 19448a2561699807c075e071a45df292efd01f6b) +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 18 ++++++++---------- + ...base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml | 1 + + .../qemuxml2xmlout-disk-active-commit.xml | 1 + + .../qemuxml2xmlout-disk-backing-chains-active.xml | 3 +++ + .../qemuxml2xmlout-disk-mirror-active.xml | 4 ++++ + .../qemuxml2xmlout-disk-mirror-old.xml | 4 ++++ + .../qemuxml2xmlout-seclabel-static-labelskip.xml | 1 + + 7 files changed, 22 insertions(+), 10 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 27cfecffda..3b337d1a64 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -8539,16 +8539,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, + char *idx = NULL; + int ret = -1; + +- if (!(ctxt->node = virXPathNode("./backingStore[*]", ctxt))) { +- ret = 0; +- goto cleanup; +- } +- +- if (!(type = virXMLPropString(ctxt->node, "type"))) { +- /* terminator does not have a type */ +- if (VIR_ALLOC(backingStore) < 0) +- goto cleanup; +- ++ if (!(ctxt->node = virXPathNode("./backingStore", ctxt))) { + ret = 0; + goto cleanup; + } +@@ -8556,6 +8547,13 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt, + if (VIR_ALLOC(backingStore) < 0) + goto cleanup; + ++ /* terminator does not have a type */ ++ if (!(type = virXMLPropString(ctxt->node, "type"))) { ++ VIR_STEAL_PTR(src->backingStore, backingStore); ++ ret = 0; ++ goto cleanup; ++ } ++ + if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && + (idx = virXMLPropString(ctxt->node, "index")) && + virStrToLong_uip(idx, NULL, 10, &backingStore->id) < 0) { +diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml +index 9482b6794a..16caeb3542 100644 +--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml ++++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+disk-scsi-wwn+disk-scsi-duplicate-wwn.xml +@@ -22,6 +22,7 @@ + + + ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml +index 5766e4aea8..cc26af1096 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-active-commit.xml +@@ -20,6 +20,7 @@ + + + ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml +index 828defcc25..d1fd2442c3 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-backing-chains-active.xml +@@ -49,6 +49,7 @@ + + + ++ + + + +@@ -63,6 +64,7 @@ + + + ++ + +

    + +@@ -79,6 +81,7 @@ + + + ++ + + +
    +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml +index 252bde3389..c1e8a33ec1 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-active.xml +@@ -16,6 +16,7 @@ + /usr/bin/qemu-system-i686 + + ++ + + + +@@ -24,12 +25,14 @@ + + + ++ + + +
    + + + ++ + + + +@@ -39,6 +42,7 @@ + + + ++ + + + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml +index f4bd39a580..e390bc02f2 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml +@@ -16,6 +16,7 @@ + /usr/bin/qemu-system-i686 + + ++ + + + +@@ -24,12 +25,14 @@ + + + ++ + + +
    + + + ++ + + + +@@ -39,6 +42,7 @@ + + + ++ + +
    + +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml +index 91f573db7d..d37b950cbf 100644 +--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-static-labelskip.xml +@@ -18,6 +18,7 @@ + + + ++ + +
    + +-- +2.15.0 + diff --git a/SOURCES/libvirt-conf-Refactor-virCPUDefParseXML.patch b/SOURCES/libvirt-conf-Refactor-virCPUDefParseXML.patch deleted file mode 100644 index eaa2ab7..0000000 --- a/SOURCES/libvirt-conf-Refactor-virCPUDefParseXML.patch +++ /dev/null @@ -1,413 +0,0 @@ -From 7bdac52dd6979f76f9a75a404a76e79f7da11a06 Mon Sep 17 00:00:00 2001 -Message-Id: <7bdac52dd6979f76f9a75a404a76e79f7da11a06@dist-git> -From: Jiri Denemark -Date: Tue, 23 May 2017 09:29:36 +0200 -Subject: [PATCH] conf: Refactor virCPUDefParseXML - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 702013f3b3ad8bd28c326058e2dd9ea8afbd1e61) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/conf/cpu_conf.c | 109 +++++++++++++++++++++++++++---------------------- - src/conf/cpu_conf.h | 9 ++-- - src/conf/domain_conf.c | 12 +----- - src/cpu/cpu.c | 5 +-- - tests/cputest.c | 5 +-- - 5 files changed, 72 insertions(+), 68 deletions(-) - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index ffb2e83d67..da40e9ba97 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -245,12 +245,25 @@ virCPUDefCopy(const virCPUDef *cpu) - } - - --virCPUDefPtr --virCPUDefParseXML(xmlNodePtr node, -- xmlXPathContextPtr ctxt, -- virCPUType type) -+/* -+ * Parses CPU definition XML from a node pointed to by @xpath. If @xpath is -+ * NULL, the current node of @ctxt is used (i.e., it is a shortcut to "."). -+ * -+ * Missing element in the XML document is not considered an error unless -+ * @xpath is NULL in which case the function expects it was provided with a -+ * valid element already. In other words, the function returns success -+ * and sets @cpu to NULL if @xpath is not NULL and the node pointed to by -+ * @xpath is not found. -+ * -+ * Returns 0 on success, -1 on error. -+ */ -+int -+virCPUDefParseXML(xmlXPathContextPtr ctxt, -+ const char *xpath, -+ virCPUType type, -+ virCPUDefPtr *cpu) - { -- virCPUDefPtr def; -+ virCPUDefPtr def = NULL; - xmlNodePtr *nodes = NULL; - xmlNodePtr oldnode = ctxt->node; - int n; -@@ -258,15 +271,23 @@ virCPUDefParseXML(xmlNodePtr node, - char *cpuMode; - char *fallback = NULL; - char *vendor_id = NULL; -+ int ret = -1; - -- if (!xmlStrEqual(node->name, BAD_CAST "cpu")) { -+ *cpu = NULL; -+ -+ if (xpath && !(ctxt->node = virXPathNode(xpath, ctxt))) { -+ ret = 0; -+ goto cleanup; -+ } -+ -+ if (!xmlStrEqual(ctxt->node->name, BAD_CAST "cpu")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'cpu' element")); -- return NULL; -+ goto cleanup; - } - - if (VIR_ALLOC(def) < 0) -- return NULL; -+ goto cleanup; - - if (type == VIR_CPU_TYPE_AUTO) { - if (virXPathBoolean("boolean(./arch)", ctxt)) { -@@ -274,7 +295,7 @@ virCPUDefParseXML(xmlNodePtr node, - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'arch' element cannot be used inside 'cpu'" - " element with 'match' attribute'")); -- goto error; -+ goto cleanup; - } - def->type = VIR_CPU_TYPE_HOST; - } else { -@@ -284,12 +305,12 @@ virCPUDefParseXML(xmlNodePtr node, - def->type = type; - } - -- if ((cpuMode = virXMLPropString(node, "mode"))) { -+ if ((cpuMode = virXMLPropString(ctxt->node, "mode"))) { - if (def->type == VIR_CPU_TYPE_HOST) { - VIR_FREE(cpuMode); - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Attribute mode is only allowed for guest CPU")); -- goto error; -+ goto cleanup; - } else { - def->mode = virCPUModeTypeFromString(cpuMode); - -@@ -298,7 +319,7 @@ virCPUDefParseXML(xmlNodePtr node, - _("Invalid mode attribute '%s'"), - cpuMode); - VIR_FREE(cpuMode); -- goto error; -+ goto cleanup; - } - VIR_FREE(cpuMode); - } -@@ -310,7 +331,7 @@ virCPUDefParseXML(xmlNodePtr node, - } - - if (def->type == VIR_CPU_TYPE_GUEST) { -- char *match = virXMLPropString(node, "match"); -+ char *match = virXMLPropString(ctxt->node, "match"); - char *check; - - if (!match) { -@@ -326,11 +347,11 @@ virCPUDefParseXML(xmlNodePtr node, - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid match attribute for CPU " - "specification")); -- goto error; -+ goto cleanup; - } - } - -- if ((check = virXMLPropString(node, "check"))) { -+ if ((check = virXMLPropString(ctxt->node, "check"))) { - int value = virCPUCheckTypeFromString(check); - VIR_FREE(check); - -@@ -338,7 +359,7 @@ virCPUDefParseXML(xmlNodePtr node, - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid check attribute for CPU " - "specification")); -- goto error; -+ goto cleanup; - } - def->check = value; - } -@@ -349,13 +370,13 @@ virCPUDefParseXML(xmlNodePtr node, - if (!arch) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing CPU architecture")); -- goto error; -+ goto cleanup; - } - if ((def->arch = virArchFromString(arch)) == VIR_ARCH_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown architecture %s"), arch); - VIR_FREE(arch); -- goto error; -+ goto cleanup; - } - VIR_FREE(arch); - } -@@ -364,7 +385,7 @@ virCPUDefParseXML(xmlNodePtr node, - def->type == VIR_CPU_TYPE_HOST) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing CPU model name")); -- goto error; -+ goto cleanup; - } - - if (def->type == VIR_CPU_TYPE_GUEST && -@@ -374,7 +395,7 @@ virCPUDefParseXML(xmlNodePtr node, - if ((def->fallback = virCPUFallbackTypeFromString(fallback)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid fallback attribute")); -- goto error; -+ goto cleanup; - } - } - -@@ -384,14 +405,14 @@ virCPUDefParseXML(xmlNodePtr node, - virReportError(VIR_ERR_XML_ERROR, - _("vendor_id must be exactly %d characters long"), - VIR_CPU_VENDOR_ID_LENGTH); -- goto error; -+ goto cleanup; - } - - /* ensure that the string can be passed to qemu*/ - if (strchr(vendor_id, ',')) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("vendor id is invalid")); -- goto error; -+ goto cleanup; - } - - def->vendor_id = vendor_id; -@@ -403,61 +424,54 @@ virCPUDefParseXML(xmlNodePtr node, - if (def->vendor && !def->model) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("CPU vendor specified without CPU model")); -- goto error; -+ goto cleanup; - } - - if (virXPathNode("./topology[1]", ctxt)) { -- int ret; - unsigned long ul; - -- ret = virXPathULong("string(./topology[1]/@sockets)", -- ctxt, &ul); -- if (ret < 0) { -+ if (virXPathULong("string(./topology[1]/@sockets)", ctxt, &ul) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'sockets' attribute in CPU topology")); -- goto error; -+ goto cleanup; - } - def->sockets = (unsigned int) ul; - -- ret = virXPathULong("string(./topology[1]/@cores)", -- ctxt, &ul); -- if (ret < 0) { -+ if (virXPathULong("string(./topology[1]/@cores)", ctxt, &ul) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'cores' attribute in CPU topology")); -- goto error; -+ goto cleanup; - } - def->cores = (unsigned int) ul; - -- ret = virXPathULong("string(./topology[1]/@threads)", -- ctxt, &ul); -- if (ret < 0) { -+ if (virXPathULong("string(./topology[1]/@threads)", ctxt, &ul) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing 'threads' attribute in CPU topology")); -- goto error; -+ goto cleanup; - } - def->threads = (unsigned int) ul; - - if (!def->sockets || !def->cores || !def->threads) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid CPU topology")); -- goto error; -+ goto cleanup; - } - } - - if ((n = virXPathNodeSet("./feature", ctxt, &nodes)) < 0) -- goto error; -+ goto cleanup; - - if (n > 0) { - if (!def->model && def->mode == VIR_CPU_MODE_CUSTOM) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Non-empty feature list specified without " - "CPU model")); -- goto error; -+ goto cleanup; - } - - if (VIR_RESIZE_N(def->features, def->nfeatures_max, - def->nfeatures, n) < 0) -- goto error; -+ goto cleanup; - - def->nfeatures = n; - } -@@ -480,7 +494,7 @@ virCPUDefParseXML(xmlNodePtr node, - if (policy < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Invalid CPU feature policy")); -- goto error; -+ goto cleanup; - } - } else { - policy = -1; -@@ -490,7 +504,7 @@ virCPUDefParseXML(xmlNodePtr node, - VIR_FREE(name); - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid CPU feature name")); -- goto error; -+ goto cleanup; - } - - for (j = 0; j < i; j++) { -@@ -499,7 +513,7 @@ virCPUDefParseXML(xmlNodePtr node, - _("CPU feature '%s' specified more than once"), - name); - VIR_FREE(name); -- goto error; -+ goto cleanup; - } - } - -@@ -542,17 +556,16 @@ virCPUDefParseXML(xmlNodePtr node, - def->cache->mode = mode; - } - -+ VIR_STEAL_PTR(*cpu, def); -+ ret = 0; -+ - cleanup: - ctxt->node = oldnode; - VIR_FREE(fallback); - VIR_FREE(vendor_id); - VIR_FREE(nodes); -- return def; -- -- error: - virCPUDefFree(def); -- def = NULL; -- goto cleanup; -+ return ret; - } - - -diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index b0d891552a..b44974f47e 100644 ---- a/src/conf/cpu_conf.h -+++ b/src/conf/cpu_conf.h -@@ -182,10 +182,11 @@ virCPUDefCopy(const virCPUDef *cpu); - virCPUDefPtr - virCPUDefCopyWithoutModel(const virCPUDef *cpu); - --virCPUDefPtr --virCPUDefParseXML(xmlNodePtr node, -- xmlXPathContextPtr ctxt, -- virCPUType mode); -+int -+virCPUDefParseXML(xmlXPathContextPtr ctxt, -+ const char *xpath, -+ virCPUType mode, -+ virCPUDefPtr *cpu); - - bool - virCPUDefIsEqual(virCPUDefPtr src, -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 2197330a22..395dcc0531 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -17418,16 +17418,8 @@ virDomainDefParseXML(xmlDocPtr xml, - } - VIR_FREE(nodes); - -- /* analysis of cpu handling */ -- if ((node = virXPathNode("./cpu[1]", ctxt)) != NULL) { -- xmlNodePtr oldnode = ctxt->node; -- ctxt->node = node; -- def->cpu = virCPUDefParseXML(node, ctxt, VIR_CPU_TYPE_GUEST); -- ctxt->node = oldnode; -- -- if (def->cpu == NULL) -- goto error; -- } -+ if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu) < 0) -+ goto error; - - if (virDomainNumaDefCPUParseXML(def->numa, ctxt) < 0) - goto error; -diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index 702b14dbb7..96160901e1 100644 ---- a/src/cpu/cpu.c -+++ b/src/cpu/cpu.c -@@ -130,7 +130,7 @@ virCPUCompareXML(virArch arch, - if (!(doc = virXMLParseStringCtxt(xml, _("(CPU_definition)"), &ctxt))) - goto cleanup; - -- if (!(cpu = virCPUDefParseXML(ctxt->node, ctxt, VIR_CPU_TYPE_AUTO))) -+ if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu) < 0) - goto cleanup; - - ret = virCPUCompare(arch, host, cpu, failIncompatible); -@@ -562,8 +562,7 @@ cpuBaselineXML(const char **xmlCPUs, - if (!(doc = virXMLParseStringCtxt(xmlCPUs[i], _("(CPU_definition)"), &ctxt))) - goto error; - -- cpus[i] = virCPUDefParseXML(ctxt->node, ctxt, VIR_CPU_TYPE_HOST); -- if (cpus[i] == NULL) -+ if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_HOST, &cpus[i]) < 0) - goto error; - - xmlXPathFreeContext(ctxt); -diff --git a/tests/cputest.c b/tests/cputest.c -index efa891dc18..97b34de9ed 100644 ---- a/tests/cputest.c -+++ b/tests/cputest.c -@@ -88,7 +88,7 @@ cpuTestLoadXML(virArch arch, const char *name) - if (!(doc = virXMLParseFileCtxt(xml, &ctxt))) - goto cleanup; - -- cpu = virCPUDefParseXML(ctxt->node, ctxt, VIR_CPU_TYPE_AUTO); -+ virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu); - - cleanup: - xmlXPathFreeContext(ctxt); -@@ -126,8 +126,7 @@ cpuTestLoadMultiXML(virArch arch, - - for (i = 0; i < n; i++) { - ctxt->node = nodes[i]; -- cpus[i] = virCPUDefParseXML(nodes[i], ctxt, VIR_CPU_TYPE_HOST); -- if (!cpus[i]) -+ if (virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_HOST, &cpus[i]) < 0) - goto cleanup_cpus; - } - --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-Remove-ATTRIBUTE_FALLTHROUGH-from-virDomainChrTargetDefFormat.patch b/SOURCES/libvirt-conf-Remove-ATTRIBUTE_FALLTHROUGH-from-virDomainChrTargetDefFormat.patch new file mode 100644 index 0000000..c95b076 --- /dev/null +++ b/SOURCES/libvirt-conf-Remove-ATTRIBUTE_FALLTHROUGH-from-virDomainChrTargetDefFormat.patch @@ -0,0 +1,55 @@ +From d91de09fa0a626e200ac0db133a6af69a0706105 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:04 +0100 +Subject: [PATCH] conf: Remove ATTRIBUTE_FALLTHROUGH from + virDomainChrTargetDefFormat() + +Formatting the element for serial devices will become a +bit more complicated later on, and leaving the fallthrough behavior +there would do nothing but complicate it further. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 7983068fa50ea5222e62b24ea912a529994276f0) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 2489705d6b..44d9bbe01d 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -24010,14 +24010,18 @@ virDomainChrTargetDefFormat(virBufferPtr buf, + return -1; + } + ++ virBufferAddLit(buf, "targetType != VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE) { + virBufferAsprintf(buf, +- "\n", +- targetType, +- def->target.port); +- break; ++ "type='%s' ", ++ targetType); + } +- ATTRIBUTE_FALLTHROUGH; ++ ++ virBufferAsprintf(buf, ++ "port='%d'/>\n", ++ def->target.port); ++ break; + + case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: + virBufferAsprintf(buf, "\n", +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Rename-mode-parameter-in-virCPUDefParseXML.patch b/SOURCES/libvirt-conf-Rename-mode-parameter-in-virCPUDefParseXML.patch deleted file mode 100644 index 1c46aaf..0000000 --- a/SOURCES/libvirt-conf-Rename-mode-parameter-in-virCPUDefParseXML.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 46761b7fdb0707036482c98eb3a80279753df484 Mon Sep 17 00:00:00 2001 -Message-Id: <46761b7fdb0707036482c98eb3a80279753df484@dist-git> -From: Jiri Denemark -Date: Mon, 24 Apr 2017 15:38:41 +0200 -Subject: [PATCH] conf: Rename mode parameter in virCPUDefParseXML - -The type of this parameter is virCPUType so calling it 'mode' is pretty -strange, 'type' is a much better name. - -Signed-off-by: Jiri Denemark -(cherry picked from commit e841a41169dd726af13f29cb57fbafe658b7011a) - -https://bugzilla.redhat.com/show_bug.cgi?id=1428952 - -Signed-off-by: Jiri Denemark ---- - src/conf/cpu_conf.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index b78531e60..623b1699f 100644 ---- a/src/conf/cpu_conf.c -+++ b/src/conf/cpu_conf.c -@@ -230,7 +230,7 @@ virCPUDefCopy(const virCPUDef *cpu) - virCPUDefPtr - virCPUDefParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt, -- virCPUType mode) -+ virCPUType type) - { - virCPUDefPtr def; - xmlNodePtr *nodes = NULL; -@@ -250,7 +250,7 @@ virCPUDefParseXML(xmlNodePtr node, - if (VIR_ALLOC(def) < 0) - return NULL; - -- if (mode == VIR_CPU_TYPE_AUTO) { -+ if (type == VIR_CPU_TYPE_AUTO) { - if (virXPathBoolean("boolean(./arch)", ctxt)) { - if (virXPathBoolean("boolean(./@match)", ctxt)) { - virReportError(VIR_ERR_XML_ERROR, "%s", -@@ -263,7 +263,7 @@ virCPUDefParseXML(xmlNodePtr node, - def->type = VIR_CPU_TYPE_GUEST; - } - } else { -- def->type = mode; -+ def->type = type; - } - - if ((cpuMode = virXMLPropString(node, "mode"))) { --- -2.12.2 - diff --git a/SOURCES/libvirt-conf-Resolve-corner-case-on-fc_host-deletion.patch b/SOURCES/libvirt-conf-Resolve-corner-case-on-fc_host-deletion.patch deleted file mode 100644 index b5bfc3e..0000000 --- a/SOURCES/libvirt-conf-Resolve-corner-case-on-fc_host-deletion.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 70c60798f09324a9e4d91f787cad493a1ceca5d9 Mon Sep 17 00:00:00 2001 -Message-Id: <70c60798f09324a9e4d91f787cad493a1ceca5d9@dist-git> -From: John Ferlan -Date: Wed, 24 May 2017 10:27:57 -0400 -Subject: [PATCH] conf: Resolve corner case on fc_host deletion - -https://bugzilla.redhat.com/show_bug.cgi?id=1420740 - -Testing found an inventive way to cause an error at shutdown by providing the -parent name for the fc host creation using the "same name" as the HBA. Since -the code thus assumed the parent host name provided was the parent HBA and -just extracted out the host number and sent that along to the vport_destroy -this avoided checks made for equality. - -So just add the equality check to that path to resolve. - -(cherry picked from commit 2c8e30ee7e287d6490f643ccd2d7653a834e75e5) -Signed-off-by: John Ferlan -Signed-off-by: Jiri Denemark ---- - src/conf/node_device_conf.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index ac61db34c..2d0b14850 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -2300,17 +2300,25 @@ virNodeDeviceDeleteVport(virConnectPtr conn, - goto cleanup; - } - -+ if (virAsprintf(&scsi_host_name, "scsi_%s", name) < 0) -+ goto cleanup; -+ - /* If at startup time we provided a parent, then use that to - * get the parent_host value; otherwise, we have to determine - * the parent scsi_host which we did not save at startup time - */ - if (fchost->parent) { -+ /* Someone provided a parent string at startup time that -+ * was the same as the scsi_host - meaning we have a pool -+ * backed to an HBA, so there won't be a vHBA to delete */ -+ if (STREQ(scsi_host_name, fchost->parent)) { -+ ret = 0; -+ goto cleanup; -+ } -+ - if (virSCSIHostGetNumber(fchost->parent, &parent_host) < 0) - goto cleanup; - } else { -- if (virAsprintf(&scsi_host_name, "scsi_%s", name) < 0) -- goto cleanup; -- - if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name))) - goto cleanup; - --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-Run-devicePostParse-again-for-the-first-serial-device.patch b/SOURCES/libvirt-conf-Run-devicePostParse-again-for-the-first-serial-device.patch new file mode 100644 index 0000000..baa288e --- /dev/null +++ b/SOURCES/libvirt-conf-Run-devicePostParse-again-for-the-first-serial-device.patch @@ -0,0 +1,60 @@ +From 0c9561ff6de749954395f562cbb8e3d12954566c Mon Sep 17 00:00:00 2001 +Message-Id: <0c9561ff6de749954395f562cbb8e3d12954566c@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:57 +0100 +Subject: [PATCH] conf: Run devicePostParse() again for the first serial device + +The devicePostParse() callback is invoked for all devices so that +drivers have a chance to set their own specific values; however, +virDomainDefAddImplicitDevices() runs *after* the devicePostParse() +callbacks have been invoked and can add new devices, in which case +the driver wouldn't have a chance to customize them. + +Work around the issue by invoking the devicePostParse() callback +after virDomainDefAddImplicitDevices(), only for the first serial +devices, which might have been added by it. The same was already +happening for the first video device for the very same reason. + +This will become important later on, when we will change +virDomainDefAddConsoleCompat() not to set a targetType for +automatically added serial devices. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 2628afc143224d38e6ef8c06a8fbec1d0f69fb86) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 4b5e7c214f..41674a85af 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -4948,6 +4948,18 @@ virDomainDefPostParseCommon(virDomainDefPtr def, + return -1; + } + ++ if (def->nserials != 0) { ++ virDomainDeviceDef device = { ++ .type = VIR_DOMAIN_DEVICE_CHR, ++ .data.chr = def->serials[0], ++ }; ++ ++ /* serials[0] might have been added in AddImplicitDevices, after we've ++ * done the per-device post-parse */ ++ if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) < 0) ++ return -1; ++ } ++ + /* clean up possibly duplicated metadata entries */ + virXMLNodeSanitizeNamespaces(def->metadata); + +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-Sort-cache-banks-in-capabilities-XML.patch b/SOURCES/libvirt-conf-Sort-cache-banks-in-capabilities-XML.patch new file mode 100644 index 0000000..571ab1d --- /dev/null +++ b/SOURCES/libvirt-conf-Sort-cache-banks-in-capabilities-XML.patch @@ -0,0 +1,67 @@ +From 6532e10f6ddec18ab70f58dc660062d369b82304 Mon Sep 17 00:00:00 2001 +Message-Id: <6532e10f6ddec18ab70f58dc660062d369b82304@dist-git> +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:17 +0100 +Subject: [PATCH] conf: Sort cache banks in capabilities XML + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Because the cache banks are initialized based on the order in which their +respective directories exist on the filesystem, they can appear in different +order. This is here mainly for tests because the cache directory might have +different order of children nodes and tests would fail otherwise. It should not +be the case with sysfs, but one can never be sure. And this does not take +almost any extra time, mainly because it gets initialized once per driver. + +Signed-off-by: Martin Kletzander +Reviewed-by: John Ferlan +(cherry picked from commit b4698edcb0a459332b24410f59698005af37eecb) +Signed-off-by: Martin Kletzander +--- + src/conf/capabilities.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c +index 9920a675ac..1f7d8cdb31 100644 +--- a/src/conf/capabilities.c ++++ b/src/conf/capabilities.c +@@ -1561,6 +1561,23 @@ virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr) + VIR_FREE(ptr); + } + ++ ++static int ++virCapsHostCacheBankSorter(const void *a, ++ const void *b) ++{ ++ virCapsHostCacheBankPtr ca = *(virCapsHostCacheBankPtr *)a; ++ virCapsHostCacheBankPtr cb = *(virCapsHostCacheBankPtr *)b; ++ ++ if (ca->level < cb->level) ++ return -1; ++ if (ca->level > cb->level) ++ return 1; ++ ++ return ca->id - cb->id; ++} ++ ++ + int + virCapabilitiesInitCaches(virCapsPtr caps) + { +@@ -1700,6 +1717,12 @@ virCapabilitiesInitCaches(virCapsPtr caps) + goto cleanup; + } + ++ /* Sort the array in order for the tests to be predictable. This way we can ++ * still traverse the directory instead of guessing names (in case there is ++ * 'index1' and 'index3' but no 'index2'). */ ++ qsort(caps->host.caches, caps->host.ncaches, ++ sizeof(*caps->host.caches), virCapsHostCacheBankSorter); ++ + ret = 0; + cleanup: + VIR_FREE(type); +-- +2.16.1 + diff --git a/SOURCES/libvirt-conf-Use-virResctrlInfo-in-capabilities.patch b/SOURCES/libvirt-conf-Use-virResctrlInfo-in-capabilities.patch new file mode 100644 index 0000000..3121e3d --- /dev/null +++ b/SOURCES/libvirt-conf-Use-virResctrlInfo-in-capabilities.patch @@ -0,0 +1,131 @@ +From af86f99a7745f9d54c3f4e42f58130478e6aa9f5 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:26 +0100 +Subject: [PATCH] conf: Use virResctrlInfo in capabilities + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Signed-off-by: Martin Kletzander +(cherry picked from commit 3bbae43d8cc79ef1cd0b9a4ea2440203a0edc959) +Signed-off-by: Martin Kletzander +--- + src/conf/capabilities.c | 53 ++++++++++++++++++++++++------------------------- + src/conf/capabilities.h | 2 ++ + 2 files changed, 28 insertions(+), 27 deletions(-) + +diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c +index e93eaed2f0..edf9f54f77 100644 +--- a/src/conf/capabilities.c ++++ b/src/conf/capabilities.c +@@ -245,6 +245,7 @@ virCapabilitiesDispose(void *object) + VIR_FREE(caps->host.netprefix); + VIR_FREE(caps->host.pagesSize); + virCPUDefFree(caps->host.cpu); ++ virObjectUnref(caps->host.resctrl); + } + + /** +@@ -1592,6 +1593,20 @@ virCapsHostCacheBankSorter(const void *a, + } + + ++static int ++virCapabilitiesInitResctrl(virCapsPtr caps) ++{ ++ if (caps->host.resctrl) ++ return 0; ++ ++ caps->host.resctrl = virResctrlInfoNew(); ++ if (!caps->host.resctrl) ++ return -1; ++ ++ return virResctrlGetInfo(caps->host.resctrl); ++} ++ ++ + int + virCapabilitiesInitCaches(virCapsPtr caps) + { +@@ -1600,7 +1615,6 @@ virCapabilitiesInitCaches(virCapsPtr caps) + ssize_t pos = -1; + DIR *dirp = NULL; + int ret = -1; +- int typeret; + char *path = NULL; + char *type = NULL; + struct dirent *ent = NULL; +@@ -1611,6 +1625,9 @@ virCapabilitiesInitCaches(virCapsPtr caps) + * lose information. */ + const int cache_min_level = 3; + ++ if (virCapabilitiesInitResctrl(caps) < 0) ++ return -1; ++ + /* offline CPUs don't provide cache info */ + if (virFileReadValueBitmap(&cpus, "%s/cpu/online", SYSFS_SYSTEM_PATH) < 0) + return -1; +@@ -1676,32 +1693,6 @@ virCapabilitiesInitCaches(virCapsPtr caps) + SYSFS_SYSTEM_PATH, pos, ent->d_name) < 0) + goto cleanup; + +- typeret = virResctrlGetCacheControlType(bank->level); +- if (typeret < 0) +- goto cleanup; +- +- if (typeret == 1) { +- if (virResctrlGetCacheInfo(bank->level, +- bank->size, +- VIR_CACHE_TYPE_BOTH, +- &bank->controls, +- &bank->ncontrols) < 0) +- goto cleanup; +- } else if (typeret == 2) { +- if (virResctrlGetCacheInfo(bank->level, +- bank->size, +- VIR_CACHE_TYPE_CODE, +- &bank->controls, +- &bank->ncontrols) < 0) +- goto cleanup; +- if (virResctrlGetCacheInfo(bank->level, +- bank->size, +- VIR_CACHE_TYPE_DATA, +- &bank->controls, +- &bank->ncontrols) < 0) +- goto cleanup; +- } +- + kernel_type = virCacheKernelTypeFromString(type); + if (kernel_type < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, +@@ -1717,6 +1708,14 @@ virCapabilitiesInitCaches(virCapsPtr caps) + break; + } + if (i == caps->host.ncaches) { ++ /* If it is a new cache, then update its resctrl information. */ ++ if (virResctrlInfoGetCache(caps->host.resctrl, ++ bank->level, ++ bank->size, ++ &bank->ncontrols, ++ &bank->controls) < 0) ++ goto cleanup; ++ + if (VIR_APPEND_ELEMENT(caps->host.caches, + caps->host.ncaches, + bank) < 0) { +diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h +index 27b88cb5ed..694a3590bf 100644 +--- a/src/conf/capabilities.h ++++ b/src/conf/capabilities.h +@@ -170,6 +170,8 @@ struct _virCapsHost { + size_t nnumaCell_max; + virCapsHostNUMACellPtr *numaCell; + ++ virResctrlInfoPtr resctrl; ++ + size_t ncaches; + virCapsHostCacheBankPtr *caches; + +-- +2.16.1 + diff --git a/SOURCES/libvirt-conf-add-ABI-stability-checks-for-IOMMU-options.patch b/SOURCES/libvirt-conf-add-ABI-stability-checks-for-IOMMU-options.patch deleted file mode 100644 index c3c59ef..0000000 --- a/SOURCES/libvirt-conf-add-ABI-stability-checks-for-IOMMU-options.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 4383e358e2d8a85bd46936c997071c3b776fffd0 Mon Sep 17 00:00:00 2001 -Message-Id: <4383e358e2d8a85bd46936c997071c3b776fffd0@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 16 May 2017 10:44:59 +0200 -Subject: [PATCH] conf: add ABI stability checks for IOMMU options -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1427005 -(cherry picked from commit 935d927aa881753fff30f6236eedcf9680bca638) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - src/conf/domain_conf.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 7bf480f2a..370916396 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -19682,6 +19682,16 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, - } - } - -+ /* ioapic */ -+ if (src->ioapic != dst->ioapic) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("State of ioapic differs: " -+ "source: '%s', destination: '%s'"), -+ virDomainIOAPICTypeToString(src->ioapic), -+ virDomainIOAPICTypeToString(dst->ioapic)); -+ return false; -+ } -+ - return true; - } - -@@ -19821,6 +19831,22 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src, - virDomainIOMMUModelTypeToString(src->model)); - return false; - } -+ if (src->intremap != dst->intremap) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target domain IOMMU device intremap value '%s' " -+ "does not match source '%s'"), -+ virTristateSwitchTypeToString(dst->intremap), -+ virTristateSwitchTypeToString(src->intremap)); -+ return false; -+ } -+ if (src->caching_mode != dst->caching_mode) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target domain IOMMU device caching mode '%s' " -+ "does not match source '%s'"), -+ virTristateSwitchTypeToString(dst->caching_mode), -+ virTristateSwitchTypeToString(src->caching_mode)); -+ return false; -+ } - return true; - } - --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-add-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP.patch b/SOURCES/libvirt-conf-add-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP.patch new file mode 100644 index 0000000..a1b7f82 --- /dev/null +++ b/SOURCES/libvirt-conf-add-VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP.patch @@ -0,0 +1,605 @@ +From f93cc7753900a7ff80a32dae2fd3337939909b86 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Pino Toscano +Date: Wed, 29 Nov 2017 16:23:15 +0100 +Subject: [PATCH] conf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP + +Introduce specific a target types with two models for the console +devices (sclp and sclplm) used in s390 and s390x guests, so isa-serial +is no more used for them. + +This makes usable on s390 and s390x guests, with at most only +a single sclpconsole and one sclplmconsole devices usable in a single +guest (due to limitations in QEMU, which will enforce already at +runtime). + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1449265 + +Signed-off-by: Pino Toscano +Reviewed-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 21332bf6587c23409fecb06ab81dbc14dd52c10b) +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 19 ++++++++---- + docs/schemas/domaincommon.rng | 3 ++ + src/conf/domain_conf.c | 4 +++ + src/conf/domain_conf.h | 3 ++ + src/qemu/qemu_command.c | 6 ++++ + src/qemu/qemu_domain.c | 20 +++++++++++++ + src/qemu/qemu_domain_address.c | 1 + + .../qemuxml2argv-s390-serial-2.args | 24 +++++++++++++++ + .../qemuxml2argv-s390-serial-2.xml | 19 ++++++++++++ + .../qemuxml2argv-s390-serial-console.args | 25 ++++++++++++++++ + .../qemuxml2argv-s390-serial-console.xml | 15 ++++++++++ + .../qemuxml2argvdata/qemuxml2argv-s390-serial.args | 22 ++++++++++++++ + .../qemuxml2argvdata/qemuxml2argv-s390-serial.xml | 14 +++++++++ + tests/qemuxml2argvtest.c | 16 ++++++++++ + .../qemuxml2xmlout-s390-serial-2.xml | 33 +++++++++++++++++++++ + .../qemuxml2xmlout-s390-serial-console.xml | 34 ++++++++++++++++++++++ + .../qemuxml2xmlout-s390-serial.xml | 28 ++++++++++++++++++ + tests/qemuxml2xmltest.c | 6 ++++ + 18 files changed, 286 insertions(+), 6 deletions(-) + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args + create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml + create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 87389f4e73..62dd6e1ec4 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -6463,8 +6463,9 @@ qemu-kvm -net nic,model=? /dev/null + with x86 guests), usb-serial (usable whenever USB support + is available) and pci-serial (usable whenever PCI support + is available); since 3.10.0, +- spapr-vio-serial (usable with ppc64/pseries guests) and +- system-serial (usable with aarch64/virt guests) are ++ spapr-vio-serial (usable with ppc64/pseries guests), ++ system-serial (usable with aarch64/virt guests) and ++ sclp-serial (usable with s390 and s390x guests) are + available as well. +

    + +@@ -6478,7 +6479,9 @@ qemu-kvm -net nic,model=? /dev/null + (usable with the pci-serial target type); + spapr-vty (usable with the spapr-vio-serial + target type); pl011 (usable with the +- system-serial target type). ++ system-serial target type); sclpconsole and ++ sclplmconsole (usable with the sclp-serial ++ target type). +

    + +

    +@@ -6493,7 +6496,8 @@ qemu-kvm -net nic,model=? /dev/null + isa-serial), usb (for usb-serial), + pci (for pci-serial) and spapr-vio + (for spapr-vio-serial). The system-serial +- target type doesn't support specifying an address. ++ and sclp-serial target types don't support specifying an ++ address. +

    + +

    +@@ -6541,8 +6545,11 @@ qemu-kvm -net nic,model=? /dev/null + virtio (usable whenever VirtIO support is available); + xen, lxc, uml and + openvz (available when the corresponding hypervisor is in +- use); sclp and sclplm (usable for s390 and +- s390x QEMU guests). ++ use). sclp and sclplm (usable for s390 and ++ s390x QEMU guests) are supported for compatibility reasons but should ++ not be used for new guests: use the sclpconsole and ++ sclplmconsole target models, respectively, with the ++ serial element instead. +

    + +

    +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 957eae2832..5576128db5 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -3573,6 +3573,7 @@ + pci-serial + spapr-vio-serial + system-serial ++ sclp-serial + + + +@@ -3586,6 +3587,8 @@ + pci-serial + spapr-vty + pl011 ++ sclpconsole ++ sclplmconsole + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 32089df3c2..c58dae197c 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -447,6 +447,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget, + "pci-serial", + "spapr-vio-serial", + "system-serial", ++ "sclp-serial", + ); + + VIR_ENUM_IMPL(virDomainChrChannelTarget, +@@ -476,6 +477,8 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel, + "pci-serial", + "spapr-vty", + "pl011", ++ "sclpconsole", ++ "sclplmconsole", + ); + + VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST, +@@ -4066,6 +4069,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: { + + /* Create a stub console to match the serial port. +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index d6febf3059..0e97f0437e 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1079,6 +1079,7 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO, + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP, + + VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST + } virDomainChrSerialTargetType; +@@ -1113,6 +1114,8 @@ typedef enum { + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY, + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE, ++ VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE, + + VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST + } virDomainChrSerialTargetModel; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 483eee6056..a2cfb3d4a3 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -9229,6 +9229,10 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel) + return QEMU_CAPS_DEVICE_PCI_SERIAL; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + return QEMU_CAPS_DEVICE_SPAPR_VTY; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: ++ return QEMU_CAPS_DEVICE_SCLPCONSOLE; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: ++ return QEMU_CAPS_DEVICE_SCLPLMCONSOLE; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: +@@ -10355,6 +10359,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + + caps = qemuChrSerialTargetModelToCaps(serial->targetModel); + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 2fc173fa45..91c0e163e1 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3469,6 +3469,7 @@ qemuDomainChrSerialTargetTypeToAddressType(int targetType) + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + break; +@@ -3492,6 +3493,9 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel) + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: + return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: ++ return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + break; +@@ -3529,6 +3533,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target type '%s' cannot have an " +@@ -3550,6 +3555,8 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr) + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY: + case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE: + + expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel); + +@@ -3612,6 +3619,13 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, + isCompatible = false; + } + ++ if (!ARCH_IS_S390(def->os.arch) && ++ (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP || ++ dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE || ++ dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE)) { ++ isCompatible = false; ++ } ++ + if (!isCompatible) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Serial device with target type '%s' and " +@@ -4265,6 +4279,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO; + } else if (qemuDomainIsVirt(def)) { + chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM; ++ } else if (ARCH_IS_S390(def->os.arch)) { ++ chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP; + } + } + +@@ -4287,6 +4303,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: + chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011; + break; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: ++ chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE; ++ break; + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ +@@ -5210,6 +5229,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + /* Nothing to do */ +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index db9656a3a5..a40cdb3993 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -785,6 +785,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: + return 0; +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args +new file mode 100644 +index 0000000000..346dcd16bb +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args +@@ -0,0 +1,24 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-s390x \ ++-name QEMUGuest1 \ ++-S \ ++-M s390-ccw-virtio \ ++-m 214 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-boot c \ ++-chardev pty,id=charserial0 \ ++-device sclpconsole,chardev=charserial0,id=serial0 \ ++-chardev pty,id=charserial1 \ ++-device sclplmconsole,chardev=charserial1,id=serial1 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml +new file mode 100644 +index 0000000000..b6eb377c98 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml +@@ -0,0 +1,19 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-s390x ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args +new file mode 100644 +index 0000000000..c405fb59ee +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args +@@ -0,0 +1,25 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-s390x \ ++-name QEMUGuest1 \ ++-S \ ++-M s390-ccw-virtio \ ++-m 214 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-boot c \ ++-device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0000 \ ++-chardev pty,id=charserial0 \ ++-device sclpconsole,chardev=charserial0,id=serial0 \ ++-chardev pty,id=charconsole1 \ ++-device virtconsole,chardev=charconsole1,id=console1 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml +new file mode 100644 +index 0000000000..c841f1f245 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml +@@ -0,0 +1,15 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-s390x ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args +new file mode 100644 +index 0000000000..20968f7945 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args +@@ -0,0 +1,22 @@ ++LC_ALL=C \ ++PATH=/bin \ ++HOME=/home/test \ ++USER=test \ ++LOGNAME=test \ ++QEMU_AUDIO_DRV=none \ ++/usr/bin/qemu-system-s390x \ ++-name QEMUGuest1 \ ++-S \ ++-M s390-ccw-virtio \ ++-m 214 \ ++-smp 1,sockets=1,cores=1,threads=1 \ ++-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ ++-nographic \ ++-nodefconfig \ ++-nodefaults \ ++-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ ++server,nowait \ ++-mon chardev=charmonitor,id=monitor,mode=readline \ ++-boot c \ ++-chardev pty,id=charserial0 \ ++-device sclpconsole,chardev=charserial0,id=serial0 +diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml +new file mode 100644 +index 0000000000..55b45bac00 +--- /dev/null ++++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml +@@ -0,0 +1,14 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ /usr/bin/qemu-system-s390x ++ ++ ++ ++ +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 656b8c0995..852525e7b4 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -2049,6 +2049,22 @@ mymain(void) + QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_VIRTIO_CCW, + QEMU_CAPS_VIRTIO_S390); ++ DO_TEST("s390-serial", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_VIRTIO_CCW, ++ QEMU_CAPS_VIRTIO_S390, ++ QEMU_CAPS_DEVICE_SCLPCONSOLE); ++ DO_TEST("s390-serial-2", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_VIRTIO_CCW, ++ QEMU_CAPS_VIRTIO_S390, ++ QEMU_CAPS_DEVICE_SCLPCONSOLE, ++ QEMU_CAPS_DEVICE_SCLPLMCONSOLE); ++ DO_TEST("s390-serial-console", ++ QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_VIRTIO_CCW, ++ QEMU_CAPS_VIRTIO_S390, ++ QEMU_CAPS_DEVICE_SCLPCONSOLE); + + DO_TEST("ppc-dtb", + QEMU_CAPS_KVM, +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml +new file mode 100644 +index 0000000000..bb9ca30f1d +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml +@@ -0,0 +1,33 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-s390x ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml +new file mode 100644 +index 0000000000..db3023b7a6 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml +@@ -0,0 +1,34 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-s390x ++ ++

    ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml +new file mode 100644 +index 0000000000..9c9b4dd27a +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml +@@ -0,0 +1,28 @@ ++ ++ QEMUGuest1 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219100 ++ 219100 ++ 1 ++ ++ hvm ++ ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-s390x ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c +index bd18507bb6..8766646738 100644 +--- a/tests/qemuxml2xmltest.c ++++ b/tests/qemuxml2xmltest.c +@@ -1155,6 +1155,12 @@ mymain(void) + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("s390-panic-no-address", + QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); ++ DO_TEST("s390-serial", ++ QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); ++ DO_TEST("s390-serial-2", ++ QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); ++ DO_TEST("s390-serial-console", ++ QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390); + + DO_TEST("pcihole64", NONE); + DO_TEST("pcihole64-gib", NONE); +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-add-a-new-parse-flag-VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION.patch b/SOURCES/libvirt-conf-add-a-new-parse-flag-VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION.patch deleted file mode 100644 index 6ce10e4..0000000 --- a/SOURCES/libvirt-conf-add-a-new-parse-flag-VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION.patch +++ /dev/null @@ -1,72 +0,0 @@ -From b24b004e1196889201142d1fc7d51e2fafdbe328 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Pavel Hrdina -Date: Thu, 20 Apr 2017 09:16:20 +0200 -Subject: [PATCH] conf: add a new parse flag - VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION - -So far there is probably no change that is allowed to be done -by the VIR_DOMAIN_DEF_PARSE_ABI_UPDATE flag that would break -guest ABI but this may change in the future. - -This introduces new VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION -which should be used only for ABI updates that are "safe" for -persistent migration. - -Signed-off-by: Pavel Hrdina -(cherry picked from commit 5c7d88085a762cf4ecc9416a3b7581fa45738c2a) - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1373184 - -Signed-off-by: Pavel Hrdina ---- - src/conf/domain_conf.c | 3 ++- - src/conf/domain_conf.h | 4 ++++ - src/qemu/qemu_migration_cookie.c | 2 +- - 3 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 1b0a55b27..71f0c95c3 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -3805,7 +3805,8 @@ virDomainDefPostParseMemory(virDomainDefPtr def, - /* Attempt to infer the initial memory size from the sum NUMA memory sizes - * in case ABI updates are allowed or the element wasn't specified */ - if (def->mem.total_memory == 0 || -- parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) -+ parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE || -+ parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION) - numaMemory = virDomainNumaGetMemorySize(def->numa); - - /* calculate the sizes of hotplug memory */ -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 47eaacef3..71e651975 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2725,6 +2725,10 @@ typedef enum { - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 10, - /* skip parsing of security labels */ - VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL = 1 << 11, -+ /* Allows updates in post parse callback for incoming persistent migration -+ * that would break ABI otherwise. This should be used only if it's safe -+ * to do such change. */ -+ VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 12, - } virDomainDefParseFlags; - - typedef enum { -diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c -index bd12f1124..12887892d 100644 ---- a/src/qemu/qemu_migration_cookie.c -+++ b/src/qemu/qemu_migration_cookie.c -@@ -1173,7 +1173,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, - mig->persistent = virDomainDefParseNode(doc, nodes[0], - caps, driver->xmlopt, NULL, - VIR_DOMAIN_DEF_PARSE_INACTIVE | -- VIR_DOMAIN_DEF_PARSE_ABI_UPDATE | -+ VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); - if (!mig->persistent) { - /* virDomainDefParseNode already reported --- -2.12.2 - diff --git a/SOURCES/libvirt-conf-add-caching_mode-attribute-to-iommu-device.patch b/SOURCES/libvirt-conf-add-caching_mode-attribute-to-iommu-device.patch deleted file mode 100644 index 5e209b4..0000000 --- a/SOURCES/libvirt-conf-add-caching_mode-attribute-to-iommu-device.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 3b7b827deb9eb7f43f548aabd27c300ae24c7db3 Mon Sep 17 00:00:00 2001 -Message-Id: <3b7b827deb9eb7f43f548aabd27c300ae24c7db3@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 16 May 2017 10:44:56 +0200 -Subject: [PATCH] conf: add caching_mode attribute to iommu device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a new attribute to control the caching mode. - -https://bugzilla.redhat.com/show_bug.cgi?id=1427005 -(cherry picked from commit d12781b47eb0c9f3a498d88b632c327aa08aaf8a) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 9 ++++ - docs/schemas/domaincommon.rng | 5 +++ - src/conf/domain_conf.c | 24 +++++++++-- - src/conf/domain_conf.h | 1 + - .../qemuxml2argv-intel-iommu-caching-mode.xml | 50 ++++++++++++++++++++++ - .../qemuxml2xmlout-intel-iommu-caching-mode.xml | 1 + - tests/qemuxml2xmltest.c | 1 + - 7 files changed, 88 insertions(+), 3 deletions(-) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml - create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 41b8bfb50..43a75c1ee 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -7424,6 +7424,15 @@ qemu-kvm -net nic,model=? /dev/null - Since 3.4.0 (QEMU/KVM only) -

    - -+
    caching_mode
    -+
    -+

    -+ The caching_mode attribute with possible values -+ on and off can be used to -+ turn on the VT-d caching mode (useful for assigned devices). -+ Since 3.4.0 (QEMU/KVM only) -+

    -+
    - - - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index a400d961b..12ccbd4e2 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3900,6 +3900,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 45473f65b..e77b542f3 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -14167,6 +14167,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, - iommu->intremap = val; - } - -+ VIR_FREE(tmp); -+ if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp); -+ goto cleanup; -+ } -+ iommu->caching_mode = val; -+ } -+ - ret = iommu; - iommu = NULL; - -@@ -24114,9 +24123,18 @@ virDomainIOMMUDefFormat(virBufferPtr buf, - - virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); - -- if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) { -- virBufferAsprintf(&childBuf, "\n", -- virTristateSwitchTypeToString(iommu->intremap)); -+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT || -+ iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAddLit(&childBuf, "intremap != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(&childBuf, " intremap='%s'", -+ virTristateSwitchTypeToString(iommu->intremap)); -+ } -+ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(&childBuf, " caching_mode='%s'", -+ virTristateSwitchTypeToString(iommu->caching_mode)); -+ } -+ virBufferAddLit(&childBuf, "/>\n"); - } - - virBufferAsprintf(buf, " -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219100 -+ 219100 -+ 1 -+ -+ hvm -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+ -+
    -+ -+ -+ -+ -+
    -+ -+ -+ -+ -+
    -+ -+ -+
    -+ -+ -+
    -+ -+ -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml -new file mode 120000 -index 000000000..d971a35dc ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml -@@ -0,0 +1 @@ -+../qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml -\ No newline at end of file -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index 0482ad9cb..e1938421a 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -1129,6 +1129,7 @@ mymain(void) - QEMU_CAPS_MACHINE_OPT, - QEMU_CAPS_MACHINE_IOMMU); - DO_TEST("intel-iommu-ioapic", NONE); -+ DO_TEST("intel-iommu-caching-mode", NONE); - - DO_TEST("cpu-check-none", NONE); - DO_TEST("cpu-check-partial", NONE); --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-add-driver-intremap-to-iommu.patch b/SOURCES/libvirt-conf-add-driver-intremap-to-iommu.patch deleted file mode 100644 index 8bd9e7f..0000000 --- a/SOURCES/libvirt-conf-add-driver-intremap-to-iommu.patch +++ /dev/null @@ -1,201 +0,0 @@ -From 2bb15d3f041ec2506012aa701547334af429b915 Mon Sep 17 00:00:00 2001 -Message-Id: <2bb15d3f041ec2506012aa701547334af429b915@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 16 May 2017 10:44:54 +0200 -Subject: [PATCH] conf: add to -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a new attribute to control interrupt remapping. - -https://bugzilla.redhat.com/show_bug.cgi?id=1427005 -(cherry picked from commit 2020e2c6f2656ca1aa9032859ccde76185c37c39) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 24 +++++++++++++- - docs/schemas/domaincommon.rng | 9 +++++ - src/conf/domain_conf.c | 38 +++++++++++++++++++--- - src/conf/domain_conf.h | 1 + - .../qemuxml2argv-intel-iommu-ioapic.xml | 4 ++- - 5 files changed, 70 insertions(+), 6 deletions(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 869c1f73e..41b8bfb50 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -7393,7 +7393,9 @@ qemu-kvm -net nic,model=? /dev/null -
    - ...
    - <devices>
    --  <iommu model='intel'/>
    -+  <iommu model='intel'>
    -+    <driver intremap='on'/>
    -+  </iommu>
    - </devices>
    - ...
    - 
    -@@ -7404,6 +7406,26 @@ qemu-kvm -net nic,model=? /dev/null - Currently only the intel model is supported. -

    - -+
    driver
    -+
    -+

    -+ The driver subelement can be used to configure -+ additional options: -+

    -+
    -+
    intremap
    -+
    -+

    -+ The intremap attribute with possible values -+ on and off can be used to -+ turn on interrupt remapping, a part of the VT-d functionality. -+ Currently this requires split I/O APIC -+ (<ioapic driver='qemu'/>). -+ Since 3.4.0 (QEMU/KVM only) -+

    -+
    -+
    -+
    - - -

    Security label

    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index c72ba7e97..a400d961b 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3893,6 +3893,15 @@ - - intel - -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index d5c4f6ddd..45473f65b 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -14132,12 +14132,16 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, - - - static virDomainIOMMUDefPtr --virDomainIOMMUDefParseXML(xmlNodePtr node) -+virDomainIOMMUDefParseXML(xmlNodePtr node, -+ xmlXPathContextPtr ctxt) - { - virDomainIOMMUDefPtr iommu = NULL, ret = NULL; -+ xmlNodePtr save = ctxt->node; - char *tmp = NULL; - int val; - -+ ctxt->node = node; -+ - if (VIR_ALLOC(iommu) < 0) - goto cleanup; - -@@ -14154,10 +14158,20 @@ virDomainIOMMUDefParseXML(xmlNodePtr node) - - iommu->model = val; - -+ VIR_FREE(tmp); -+ if ((tmp = virXPathString("string(./driver/@intremap)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %s"), tmp); -+ goto cleanup; -+ } -+ iommu->intremap = val; -+ } -+ - ret = iommu; - iommu = NULL; - - cleanup: -+ ctxt->node = save; - VIR_FREE(iommu); - VIR_FREE(tmp); - return ret; -@@ -14310,7 +14324,7 @@ virDomainDeviceDefParse(const char *xmlStr, - goto error; - break; - case VIR_DOMAIN_DEVICE_IOMMU: -- if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node))) -+ if (!(dev->data.iommu = virDomainIOMMUDefParseXML(node, ctxt))) - goto error; - break; - case VIR_DOMAIN_DEVICE_NONE: -@@ -18440,7 +18454,7 @@ virDomainDefParseXML(xmlDocPtr xml, - } - - if (n > 0) { -- if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0]))) -+ if (!(def->iommu = virDomainIOMMUDefParseXML(nodes[0], ctxt))) - goto error; - } - VIR_FREE(nodes); -@@ -24096,8 +24110,24 @@ static void - virDomainIOMMUDefFormat(virBufferPtr buf, - const virDomainIOMMUDef *iommu) - { -- virBufferAsprintf(buf, "\n", -+ virBuffer childBuf = VIR_BUFFER_INITIALIZER; -+ -+ virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); -+ -+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(&childBuf, "\n", -+ virTristateSwitchTypeToString(iommu->intremap)); -+ } -+ -+ virBufferAsprintf(buf, "model)); -+ if (virBufferUse(&childBuf)) { -+ virBufferAddLit(buf, ">\n"); -+ virBufferAddBuffer(buf, &childBuf); -+ virBufferAddLit(buf, "\n"); -+ } else { -+ virBufferAddLit(buf, "/>\n"); -+ } - } - - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 4cb37b1fc..8eb422a57 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2209,6 +2209,7 @@ typedef enum { - - struct _virDomainIOMMUDef { - virDomainIOMMUModel model; -+ virTristateSwitch intremap; - }; - /* - * Guest VM main configuration -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -index 284d63a30..bfe714ad8 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -@@ -24,6 +24,8 @@ - - - -- -+ -+ -+ - - --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-add-eim-attribute-to-iommu-driver.patch b/SOURCES/libvirt-conf-add-eim-attribute-to-iommu-driver.patch deleted file mode 100644 index 8297928..0000000 --- a/SOURCES/libvirt-conf-add-eim-attribute-to-iommu-driver.patch +++ /dev/null @@ -1,191 +0,0 @@ -From d7a019948e1c1f0400ee174ef60bf0cb32d181f9 Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 26 May 2017 08:52:56 +0200 -Subject: [PATCH] conf: add eim attribute to -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add an attribute to control extended interrupt mode. - -https://bugzilla.redhat.com/show_bug.cgi?id=1451282 - -Reviewed-by: Andrea Bolognani -(cherry picked from commit dc61d927589b2b122868e6abea86b73caa682226) - -Signed-off-by: Ján Tomko - -Also: -https://bugzilla.redhat.com/show_bug.cgi?id=1289153 -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 13 +++++++++ - docs/schemas/domaincommon.rng | 5 ++++ - src/conf/domain_conf.c | 21 +++++++++++++++ - src/conf/domain_conf.h | 1 + - .../qemuxml2argv-intel-iommu-eim.xml | 31 ++++++++++++++++++++++ - .../qemuxml2xmlout-intel-iommu-eim.xml | 1 + - tests/qemuxml2xmltest.c | 1 + - 7 files changed, 73 insertions(+) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml - create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 43a75c1ee..e886e4e17 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -7433,6 +7433,19 @@ qemu-kvm -net nic,model=? /dev/null - Since 3.4.0 (QEMU/KVM only) -

    - -+
    eim
    -+
    -+

    -+ The eim attribute (with possible values -+ on and off) can be used to -+ configure Extended Interrupt Mode. A q35 domain with -+ split I/O APIC (as described in -+ hypervisor features), -+ and both interrupt remapping and EIM turned on for -+ the IOMMU, will be able to use more than 255 vCPUs. -+ Since 3.4.0 (QEMU/KVM only) -+

    -+
    - - - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 12ccbd4e2..af7824aa0 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3905,6 +3905,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 370916396..4404b8f73 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -14176,6 +14176,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, - iommu->caching_mode = val; - } - -+ VIR_FREE(tmp); -+ if ((tmp = virXPathString("string(./driver/@eim)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), tmp); -+ goto cleanup; -+ } -+ iommu->eim = val; -+ } -+ - ret = iommu; - iommu = NULL; - -@@ -19847,6 +19856,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src, - virTristateSwitchTypeToString(src->caching_mode)); - return false; - } -+ if (src->eim != dst->eim) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target domain IOMMU device eim value '%s' " -+ "does not match source '%s'"), -+ virTristateSwitchTypeToString(dst->eim), -+ virTristateSwitchTypeToString(src->eim)); -+ return false; -+ } - return true; - } - -@@ -24170,6 +24187,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf, - virBufferAsprintf(&childBuf, " caching_mode='%s'", - virTristateSwitchTypeToString(iommu->caching_mode)); - } -+ if (iommu->eim != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(&childBuf, " eim='%s'", -+ virTristateSwitchTypeToString(iommu->eim)); -+ } - virBufferAddLit(&childBuf, "/>\n"); - } - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 825158a7d..980aafa66 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2211,6 +2211,7 @@ struct _virDomainIOMMUDef { - virDomainIOMMUModel model; - virTristateSwitch intremap; - virTristateSwitch caching_mode; -+ virTristateSwitch eim; - }; - /* - * Guest VM main configuration -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml -new file mode 100644 -index 000000000..8642ed349 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml -@@ -0,0 +1,31 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219100 -+ 219100 -+ 288 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml -new file mode 120000 -index 000000000..9fbec36dc ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml -@@ -0,0 +1 @@ -+../qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml -\ No newline at end of file -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index e1938421a..6283da409 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -1130,6 +1130,7 @@ mymain(void) - QEMU_CAPS_MACHINE_IOMMU); - DO_TEST("intel-iommu-ioapic", NONE); - DO_TEST("intel-iommu-caching-mode", NONE); -+ DO_TEST("intel-iommu-eim", NONE); - - DO_TEST("cpu-check-none", NONE); - DO_TEST("cpu-check-partial", NONE); --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-add-ioapic-driver-to-features.patch b/SOURCES/libvirt-conf-add-ioapic-driver-to-features.patch deleted file mode 100644 index c7b34fa..0000000 --- a/SOURCES/libvirt-conf-add-ioapic-driver-to-features.patch +++ /dev/null @@ -1,249 +0,0 @@ -From abbea18f4b3747d738d05f36884dda3202128b65 Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 16 May 2017 10:44:52 +0200 -Subject: [PATCH] conf: add to -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a new element with a driver attribute. - -Possible values are qemu and kvm. With 'qemu', the I/O -APIC can be put in the userspace even for KVM domains. - -https://bugzilla.redhat.com/show_bug.cgi?id=1427005 -(cherry picked from commit 8023b21a95f271e51810de7f1362e609eaadc1e4) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 9 ++++++ - docs/schemas/domaincommon.rng | 15 ++++++++++ - src/conf/domain_conf.c | 33 +++++++++++++++++++++- - src/conf/domain_conf.h | 11 ++++++++ - .../qemuxml2argv-intel-iommu-ioapic.xml | 29 +++++++++++++++++++ - .../qemuxml2xmlout-intel-iommu-ioapic.xml | 1 + - tests/qemuxml2xmltest.c | 1 + - 7 files changed, 98 insertions(+), 1 deletion(-) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml - create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 7e55b0327..869c1f73e 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -1675,6 +1675,7 @@ - </kvm> - <pvspinlock state='on'/> - <gic version='2'/> -+ <ioapic driver='qemu'/> - - </features> - ... -@@ -1836,6 +1837,14 @@ - for hypervisor to decide. - Since 2.1.0 - -+
    ioapic
    -+
    Tune the I/O APIC. Possible values for the -+ driver attribute are: -+ kvm (default for KVM domains) -+ and qemu which puts I/O APIC in userspace -+ which is also known as a split I/O APIC mode. -+ Since 3.4.0 (QEMU/KVM only) -+
    - - -

    Time keeping

    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index 7271f0113..c72ba7e97 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -4515,6 +4515,9 @@ - - - -+ -+ -+ - - - -@@ -4693,6 +4696,18 @@ - - - -+ -+ -+ -+ -+ qemu -+ kvm -+ -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 4096b9caf..d5c4f6ddd 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -141,7 +141,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, - "pmu", - "vmport", - "gic", -- "smm") -+ "smm", -+ "ioapic") - - VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, - "default", -@@ -859,6 +860,11 @@ VIR_ENUM_IMPL(virDomainLoader, - "rom", - "pflash") - -+VIR_ENUM_IMPL(virDomainIOAPIC, -+ VIR_DOMAIN_IOAPIC_LAST, -+ "qemu", -+ "kvm") -+ - /* Internal mapping: subset of block job types that can be present in - * XML (remaining types are not two-phase). */ - VIR_ENUM_DECL(virDomainBlockJob) -@@ -17518,6 +17524,24 @@ virDomainDefParseXML(xmlDocPtr xml, - ctxt->node = node; - break; - -+ case VIR_DOMAIN_FEATURE_IOAPIC: -+ node = ctxt->node; -+ ctxt->node = nodes[i]; -+ tmp = virXPathString("string(./@driver)", ctxt); -+ if (tmp) { -+ int value = virDomainIOAPICTypeFromString(tmp); -+ if (value < 0) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Unknown driver mode: %s"), -+ tmp); -+ goto error; -+ } -+ def->ioapic = value; -+ def->features[val] = VIR_TRISTATE_SWITCH_ON; -+ } -+ ctxt->node = node; -+ break; -+ - /* coverity[dead_error_begin] */ - case VIR_DOMAIN_FEATURE_LAST: - break; -@@ -24598,6 +24622,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, - } - break; - -+ case VIR_DOMAIN_FEATURE_IOAPIC: -+ if (def->features[i] == VIR_TRISTATE_SWITCH_ON) { -+ virBufferAsprintf(buf, "\n", -+ virDomainIOAPICTypeToString(def->ioapic)); -+ } -+ break; -+ - /* coverity[dead_error_begin] */ - case VIR_DOMAIN_FEATURE_LAST: - break; -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index f1e9fc2ba..4cb37b1fc 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -1670,6 +1670,7 @@ typedef enum { - VIR_DOMAIN_FEATURE_VMPORT, - VIR_DOMAIN_FEATURE_GIC, - VIR_DOMAIN_FEATURE_SMM, -+ VIR_DOMAIN_FEATURE_IOAPIC, - - VIR_DOMAIN_FEATURE_LAST - } virDomainFeature; -@@ -1809,6 +1810,15 @@ struct _virDomainLoaderDef { - - void virDomainLoaderDefFree(virDomainLoaderDefPtr loader); - -+typedef enum { -+ VIR_DOMAIN_IOAPIC_QEMU = 0, -+ VIR_DOMAIN_IOAPIC_KVM, -+ -+ VIR_DOMAIN_IOAPIC_LAST -+} virDomainIOAPIC; -+ -+VIR_ENUM_DECL(virDomainIOAPIC); -+ - /* Operating system configuration data & machine / arch */ - typedef struct _virDomainOSDef virDomainOSDef; - typedef virDomainOSDef *virDomainOSDefPtr; -@@ -2258,6 +2268,7 @@ struct _virDomainDef { - unsigned int hyperv_spinlocks; - virGICVersion gic_version; - char *hyperv_vendor_id; -+ virDomainIOAPIC ioapic; - - /* These options are of type virTristateSwitch: ON = keep, OFF = drop */ - int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -new file mode 100644 -index 000000000..284d63a30 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -@@ -0,0 +1,29 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219100 -+ 219100 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml -new file mode 120000 -index 000000000..42d17b2c0 ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml -@@ -0,0 +1 @@ -+../qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml -\ No newline at end of file -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index ff533ab19..0482ad9cb 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -1128,6 +1128,7 @@ mymain(void) - DO_TEST("intel-iommu-machine", - QEMU_CAPS_MACHINE_OPT, - QEMU_CAPS_MACHINE_IOMMU); -+ DO_TEST("intel-iommu-ioapic", NONE); - - DO_TEST("cpu-check-none", NONE); - DO_TEST("cpu-check-partial", NONE); --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-add-iotlb-attribute-to-iommu.patch b/SOURCES/libvirt-conf-add-iotlb-attribute-to-iommu.patch deleted file mode 100644 index d8b4894..0000000 --- a/SOURCES/libvirt-conf-add-iotlb-attribute-to-iommu.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 1e915e38d422df8b3cb4e049e932a5e6900735bc Mon Sep 17 00:00:00 2001 -Message-Id: <1e915e38d422df8b3cb4e049e932a5e6900735bc@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:48:56 +0200 -Subject: [PATCH] conf: add iotlb attribute to iommu -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add a new iotlb attribute to the iommu device -to control the device IOTLB support for intel-iommu. - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 - -Reviewed-by: Pavel Hrdina -(cherry picked from commit 27b187be3988c60cd26e08ab4bcab66bed5a3646) -Signed-off-by: Ján Tomko -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 10 +++++++ - docs/schemas/domaincommon.rng | 5 ++++ - src/conf/domain_conf.c | 23 +++++++++++++++- - src/conf/domain_conf.h | 1 + - .../qemuxml2argv-intel-iommu-device-iotlb.xml | 31 ++++++++++++++++++++++ - .../qemuxml2xmlout-intel-iommu-device-iotlb.xml | 1 + - tests/qemuxml2xmltest.c | 1 + - 7 files changed, 71 insertions(+), 1 deletion(-) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml - create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index e886e4e17e..e8a3367bac 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -7446,6 +7446,16 @@ qemu-kvm -net nic,model=? /dev/null - Since 3.4.0 (QEMU/KVM only) -

    - -+
    iotlb
    -+
    -+

    -+ The iotlb attribute with possible values -+ on and off can be used to -+ turn on the IOTLB used to cache address translation -+ requests from devices. -+ Since 3.5.0 (QEMU/KVM only) -+

    -+
    - - - -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng -index af7824aa02..1b66362f17 100644 ---- a/docs/schemas/domaincommon.rng -+++ b/docs/schemas/domaincommon.rng -@@ -3910,6 +3910,11 @@ - - - -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 275145b1ec..701a6d2136 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -14196,6 +14196,14 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, - } - iommu->caching_mode = val; - } -+ VIR_FREE(tmp); -+ if ((tmp = virXPathString("string(./driver/@iotlb)", ctxt))) { -+ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, _("unknown iotlb value: %s"), tmp); -+ goto cleanup; -+ } -+ iommu->iotlb = val; -+ } - - VIR_FREE(tmp); - if ((tmp = virXPathString("string(./driver/@eim)", ctxt))) { -@@ -19877,6 +19885,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src, - virTristateSwitchTypeToString(src->eim)); - return false; - } -+ if (src->iotlb != dst->iotlb) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target domain IOMMU device iotlb value '%s' " -+ "does not match source '%s'"), -+ virTristateSwitchTypeToString(dst->iotlb), -+ virTristateSwitchTypeToString(src->iotlb)); -+ return false; -+ } - return true; - } - -@@ -24212,7 +24228,8 @@ virDomainIOMMUDefFormat(virBufferPtr buf, - virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); - - if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT || -- iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) { -+ iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT || -+ iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAddLit(&childBuf, "intremap != VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&childBuf, " intremap='%s'", -@@ -24226,6 +24243,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf, - virBufferAsprintf(&childBuf, " eim='%s'", - virTristateSwitchTypeToString(iommu->eim)); - } -+ if (iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT) { -+ virBufferAsprintf(&childBuf, " iotlb='%s'", -+ virTristateSwitchTypeToString(iommu->iotlb)); -+ } - virBufferAddLit(&childBuf, "/>\n"); - } - -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h -index 706d106ad9..e6c20a9e1e 100644 ---- a/src/conf/domain_conf.h -+++ b/src/conf/domain_conf.h -@@ -2213,6 +2213,7 @@ struct _virDomainIOMMUDef { - virTristateSwitch intremap; - virTristateSwitch caching_mode; - virTristateSwitch eim; -+ virTristateSwitch iotlb; - }; - /* - * Guest VM main configuration -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml -new file mode 100644 -index 0000000000..3eb08ab9af ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml -@@ -0,0 +1,31 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219100 -+ 219100 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.xml -new file mode 120000 -index 0000000000..3120d9f677 ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.xml -@@ -0,0 +1 @@ -+../qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml -\ No newline at end of file -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index 6283da4096..3f7c268e43 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -1131,6 +1131,7 @@ mymain(void) - DO_TEST("intel-iommu-ioapic", NONE); - DO_TEST("intel-iommu-caching-mode", NONE); - DO_TEST("intel-iommu-eim", NONE); -+ DO_TEST("intel-iommu-device-iotlb", NONE); - - DO_TEST("cpu-check-none", NONE); - DO_TEST("cpu-check-partial", NONE); --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-docs-Add-support-for-coalesce-setting-s.patch b/SOURCES/libvirt-conf-docs-Add-support-for-coalesce-setting-s.patch deleted file mode 100644 index f7166fc..0000000 --- a/SOURCES/libvirt-conf-docs-Add-support-for-coalesce-setting-s.patch +++ /dev/null @@ -1,557 +0,0 @@ -From 705cbf8998e405b98f2d536f6d92c524755fe219 Mon Sep 17 00:00:00 2001 -Message-Id: <705cbf8998e405b98f2d536f6d92c524755fe219@dist-git> -From: Martin Kletzander -Date: Tue, 25 Apr 2017 13:41:16 +0200 -Subject: [PATCH] conf, docs: Add support for coalesce setting(s) - -https://bugzilla.redhat.com/show_bug.cgi?id=1414627 - -We are currently parsing only rx/frames/max because that's the only -value that makes sense for us. The tun device just added support for -this one and the others are only supported by hardware devices which -we don't need to worry about as the only way we'd pass those to the -domain is using or . And in -those cases the guest can modify the settings itself. - -Signed-off-by: Martin Kletzander -(cherry picked from commit 523c9960621eaf307ae8d4ae2735fb66f89d5634) -Signed-off-by: Martin Kletzander -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 27 +++++ - docs/schemas/domaincommon.rng | 131 +++++++++++++++++++++ - src/conf/domain_conf.c | 80 +++++++++++++ - src/conf/domain_conf.h | 2 + - src/qemu/qemu_domain.c | 31 +++++ - .../qemuxml2argvdata/qemuxml2argv-net-coalesce.xml | 68 +++++++++++ - .../qemuxml2xmlout-net-coalesce.xml | 71 +++++++++++ - tests/qemuxml2xmltest.c | 1 + - 8 files changed, 411 insertions(+) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-coalesce.xml - create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index aee1e1442..7374cb243 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -5437,6 +5437,33 @@ qemu-kvm -net nic,model=? /dev/null - Since 3.1.0 -

    - -+
    Coalesce settings
    -+
    -+...
    -+<devices>
    -+  <interface type='network'>
    -+    <source network='default'/>
    -+    <target dev='vnet0'/>
    -+    <coalesce>
    -+      <rx>
    -+        <frames max='7'/>
    -+      </rx>
    -+    </coalesce>
    -+  </interface>
    -+</devices>
    -+...
    -+ -+

    -+ This element provides means of setting coalesce settings for -+ some interface devices (currently only type network -+ and bridge. Currently there is just one attribute, -+ max, to tweak, in element frames for -+ the rx group, which accepts a non-negative integer -+ that specifies the maximum number of packets that will be -+ received before an interrupt. -+ Since 3.3.0 -+

    -+ -
    IP configuration
    -
    - ...
    -diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
    -index d5c28ee3c..7a9b4b702 100644
    ---- a/docs/schemas/domaincommon.rng
    -+++ b/docs/schemas/domaincommon.rng
    -@@ -2509,6 +2509,9 @@
    -         
    -       
    -       
    -+        
    -+      
    -+      
    -         
    -           
    -             
    -@@ -5746,4 +5749,132 @@
    -       
    -     
    -   
    -+
    -+  
    -+    
    -+      
    -+        
    -+          
    -+            
    -+              
    -+                
    -+                  
    -+                    
    -+                  
    -+                
    -+                
    -+              
    -+            
    -+            
    -+          
    -+        
    -+        
    -+      
    -+    
    -+  
    -+
    - 
    -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
    -index 71f0c95c3..f2801ec84 100644
    ---- a/src/conf/domain_conf.c
    -+++ b/src/conf/domain_conf.c
    -@@ -6759,6 +6759,77 @@ virDomainNetIPInfoParseXML(const char *source,
    -     return ret;
    - }
    - 
    -+
    -+static virNetDevCoalescePtr
    -+virDomainNetDefCoalesceParseXML(xmlNodePtr node,
    -+                                xmlXPathContextPtr ctxt)
    -+{
    -+    virNetDevCoalescePtr ret = NULL;
    -+    xmlNodePtr save = NULL;
    -+    char *str = NULL;
    -+    unsigned long long tmp = 0;
    -+
    -+    save = ctxt->node;
    -+    ctxt->node = node;
    -+
    -+    str = virXPathString("string(./rx/frames/@max)", ctxt);
    -+    if (!str)
    -+        goto cleanup;
    -+
    -+    if (!ret && VIR_ALLOC(ret) < 0)
    -+        goto cleanup;
    -+
    -+    if (virStrToLong_ullp(str, NULL, 10, &tmp) < 0) {
    -+        virReportError(VIR_ERR_XML_DETAIL,
    -+                       _("cannot parse value '%s' for coalesce parameter"),
    -+                       str);
    -+        VIR_FREE(str);
    -+        goto error;
    -+    }
    -+    VIR_FREE(str);
    -+
    -+    if (tmp > UINT32_MAX) {
    -+        virReportError(VIR_ERR_OVERFLOW,
    -+                       _("value '%llu' is too big for coalesce "
    -+                         "parameter, maximum is '%lu'"),
    -+                       tmp, (unsigned long) UINT32_MAX);
    -+        goto error;
    -+    }
    -+    ret->rx_max_coalesced_frames = tmp;
    -+
    -+ cleanup:
    -+    ctxt->node = save;
    -+    return ret;
    -+
    -+ error:
    -+    VIR_FREE(ret);
    -+    goto cleanup;
    -+}
    -+
    -+static void
    -+virDomainNetDefCoalesceFormatXML(virBufferPtr buf,
    -+                                 virNetDevCoalescePtr coalesce)
    -+{
    -+    if (!coalesce || !coalesce->rx_max_coalesced_frames)
    -+        return;
    -+
    -+    virBufferAddLit(buf, "\n");
    -+    virBufferAdjustIndent(buf, 2);
    -+
    -+    virBufferAddLit(buf, "\n");
    -+    virBufferAdjustIndent(buf, 2);
    -+
    -+    virBufferAsprintf(buf, "\n",
    -+                      coalesce->rx_max_coalesced_frames);
    -+
    -+    virBufferAdjustIndent(buf, -2);
    -+    virBufferAddLit(buf, "\n");
    -+
    -+    virBufferAdjustIndent(buf, -2);
    -+    virBufferAddLit(buf, "\n");
    -+}
    -+
    -+
    - static int
    - virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
    -                                 xmlXPathContextPtr ctxt,
    -@@ -10242,6 +10313,13 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
    -         goto error;
    -     }
    - 
    -+    node = virXPathNode("./coalesce", ctxt);
    -+    if (node) {
    -+        def->coalesce = virDomainNetDefCoalesceParseXML(node, ctxt);
    -+        if (!def->coalesce)
    -+            goto error;
    -+    }
    -+
    -  cleanup:
    -     ctxt->node = oldnode;
    -     VIR_FREE(macaddr);
    -@@ -22135,6 +22213,8 @@ virDomainNetDefFormat(virBufferPtr buf,
    -     if (def->mtu)
    -         virBufferAsprintf(buf, "\n", def->mtu);
    - 
    -+    virDomainNetDefCoalesceFormatXML(buf, def->coalesce);
    -+
    -     if (virDomainDeviceInfoFormat(buf, &def->info,
    -                                   flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT
    -                                   | VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) < 0)
    -diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
    -index 71e651975..1dbbcdc51 100644
    ---- a/src/conf/domain_conf.h
    -+++ b/src/conf/domain_conf.h
    -@@ -41,6 +41,7 @@
    - # include "numa_conf.h"
    - # include "virnetdevmacvlan.h"
    - # include "virsysinfo.h"
    -+# include "virnetdev.h"
    - # include "virnetdevip.h"
    - # include "virnetdevvportprofile.h"
    - # include "virnetdevbandwidth.h"
    -@@ -1036,6 +1037,7 @@ struct _virDomainNetDef {
    -     int trustGuestRxFilters; /* enum virTristateBool */
    -     int linkstate;
    -     unsigned int mtu;
    -+    virNetDevCoalescePtr coalesce;
    - };
    - 
    - /* Used for prefix of ifname of any network name generated dynamically
    -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
    -index d31645fd1..53586878b 100644
    ---- a/src/qemu/qemu_domain.c
    -+++ b/src/qemu/qemu_domain.c
    -@@ -3012,6 +3012,30 @@ qemuDomainDefValidate(const virDomainDef *def,
    - }
    - 
    - 
    -+static bool
    -+qemuDomainNetSupportsCoalesce(virDomainNetType type)
    -+{
    -+    switch (type) {
    -+    case VIR_DOMAIN_NET_TYPE_NETWORK:
    -+    case VIR_DOMAIN_NET_TYPE_BRIDGE:
    -+        return true;
    -+    case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
    -+    case VIR_DOMAIN_NET_TYPE_ETHERNET:
    -+    case VIR_DOMAIN_NET_TYPE_DIRECT:
    -+    case VIR_DOMAIN_NET_TYPE_HOSTDEV:
    -+    case VIR_DOMAIN_NET_TYPE_USER:
    -+    case VIR_DOMAIN_NET_TYPE_SERVER:
    -+    case VIR_DOMAIN_NET_TYPE_CLIENT:
    -+    case VIR_DOMAIN_NET_TYPE_MCAST:
    -+    case VIR_DOMAIN_NET_TYPE_INTERNAL:
    -+    case VIR_DOMAIN_NET_TYPE_UDP:
    -+    case VIR_DOMAIN_NET_TYPE_LAST:
    -+        break;
    -+    }
    -+    return false;
    -+}
    -+
    -+
    - static int
    - qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
    -                             const virDomainDef *def ATTRIBUTE_UNUSED,
    -@@ -3046,6 +3070,13 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
    -                            virDomainNetTypeToString(net->type));
    -             goto cleanup;
    -         }
    -+
    -+        if (net->coalesce && !qemuDomainNetSupportsCoalesce(net->type)) {
    -+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
    -+                           _("coalesce settings on interface type %s are not supported"),
    -+                           virDomainNetTypeToString(net->type));
    -+            goto cleanup;
    -+        }
    -     }
    - 
    -     ret = 0;
    -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-coalesce.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-coalesce.xml
    -new file mode 100644
    -index 000000000..b51032442
    ---- /dev/null
    -+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-coalesce.xml
    -@@ -0,0 +1,68 @@
    -+
    -+  test
    -+  15d091de-0181-456b-9554-e4382dc1f1ab
    -+  1048576
    -+  1048576
    -+  1
    -+  
    -+    hvm
    -+    
    -+    
    -+    
    -+  
    -+  
    -+  destroy
    -+  restart
    -+  restart
    -+  
    -+    /usr/bin/qemu-system-x86_64
    -+    
    -+      
    -+      
    -+      
    -+      
    -+ -+ -+ -+ -+ -+ -+
    -+ -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml -new file mode 100644 -index 000000000..fd5fdbece ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-coalesce.xml -@@ -0,0 +1,71 @@ -+ -+ test -+ 15d091de-0181-456b-9554-e4382dc1f1ab -+ 1048576 -+ 1048576 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ destroy -+ restart -+ restart -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+
    -+ -+ -+
    -+ -+ -+
    -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
    -+ -+ -+ -+ -+ -+
    -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+
    -+ -+ -+ -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index eae999dd6..26a2259fd 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -532,6 +532,7 @@ mymain(void) - DO_TEST("net-bandwidth", NONE); - DO_TEST("net-bandwidth2", NONE); - DO_TEST("net-mtu", NONE); -+ DO_TEST("net-coalesce", NONE); - - DO_TEST("serial-vc", NONE); - DO_TEST("serial-pty", NONE); --- -2.12.2 - diff --git a/SOURCES/libvirt-conf-don-t-ignore-target-dev-blah-for-macvtap-interfaces.patch b/SOURCES/libvirt-conf-don-t-ignore-target-dev-blah-for-macvtap-interfaces.patch deleted file mode 100644 index 4b716d6..0000000 --- a/SOURCES/libvirt-conf-don-t-ignore-target-dev-blah-for-macvtap-interfaces.patch +++ /dev/null @@ -1,71 +0,0 @@ -From c2e748f3d928f8030e5c12b474c427086c962ad4 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Laine Stump -Date: Tue, 2 May 2017 12:33:11 -0400 -Subject: [PATCH] conf: don't ignore for macvtap - interfaces - -The parser had been clearing out *all* suggested device names for -type='direct' (aka macvtap) interfaces. All of the code implementing -macvtap allows for a user-specified device name, so we should allow -it. In the case that an interface name starts with "macvtap" or -"macvlan" though, we do still clear it out, just as we do with "vnet" -(which is the prefix used for automatically generated tap device -names), since those are the prefixes for the names we autogenerate for -macvtap and macvlan devices. - -Resolves: https://bugzilla.redhat.com/1335798 -(cherry picked from commit 9cb891141c4a5a96243c61518c4e0dbcf6a86c24) - -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 6 +++--- - src/conf/domain_conf.c | 7 ++++++- - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 2dc5e751a..7e55b0327 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -5207,9 +5207,9 @@ qemu-kvm -net nic,model=? /dev/null - If no target is specified, certain hypervisors will - automatically generate a name for the created tun device. This - name can be manually specified, however the name should not -- start with either 'vnet' or 'vif', which are prefixes -- reserved by libvirt and certain hypervisors. Manually specified -- targets using these prefixes may be ignored. -+ start with either 'vnet', 'vif', 'macvtap', or 'macvlan', -+ which are prefixes reserved by libvirt and certain hypervisors. -+ Manually specified targets using these prefixes may be ignored. -

    - -

    -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 7ab5e5051..84a8a94e5 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -55,6 +55,7 @@ - #include "virtpm.h" - #include "virstring.h" - #include "virnetdev.h" -+#include "virnetdevmacvlan.h" - #include "virhostdev.h" - #include "virmdev.h" - -@@ -10016,8 +10017,12 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, - def->data.direct.linkdev = dev; - dev = NULL; - -- if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) -+ if (ifname && -+ flags & VIR_DOMAIN_DEF_PARSE_INACTIVE && -+ (STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX) || -+ STRPREFIX(ifname, VIR_NET_GENERATED_MACVTAP_PREFIX))) { - VIR_FREE(ifname); -+ } - - break; - --- -2.12.2 - diff --git a/SOURCES/libvirt-conf-fix-migratable-XML-for-graphics-if-socket-is-generated-based-on-config.patch b/SOURCES/libvirt-conf-fix-migratable-XML-for-graphics-if-socket-is-generated-based-on-config.patch new file mode 100644 index 0000000..10cf184 --- /dev/null +++ b/SOURCES/libvirt-conf-fix-migratable-XML-for-graphics-if-socket-is-generated-based-on-config.patch @@ -0,0 +1,57 @@ +From a1c433306e79ec6b5c0ca4b3e3243875ccabdeb2 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Pavel Hrdina +Date: Thu, 30 Nov 2017 17:56:41 +0100 +Subject: [PATCH] conf: fix migratable XML for graphics if socket is generated + based on config + +The graphics code is complex and there are a lot of exceptions and +backward compatible combinations. One of them is the possibility +to configure "spice_auto_unix_socket" in qemu.conf which will convert +all spice graphics with listen type "address" without any address +specified to listen type "socket" when the guest is started. + +We don't format this generated socket into migratable XML to make +migration work with older libvirt. However, spice has another +exception that if autoport='no' and there is no port configured +it is converted to listen type "none". Because of this we need +to format autoport='yes' to make sure that the listen type will +be the same as the offline XML. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1511407 + +Reviewed-by: Jiri Denemark +Signed-off-by: Pavel Hrdina +(cherry picked from commit cb06ea57ad80a964028f22fb49d6ab96648ae741) +Signed-off-by: Pavel Hrdina +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index c58dae197c..ec138ea861 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -25150,6 +25150,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf, + break; + + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: ++ /* If socket is auto-generated based on config option we don't ++ * add any listen element into migratable XML because the original ++ * listen type is "address". ++ * We need to set autoport to make sure that libvirt on destination ++ * will parse it as listen type "address", without autoport it is ++ * parsed as listen type "none". */ ++ if ((flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) && ++ glisten->fromConfig) { ++ virBufferAddStr(buf, " autoport='yes'"); ++ } ++ break; ++ + case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_LAST: + break; + } +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-honor-maxnames-in-nodeListDevices-API.patch b/SOURCES/libvirt-conf-honor-maxnames-in-nodeListDevices-API.patch new file mode 100644 index 0000000..f7b19a7 --- /dev/null +++ b/SOURCES/libvirt-conf-honor-maxnames-in-nodeListDevices-API.patch @@ -0,0 +1,36 @@ +From a64f825a244c77556c0ed7c5f425ba70b28cca70 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Pavel Hrdina +Date: Tue, 2 Jan 2018 12:39:13 +0100 +Subject: [PATCH] conf: honor maxnames in nodeListDevices API + +Introduced by commit <4ae9dbea99c>. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1528572 + +Signed-off-by: Pavel Hrdina +(cherry picked from commit bbf6573e94528ac8a8867855e6671b48e13f1cd1) +Signed-off-by: Pavel Hrdina +Reviewed-by: Erik Skultety +Signed-off-by: Jiri Denemark +--- + src/conf/virnodedeviceobj.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c +index 872ec1fd4b..c4e3a40d3a 100644 +--- a/src/conf/virnodedeviceobj.c ++++ b/src/conf/virnodedeviceobj.c +@@ -798,6 +798,9 @@ virNodeDeviceObjListGetNamesCallback(void *payload, + if (data->error) + return 0; + ++ if (data->nnames >= data->maxnames) ++ return 0; ++ + virObjectLock(obj); + def = obj->def; + +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-include-x86-microcode-version-in-virsh-capabiltiies.patch b/SOURCES/libvirt-conf-include-x86-microcode-version-in-virsh-capabiltiies.patch index 7c45cd5..edf12a0 100644 --- a/SOURCES/libvirt-conf-include-x86-microcode-version-in-virsh-capabiltiies.patch +++ b/SOURCES/libvirt-conf-include-x86-microcode-version-in-virsh-capabiltiies.patch @@ -1,5 +1,5 @@ -From a2fe4ef20df702070ffec676172c19e6c89b8312 Mon Sep 17 00:00:00 2001 -Message-Id: +From 4f1684dd855d48517e04507edadba2fd454e4ada Mon Sep 17 00:00:00 2001 +Message-Id: <4f1684dd855d48517e04507edadba2fd454e4ada@dist-git> From: Paolo Bonzini Date: Tue, 12 Dec 2017 16:23:40 +0100 Subject: [PATCH] conf: include x86 microcode version in virsh capabiltiies @@ -16,60 +16,17 @@ CVE-2017-5715 Signed-off-by: Paolo Bonzini Signed-off-by: Jiri Denemark - -Conflicts: - src/cpu/cpu_x86.c - - context; x86DecodeCPUData has more parameters in 7.4 --- - src/conf/capabilities.c | 12 ++++++++++++ - src/conf/capabilities.h | 2 ++ - src/conf/cpu_conf.c | 14 ++++++++++++++ - src/conf/cpu_conf.h | 1 + - src/cpu/cpu_x86.c | 9 +++++++++ - src/libvirt_private.syms | 1 + - 6 files changed, 39 insertions(+) + src/conf/cpu_conf.c | 14 ++++++++++++++ + src/conf/cpu_conf.h | 1 + + src/cpu/cpu_x86.c | 9 +++++++++ + 3 files changed, 24 insertions(+) -diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c -index 08907aced1..fad6cc1c07 100644 ---- a/src/conf/capabilities.c -+++ b/src/conf/capabilities.c -@@ -355,6 +355,18 @@ virCapabilitiesAddHostNUMACell(virCapsPtr caps, - } - - -+/** -+ * virCapabilitiesGetMicrocodeVersion: -+ * @caps: capabilities to access -+ * -+ * Get host CPU microcode version, or 0 if unavailable -+ */ -+unsigned int -+virCapabilitiesGetMicrocodeVersion(virCapsPtr caps) -+{ -+ return caps->host.cpu ? caps->host.cpu->microcodeVersion : 0; -+} -+ - /** - * virCapabilitiesSetHostCPU: - * @caps: capabilities to extend -diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h -index d10eef3afd..75e0748e9e 100644 ---- a/src/conf/capabilities.h -+++ b/src/conf/capabilities.h -@@ -299,6 +299,8 @@ virBitmapPtr virCapabilitiesGetCpusForNodemask(virCapsPtr caps, - - int virCapabilitiesGetNodeInfo(virNodeInfoPtr nodeinfo); - -+unsigned int virCapabilitiesGetMicrocodeVersion(virCapsPtr caps); -+ - int virCapabilitiesInitPages(virCapsPtr caps); - - int virCapabilitiesInitNUMA(virCapsPtr caps); diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c -index e570dffcd2..239f671fa7 100644 +index 669935acf8..7e00299c66 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c -@@ -127,6 +127,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst, +@@ -130,6 +130,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst, VIR_STRDUP(dst->vendor_id, src->vendor_id) < 0 || VIR_ALLOC_N(dst->features, src->nfeatures) < 0) return -1; @@ -77,7 +34,7 @@ index e570dffcd2..239f671fa7 100644 dst->nfeatures_max = src->nfeatures; dst->nfeatures = 0; -@@ -178,6 +179,7 @@ virCPUDefStealModel(virCPUDefPtr dst, +@@ -181,6 +182,7 @@ virCPUDefStealModel(virCPUDefPtr dst, VIR_STEAL_PTR(dst->model, src->model); VIR_STEAL_PTR(dst->features, src->features); @@ -85,7 +42,7 @@ index e570dffcd2..239f671fa7 100644 dst->nfeatures_max = src->nfeatures_max; src->nfeatures_max = 0; dst->nfeatures = src->nfeatures; -@@ -379,6 +381,14 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, +@@ -382,6 +384,14 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, goto cleanup; } VIR_FREE(arch); @@ -112,7 +69,7 @@ index e570dffcd2..239f671fa7 100644 virBufferAddLit(buf, "sockets); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h -index 1978814d36..1a13ae6e46 100644 +index d1983f5d4f..9f2e7ee264 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -133,6 +133,7 @@ struct _virCPUDef { @@ -124,7 +81,7 @@ index 1978814d36..1a13ae6e46 100644 unsigned int cores; unsigned int threads; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index 8af0a1a2b7..efef7f235d 100644 +index 693e571a3d..ad35532fc1 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -33,6 +33,7 @@ @@ -144,7 +101,7 @@ index 8af0a1a2b7..efef7f235d 100644 int virCPUx86DriverOnceInit(void); VIR_ONCE_GLOBAL_INIT(virCPUx86Driver); -@@ -1391,6 +1394,8 @@ virCPUx86DriverOnceInit(void) +@@ -1409,6 +1412,8 @@ virCPUx86DriverOnceInit(void) if (!(cpuMap = virCPUx86LoadMap())) return -1; @@ -153,7 +110,7 @@ index 8af0a1a2b7..efef7f235d 100644 return 0; } -@@ -2408,6 +2413,9 @@ virCPUx86GetHost(virCPUDefPtr cpu, +@@ -2424,6 +2429,9 @@ virCPUx86GetHost(virCPUDefPtr cpu, virCPUDataPtr cpuData = NULL; int ret = -1; @@ -163,26 +120,14 @@ index 8af0a1a2b7..efef7f235d 100644 if (!(cpuData = virCPUDataNew(archs[0]))) goto cleanup; -@@ -2416,6 +2424,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, +@@ -2432,6 +2440,7 @@ virCPUx86GetHost(virCPUDefPtr cpu, goto cleanup; - ret = x86DecodeCPUData(cpu, cpuData, models, nmodels, NULL); + ret = x86DecodeCPUData(cpu, cpuData, models); + cpu->microcodeVersion = microcodeVersion; cleanup: virCPUx86DataFree(cpuData); -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index c50b6c2f77..c7834115fd 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -57,6 +57,7 @@ virCapabilitiesFreeGuest; - virCapabilitiesFreeMachines; - virCapabilitiesFreeNUMAInfo; - virCapabilitiesGetCpusForNodemask; -+virCapabilitiesGetMicrocodeVersion; - virCapabilitiesGetNodeInfo; - virCapabilitiesHostSecModelAddBaseLabel; - virCapabilitiesInitNUMA; -- 2.15.1 diff --git a/SOURCES/libvirt-conf-introduce-virDomainControllerDriverFormat.patch b/SOURCES/libvirt-conf-introduce-virDomainControllerDriverFormat.patch deleted file mode 100644 index 5f37f4f..0000000 --- a/SOURCES/libvirt-conf-introduce-virDomainControllerDriverFormat.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 8874ecd393f7098376d9c46c34f43d47a697f932 Mon Sep 17 00:00:00 2001 -Message-Id: <8874ecd393f7098376d9c46c34f43d47a697f932@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:48:55 +0200 -Subject: [PATCH] conf: introduce virDomainControllerDriverFormat -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Split out formatting the subelement of -to make adding new options easier. - -(cherry picked from commit fe262186dccfa5c5cbcfe5ab7eb95195cf3b10f5) -Signed-off-by: Ján Tomko - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 -Signed-off-by: Jiri Denemark ---- - src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++--------------------- - 1 file changed, 32 insertions(+), 23 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index e004559f9f..275145b1ec 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -21323,6 +21323,37 @@ virDomainDiskDefFormat(virBufferPtr buf, - #undef FORMAT_IOTUNE - - -+static void -+virDomainControllerDriverFormat(virBufferPtr buf, -+ virDomainControllerDefPtr def) -+{ -+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER; -+ -+ if (def->queues) -+ virBufferAsprintf(&driverBuf, " queues='%u'", def->queues); -+ -+ if (def->cmd_per_lun) -+ virBufferAsprintf(&driverBuf, " cmd_per_lun='%u'", def->cmd_per_lun); -+ -+ if (def->max_sectors) -+ virBufferAsprintf(&driverBuf, " max_sectors='%u'", def->max_sectors); -+ -+ if (def->ioeventfd) { -+ virBufferAsprintf(&driverBuf, " ioeventfd='%s'", -+ virTristateSwitchTypeToString(def->ioeventfd)); -+ } -+ -+ if (def->iothread) -+ virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); -+ -+ if (virBufferUse(&driverBuf)) { -+ virBufferAddLit(buf, "\n"); -+ } -+} -+ -+ - static int - virDomainControllerDefFormat(virBufferPtr buf, - virDomainControllerDefPtr def, -@@ -21332,7 +21363,6 @@ virDomainControllerDefFormat(virBufferPtr buf, - const char *model = NULL; - const char *modelName = NULL; - bool pcihole64 = false, pciModel = false, pciTarget = false; -- virBuffer driverBuf = VIR_BUFFER_INITIALIZER; - - if (!type) { - virReportError(VIR_ERR_INTERNAL_ERROR, -@@ -21437,28 +21467,7 @@ virDomainControllerDefFormat(virBufferPtr buf, - } - } - -- if (def->queues) -- virBufferAsprintf(&driverBuf, " queues='%u'", def->queues); -- -- if (def->cmd_per_lun) -- virBufferAsprintf(&driverBuf, " cmd_per_lun='%u'", def->cmd_per_lun); -- -- if (def->max_sectors) -- virBufferAsprintf(&driverBuf, " max_sectors='%u'", def->max_sectors); -- -- if (def->ioeventfd) { -- virBufferAsprintf(&driverBuf, " ioeventfd='%s'", -- virTristateSwitchTypeToString(def->ioeventfd)); -- } -- -- if (def->iothread) -- virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread); -- -- if (virBufferUse(&driverBuf)) { -- virBufferAddLit(buf, "\n"); -- } -+ virDomainControllerDriverFormat(buf, def); - - if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && - virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) --- -2.13.1 - diff --git a/SOURCES/libvirt-conf-move-generated-member-from-virMacAddr-to-virDomainNetDef.patch b/SOURCES/libvirt-conf-move-generated-member-from-virMacAddr-to-virDomainNetDef.patch new file mode 100644 index 0000000..32863e9 --- /dev/null +++ b/SOURCES/libvirt-conf-move-generated-member-from-virMacAddr-to-virDomainNetDef.patch @@ -0,0 +1,162 @@ +From 5b225fe7ac882c8696b9759251c519c785f5407c Mon Sep 17 00:00:00 2001 +Message-Id: <5b225fe7ac882c8696b9759251c519c785f5407c@dist-git> +From: Laine Stump +Date: Tue, 6 Mar 2018 16:19:31 -0500 +Subject: [PATCH] conf: move 'generated' member from virMacAddr to + virDomainNetDef + +Commit 7e62c4cd26d (first appearing in libvirt-3.9.0 as a resolution +to rhbz #1343919) added a "generated" attribute to virMacAddr that was +set whenever a mac address was auto-generated by libvirt. This +knowledge was used in a single place - when trying to match a NetDef +from the Domain to Delete with user-provided XML. Since the XML parser +always auto-generates a MAC address for NetDefs when none is provided, +it was previously impossible to make a search where the MAC address +isn't significant, but the addition of the "generated" attribute made +it possible for the search function to ignore auto-generated MACs. + +This implementation had a problem though - it was adding a field to a +"low level" struct - virMacAddr - which is used in other places with +the assumption that it contains exactly a 6 byte MAC address and +nothing else. In particular, virNWFilterSnoopEthHdr uses virMacAddr as +part of the definition of an ethernet packet header, whose layout must +of course match an actual ethernet packet. Adding the extra bools into +virNWFilterSnoopEthHdr caused the nwfilter driver's "IP discovery via +DHCP packet snooping" functionality to mysteriously stop working. + +In order to fix that behavior, and prevent potential future similar +odd behavior, this patch moves the "generated" member out of +virMacAddr (so that it is again really is just a MAC address) into +virDomainNetDef, and sets it only when virDomainNetGenerateMAC() is +called from virDomainNetDefParseXML() (which is the only time we care +about it). + +Resolves: https://bugzilla.redhat.com/1529338 + +(It should also be applied to any maintenance branch that applies +commit 7e62c4cd26 and friends to resolve +https://bugzilla.redhat.com/1343919) + +Signed-off-by: Laine Stump +(cherry picked from commit e62cb4a9b78c7f4499a206635fb4f06e6ac627e5) +--- + src/conf/domain_conf.c | 3 ++- + src/conf/domain_conf.h | 1 + + src/util/virmacaddr.c | 5 ----- + src/util/virmacaddr.h | 9 +++++++-- + tests/bhyveargv2xmlmock.c | 1 - + 5 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 0af3dd5ab6..1a3db4a7be 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -10989,6 +10989,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, + } + } else { + virDomainNetGenerateMAC(xmlopt, &def->mac); ++ def->mac_generated = true; + } + + if (devaddr) { +@@ -16205,7 +16206,7 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net) + size_t i; + int matchidx = -1; + char mac[VIR_MAC_STRING_BUFLEN]; +- bool MACAddrSpecified = !net->mac.generated; ++ bool MACAddrSpecified = !net->mac_generated; + bool PCIAddrSpecified = virDomainDeviceAddressIsValid(&net->info, + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI); + +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index ed7b587bed..3817887322 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -962,6 +962,7 @@ struct _virDomainActualNetDef { + struct _virDomainNetDef { + virDomainNetType type; + virMacAddr mac; ++ bool mac_generated; /* true if mac was *just now* auto-generated by libvirt */ + char *model; + union { + struct { +diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c +index 409fdc34d5..7afe032b9c 100644 +--- a/src/util/virmacaddr.c ++++ b/src/util/virmacaddr.c +@@ -107,7 +107,6 @@ void + virMacAddrSet(virMacAddrPtr dst, const virMacAddr *src) + { + memcpy(dst, src, sizeof(*src)); +- dst->generated = false; + } + + /** +@@ -121,7 +120,6 @@ void + virMacAddrSetRaw(virMacAddrPtr dst, const unsigned char src[VIR_MAC_BUFLEN]) + { + memcpy(dst->addr, src, VIR_MAC_BUFLEN); +- dst->generated = false; + } + + /** +@@ -151,7 +149,6 @@ virMacAddrParse(const char* str, virMacAddrPtr addr) + { + size_t i; + +- addr->generated = false; + errno = 0; + for (i = 0; i < VIR_MAC_BUFLEN; i++) { + char *end_ptr; +@@ -220,7 +217,6 @@ virMacAddrParseHex(const char *str, virMacAddrPtr addr) + str[VIR_MAC_HEXLEN]) + return -1; + +- addr->generated = false; + for (i = 0; i < VIR_MAC_BUFLEN; i++) + addr->addr[i] = (virHexToBin(str[2 * i]) << 4 | + virHexToBin(str[2 * i + 1])); +@@ -236,7 +232,6 @@ void virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN], + addr->addr[3] = virRandomBits(8); + addr->addr[4] = virRandomBits(8); + addr->addr[5] = virRandomBits(8); +- addr->generated = true; + } + + /* The low order bit of the first byte is the "multicast" bit. */ +diff --git a/src/util/virmacaddr.h b/src/util/virmacaddr.h +index ef4285d639..d0dd4a45c6 100644 +--- a/src/util/virmacaddr.h ++++ b/src/util/virmacaddr.h +@@ -36,9 +36,14 @@ typedef virMacAddr *virMacAddrPtr; + + struct _virMacAddr { + unsigned char addr[VIR_MAC_BUFLEN]; +- bool generated; /* True if MAC address was autogenerated, +- false otherwise. */ + }; ++/* This struct is used as a part of a larger struct that is ++ * overlaid on an ethernet packet captured with libpcap, so it ++ * must not have any extra members added - it must remain exactly ++ * 6 bytes in length. ++ */ ++verify(sizeof(struct _virMacAddr) == 6); ++ + + int virMacAddrCompare(const char *mac1, const char *mac2); + int virMacAddrCmp(const virMacAddr *mac1, const virMacAddr *mac2); +diff --git a/tests/bhyveargv2xmlmock.c b/tests/bhyveargv2xmlmock.c +index dd25f4e13a..1f08bebb7b 100644 +--- a/tests/bhyveargv2xmlmock.c ++++ b/tests/bhyveargv2xmlmock.c +@@ -16,7 +16,6 @@ virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN], + addr->addr[3] = 0; + addr->addr[4] = 0; + addr->addr[5] = 0; +- addr->generated = true; + } + + int +-- +2.16.2 + diff --git a/SOURCES/libvirt-conf-nodedev-Split-virNodeDeviceDefFormat-into-more-functions.patch b/SOURCES/libvirt-conf-nodedev-Split-virNodeDeviceDefFormat-into-more-functions.patch deleted file mode 100644 index 7cd3720..0000000 --- a/SOURCES/libvirt-conf-nodedev-Split-virNodeDeviceDefFormat-into-more-functions.patch +++ /dev/null @@ -1,644 +0,0 @@ -From f636c368f181c9f18ee135e8902490faf30186f9 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:48 +0200 -Subject: [PATCH] conf: nodedev: Split virNodeDeviceDefFormat into more - functions - -Make the code look cleaner by moving the capability specific bits into -separate functions. - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit bfaaaf108da087c38cc0f2890ed96730a3734ba8) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/conf/node_device_conf.c | 578 ++++++++++++++++++++++++-------------------- - 1 file changed, 322 insertions(+), 256 deletions(-) - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index cc3fad8b9..02215f32d 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -155,6 +155,320 @@ virPCIEDeviceInfoFormat(virBufferPtr buf, - } - - -+static void -+virNodeDeviceCapSystemDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ char uuidstr[VIR_UUID_STRING_BUFLEN]; -+ -+ if (data->system.product_name) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.product_name); -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ if (data->system.hardware.vendor_name) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.hardware.vendor_name); -+ if (data->system.hardware.version) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.hardware.version); -+ if (data->system.hardware.serial) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.hardware.serial); -+ virUUIDFormat(data->system.hardware.uuid, uuidstr); -+ virBufferAsprintf(buf, "%s\n", uuidstr); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ if (data->system.firmware.vendor_name) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.firmware.vendor_name); -+ if (data->system.firmware.version) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.firmware.version); -+ if (data->system.firmware.release_date) -+ virBufferEscapeString(buf, "%s\n", -+ data->system.firmware.release_date); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+} -+ -+ -+static void -+virNodeDeviceCapPCIDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ size_t i; -+ -+ virBufferAsprintf(buf, "%d\n", -+ data->pci_dev.domain); -+ virBufferAsprintf(buf, "%d\n", data->pci_dev.bus); -+ virBufferAsprintf(buf, "%d\n", -+ data->pci_dev.slot); -+ virBufferAsprintf(buf, "%d\n", -+ data->pci_dev.function); -+ virBufferAsprintf(buf, "pci_dev.product); -+ if (data->pci_dev.product_name) -+ virBufferEscapeString(buf, ">%s\n", -+ data->pci_dev.product_name); -+ else -+ virBufferAddLit(buf, " />\n"); -+ virBufferAsprintf(buf, "pci_dev.vendor); -+ if (data->pci_dev.vendor_name) -+ virBufferEscapeString(buf, ">%s\n", -+ data->pci_dev.vendor_name); -+ else -+ virBufferAddLit(buf, " />\n"); -+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION) { -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ virBufferAsprintf(buf, -+ "

    \n", -+ data->pci_dev.physical_function->domain, -+ data->pci_dev.physical_function->bus, -+ data->pci_dev.physical_function->slot, -+ data->pci_dev.physical_function->function); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) { -+ virBufferAddLit(buf, "pci_dev.max_virtual_functions) -+ virBufferAsprintf(buf, " maxCount='%u'", -+ data->pci_dev.max_virtual_functions); -+ if (data->pci_dev.num_virtual_functions == 0) { -+ virBufferAddLit(buf, "/>\n"); -+ } else { -+ virBufferAddLit(buf, ">\n"); -+ virBufferAdjustIndent(buf, 2); -+ for (i = 0; i < data->pci_dev.num_virtual_functions; i++) { -+ virBufferAsprintf(buf, -+ "
    \n", -+ data->pci_dev.virtual_functions[i]->domain, -+ data->pci_dev.virtual_functions[i]->bus, -+ data->pci_dev.virtual_functions[i]->slot, -+ data->pci_dev.virtual_functions[i]->function); -+ } -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+ } -+ if (data->pci_dev.hdrType) { -+ virBufferAsprintf(buf, "\n", -+ virPCIHeaderTypeToString(data->pci_dev.hdrType)); -+ } -+ if (data->pci_dev.nIommuGroupDevices) { -+ virBufferAsprintf(buf, "\n", -+ data->pci_dev.iommuGroupNumber); -+ virBufferAdjustIndent(buf, 2); -+ for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++) { -+ virBufferAsprintf(buf, -+ "
    \n", -+ data->pci_dev.iommuGroupDevices[i]->domain, -+ data->pci_dev.iommuGroupDevices[i]->bus, -+ data->pci_dev.iommuGroupDevices[i]->slot, -+ data->pci_dev.iommuGroupDevices[i]->function); -+ } -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+ if (data->pci_dev.numa_node >= 0) -+ virBufferAsprintf(buf, "\n", -+ data->pci_dev.numa_node); -+ -+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE) -+ virPCIEDeviceInfoFormat(buf, data->pci_dev.pci_express); -+} -+ -+ -+static void -+virNodeDeviceCapUSBDevDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferAsprintf(buf, "%d\n", data->usb_dev.bus); -+ virBufferAsprintf(buf, "%d\n", -+ data->usb_dev.device); -+ virBufferAsprintf(buf, "usb_dev.product); -+ if (data->usb_dev.product_name) -+ virBufferEscapeString(buf, ">%s\n", -+ data->usb_dev.product_name); -+ else -+ virBufferAddLit(buf, " />\n"); -+ virBufferAsprintf(buf, "usb_dev.vendor); -+ if (data->usb_dev.vendor_name) -+ virBufferEscapeString(buf, ">%s\n", -+ data->usb_dev.vendor_name); -+ else -+ virBufferAddLit(buf, " />\n"); -+} -+ -+ -+static void -+virNodeDeviceCapUSBInterfaceDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferAsprintf(buf, "%d\n", -+ data->usb_if.number); -+ virBufferAsprintf(buf, "%d\n", -+ data->usb_if._class); -+ virBufferAsprintf(buf, "%d\n", -+ data->usb_if.subclass); -+ virBufferAsprintf(buf, "%d\n", -+ data->usb_if.protocol); -+ if (data->usb_if.description) -+ virBufferEscapeString(buf, -+ "%s\n", -+ data->usb_if.description); -+} -+ -+ -+static void -+virNodeDeviceCapNetDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ size_t i; -+ -+ virBufferEscapeString(buf, "%s\n", -+ data->net.ifname); -+ if (data->net.address) -+ virBufferEscapeString(buf, "
    %s
    \n", -+ data->net.address); -+ virInterfaceLinkFormat(buf, &data->net.lnk); -+ if (data->net.features) { -+ for (i = 0; i < VIR_NET_DEV_FEAT_LAST; i++) { -+ if (virBitmapIsBitSet(data->net.features, i)) { -+ virBufferAsprintf(buf, "\n", -+ virNetDevFeatureTypeToString(i)); -+ } -+ } -+ } -+ if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) { -+ const char *subtyp = -+ virNodeDevNetCapTypeToString(data->net.subtype); -+ virBufferEscapeString(buf, "\n", -+ subtyp); -+ } -+} -+ -+ -+static void -+virNodeDeviceCapSCSIHostDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferAsprintf(buf, "%d\n", -+ data->scsi_host.host); -+ if (data->scsi_host.unique_id != -1) -+ virBufferAsprintf(buf, "%d\n", -+ data->scsi_host.unique_id); -+ if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) { -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ virBufferEscapeString(buf, "%s\n", -+ data->scsi_host.wwnn); -+ virBufferEscapeString(buf, "%s\n", -+ data->scsi_host.wwpn); -+ virBufferEscapeString(buf, "%s\n", -+ data->scsi_host.fabric_wwn); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+ if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS) { -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ virBufferAsprintf(buf, "%d\n", -+ data->scsi_host.max_vports); -+ virBufferAsprintf(buf, "%d\n", -+ data->scsi_host.vports); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+} -+ -+ -+static void -+virNodeDeviceCapSCSIDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferAsprintf(buf, "%d\n", data->scsi.host); -+ virBufferAsprintf(buf, "%d\n", data->scsi.bus); -+ virBufferAsprintf(buf, "%d\n", -+ data->scsi.target); -+ virBufferAsprintf(buf, "%d\n", data->scsi.lun); -+ if (data->scsi.type) -+ virBufferEscapeString(buf, "%s\n", -+ data->scsi.type); -+} -+ -+ -+static void -+virNodeDeviceCapStorageDefFormat(virBufferPtr buf, -+ const virNodeDevCapData *data) -+{ -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.block); -+ if (data->storage.bus) -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.bus); -+ if (data->storage.drive_type) -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.drive_type); -+ if (data->storage.model) -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.model); -+ if (data->storage.vendor) -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.vendor); -+ if (data->storage.serial) -+ virBufferEscapeString(buf, "%s\n", -+ data->storage.serial); -+ if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) { -+ int avl = data->storage.flags & -+ VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE; -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ virBufferAsprintf(buf, "%d" -+ "\n", avl ? 1 : 0); -+ virBufferAsprintf(buf, "%llu\n", -+ data->storage.removable_media_size); -+ if (data->storage.media_label) -+ virBufferEscapeString(buf, -+ "%s\n", -+ data->storage.media_label); -+ if (data->storage.logical_block_size > 0) -+ virBufferAsprintf(buf, "%llu" -+ "\n", -+ data->storage.logical_block_size); -+ if (data->storage.num_blocks > 0) -+ virBufferAsprintf(buf, -+ "%llu\n", -+ data->storage.num_blocks); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } else { -+ virBufferAsprintf(buf, "%llu\n", -+ data->storage.size); -+ if (data->storage.logical_block_size > 0) -+ virBufferAsprintf(buf, "%llu" -+ "\n", -+ data->storage.logical_block_size); -+ if (data->storage.num_blocks > 0) -+ virBufferAsprintf(buf, "%llu\n", -+ data->storage.num_blocks); -+ } -+ if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE) -+ virBufferAddLit(buf, "\n"); -+} -+ -+ - char * - virNodeDeviceDefFormat(const virNodeDeviceDef *def) - { -@@ -185,7 +499,6 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) - } - - for (caps = def->caps; caps; caps = caps->next) { -- char uuidstr[VIR_UUID_STRING_BUFLEN]; - virNodeDevCapDataPtr data = &caps->data; - - virBufferAsprintf(&buf, "\n", -@@ -193,279 +506,32 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) - virBufferAdjustIndent(&buf, 2); - switch (caps->data.type) { - case VIR_NODE_DEV_CAP_SYSTEM: -- if (data->system.product_name) -- virBufferEscapeString(&buf, "%s\n", -- data->system.product_name); -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- if (data->system.hardware.vendor_name) -- virBufferEscapeString(&buf, "%s\n", -- data->system.hardware.vendor_name); -- if (data->system.hardware.version) -- virBufferEscapeString(&buf, "%s\n", -- data->system.hardware.version); -- if (data->system.hardware.serial) -- virBufferEscapeString(&buf, "%s\n", -- data->system.hardware.serial); -- virUUIDFormat(data->system.hardware.uuid, uuidstr); -- virBufferAsprintf(&buf, "%s\n", uuidstr); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- if (data->system.firmware.vendor_name) -- virBufferEscapeString(&buf, "%s\n", -- data->system.firmware.vendor_name); -- if (data->system.firmware.version) -- virBufferEscapeString(&buf, "%s\n", -- data->system.firmware.version); -- if (data->system.firmware.release_date) -- virBufferEscapeString(&buf, "%s\n", -- data->system.firmware.release_date); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -+ virNodeDeviceCapSystemDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_PCI_DEV: -- virBufferAsprintf(&buf, "%d\n", -- data->pci_dev.domain); -- virBufferAsprintf(&buf, "%d\n", data->pci_dev.bus); -- virBufferAsprintf(&buf, "%d\n", -- data->pci_dev.slot); -- virBufferAsprintf(&buf, "%d\n", -- data->pci_dev.function); -- virBufferAsprintf(&buf, "pci_dev.product); -- if (data->pci_dev.product_name) -- virBufferEscapeString(&buf, ">%s\n", -- data->pci_dev.product_name); -- else -- virBufferAddLit(&buf, " />\n"); -- virBufferAsprintf(&buf, "pci_dev.vendor); -- if (data->pci_dev.vendor_name) -- virBufferEscapeString(&buf, ">%s\n", -- data->pci_dev.vendor_name); -- else -- virBufferAddLit(&buf, " />\n"); -- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION) { -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- virBufferAsprintf(&buf, -- "
    \n", -- data->pci_dev.physical_function->domain, -- data->pci_dev.physical_function->bus, -- data->pci_dev.physical_function->slot, -- data->pci_dev.physical_function->function); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } -- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION) { -- virBufferAddLit(&buf, "pci_dev.max_virtual_functions) -- virBufferAsprintf(&buf, " maxCount='%u'", -- data->pci_dev.max_virtual_functions); -- if (data->pci_dev.num_virtual_functions == 0) { -- virBufferAddLit(&buf, "/>\n"); -- } else { -- virBufferAddLit(&buf, ">\n"); -- virBufferAdjustIndent(&buf, 2); -- for (i = 0; i < data->pci_dev.num_virtual_functions; i++) { -- virBufferAsprintf(&buf, -- "
    \n", -- data->pci_dev.virtual_functions[i]->domain, -- data->pci_dev.virtual_functions[i]->bus, -- data->pci_dev.virtual_functions[i]->slot, -- data->pci_dev.virtual_functions[i]->function); -- } -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } -- } -- if (data->pci_dev.hdrType) { -- virBufferAsprintf(&buf, "\n", -- virPCIHeaderTypeToString(data->pci_dev.hdrType)); -- } -- if (data->pci_dev.nIommuGroupDevices) { -- virBufferAsprintf(&buf, "\n", -- data->pci_dev.iommuGroupNumber); -- virBufferAdjustIndent(&buf, 2); -- for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++) { -- virBufferAsprintf(&buf, -- "
    \n", -- data->pci_dev.iommuGroupDevices[i]->domain, -- data->pci_dev.iommuGroupDevices[i]->bus, -- data->pci_dev.iommuGroupDevices[i]->slot, -- data->pci_dev.iommuGroupDevices[i]->function); -- } -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } -- if (data->pci_dev.numa_node >= 0) -- virBufferAsprintf(&buf, "\n", -- data->pci_dev.numa_node); -- -- if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCIE) -- virPCIEDeviceInfoFormat(&buf, data->pci_dev.pci_express); -+ virNodeDeviceCapPCIDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_USB_DEV: -- virBufferAsprintf(&buf, "%d\n", data->usb_dev.bus); -- virBufferAsprintf(&buf, "%d\n", -- data->usb_dev.device); -- virBufferAsprintf(&buf, "usb_dev.product); -- if (data->usb_dev.product_name) -- virBufferEscapeString(&buf, ">%s\n", -- data->usb_dev.product_name); -- else -- virBufferAddLit(&buf, " />\n"); -- virBufferAsprintf(&buf, "usb_dev.vendor); -- if (data->usb_dev.vendor_name) -- virBufferEscapeString(&buf, ">%s\n", -- data->usb_dev.vendor_name); -- else -- virBufferAddLit(&buf, " />\n"); -+ virNodeDeviceCapUSBDevDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_USB_INTERFACE: -- virBufferAsprintf(&buf, "%d\n", -- data->usb_if.number); -- virBufferAsprintf(&buf, "%d\n", -- data->usb_if._class); -- virBufferAsprintf(&buf, "%d\n", -- data->usb_if.subclass); -- virBufferAsprintf(&buf, "%d\n", -- data->usb_if.protocol); -- if (data->usb_if.description) -- virBufferEscapeString(&buf, -- "%s\n", -- data->usb_if.description); -+ virNodeDeviceCapUSBInterfaceDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_NET: -- virBufferEscapeString(&buf, "%s\n", -- data->net.ifname); -- if (data->net.address) -- virBufferEscapeString(&buf, "
    %s
    \n", -- data->net.address); -- virInterfaceLinkFormat(&buf, &data->net.lnk); -- if (data->net.features) { -- for (i = 0; i < VIR_NET_DEV_FEAT_LAST; i++) { -- if (virBitmapIsBitSet(data->net.features, i)) { -- virBufferAsprintf(&buf, "\n", -- virNetDevFeatureTypeToString(i)); -- } -- } -- } -- if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) { -- const char *subtyp = -- virNodeDevNetCapTypeToString(data->net.subtype); -- virBufferEscapeString(&buf, "\n", -- subtyp); -- } -+ virNodeDeviceCapNetDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_SCSI_HOST: -- virBufferAsprintf(&buf, "%d\n", -- data->scsi_host.host); -- if (data->scsi_host.unique_id != -1) -- virBufferAsprintf(&buf, "%d\n", -- data->scsi_host.unique_id); -- if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) { -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- virBufferEscapeString(&buf, "%s\n", -- data->scsi_host.wwnn); -- virBufferEscapeString(&buf, "%s\n", -- data->scsi_host.wwpn); -- virBufferEscapeString(&buf, "%s\n", -- data->scsi_host.fabric_wwn); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } -- if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS) { -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- virBufferAsprintf(&buf, "%d\n", -- data->scsi_host.max_vports); -- virBufferAsprintf(&buf, "%d\n", -- data->scsi_host.vports); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } -- -+ virNodeDeviceCapSCSIHostDefFormat(&buf, data); - break; -- - case VIR_NODE_DEV_CAP_SCSI_TARGET: - virBufferEscapeString(&buf, "%s\n", - data->scsi_target.name); - break; -- - case VIR_NODE_DEV_CAP_SCSI: -- virBufferAsprintf(&buf, "%d\n", data->scsi.host); -- virBufferAsprintf(&buf, "%d\n", data->scsi.bus); -- virBufferAsprintf(&buf, "%d\n", -- data->scsi.target); -- virBufferAsprintf(&buf, "%d\n", data->scsi.lun); -- if (data->scsi.type) -- virBufferEscapeString(&buf, "%s\n", -- data->scsi.type); -+ virNodeDeviceCapSCSIDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_STORAGE: -- virBufferEscapeString(&buf, "%s\n", -- data->storage.block); -- if (data->storage.bus) -- virBufferEscapeString(&buf, "%s\n", -- data->storage.bus); -- if (data->storage.drive_type) -- virBufferEscapeString(&buf, "%s\n", -- data->storage.drive_type); -- if (data->storage.model) -- virBufferEscapeString(&buf, "%s\n", -- data->storage.model); -- if (data->storage.vendor) -- virBufferEscapeString(&buf, "%s\n", -- data->storage.vendor); -- if (data->storage.serial) -- virBufferEscapeString(&buf, "%s\n", -- data->storage.serial); -- if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) { -- int avl = data->storage.flags & -- VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE; -- virBufferAddLit(&buf, "\n"); -- virBufferAdjustIndent(&buf, 2); -- virBufferAsprintf(&buf, "%d" -- "\n", avl ? 1 : 0); -- virBufferAsprintf(&buf, "%llu\n", -- data->storage.removable_media_size); -- if (data->storage.media_label) -- virBufferEscapeString(&buf, -- "%s\n", -- data->storage.media_label); -- if (data->storage.logical_block_size > 0) -- virBufferAsprintf(&buf, "%llu" -- "\n", -- data->storage.logical_block_size); -- if (data->storage.num_blocks > 0) -- virBufferAsprintf(&buf, -- "%llu\n", -- data->storage.num_blocks); -- virBufferAdjustIndent(&buf, -2); -- virBufferAddLit(&buf, "\n"); -- } else { -- virBufferAsprintf(&buf, "%llu\n", -- data->storage.size); -- if (data->storage.logical_block_size > 0) -- virBufferAsprintf(&buf, "%llu" -- "\n", -- data->storage.logical_block_size); -- if (data->storage.num_blocks > 0) -- virBufferAsprintf(&buf, "%llu\n", -- data->storage.num_blocks); -- } -- if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE) -- virBufferAddLit(&buf, "\n"); -+ virNodeDeviceCapStorageDefFormat(&buf, data); - break; - case VIR_NODE_DEV_CAP_SCSI_GENERIC: - virBufferEscapeString(&buf, "%s\n", --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-qemu-Use-type-aware-switches-where-possible.patch b/SOURCES/libvirt-conf-qemu-Use-type-aware-switches-where-possible.patch new file mode 100644 index 0000000..0af72f8 --- /dev/null +++ b/SOURCES/libvirt-conf-qemu-Use-type-aware-switches-where-possible.patch @@ -0,0 +1,115 @@ +From 08c0c0562f8444859cc110e4fc2199d2c4254a53 Mon Sep 17 00:00:00 2001 +Message-Id: <08c0c0562f8444859cc110e4fc2199d2c4254a53@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:54 +0100 +Subject: [PATCH] conf, qemu: Use type-aware switches where possible + +The compiler can warn us if we add a value to the +virDomainChrSerialTargetType enumeration but forget to handle +it properly in the code. Let's take advantage of that. + +This commit is best viewed with 'git diff -w'. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 18dfc0014501c3811ee32669ea96583131dca9b3) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 47 ++++++++++++++++++++++++++++++----------------- + src/qemu/qemu_command.c | 7 ++++++- + 2 files changed, 36 insertions(+), 18 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 530fae9d9d..4b5e7c214f 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -4046,26 +4046,39 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def) + def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; + } + } else if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && def->nserials > 0 && +- def->serials[0]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && +- def->serials[0]->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA) { +- /* Create a stub console to match the serial port. +- * console[0] either does not exist +- * or has a different type than SERIAL or NONE. +- */ +- virDomainChrDefPtr chr; +- if (!(chr = virDomainChrDefNew(NULL))) +- return -1; ++ def->serials[0]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { + +- if (VIR_INSERT_ELEMENT(def->consoles, +- 0, +- def->nconsoles, +- chr) < 0) { +- virDomainChrDefFree(chr); +- return -1; ++ switch ((virDomainChrSerialTargetType) def->serials[0]->targetType) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: { ++ ++ /* Create a stub console to match the serial port. ++ * console[0] either does not exist ++ * or has a different type than SERIAL or NONE. ++ */ ++ virDomainChrDefPtr chr; ++ if (!(chr = virDomainChrDefNew(NULL))) ++ return -1; ++ ++ if (VIR_INSERT_ELEMENT(def->consoles, ++ 0, ++ def->nconsoles, ++ chr) < 0) { ++ virDomainChrDefFree(chr); ++ return -1; ++ } ++ ++ def->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; ++ def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; ++ ++ break; + } + +- def->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; +- def->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ /* Nothing to do */ ++ break; ++ } + } + + return 0; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 19a819a3aa..3d970ed9d1 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -10338,7 +10338,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + serial->info.alias); + } + } else { +- switch (serial->targetType) { ++ switch ((virDomainChrSerialTargetType) serial->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +@@ -10377,6 +10377,11 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + goto error; + } + break; ++ ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("Invalid target type for serial device")); ++ goto error; + } + + virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s", +-- +2.15.1 + diff --git a/SOURCES/libvirt-conf-s-virDomainObjGetShortName-virDomainDefGetShortName.patch b/SOURCES/libvirt-conf-s-virDomainObjGetShortName-virDomainDefGetShortName.patch new file mode 100644 index 0000000..7e74c84 --- /dev/null +++ b/SOURCES/libvirt-conf-s-virDomainObjGetShortName-virDomainDefGetShortName.patch @@ -0,0 +1,130 @@ +From db9daffe41e8804f9db0fb70678be99e02efc168 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Thu, 9 Nov 2017 16:06:42 +0100 +Subject: [PATCH] conf: s/virDomainObjGetShortName/virDomainDefGetShortName/ + +https://bugzilla.redhat.com/show_bug.cgi?id=1461214 + +This function works over domain definition and not domain object. +Its name is thus misleading. + +Signed-off-by: Michal Privoznik +Reviewed-by: John Ferlan +(cherry picked from commit fe70fd0c106e7fbe4f7272e5c041324ea3633ce4) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 4 ++-- + src/conf/domain_conf.h | 2 +- + src/libvirt_private.syms | 2 +- + src/qemu/qemu_conf.c | 2 +- + src/qemu/qemu_domain.c | 4 ++-- + src/qemu/qemu_driver.c | 2 +- + 6 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 394afb0d80..27cfecffda 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27871,14 +27871,14 @@ virDomainDefHasMemballoon(const virDomainDef *def) + #define VIR_DOMAIN_SHORT_NAME_MAX 20 + + /** +- * virDomainObjGetShortName: ++ * virDomainDefGetShortName: + * @vm: Machine for which to get a name + * @unique: Make sure the name is unique (use id as well) + * + * Shorten domain name to avoid possible path length limitations. + */ + char * +-virDomainObjGetShortName(const virDomainDef *def) ++virDomainDefGetShortName(const virDomainDef *def) + { + wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] = {0}; + size_t len = 0; +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 171f340785..388fa92dda 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -3366,7 +3366,7 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def, + + bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(1); + +-char *virDomainObjGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1); ++char *virDomainDefGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1); + + int + virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def, +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 811d9053e6..6653f95722 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -262,6 +262,7 @@ virDomainDefGetMemoryInitial; + virDomainDefGetMemoryTotal; + virDomainDefGetOnlineVcpumap; + virDomainDefGetSecurityLabelDef; ++virDomainDefGetShortName; + virDomainDefGetVcpu; + virDomainDefGetVcpuPinInfoHelper; + virDomainDefGetVcpus; +@@ -458,7 +459,6 @@ virDomainObjGetMetadata; + virDomainObjGetOneDef; + virDomainObjGetOneDefState; + virDomainObjGetPersistentDef; +-virDomainObjGetShortName; + virDomainObjGetState; + virDomainObjNew; + virDomainObjParseNode; +diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c +index 4e5b33b788..66f9761eea 100644 +--- a/src/qemu/qemu_conf.c ++++ b/src/qemu/qemu_conf.c +@@ -1676,7 +1676,7 @@ qemuGetDomainHugepagePath(const virDomainDef *def, + virHugeTLBFSPtr hugepage) + { + char *base = qemuGetBaseHugepagePath(hugepage); +- char *domPath = virDomainObjGetShortName(def); ++ char *domPath = virDomainDefGetShortName(def); + char *ret = NULL; + + if (base && domPath) +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 81bfef946e..27117d83ef 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -1706,7 +1706,7 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver, + { + virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); + qemuDomainObjPrivatePtr priv = vm->privateData; +- char *domname = virDomainObjGetShortName(vm->def); ++ char *domname = virDomainDefGetShortName(vm->def); + int ret = -1; + + if (!domname) +@@ -8207,7 +8207,7 @@ qemuDomainGetPreservedMountPath(virQEMUDriverConfigPtr cfg, + char *path = NULL; + char *tmp; + const char *suffix = mountpoint + strlen(DEVPREFIX); +- char *domname = virDomainObjGetShortName(vm->def); ++ char *domname = virDomainDefGetShortName(vm->def); + size_t off; + + if (!domname) +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 82c60e6ef1..5617c78997 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -4088,7 +4088,7 @@ getAutoDumpPath(virQEMUDriverPtr driver, + virDomainObjPtr vm) + { + char *dumpfile = NULL; +- char *domname = virDomainObjGetShortName(vm->def); ++ char *domname = virDomainDefGetShortName(vm->def); + char timestr[100]; + struct tm time_info; + time_t curtime = time(NULL); +-- +2.15.0 + diff --git a/SOURCES/libvirt-conf-split-out-virDomainIOMMUDefCheckABIStability.patch b/SOURCES/libvirt-conf-split-out-virDomainIOMMUDefCheckABIStability.patch deleted file mode 100644 index 9d33757..0000000 --- a/SOURCES/libvirt-conf-split-out-virDomainIOMMUDefCheckABIStability.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 244b42c385fc611380bfb2532905a63ce4380254 Mon Sep 17 00:00:00 2001 -Message-Id: <244b42c385fc611380bfb2532905a63ce4380254@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Tue, 16 May 2017 10:44:58 +0200 -Subject: [PATCH] conf: split out virDomainIOMMUDefCheckABIStability -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -(cherry picked from commit 3a276c6524026b661ed7bee4539fc5387b963611) -Signed-off-by: Ján Tomko - -https://bugzilla.redhat.com/show_bug.cgi?id=1427005 -Signed-off-by: Jiri Denemark ---- - src/conf/domain_conf.c | 24 +++++++++++++++++------- - 1 file changed, 17 insertions(+), 7 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index e77b542f3..7bf480f2a 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -19810,6 +19810,22 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src, - - - static bool -+virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src, -+ virDomainIOMMUDefPtr dst) -+{ -+ if (src->model != dst->model) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("Target domain IOMMU device model '%s' " -+ "does not match source '%s'"), -+ virDomainIOMMUModelTypeToString(dst->model), -+ virDomainIOMMUModelTypeToString(src->model)); -+ return false; -+ } -+ return true; -+} -+ -+ -+static bool - virDomainDefVcpuCheckAbiStability(virDomainDefPtr src, - virDomainDefPtr dst) - { -@@ -20275,14 +20291,8 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src, - } - - if (src->iommu && -- src->iommu->model != dst->iommu->model) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -- _("Target domain IOMMU device model '%s' " -- "does not match source '%s'"), -- virDomainIOMMUModelTypeToString(dst->iommu->model), -- virDomainIOMMUModelTypeToString(src->iommu->model)); -+ !virDomainIOMMUDefCheckABIStability(src->iommu, dst->iommu)) - goto error; -- } - - /* Coverity is not very happy with this - all dead_error_condition */ - #if !STATIC_ANALYSIS --- -2.13.0 - diff --git a/SOURCES/libvirt-conf-use-a-leading-space-in-virDomainVirtioNetDriverFormat.patch b/SOURCES/libvirt-conf-use-a-leading-space-in-virDomainVirtioNetDriverFormat.patch deleted file mode 100644 index fe28da8..0000000 --- a/SOURCES/libvirt-conf-use-a-leading-space-in-virDomainVirtioNetDriverFormat.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 5238dd8211d06fc8c7003bb608e41bb2a4653dec Mon Sep 17 00:00:00 2001 -Message-Id: <5238dd8211d06fc8c7003bb608e41bb2a4653dec@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Fri, 9 Jun 2017 12:48:59 +0200 -Subject: [PATCH] conf: use a leading space in virDomainVirtioNetDriverFormat -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Instead of formatting a space after every option. - -Reviewed-by: Pavel Hrdina -(cherry picked from commit d1feb4773d41b928dc1079dfc19d17b5a0e5957b) -Signed-off-by: Ján Tomko - -https://bugzilla.redhat.com/show_bug.cgi?id=1283251 -Signed-off-by: Jiri Denemark ---- - src/conf/domain_conf.c | 18 ++++++++---------- - 1 file changed, 8 insertions(+), 10 deletions(-) - -diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c -index 701a6d2136..4652e1c72b 100644 ---- a/src/conf/domain_conf.c -+++ b/src/conf/domain_conf.c -@@ -22053,29 +22053,27 @@ virDomainVirtioNetDriverFormat(char **outstr, - { - virBuffer buf = VIR_BUFFER_INITIALIZER; - if (def->driver.virtio.name) { -- virBufferAsprintf(&buf, "name='%s' ", -+ virBufferAsprintf(&buf, " name='%s'", - virDomainNetBackendTypeToString(def->driver.virtio.name)); - } - if (def->driver.virtio.txmode) { -- virBufferAsprintf(&buf, "txmode='%s' ", -+ virBufferAsprintf(&buf, " txmode='%s'", - virDomainNetVirtioTxModeTypeToString(def->driver.virtio.txmode)); - } - if (def->driver.virtio.ioeventfd) { -- virBufferAsprintf(&buf, "ioeventfd='%s' ", -+ virBufferAsprintf(&buf, " ioeventfd='%s'", - virTristateSwitchTypeToString(def->driver.virtio.ioeventfd)); - } - if (def->driver.virtio.event_idx) { -- virBufferAsprintf(&buf, "event_idx='%s' ", -+ virBufferAsprintf(&buf, " event_idx='%s'", - virTristateSwitchTypeToString(def->driver.virtio.event_idx)); - } - if (def->driver.virtio.queues) -- virBufferAsprintf(&buf, "queues='%u' ", def->driver.virtio.queues); -+ virBufferAsprintf(&buf, " queues='%u'", def->driver.virtio.queues); - if (def->driver.virtio.rx_queue_size) -- virBufferAsprintf(&buf, "rx_queue_size='%u' ", -+ virBufferAsprintf(&buf, " rx_queue_size='%u'", - def->driver.virtio.rx_queue_size); - -- virBufferTrim(&buf, " ", -1); -- - if (virBufferCheckError(&buf) < 0) - return -1; - -@@ -22323,10 +22321,10 @@ virDomainNetDefFormat(virBufferPtr buf, - - if (!gueststr && !hoststr) { - if (str) -- virBufferAsprintf(buf, "\n", str); -+ virBufferAsprintf(buf, "\n", str); - } else { - if (str) -- virBufferAsprintf(buf, "\n", str); -+ virBufferAsprintf(buf, "\n", str); - else - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); --- -2.13.1 - diff --git a/SOURCES/libvirt-cpu-Drop-feature-filtering-from-virCPUUpdate.patch b/SOURCES/libvirt-cpu-Drop-feature-filtering-from-virCPUUpdate.patch deleted file mode 100644 index 239d248..0000000 --- a/SOURCES/libvirt-cpu-Drop-feature-filtering-from-virCPUUpdate.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 2642333131bda397dc4b00fd945efdd34e2aa314 Mon Sep 17 00:00:00 2001 -Message-Id: <2642333131bda397dc4b00fd945efdd34e2aa314@dist-git> -From: Jiri Denemark -Date: Wed, 29 Mar 2017 15:00:21 +0200 -Subject: [PATCH] cpu: Drop feature filtering from virCPUUpdate - -Because of the changes done in the previous commit, @host is already a -migratable CPU and there's no need to do any additional filtering. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 232d87c7dd081d126a079fb45178e0be096cc680) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/cpu/cpu_x86.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index a771b251e..53359ff9b 100644 ---- a/src/cpu/cpu_x86.c -+++ b/src/cpu/cpu_x86.c -@@ -2549,8 +2549,7 @@ x86Baseline(virCPUDefPtr *cpus, - - static int - x86UpdateHostModel(virCPUDefPtr guest, -- const virCPUDef *host, -- virCPUx86MapPtr map) -+ const virCPUDef *host) - { - virCPUDefPtr updated = NULL; - size_t i; -@@ -2559,11 +2558,9 @@ x86UpdateHostModel(virCPUDefPtr guest, - if (!(updated = virCPUDefCopyWithoutModel(host))) - goto cleanup; - -- /* Remove non-migratable features by default */ - updated->type = VIR_CPU_TYPE_GUEST; - updated->mode = VIR_CPU_MODE_CUSTOM; -- if (virCPUDefCopyModelFilter(updated, host, true, -- x86FeatureIsMigratable, map) < 0) -+ if (virCPUDefCopyModel(updated, host, true) < 0) - goto cleanup; - - if (guest->vendor_id) { -@@ -2627,7 +2624,7 @@ virCPUx86Update(virCPUDefPtr guest, - - if (guest->mode == VIR_CPU_MODE_HOST_MODEL || - guest->match == VIR_CPU_MATCH_MINIMUM) -- ret = x86UpdateHostModel(guest, host, map); -+ ret = x86UpdateHostModel(guest, host); - else - ret = 0; - --- -2.12.2 - diff --git a/SOURCES/libvirt-cpu-Introduce-virCPUCopyMigratable.patch b/SOURCES/libvirt-cpu-Introduce-virCPUCopyMigratable.patch deleted file mode 100644 index 382224f..0000000 --- a/SOURCES/libvirt-cpu-Introduce-virCPUCopyMigratable.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 57b2e02a1c4cf52f3ea1ec3af469dd4e44402595 Mon Sep 17 00:00:00 2001 -Message-Id: <57b2e02a1c4cf52f3ea1ec3af469dd4e44402595@dist-git> -From: Jiri Denemark -Date: Wed, 29 Mar 2017 14:45:44 +0200 -Subject: [PATCH] cpu: Introduce virCPUCopyMigratable - -This new internal API makes a copy of virCPUDef while removing all -features which would block migration. It uses cpu_map.xml as a database -of such features, which should only be used as a fallback when we cannot -get the data from a hypervisor. The main goal of this API is to decouple -this filtering from virCPUUpdate so that the hypervisor driver can -filter the features according to the hypervisor. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 05e91c79f19e0be96526098d58a3498dac3f8529) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/cpu/cpu.c | 31 +++++++++++++++++++++++++++++++ - src/cpu/cpu.h | 8 ++++++++ - src/cpu/cpu_x86.c | 25 +++++++++++++++++++++++++ - src/libvirt_private.syms | 1 + - 4 files changed, 65 insertions(+) - -diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index 93647a2ed..8a407ac18 100644 ---- a/src/cpu/cpu.c -+++ b/src/cpu/cpu.c -@@ -1130,3 +1130,34 @@ virCPUExpandFeatures(virArch arch, - VIR_DEBUG("nfeatures=%zu", cpu->nfeatures); - return 0; - } -+ -+ -+/** -+ * virCPUCopyMigratable: -+ * -+ * @arch: CPU architecture -+ * @cpu: CPU definition to be copied -+ * -+ * Makes a copy of @cpu with all features which would block migration removed. -+ * If this doesn't make sense for a given architecture, the function returns a -+ * plain copy of @cpu (i.e., a copy with no features removed). -+ * -+ * Returns the copy of the CPU or NULL on error. -+ */ -+virCPUDefPtr -+virCPUCopyMigratable(virArch arch, -+ virCPUDefPtr cpu) -+{ -+ struct cpuArchDriver *driver; -+ -+ VIR_DEBUG("arch=%s, cpu=%p, model=%s", -+ virArchToString(arch), cpu, NULLSTR(cpu->model)); -+ -+ if (!(driver = cpuGetSubDriver(arch))) -+ return NULL; -+ -+ if (driver->copyMigratable) -+ return driver->copyMigratable(cpu); -+ else -+ return virCPUDefCopy(cpu); -+} -diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h -index 8c238ad55..352445c40 100644 ---- a/src/cpu/cpu.h -+++ b/src/cpu/cpu.h -@@ -118,6 +118,9 @@ typedef int - typedef int - (*virCPUArchExpandFeatures)(virCPUDefPtr cpu); - -+typedef virCPUDefPtr -+(*virCPUArchCopyMigratable)(virCPUDefPtr cpu); -+ - struct cpuArchDriver { - const char *name; - const virArch *arch; -@@ -138,6 +141,7 @@ struct cpuArchDriver { - virCPUArchTranslate translate; - virCPUArchConvertLegacy convertLegacy; - virCPUArchExpandFeatures expandFeatures; -+ virCPUArchCopyMigratable copyMigratable; - }; - - -@@ -254,6 +258,10 @@ int - virCPUExpandFeatures(virArch arch, - virCPUDefPtr cpu); - -+virCPUDefPtr -+virCPUCopyMigratable(virArch arch, -+ virCPUDefPtr cpu); -+ - /* virCPUDataFormat and virCPUDataParse are implemented for unit tests only and - * have no real-life usage - */ -diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index 48648a7f4..a771b251e 100644 ---- a/src/cpu/cpu_x86.c -+++ b/src/cpu/cpu_x86.c -@@ -2903,6 +2903,30 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu) - } - - -+static virCPUDefPtr -+virCPUx86CopyMigratable(virCPUDefPtr cpu) -+{ -+ virCPUDefPtr copy; -+ virCPUx86MapPtr map; -+ -+ if (!(map = virCPUx86GetMap())) -+ return NULL; -+ -+ if (!(copy = virCPUDefCopyWithoutModel(cpu))) -+ return NULL; -+ -+ if (virCPUDefCopyModelFilter(copy, cpu, false, -+ x86FeatureIsMigratable, map) < 0) -+ goto error; -+ -+ return copy; -+ -+ error: -+ virCPUDefFree(copy); -+ return NULL; -+} -+ -+ - int - virCPUx86DataAddCPUID(virCPUDataPtr cpuData, - const virCPUx86CPUID *cpuid) -@@ -2978,4 +3002,5 @@ struct cpuArchDriver cpuDriverX86 = { - .getModels = virCPUx86GetModels, - .translate = virCPUx86Translate, - .expandFeatures = virCPUx86ExpandFeatures, -+ .copyMigratable = virCPUx86CopyMigratable, - }; -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index 9a334311d..cc78c5975 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -1018,6 +1018,7 @@ virCPUCheckFeature; - virCPUCompare; - virCPUCompareXML; - virCPUConvertLegacy; -+virCPUCopyMigratable; - virCPUDataCheckFeature; - virCPUDataFormat; - virCPUDataFree; --- -2.12.2 - diff --git a/SOURCES/libvirt-cpu-Introduce-virCPUGetHostIsSupported.patch b/SOURCES/libvirt-cpu-Introduce-virCPUGetHostIsSupported.patch deleted file mode 100644 index 87757a9..0000000 --- a/SOURCES/libvirt-cpu-Introduce-virCPUGetHostIsSupported.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 401cbf50f18234b0631b4b0e01b9e403137fee95 Mon Sep 17 00:00:00 2001 -Message-Id: <401cbf50f18234b0631b4b0e01b9e403137fee95@dist-git> -From: Jiri Denemark -Date: Tue, 11 Apr 2017 20:45:07 +0200 -Subject: [PATCH] cpu: Introduce virCPUGetHostIsSupported - -Sometimes we want to call virCPUGetHost only when it is implemented for -a given architecture to avoid logging expected and possibly misleading -errors. The new virCPUGetHostIsSupported API may be used to guard such -calls to virCPUGetHost. - -Signed-off-by: Jiri Denemark -(cherry picked from commit bf1a881715c905c67f7d38dcd5bd6c2afbff1f9b) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/cpu/cpu.c | 20 ++++++++++++++++++++ - src/cpu/cpu.h | 3 +++ - src/libvirt_private.syms | 1 + - 3 files changed, 24 insertions(+) - -diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c -index 8a407ac18..702b14dbb 100644 ---- a/src/cpu/cpu.c -+++ b/src/cpu/cpu.c -@@ -358,6 +358,26 @@ virCPUDataFree(virCPUDataPtr data) - - - /** -+ * virCPUGetHostIsSupported: -+ * -+ * @arch: CPU architecture -+ * -+ * Check whether virCPUGetHost is supported for @arch. -+ * -+ * Returns true if virCPUGetHost is supported, false otherwise. -+ */ -+bool -+virCPUGetHostIsSupported(virArch arch) -+{ -+ struct cpuArchDriver *driver; -+ -+ VIR_DEBUG("arch=%s", virArchToString(arch)); -+ -+ return (driver = cpuGetSubDriver(arch)) && driver->getHost; -+} -+ -+ -+/** - * virCPUGetHost: - * - * @arch: CPU architecture -diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h -index 352445c40..c6ca111e9 100644 ---- a/src/cpu/cpu.h -+++ b/src/cpu/cpu.h -@@ -183,6 +183,9 @@ virCPUDataNew(virArch arch); - void - virCPUDataFree(virCPUDataPtr data); - -+bool -+virCPUGetHostIsSupported(virArch arch); -+ - virCPUDefPtr - virCPUGetHost(virArch arch, - virCPUType type, -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index cc78c5975..d802e7598 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -1026,6 +1026,7 @@ virCPUDataNew; - virCPUDataParse; - virCPUExpandFeatures; - virCPUGetHost; -+virCPUGetHostIsSupported; - virCPUGetModels; - virCPUProbeHost; - virCPUTranslate; --- -2.12.2 - diff --git a/SOURCES/libvirt-cpu-add-CPU-features-and-model-for-indirect-branch-prediction-protection.patch b/SOURCES/libvirt-cpu-add-CPU-features-and-model-for-indirect-branch-prediction-protection.patch index d264d5d..a915513 100644 --- a/SOURCES/libvirt-cpu-add-CPU-features-and-model-for-indirect-branch-prediction-protection.patch +++ b/SOURCES/libvirt-cpu-add-CPU-features-and-model-for-indirect-branch-prediction-protection.patch @@ -1,5 +1,5 @@ -From b3505e6f099cf4af35e254e077bb61cf62f035ed Mon Sep 17 00:00:00 2001 -Message-Id: +From 9df09ec5e1afef8659271c6cc4a5b741d5d06815 Mon Sep 17 00:00:00 2001 +Message-Id: <9df09ec5e1afef8659271c6cc4a5b741d5d06815@dist-git> From: Paolo Bonzini Date: Tue, 12 Dec 2017 16:23:42 +0100 Subject: [PATCH] cpu: add CPU features and model for indirect branch @@ -9,21 +9,17 @@ CVE-2017-5715 Signed-off-by: Paolo Bonzini Signed-off-by: Jiri Denemark - -Conflicts: - src/cpu/cpu_map.xml - - no Skylake-Server and EPYC CPU models --- - src/cpu/cpu_map.xml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 50 insertions(+) + src/cpu/cpu_map.xml | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 58 insertions(+) diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml -index 29b5b596f4..7fbba9f0d8 100644 +index 96f4ce60dd..a7888ec134 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml -@@ -283,6 +283,15 @@ +@@ -292,6 +292,15 @@ - + + + @@ -37,7 +33,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -411,6 +420,11 @@ +@@ -420,6 +429,11 @@ @@ -49,7 +45,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -857,6 +871,10 @@ +@@ -866,6 +880,10 @@ @@ -60,7 +56,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -894,6 +912,10 @@ +@@ -903,6 +921,10 @@ @@ -71,7 +67,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -937,6 +959,10 @@ +@@ -946,6 +968,10 @@ @@ -82,7 +78,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -986,6 +1012,10 @@ +@@ -995,6 +1021,10 @@ @@ -93,7 +89,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -1039,6 +1069,10 @@ +@@ -1048,6 +1078,10 @@ @@ -104,7 +100,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -1094,6 +1128,10 @@ +@@ -1103,6 +1137,10 @@ @@ -115,7 +111,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -1151,6 +1189,10 @@ +@@ -1160,6 +1198,10 @@ @@ -126,7 +122,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -1210,6 +1252,10 @@ +@@ -1219,6 +1261,10 @@ @@ -137,7 +133,7 @@ index 29b5b596f4..7fbba9f0d8 100644 -@@ -1278,6 +1324,10 @@ +@@ -1287,6 +1333,10 @@ @@ -146,8 +142,30 @@ index 29b5b596f4..7fbba9f0d8 100644 + + + + +@@ -1362,6 +1412,10 @@ + + + ++ ++ ++ ++ + +@@ -1700,6 +1754,10 @@ + + + ++ ++ ++ ++ + + + -- 2.15.1 diff --git a/SOURCES/libvirt-cpu_x86-Copy-CPU-signature-from-ancestor.patch b/SOURCES/libvirt-cpu_x86-Copy-CPU-signature-from-ancestor.patch index 77bda28..b81e716 100644 --- a/SOURCES/libvirt-cpu_x86-Copy-CPU-signature-from-ancestor.patch +++ b/SOURCES/libvirt-cpu_x86-Copy-CPU-signature-from-ancestor.patch @@ -1,7 +1,7 @@ -From e8639315f3f6116b3f589657bad57a15f119ddbc Mon Sep 17 00:00:00 2001 -Message-Id: +From 38b3d773dddd7f3cfe715b9cbabaa296c16c1290 Mon Sep 17 00:00:00 2001 +Message-Id: <38b3d773dddd7f3cfe715b9cbabaa296c16c1290@dist-git> From: Jiri Denemark -Date: Thu, 11 Jan 2018 14:33:07 +0100 +Date: Fri, 5 Jan 2018 17:43:03 +0100 Subject: [PATCH] cpu_x86: Copy CPU signature from ancestor When specifying a new CPU model in cpu_map.xml as an extension to an @@ -17,7 +17,7 @@ Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina (cherry picked from commit b427cf4831d0ea7aac9dd1a3aa7682478356a483) -https://bugzilla.redhat.com/show_bug.cgi?id=1533418 +https://bugzilla.redhat.com/show_bug.cgi?id=1533125 The new -IBRS and -IBPB CPU models were defined via inheritance from their original models in RHEL. Thus when the host CPU matches the @@ -31,10 +31,10 @@ Signed-off-by: Jiri Denemark 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index efef7f235d..41aaa61c35 100644 +index ad35532fc1..001109f701 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c -@@ -1209,6 +1209,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, +@@ -1227,6 +1227,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, VIR_FREE(name); model->vendor = ancestor->vendor; diff --git a/SOURCES/libvirt-cpu_x86-Properly-disable-unknown-CPU-features.patch b/SOURCES/libvirt-cpu_x86-Properly-disable-unknown-CPU-features.patch deleted file mode 100644 index a54fa77..0000000 --- a/SOURCES/libvirt-cpu_x86-Properly-disable-unknown-CPU-features.patch +++ /dev/null @@ -1,453 +0,0 @@ -From 73e87a037ccd6d9fd02c3fd0a082f014412c7555 Mon Sep 17 00:00:00 2001 -Message-Id: <73e87a037ccd6d9fd02c3fd0a082f014412c7555@dist-git> -From: Jiri Denemark -Date: Mon, 19 Jun 2017 13:18:52 +0200 -Subject: [PATCH] cpu_x86: Properly disable unknown CPU features - -CPU features unknown to a hypervisor will not be present in dataDisabled -even though the features won't naturally be enabled because. -Thus any features we asked for which are not in dataEnabled should be -considered disabled. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 83e081b8ab32dd990b4e4ccc7bf8a1a416fc51c2) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/cpu/cpu_x86.c | 9 +- - tests/cputest.c | 1 + - .../x86_64-cpuid-Core-i7-5600U-arat-disabled.xml | 5 + - .../x86_64-cpuid-Core-i7-5600U-arat-enabled.xml | 8 + - .../x86_64-cpuid-Core-i7-5600U-arat-guest.xml | 29 +++ - .../x86_64-cpuid-Core-i7-5600U-arat-host.xml | 30 +++ - .../x86_64-cpuid-Core-i7-5600U-arat-json.xml | 14 ++ - .../x86_64-cpuid-Core-i7-5600U-arat.json | 202 +++++++++++++++++++++ - .../x86_64-cpuid-Core-i7-5600U-arat.xml | 41 +++++ - 9 files changed, 335 insertions(+), 4 deletions(-) - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json - create mode 100644 tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml - -diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index 53359ff9b6..2864454211 100644 ---- a/src/cpu/cpu_x86.c -+++ b/src/cpu/cpu_x86.c -@@ -2664,12 +2664,11 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, - x86DataCopy(&disabled, &dataDisabled->data.x86) < 0) - goto cleanup; - -- x86DataSubtract(&enabled, &model->data); -- - for (i = 0; i < map->nfeatures; i++) { - virCPUx86FeaturePtr feature = map->features[i]; - -- if (x86DataIsSubset(&enabled, &feature->data)) { -+ if (x86DataIsSubset(&enabled, &feature->data) && -+ !x86DataIsSubset(&model->data, &feature->data)) { - VIR_DEBUG("Feature '%s' enabled by the hypervisor", feature->name); - if (cpu->check == VIR_CPU_CHECK_FULL) - virBufferAsprintf(&bufAdded, "%s,", feature->name); -@@ -2678,7 +2677,9 @@ virCPUx86UpdateLive(virCPUDefPtr cpu, - goto cleanup; - } - -- if (x86DataIsSubset(&disabled, &feature->data)) { -+ if (x86DataIsSubset(&disabled, &feature->data) || -+ (x86DataIsSubset(&model->data, &feature->data) && -+ !x86DataIsSubset(&enabled, &feature->data))) { - VIR_DEBUG("Feature '%s' disabled by the hypervisor", feature->name); - if (cpu->check == VIR_CPU_CHECK_FULL) - virBufferAsprintf(&bufRemoved, "%s,", feature->name); -diff --git a/tests/cputest.c b/tests/cputest.c -index 97b34de9ed..5190a83467 100644 ---- a/tests/cputest.c -+++ b/tests/cputest.c -@@ -991,6 +991,7 @@ mymain(void) - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4600U", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-4510U", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U", true); -+ DO_TEST_CPUID(VIR_ARCH_X86_64, "Core-i7-5600U-arat", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-E6850", true); - DO_TEST_CPUID(VIR_ARCH_X86_64, "Core2-Q9500", false); - DO_TEST_CPUID(VIR_ARCH_X86_64, "FX-8150", false); -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml -new file mode 100644 -index 0000000000..4a0477f788 ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-disabled.xml -@@ -0,0 +1,5 @@ -+ -+ -+ -+ -+ -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml -new file mode 100644 -index 0000000000..5cffacef59 ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-enabled.xml -@@ -0,0 +1,8 @@ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml -new file mode 100644 -index 0000000000..877895cf15 ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-guest.xml -@@ -0,0 +1,29 @@ -+ -+ Broadwell -+ Intel -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml -new file mode 100644 -index 0000000000..9b24941e0e ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-host.xml -@@ -0,0 +1,30 @@ -+ -+ x86_64 -+ Broadwell -+ Intel -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml -new file mode 100644 -index 0000000000..4f253fc08a ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat-json.xml -@@ -0,0 +1,14 @@ -+ -+ Broadwell -+ Intel -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json -new file mode 100644 -index 0000000000..f2aa7f3185 ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.json -@@ -0,0 +1,202 @@ -+{ -+ "return": { -+ "model": { -+ "name": "base", -+ "props": { -+ "pfthreshold": false, -+ "pku": false, -+ "rtm": true, -+ "tsc_adjust": true, -+ "tsc-deadline": true, -+ "xstore-en": false, -+ "tsc-scale": false, -+ "sse": true, -+ "smap": true, -+ "stepping": 4, -+ "tce": false, -+ "kvm_steal_time": true, -+ "smep": true, -+ "rdpid": false, -+ "xcrypt": false, -+ "sse4_2": true, -+ "monitor": false, -+ "sse4_1": true, -+ "kvm-mmu": false, -+ "flushbyasid": false, -+ "kvm-steal-time": true, -+ "lm": true, -+ "tsc": true, -+ "adx": true, -+ "fxsr": true, -+ "sha-ni": false, -+ "tm": false, -+ "pclmuldq": true, -+ "xgetbv1": false, -+ "xstore": false, -+ "vmcb_clean": false, -+ "vme": true, -+ "vendor": "GenuineIntel", -+ "ffxsr": false, -+ "de": true, -+ "avx512f": false, -+ "pse": true, -+ "ds-cpl": false, -+ "tbm": false, -+ "ia64": false, -+ "phe-en": false, -+ "f16c": true, -+ "ds": false, -+ "mpx": false, -+ "tsc-adjust": true, -+ "aes": true, -+ "avx2": true, -+ "pbe": false, -+ "cx16": true, -+ "ds_cpl": false, -+ "movbe": true, -+ "perfctr-nb": false, -+ "nrip_save": false, -+ "kvm_mmu": false, -+ "ospke": false, -+ "avx512ifma": false, -+ "vmx": true, -+ "sep": true, -+ "xsaveopt": true, -+ "sse4a": false, -+ "avx512dq": false, -+ "i64": true, -+ "avx512-4vnniw": false, -+ "xsave": true, -+ "erms": true, -+ "hle": true, -+ "nodeid_msr": false, -+ "est": false, -+ "svm_lock": false, -+ "xop": false, -+ "model-id": "Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz", -+ "abm": true, -+ "avx512er": false, -+ "sse4.1": true, -+ "sse4.2": true, -+ "pause-filter": false, -+ "lahf-lm": true, -+ "kvm-nopiodelay": true, -+ "cmp_legacy": false, -+ "acpi": false, -+ "fma4": false, -+ "popcnt": true, -+ "mmx": true, -+ "osxsave": false, -+ "pcommit": false, -+ "avx512pf": false, -+ "clwb": false, -+ "dca": false, -+ "pdcm": false, -+ "xcrypt-en": false, -+ "3dnow": false, -+ "invtsc": false, -+ "tm2": false, -+ "hypervisor": true, -+ "kvmclock-stable-bit": true, -+ "fxsr-opt": false, -+ "pcid": true, -+ "sse4-1": true, -+ "sse4-2": true, -+ "avx512-vpopcntdq": false, -+ "avx512-4fmaps": false, -+ "pause_filter": false, -+ "svm-lock": false, -+ "rdrand": true, -+ "nrip-save": false, -+ "avx512vl": false, -+ "x2apic": true, -+ "kvmclock": true, -+ "pge": true, -+ "family": 6, -+ "dtes64": false, -+ "xd": true, -+ "kvm_pv_eoi": true, -+ "ace2": false, -+ "kvm_pv_unhalt": true, -+ "xtpr": false, -+ "perfctr_nb": false, -+ "avx512bw": false, -+ "nx": true, -+ "lwp": false, -+ "msr": true, -+ "ace2-en": false, -+ "decodeassists": false, -+ "perfctr-core": false, -+ "pn": false, -+ "fma": true, -+ "nodeid-msr": false, -+ "kvm_asyncpf": true, -+ "clflush": true, -+ "cx8": true, -+ "mce": true, -+ "avx512cd": false, -+ "cr8legacy": false, -+ "mca": true, -+ "pni": true, -+ "rdseed": true, -+ "apic": true, -+ "fsgsbase": true, -+ "cmp-legacy": false, -+ "kvm-pv-unhalt": true, -+ "rdtscp": true, -+ "mmxext": false, -+ "cid": false, -+ "ssse3": true, -+ "extapic": false, -+ "pse36": true, -+ "mtrr": true, -+ "ibs": false, -+ "la57": false, -+ "avx": true, -+ "syscall": true, -+ "umip": false, -+ "invpcid": true, -+ "avx512vbmi": false, -+ "kvm-asyncpf": true, -+ "vmcb-clean": false, -+ "pmm": false, -+ "cmov": true, -+ "perfctr_core": false, -+ "misalignsse": false, -+ "clflushopt": false, -+ "pat": true, -+ "lbrv": false, -+ "3dnowprefetch": true, -+ "fpu": true, -+ "pae": true, -+ "wdt": false, -+ "tsc_scale": false, -+ "skinit": false, -+ "fxsr_opt": false, -+ "kvm_nopiodelay": true, -+ "pmm-en": false, -+ "phe": false, -+ "3dnowext": false, -+ "osvw": false, -+ "ht": false, -+ "pdpe1gb": true, -+ "kvm-pv-eoi": true, -+ "npt": false, -+ "xsavec": false, -+ "lahf_lm": true, -+ "pclmulqdq": true, -+ "svm": false, -+ "sse3": true, -+ "sse2": true, -+ "ss": true, -+ "topoext": false, -+ "smx": false, -+ "bmi1": true, -+ "bmi2": true, -+ "xsaves": false, -+ "model": 61 -+ } -+ } -+ }, -+ "id": "model-expansion" -+} -diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml -new file mode 100644 -index 0000000000..ecb4a6e15c ---- /dev/null -+++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-arat.xml -@@ -0,0 +1,41 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ --- -2.13.2 - diff --git a/SOURCES/libvirt-cpu_x86-Rename-virCPUx86MapInitialize.patch b/SOURCES/libvirt-cpu_x86-Rename-virCPUx86MapInitialize.patch index 1808387..b757b16 100644 --- a/SOURCES/libvirt-cpu_x86-Rename-virCPUx86MapInitialize.patch +++ b/SOURCES/libvirt-cpu_x86-Rename-virCPUx86MapInitialize.patch @@ -1,5 +1,5 @@ -From 3a74e5ae1229d1be6792178e650174f4a740e869 Mon Sep 17 00:00:00 2001 -Message-Id: <3a74e5ae1229d1be6792178e650174f4a740e869@dist-git> +From b200b9cbb5c6c7d3d3b1bb4f745a7371cc35a429 Mon Sep 17 00:00:00 2001 +Message-Id: From: Jiri Denemark Date: Wed, 13 Dec 2017 22:30:31 +0100 Subject: [PATCH] cpu_x86: Rename virCPUx86MapInitialize @@ -15,7 +15,7 @@ Signed-off-by: Jiri Denemark 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c -index 2864454211..8af0a1a2b7 100644 +index a6cbd45766..693e571a3d 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -153,8 +153,8 @@ struct _virCPUx86Map { @@ -29,7 +29,7 @@ index 2864454211..8af0a1a2b7 100644 typedef enum { -@@ -1386,7 +1386,7 @@ virCPUx86LoadMap(void) +@@ -1404,7 +1404,7 @@ virCPUx86LoadMap(void) int @@ -38,7 +38,7 @@ index 2864454211..8af0a1a2b7 100644 { if (!(cpuMap = virCPUx86LoadMap())) return -1; -@@ -1398,7 +1398,7 @@ virCPUx86MapOnceInit(void) +@@ -1416,7 +1416,7 @@ virCPUx86MapOnceInit(void) static virCPUx86MapPtr virCPUx86GetMap(void) { diff --git a/SOURCES/libvirt-daemon-Don-t-initialize-SASL-context-if-not-necessary.patch b/SOURCES/libvirt-daemon-Don-t-initialize-SASL-context-if-not-necessary.patch deleted file mode 100644 index 159fca0..0000000 --- a/SOURCES/libvirt-daemon-Don-t-initialize-SASL-context-if-not-necessary.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8c9296cbe21657aadbc4bff88eabd617168349f6 Mon Sep 17 00:00:00 2001 -Message-Id: <8c9296cbe21657aadbc4bff88eabd617168349f6@dist-git> -From: Peter Krempa -Date: Fri, 2 Jun 2017 15:07:59 +0200 -Subject: [PATCH] daemon: Don't initialize SASL context if not necessary - -SASL context would be initialized even if the corresponding TCP or TLS -sockets are not enabled. - -fe772f24a68 attempted to fix the symptom by commenting out the settings, -but that did not fix the root cause. 3c647ee4bbb later reverted those -changes so that the more secure algorithm is used. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1450095 -(cherry picked from commit ed914284ba74afb7dd16dcb623073bb1a1d5cd21) - -Signed-off-by: Jiri Denemark ---- - daemon/libvirtd.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c -index 891238bcbe..bac4bc1b65 100644 ---- a/daemon/libvirtd.c -+++ b/daemon/libvirtd.c -@@ -613,11 +613,11 @@ daemonSetupNetworking(virNetServerPtr srv, - - #if WITH_SASL - if (config->auth_unix_rw == REMOTE_AUTH_SASL || -- config->auth_unix_ro == REMOTE_AUTH_SASL || -+ (sock_path_ro && config->auth_unix_ro == REMOTE_AUTH_SASL) || - # if WITH_GNUTLS -- config->auth_tls == REMOTE_AUTH_SASL || -+ (ipsock && config->listen_tls && config->auth_tls == REMOTE_AUTH_SASL) || - # endif -- config->auth_tcp == REMOTE_AUTH_SASL) { -+ (ipsock && config->listen_tcp && config->auth_tcp == REMOTE_AUTH_SASL)) { - saslCtxt = virNetSASLContextNewServer( - (const char *const*)config->sasl_allowed_username_list); - if (!saslCtxt) --- -2.13.1 - diff --git a/SOURCES/libvirt-disk-Force-usage-of-parted-when-checking-disk-format-for-bsd.patch b/SOURCES/libvirt-disk-Force-usage-of-parted-when-checking-disk-format-for-bsd.patch deleted file mode 100644 index e867cc5..0000000 --- a/SOURCES/libvirt-disk-Force-usage-of-parted-when-checking-disk-format-for-bsd.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 911438df6c652e377f80712c67da90aed91444b7 Mon Sep 17 00:00:00 2001 -Message-Id: <911438df6c652e377f80712c67da90aed91444b7@dist-git> -From: John Ferlan -Date: Wed, 26 Apr 2017 08:41:09 -0400 -Subject: [PATCH] disk: Force usage of parted when checking disk format for - "bsd" - -https://bugzilla.redhat.com/show_bug.cgi?id=1439132 - -Add "bsd" to the list of format types to not checked during blkid -processing even though it supposedly knows the format - for some -(now unknown) reason it's returning partition table not found. So -let's just let PARTED handle "bsd" too. - -Signed-off-by: John Ferlan -(cherry picked from commit 98f424d5038b362d1b62549930d0b9253106bdca) -Signed-off-by: Jiri Denemark ---- - src/storage/storage_util.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c -index 7a458b828..adec9ab6f 100644 ---- a/src/storage/storage_util.c -+++ b/src/storage/storage_util.c -@@ -3002,10 +3002,12 @@ virStorageBackendBLKIDFindPart(blkid_probe probe, - - /* A blkid_known_pttype on "dvh" and "pc98" returns a failure; - * however, the blkid_do_probe for "dvh" returns "sgi" and -- * for "pc98" it returns "dos". So since those will cause problems -+ * for "pc98" it returns "dos". Although "bsd" is recognized, -+ * it seems that the parted created partition table is not being -+ * properly recogized. Since each of these will cause problems - * with startup comparison, let's just treat them as UNKNOWN causing - * the caller to fallback to using PARTED */ -- if (STREQ(format, "dvh") || STREQ(format, "pc98")) -+ if (STREQ(format, "dvh") || STREQ(format, "pc98") || STREQ(format, "bsd")) - return VIR_STORAGE_BLKID_PROBE_UNKNOWN; - - /* Make sure we're doing a partitions probe from the start */ --- -2.12.2 - diff --git a/SOURCES/libvirt-disk-Resolve-issues-with-disk-partition-build-start-checks.patch b/SOURCES/libvirt-disk-Resolve-issues-with-disk-partition-build-start-checks.patch deleted file mode 100644 index 77b111d..0000000 --- a/SOURCES/libvirt-disk-Resolve-issues-with-disk-partition-build-start-checks.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 5c1a822cfa7993b1f55f90b75b66c86787a063d1 Mon Sep 17 00:00:00 2001 -Message-Id: <5c1a822cfa7993b1f55f90b75b66c86787a063d1@dist-git> -From: John Ferlan -Date: Wed, 26 Apr 2017 08:41:08 -0400 -Subject: [PATCH] disk: Resolve issues with disk partition build/start checks - -https://bugzilla.redhat.com/show_bug.cgi?id=1439132 - -Commit id 'a48c674fb' added a check for format types "dvh" and "pc98" -to use the parted print processing instead of using blkid processing -in order to validate the label on the disk was what is expected for -disk pool startup. However, commit id 'a4cb4a74f' really messed things -up by missing an else condition causing PARTEDFindLabel to always -return DIFFERENT. - -Signed-off-by: John Ferlan -(cherry picked from commit f2a123203105b4fe010aea866e87f8bcf5f31193) -Signed-off-by: Jiri Denemark ---- - src/storage/storage_util.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c -index 0ceaab6b9..7a458b828 100644 ---- a/src/storage/storage_util.c -+++ b/src/storage/storage_util.c -@@ -3213,8 +3213,8 @@ virStorageBackendPARTEDFindLabel(const char *device, - /* Does the on disk match what the pool desired? */ - if (STREQ(start, format)) - ret = VIR_STORAGE_PARTED_MATCH; -- -- ret = VIR_STORAGE_PARTED_DIFFERENT; -+ else -+ ret = VIR_STORAGE_PARTED_DIFFERENT; - - cleanup: - virCommandFree(cmd); --- -2.12.2 - diff --git a/SOURCES/libvirt-disk-Use-virStorageBackendZeroPartitionTable.patch b/SOURCES/libvirt-disk-Use-virStorageBackendZeroPartitionTable.patch deleted file mode 100644 index 705de4d..0000000 --- a/SOURCES/libvirt-disk-Use-virStorageBackendZeroPartitionTable.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 9aeaadcf7d7f33cc5208bcbc788676f27691843a Mon Sep 17 00:00:00 2001 -Message-Id: <9aeaadcf7d7f33cc5208bcbc788676f27691843a@dist-git> -From: John Ferlan -Date: Wed, 26 Apr 2017 08:41:14 -0400 -Subject: [PATCH] disk: Use virStorageBackendZeroPartitionTable - -https://bugzilla.redhat.com/show_bug.cgi?id=1439132 - -During 'matrix' testing of all possible combinations I found that if -device is formated with "gpt" first, then an attempt is made to format -using "mac", a startup will fail. - -Deeper analysis by Peter Krempa indicates that the "mac" table fits -into the first block on the disk. Since the GPT disklabel is stored -at LBA address 1 it is not overwritten at all. Thus it's apparent that -the (blkid) detection tool then prefers GPT over a older disklabel. - -The GPT disklabel has also a secondary copy at the last LBA of the disk. - -So, follow the same logic as the logical pool in clearing a 1MB swath -at the beginning and end of the device to avoid potential issues with -larger sector sizes for the device. - -Also fixed a minor formatting nit in virStorageBackendDeviceIsEmpty call. - -(cherry picked from commit 3c4f2e3fb725054921f855a229afc7daca7119ae) -Signed-off-by: John Ferlan -Signed-off-by: Jiri Denemark ---- - src/storage/storage_backend_disk.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c -index 39371f2d9..e8f67bb00 100644 ---- a/src/storage/storage_backend_disk.c -+++ b/src/storage/storage_backend_disk.c -@@ -491,11 +491,15 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED, - ok_to_mklabel = true; - } else { - if (virStorageBackendDeviceIsEmpty(pool->def->source.devices[0].path, -- fmt, true)) -+ fmt, true)) - ok_to_mklabel = true; - } - - if (ok_to_mklabel) { -+ if (virStorageBackendZeroPartitionTable(pool->def->source.devices[0].path, -+ 1024 * 1024) < 0) -+ goto error; -+ - /* eg parted /dev/sda mklabel --script msdos */ - if (format == VIR_STORAGE_POOL_DISK_UNKNOWN) - format = pool->def->source.format = VIR_STORAGE_POOL_DISK_DOS; --- -2.12.2 - diff --git a/SOURCES/libvirt-docs-Document-the-mediated-devices-within-the-nodedev-driver.patch b/SOURCES/libvirt-docs-Document-the-mediated-devices-within-the-nodedev-driver.patch deleted file mode 100644 index fa10ab2..0000000 --- a/SOURCES/libvirt-docs-Document-the-mediated-devices-within-the-nodedev-driver.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 9a202d80f7b60fcf6caf059570bfd2d0b0cbe8a4 Mon Sep 17 00:00:00 2001 -Message-Id: <9a202d80f7b60fcf6caf059570bfd2d0b0cbe8a4@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:55 +0200 -Subject: [PATCH] docs: Document the mediated devices within the nodedev driver - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit a0a0b3cf71cbee1df40dd0fdebd7bb6a84682f09) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - docs/drvnodedev.html.in | 168 +++++++++++++++++++++++++++++++++++++++++++++++- - tools/virsh.pod | 7 +- - 2 files changed, 171 insertions(+), 4 deletions(-) - -diff --git a/docs/drvnodedev.html.in b/docs/drvnodedev.html.in -index 0a3870343..26c52dd0d 100644 ---- a/docs/drvnodedev.html.in -+++ b/docs/drvnodedev.html.in -@@ -9,7 +9,7 @@ - (historically also referred to as node devices) like USB, PCI, SCSI, and - network devices. This also includes various virtualization capabilities - which the aforementioned devices provide for utilization, for example -- SR-IOV, NPIV, DRM, etc. -+ SR-IOV, NPIV, MDEV, DRM, etc. -

    - -

    -@@ -75,6 +75,7 @@ - storage (Since 1.0.4), - scsi_generic (Since 1.0.7), - drm (Since 3.1.0), and -+ mdev (Since 3.4.0). - This element can be nested in which case it further specifies a - device's capability. Refer to specific device types to see more values - for the type attribute which are exclusive. -@@ -185,5 +186,170 @@ - ... - <device>

    - -+

    MDEV capability

    -+

    -+ A PCI device capable of creating mediated devices will include a nested -+ capability mdev_types which enumerates all supported mdev -+ types on the physical device, along with the type attributes available -+ through sysfs: -+

    -+ -+
    -+
    type
    -+
    -+ This element describes a mediated device type which acts as an -+ abstract template defining a resource allocation for instances of this -+ device type. The element has one attribute id which holds -+ an official vendor-supplied identifier for the type. -+ Since 3.4.0 -+
    -+ -+
    name
    -+
    -+ The name element holds a vendor-supplied code name for -+ the given mediated device type. This is an optional element. -+ Since 3.4.0 -+
    -+ -+
    deviceAPI
    -+
    -+ The value of this element describes how an instance of the given type -+ will be presented to the guest by the VFIO framework. -+ Since 3.4.0 -+
    -+ -+
    availableInstances
    -+
    -+ This element reports the current state of resource allocation. In other -+ words, how many instances of the given type can still be successfully -+ created on the physical device. -+ Since 3.4.0 -+
    -+
    -+ -+

    -+ For a more info about mediated devices, refer to the -+ paragraph below. -+

    -+ -+
    -+<device>
    -+...
    -+  <driver>
    -+    <name>nvidia</name>
    -+  </driver>
    -+  <capability type='pci'>
    -+...
    -+    <capability type='mdev_types'>
    -+      <type id='nvidia-11'>
    -+        <name>GRID M60-0B</name>
    -+        <deviceAPI>vfio-pci</deviceAPI>
    -+        <availableInstances>16</availableInstances>
    -+      </type>
    -+      <!-- Here would come the rest of the available mdev types -->
    -+    </capability>
    -+...
    -+  </capability>
    -+</device>
    -+ -+

    Mediated devices (MDEVs)

    -+

    -+ Mediated devices (Since 3.2.0) are software -+ devices defining resource allocation on the backing physical device which -+ in turn allows the parent physical device's resources to be divided into -+ several mediated devices, thus sharing the physical device's performance -+ among multiple guests. Unlike SR-IOV however, where a PCIe device appears -+ as multiple separate PCIe devices on the host's PCI bus, mediated devices -+ only appear on the mdev virtual bus. Therefore, no detach/reattach -+ procedure from/to the host driver procedure is involved even though -+ mediated devices are used in a direct device assignment manner. -+

    -+ -+

    -+ The following sub-elements and attributes are exposed within the -+ capability element: -+

    -+ -+
    -+
    type
    -+
    -+ This element describes a mediated device type which acts as an -+ abstract template defining a resource allocation for instances of this -+ device type. The element has one attribute id which holds -+ an official vendor-supplied identifier for the type. -+ Since 3.4.0 -+
    -+ -+
    iommuGroup
    -+
    -+ This element supports a single attribute number which holds -+ the IOMMU group number the mediated device belongs to. -+ Since 3.4.0 -+
    -+
    -+ -+

    Example of a mediated device

    -+
    -+<device>
    -+  <name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
    -+  <path>/sys/devices/pci0000:00/0000:00:02.0/4b20d080-1b54-4048-85b3-a6a62d165c01</path>
    -+  <parent>pci_0000_06_00_0</parent>
    -+  <driver>
    -+    <name>vfio_mdev</name>
    -+  </driver>
    -+  <capability type='mdev'>
    -+    <type id='nvidia-11'/>
    -+    <iommuGroup number='12'/>
    -+  <capability/>
    -+<device/>
    -+ -+

    -+ The support of mediated device's framework in libvirt's node device driver -+ covers the following features: -+

    -+ -+
      -+
    • -+ list available mediated devices on the host -+ (Since 3.4.0) -+
    • -+
    • -+ display device details -+ (Since 3.4.0) -+
    • -+
    -+ -+

    -+ Because mediated devices are instantiated from vendor specific templates, -+ simply called 'types', information describing these types is contained -+ within the parent device's capabilities -+ (see the example in PCI host devices). -+

    -+ -+

    -+ To see the supported mediated device types on a specific physical device -+ use the following: -+

    -+ -+
    -+$ ls /sys/class/mdev_bus/<device>/mdev_supported_types
    -+ -+

    -+ To manually instantiate a mediated device, use one of the following as a -+ reference: -+

    -+ -+
    -+$ uuidgen > /sys/class/mdev_bus/<device>/mdev_supported_types/<type>/create
    -+...
    -+$ echo <UUID> > /sys/class/mdev_bus/<device>/mdev_supported_types/<type>/create
    -+ -+

    -+ Manual removal of a mediated device is then performed as follows: -+

    -+ -+
    -+$ echo 1 > /sys/bus/mdev/devices/<uuid>/remove
    -+ - - -diff --git a/tools/virsh.pod b/tools/virsh.pod -index 0dd1fc7b2..11bacefa9 100644 ---- a/tools/virsh.pod -+++ b/tools/virsh.pod -@@ -3155,10 +3155,11 @@ for HBA). - - List all of the devices available on the node that are known by libvirt. - I is used to filter the list by capability types, the types must be --separated by comma, e.g. --cap pci,scsi, valid capability types include -+separated by comma, e.g. --cap pci,scsi. Valid capability types include - 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', --'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm'.If I<--tree> --is used, the output is formatted in a tree representing parents of each -+'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', -+'mdev_types'. -+If I<--tree> is used, the output is formatted in a tree representing parents of each - node. I and I<--tree> are mutually exclusive. - - =item B I --- -2.13.0 - diff --git a/SOURCES/libvirt-docs-Improve-documentation-for-serial-consoles.patch b/SOURCES/libvirt-docs-Improve-documentation-for-serial-consoles.patch new file mode 100644 index 0000000..7467515 --- /dev/null +++ b/SOURCES/libvirt-docs-Improve-documentation-for-serial-consoles.patch @@ -0,0 +1,294 @@ +From 07ed5aa86d223b1e99ef716429be60c1823ce0f5 Mon Sep 17 00:00:00 2001 +Message-Id: <07ed5aa86d223b1e99ef716429be60c1823ce0f5@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:55 +0100 +Subject: [PATCH] docs: Improve documentation for serial consoles + +Our current documentation is missing some information and doesn't +do a great job at explaining how the and elements +are connected. Let's try to fix that. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 4567cecb372c48095fce23ce3040d1c687cc3640) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 224 +++++++++++++++++++++++++++++++++------------- + 1 file changed, 164 insertions(+), 60 deletions(-) + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 4f28dce355..f57a124056 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -6434,77 +6434,68 @@ qemu-kvm -net nic,model=? /dev/null +
    + ...
    + <devices>
    ++  <!-- Serial port -->
    +   <serial type='pty'>
    +     <source path='/dev/pts/3'/>
    +     <target port='0'/>
    +   </serial>
    + </devices>
    ++...
    ++ ++
    ++...
    ++<devices>
    ++  <!-- USB serial port -->
    ++  <serial type='pty'>
    ++    <target type='usb-serial' port='0'/>
    ++    <address type='usb' bus='0' port='1'/>
    ++  </serial>
    ++</devices>
    + ...
    + +

    +- target can have a port attribute, which +- specifies the port number. Ports are numbered starting from 0. There are +- usually 0, 1 or 2 serial ports. There is also an optional +- type attribute since 1.0.2 +- which has three choices for its value, one is isa-serial, +- then usb-serial and last one is pci-serial. +- If type is missing, isa-serial will be used by +- default. For usb-serial an optional sub-element +- <address/> with type='usb' can tie the +- device to a particular controller, documented above. +- Similarly, pci-serial can be used to attach the device to +- the pci bus (since 1.2.16). Again, it has +- optional sub-element <address/> with +- type='pci' to select desired location on the PCI bus. ++ The target element can have an optional port ++ attribute, which specifies the port number (starting from 0), and an ++ optional type attribute: valid values are, ++ since 1.0.2, isa-serial (usable ++ with x86 guests), usb-serial (usable whenever USB support ++ is available) and pci-serial (usable whenever PCI support ++ is available). ++

    ++ ++

    ++ If any of the attributes is not specified by the user, libvirt will ++ choose a value suitable for most users. ++

    ++ ++

    ++ All of the target types support configuring the guest-visible device ++ address as documented above; more ++ specifically, acceptable address types are isa (for ++ isa-serial), usb (for usb-serial) ++ and pci (for pci-serial). ++

    ++ ++

    ++ For the relationship between serial ports and consoles, ++ see below. +

    + +
    Console
    + +-

    +- The console element is used to represent interactive consoles. Depending +- on the type of guest in use, the consoles might be paravirtualized devices, +- or they might be a clone of a serial device, according to the following +- rules: +-

    +- +-
      +-
    • If no targetType attribute is set, then the default +- device type is according to the hypervisor's rules. The default +- type will be added when re-querying the XML fed into libvirt. +- For fully virtualized guests, the default device type will usually +- be a serial port.
    • +-
    • If the targetType attribute is serial, +- then if no <serial> element exists, the console +- element will be copied to the serial element. If a <serial> +- element does already exist, the console element will be ignored.
    • +-
    • If the targetType attribute is not serial, +- it will be treated normally.
    • +-
    • Only the first console element may use a targetType +- of serial. Secondary consoles must all be paravirtualized. +-
    • +-
    • On S390, the console element may use a +- targetType of sclp or sclplm +- (line mode). SCLP is the native console type for S390. There's no +- controller associated to SCLP consoles. +- Since 1.0.2 +-
    • +-
    +- +-

    +- A virtio console device is exposed in the +- guest as /dev/hvc[0-7] (for more information, see +- http://fedoraproject.org/wiki/Features/VirtioSerial) +- Since 0.8.3 +-

    +- +
    + ...
    + <devices>
    ++  <!-- Serial console -->
    +   <console type='pty'>
    +-    <source path='/dev/pts/4'/>
    +-    <target port='0'/>
    ++    <source path='/dev/pts/2'/>
    ++    <target type='serial' port='0'/>
    +   </console>
    ++</devices>
    ++...
    + ++
    ++...
    +   <!-- KVM virtio console -->
    +   <console type='pty'>
    +     <source path='/dev/pts/5'/>
    +@@ -6513,21 +6504,134 @@ qemu-kvm -net nic,model=? /dev/null
    + </devices>
    + ...
    + ++

    ++ The console element is used to represent interactive ++ serial consoles. Depending on the type of guest in use and the specifics ++ of the configuration, the console element might represent ++ the same device as an existing serial element or a separate ++ device. ++

    ++ ++

    ++ A target subelement is supported and works the same ++ way as with the serial element ++ (see above for details). ++ Valid values for the type attribute are: ++ serial (described below); ++ virtio (usable whenever VirtIO support is available); ++ xen, lxc, uml and ++ openvz (available when the corresponding hypervisor is in ++ use); sclp and sclplm (usable for s390 and ++ s390x QEMU guests). ++

    ++ ++

    ++ Of the target types listed above, serial is special in ++ that it doesn't represents a separate device, but rather the same ++ device as the first serial element. Due to this, there can ++ only be a single console element with target type ++ serial per guest. ++

    ++ ++

    ++ Virtio consoles are usually accessible as /dev/hvc[0-7] ++ from inside the guest; for more information, see ++ http://fedoraproject.org/wiki/Features/VirtioSerial. ++ Since 0.8.3 ++

    ++ ++

    ++ For the relationship between serial ports and consoles, ++ see below. ++

    ++ ++
    Relationship between serial ports and consoles
    ++ ++

    ++ Due to hystorical reasons, the serial and ++ console elements have partially overlapping scopes. ++

    ++ ++

    ++ In general, both elements are used to configure one or more serial ++ consoles to be used for interacting with the guest. The main difference ++ between the two is that serial is used for emulated, ++ usually native, serial consoles, whereas console is used ++ for paravirtualized ones. ++

    ++ ++

    ++ Both emulated and paravirtualized serial consoles have advantages and ++ disadvantages: ++

    ++ ++
      ++
    • ++ emulated serial consoles are usually initialized much earlier than ++ paravirtualized ones, so they can be used to control the bootloader ++ and display both firmware and early boot messages; ++
    • ++
    • ++ on several platforms, there can only be a single emulated serial ++ console per guest but paravirtualized consoles don't suffer from the ++ same limitation. ++
    • ++
    ++ ++

    ++ A configuration such as: ++

    ++ +
    + ...
    +-<devices>
    +-  <!-- KVM S390 sclp console -->
    ++</devices>
    +   <console type='pty'>
    +-    <source path='/dev/pts/1'/>
    +-    <target type='sclp' port='0'/>
    ++    <target type='serial'/>
    ++  </console>
    ++  <console type='pty'>
    ++    <target type='virtio'/>
    +   </console>
    + </devices>
    + ...
    + +

    +- If the console is presented as a serial port, the target +- element has the same attributes as for a serial port. There is usually +- only 1 console. ++ will work on any platform and will result in one emulated serial console ++ for early boot logging / interactive / recovery use, and one ++ paravirtualized serial console to be used eg. as a side channel. Most ++ people will be fine with having just the first console ++ element in their configuration. ++

    ++ ++

    ++ Note that, due to the compatibility concerns mentioned earlier, all the ++ following configurations: ++

    ++ ++
    ++...
    ++</devices>
    ++  <serial type='pty'/>
    ++</devices>
    ++...
    ++ ++
    ++...
    ++</devices>
    ++  <console type='pty'/>
    ++</devices>
    ++...
    ++ ++
    ++...
    ++</devices>
    ++  <serial type='pty'/>
    ++  <console type='pty'/>
    ++</devices>
    ++...
    ++ ++

    ++ will be treated the same and will result in a single emulated serial ++ console being available to the guest. +

    + +
    Channel
    +-- +2.15.1 + diff --git a/SOURCES/libvirt-docs-Provide-a-nodedev-driver-stub-documentation.patch b/SOURCES/libvirt-docs-Provide-a-nodedev-driver-stub-documentation.patch deleted file mode 100644 index f7047b8..0000000 --- a/SOURCES/libvirt-docs-Provide-a-nodedev-driver-stub-documentation.patch +++ /dev/null @@ -1,237 +0,0 @@ -From 8c30b1e683b37d67d7fe827f6ab63174c596494e Mon Sep 17 00:00:00 2001 -Message-Id: <8c30b1e683b37d67d7fe827f6ab63174c596494e@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:49 +0200 -Subject: [PATCH] docs: Provide a nodedev driver stub documentation - -There's lot more to document about the nodedev driver, besides PCI and -SR-IOV (even this might need to be extended), but let's start small-ish -and at least have a page for it linked from the drivers.html. - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit a94d431dc46070034de7798f572dc1d257542a50) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - docs/drivers.html.in | 6 +- - docs/drvnodedev.html.in | 189 ++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 194 insertions(+), 1 deletion(-) - create mode 100644 docs/drvnodedev.html.in - -diff --git a/docs/drivers.html.in b/docs/drivers.html.in -index be7483b9b..61993861e 100644 ---- a/docs/drivers.html.in -+++ b/docs/drivers.html.in -@@ -4,7 +4,11 @@ - -

    Internal drivers

    - --
      -+ - -

      - The libvirt public API delegates its implementation to one or -diff --git a/docs/drvnodedev.html.in b/docs/drvnodedev.html.in -new file mode 100644 -index 000000000..0a3870343 ---- /dev/null -+++ b/docs/drvnodedev.html.in -@@ -0,0 +1,189 @@ -+ -+ -+ -+ -+

      Host device management

      -+ -+

      -+ Libvirt provides management of both physical and virtual host devices -+ (historically also referred to as node devices) like USB, PCI, SCSI, and -+ network devices. This also includes various virtualization capabilities -+ which the aforementioned devices provide for utilization, for example -+ SR-IOV, NPIV, DRM, etc. -+

      -+ -+

      -+ The node device driver provides means to list and show details about host -+ devices (virsh nodedev-list, -+ virsh nodedev-dumpxml), which are generic and can be used -+ with all devices. It also provides means to create and destroy devices -+ (virsh nodedev-create, virsh nodedev-destroy) -+ which are meant to be used to create virtual devices, currently only -+ supported by NPIV -+ (more info about NPIV)). -+ Devices on the host system are arranged in a tree-like hierarchy, with -+ the root node being called computer. The node device driver -+ supports two backends to manage the devices, HAL and udev, with the former -+ being deprecated in favour of the latter. -+

      -+ -+

      -+ The generic format of a host device XML can be seen below. -+ To identify a device both within the host and the device tree hierarchy, -+ the following elements are used: -+

      -+
      -+
      name
      -+
      -+ The device's name will be generated by libvirt using the subsystem, -+ like pci and the device's sysfs basename. -+
      -+
      path
      -+
      -+ Fully qualified sysfs path to the device. -+
      -+
      parent
      -+
      -+ This element identifies the parent node in the device hierarchy. The -+ value of the element will correspond with the device parent's -+ name element or computer if the device does -+ not have any parent. -+
      -+
      driver
      -+
      -+ This elements reports the driver in use for this device. The presence -+ of this element in the output XML depends on whether the underlying -+ device manager (most likely udev) exposes information about the -+ driver. -+
      -+
      capability
      -+
      -+ Describes the device in terms of feature support. The element has one -+ mandatory attribute type the value of which determines -+ the type of the device. Currently recognized values for the attribute -+ are: -+ system, -+ pci, -+ usb, -+ usb_device, -+ net, -+ scsi, -+ scsi_host (Since 0.4.7), -+ fc_host, -+ vports, -+ scsi_target (Since 0.7.3), -+ storage (Since 1.0.4), -+ scsi_generic (Since 1.0.7), -+ drm (Since 3.1.0), and -+ This element can be nested in which case it further specifies a -+ device's capability. Refer to specific device types to see more values -+ for the type attribute which are exclusive. -+
      -+
      -+ -+

      Basic structure of a node device

      -+
      -+<device>
      -+  <name>pci_0000_00_17_0</name>
      -+  <path>/sys/devices/pci0000:00/0000:00:17.0</path>
      -+  <parent>computer</parent>
      -+  <driver>
      -+    <name>ahci</name>
      -+  </driver>
      -+  <capability type='pci'>
      -+...
      -+  </capability>
      -+</device>
      -+ -+
        -+ -+

        PCI host devices

        -+
        -+
        capability
        -+
        -+ When used as top level element, the supported values for the -+ type attribute are pci and -+ phys_function (see SR-IOV below). -+
        -+
        -+
        -+<device>
        -+  <name>pci_0000_04_00_1</name>
        -+  <path>/sys/devices/pci0000:00/0000:00:06.0/0000:04:00.1</path>
        -+  <parent>pci_0000_00_06_0</parent>
        -+  <driver>
        -+    <name>igb</name>
        -+  </driver>
        -+  <capability type='pci'>
        -+    <domain>0</domain>
        -+    <bus>4</bus>
        -+    <slot>0</slot>
        -+    <function>1</function>
        -+    <product id='0x10c9'>82576 Gigabit Network Connection</product>
        -+    <vendor id='0x8086'>Intel Corporation</vendor>
        -+    <iommuGroup number='15'>
        -+      <address domain='0x0000' bus='0x04' slot='0x00' function='0x1'/>
        -+    </iommuGroup>
        -+    <numa node='0'/>
        -+    <pci-express>
        -+      <link validity='cap' port='1' speed='2.5' width='2'/>
        -+      <link validity='sta' speed='2.5' width='2'/>
        -+    </pci-express>
        -+  </capability>
        -+</device>
        -+ -+

        -+ The XML format for a PCI device stays the same for any further -+ capabilities it supports, a single nested <capability> -+ element will be included for each capability the device supports. -+

        -+ -+

        SR-IOV capability

        -+

        -+ Single root input/output virtualization (SR-IOV) allows sharing of the -+ PCIe resources by multiple virtual environments. That is achieved by -+ slicing up a single full-featured physical resource called physical -+ function (PF) into multiple devices called virtual functions (VFs) sharing -+ their configuration with the underlying PF. Despite the SR-IOV -+ specification, the amount of VFs that can be created on a PF varies among -+ manufacturers. -+

        -+ -+

        -+ Suppose the NIC above was also SR-IOV capable, it would -+ also include a nested -+ <capability> element enumerating all virtual -+ functions available on the physical device (physical port) like in the -+ example below. -+

        -+ -+
        -+<capability type='pci'>
        -+...
        -+  <capability type='virt_functions' maxCount='7'>
        -+    <address domain='0x0000' bus='0x04' slot='0x10' function='0x1'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x10' function='0x3'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x10' function='0x5'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x10' function='0x7'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x11' function='0x1'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x11' function='0x3'/>
        -+    <address domain='0x0000' bus='0x04' slot='0x11' function='0x5'/>
        -+  </capability>
        -+...
        -+</capability>
        -+

        -+ A SR-IOV child device on the other hand, would then report its top level -+ capability type as a phys_function instead: -+

        -+ -+
        -+<device>
        -+...
        -+  <capability type='phys_function'>
        -+    <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
        -+  </capability>
        -+...
        -+<device>
        -+ -+ -+ --- -2.13.0 - diff --git a/SOURCES/libvirt-docs-correct-improper-information-about-domain-states-in-virsh-manpage.patch b/SOURCES/libvirt-docs-correct-improper-information-about-domain-states-in-virsh-manpage.patch deleted file mode 100644 index 866c030..0000000 --- a/SOURCES/libvirt-docs-correct-improper-information-about-domain-states-in-virsh-manpage.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 7a40c13d93a300f6f2c493c864da7342f34e9a6c Mon Sep 17 00:00:00 2001 -Message-Id: <7a40c13d93a300f6f2c493c864da7342f34e9a6c@dist-git> -From: Laine Stump -Date: Tue, 6 Jun 2017 12:07:49 -0400 -Subject: [PATCH] docs: correct improper information about domain states in - virsh manpage - -Commit 24d4a0a1f removed the non-existent "dying" state from the list -of possible domain states given in the virsh manpage, but didn't -correct the count of states from 8 down to 7. This patch fixes that -mismatch by completely removing any reference to the exact number of -states (thus preventing a potential future mismatch), while wording -the sentence in a more readable/truthful manner. - -(cherry picked from commit c44482eb4fb703391f2ee00c23b2187e0415e799) - -https://bugzilla.redhat.com/show_bug.cgi?id=1408778 - -Signed-off-by: Jiri Denemark ---- - tools/virsh.pod | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/tools/virsh.pod b/tools/virsh.pod -index 0315f1f265..6386c39fbc 100644 ---- a/tools/virsh.pod -+++ b/tools/virsh.pod -@@ -418,8 +418,9 @@ State is the run state (see below). - - B - --The State field lists 8 states for a domain, and which ones the --current domain is in. -+The State field lists what state each domain is currently in. A domain -+can be in one of the following possible states: -+ - - =over 4 - --- -2.13.1 - diff --git a/SOURCES/libvirt-docs-domain-Fix-documentation-of-the-snapshot-attribute-for-disk.patch b/SOURCES/libvirt-docs-domain-Fix-documentation-of-the-snapshot-attribute-for-disk.patch new file mode 100644 index 0000000..b6944df --- /dev/null +++ b/SOURCES/libvirt-docs-domain-Fix-documentation-of-the-snapshot-attribute-for-disk.patch @@ -0,0 +1,51 @@ +From 60643d072a849ffbb01e8313124154f7aecc02ad Mon Sep 17 00:00:00 2001 +Message-Id: <60643d072a849ffbb01e8313124154f7aecc02ad@dist-git> +From: Peter Krempa +Date: Thu, 7 Dec 2017 14:36:06 +0100 +Subject: [PATCH] docs: domain: Fix documentation of the 'snapshot' attribute + for + +Emphasise the valid values by wrapping them in and reword the +last sentence so that the invalid value example can be dropped. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1523070 +(cherry picked from commit 1e98d450f27ae0131ac2ac8aa1c1d7a254d22dd1) +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 6807da5c6f..0cfbf051b7 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -2573,17 +2573,16 @@ +
        snapshot
        +
        + Indicates the default behavior of the disk during disk snapshots: +- "internal" requires a file format such as qcow2 that can store +- both the snapshot and the data changes since the snapshot; +- "external" will separate the snapshot from the live data; and +- "no" means the disk will not participate in snapshots. Read-only +- disks default to "no", while the default for other disks depends +- on the hypervisor's capabilities. Some hypervisors allow a +- per-snapshot choice as well, during ++ "internal" requires a file format such as qcow2 that ++ can store both the snapshot and the data changes since the snapshot; ++ "external" will separate the snapshot from the live ++ data; and "no" means the disk will not participate in ++ snapshots. Read-only disks default to "no", while the ++ default for other disks depends on the hypervisor's capabilities. ++ Some hypervisors allow a per-snapshot choice as well, during + domain snapshot creation. +- Not all snapshot modes are supported; for example, +- snapshot='yes' with a transient disk generally +- does not make sense. ++ Not all snapshot modes are supported; for example, enabling ++ snapshots with a transient disk generally does not make sense. + Since 0.9.5 +
        + +-- +2.15.1 + diff --git a/SOURCES/libvirt-docs-fix-typo-in-closing-HTML-element.patch b/SOURCES/libvirt-docs-fix-typo-in-closing-HTML-element.patch deleted file mode 100644 index 0469959..0000000 --- a/SOURCES/libvirt-docs-fix-typo-in-closing-HTML-element.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 3983bc29326d6f247d4dc3517ca42896042c02e0 Mon Sep 17 00:00:00 2001 -Message-Id: <3983bc29326d6f247d4dc3517ca42896042c02e0@dist-git> -From: "Daniel P. Berrange" -Date: Tue, 25 Apr 2017 13:41:18 +0200 -Subject: [PATCH] docs: fix typo in closing HTML element - -https://bugzilla.redhat.com/show_bug.cgi?id=1414627 - -Signed-off-by: Daniel P. Berrange -(cherry picked from commit dfda3a8ed988e6542294b85b78e816d593b22dc3) -Signed-off-by: Martin Kletzander -Signed-off-by: Jiri Denemark ---- - docs/formatdomain.html.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in -index 7374cb243..c82cd69a2 100644 ---- a/docs/formatdomain.html.in -+++ b/docs/formatdomain.html.in -@@ -5457,7 +5457,7 @@ qemu-kvm -net nic,model=? /dev/null - This element provides means of setting coalesce settings for - some interface devices (currently only type network - and bridge. Currently there is just one attribute, -- max, to tweak, in element frames for -+ max, to tweak, in element frames for - the rx group, which accepts a non-negative integer - that specifies the maximum number of packets that will be - received before an interrupt. --- -2.12.2 - diff --git a/SOURCES/libvirt-fixup_resctrlinfo.patch b/SOURCES/libvirt-fixup_resctrlinfo.patch new file mode 100644 index 0000000..1c0125e --- /dev/null +++ b/SOURCES/libvirt-fixup_resctrlinfo.patch @@ -0,0 +1,76 @@ +From ff96b6f60e7062da45f24366db871c3ce675892e Mon Sep 17 00:00:00 2001 +Message-Id: +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:28 +0100 +Subject: [PATCH] fixup_resctrlinfo + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Signed-off-by: Martin Kletzander +(cherry picked from commit 434848d7dca9d1a7838ab53bbfdcf580ef7f2cc2) +Signed-off-by: Martin Kletzander +--- + src/util/virresctrl.c | 29 +++++++++++++++++++---------- + 1 file changed, 19 insertions(+), 10 deletions(-) + +diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c +index f122af2050..d439e7792c 100644 +--- a/src/util/virresctrl.c ++++ b/src/util/virresctrl.c +@@ -200,6 +200,8 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) + } + + while ((rv = virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0) { ++ VIR_DEBUG("Parsing info type '%s'", ent->d_name); ++ + if (ent->d_type != DT_DIR) + continue; + +@@ -207,16 +209,14 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) + continue; + + if (virStrToLong_uip(ent->d_name + 1, &endptr, 10, &level) < 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +- _("Cannot parse resctrl cache info level")); +- goto cleanup; ++ VIR_DEBUG("Cannot parse resctrl cache info level '%s'", ent->d_name + 1); ++ continue; + } + + type = virResctrlTypeFromString(endptr); + if (type < 0) { +- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +- _("Cannot parse resctrl cache info type")); +- goto cleanup; ++ VIR_DEBUG("Cannot parse resctrl cache info type '%s'", endptr); ++ continue; + } + + if (VIR_ALLOC(i_type) < 0) +@@ -259,10 +259,19 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) + level - resctrl->nlevels + 1) < 0) + goto cleanup; + +- if (!resctrl->levels[level] && +- (VIR_ALLOC(resctrl->levels[level]) < 0 || +- VIR_ALLOC_N(resctrl->levels[level]->types, VIR_CACHE_TYPE_LAST) < 0)) +- goto cleanup; ++ if (!resctrl->levels[level]) { ++ virResctrlInfoPerTypePtr *types = NULL; ++ ++ if (VIR_ALLOC_N(types, VIR_CACHE_TYPE_LAST) < 0) ++ goto cleanup; ++ ++ if (VIR_ALLOC(resctrl->levels[level]) < 0) { ++ VIR_FREE(types); ++ goto cleanup; ++ } ++ resctrl->levels[level]->types = types; ++ } ++ + i_level = resctrl->levels[level]; + + if (i_level->types[type]) { +-- +2.16.1 + diff --git a/SOURCES/libvirt-locking-Add-support-for-sanlock_strerror.patch b/SOURCES/libvirt-locking-Add-support-for-sanlock_strerror.patch deleted file mode 100644 index 1d51b32..0000000 --- a/SOURCES/libvirt-locking-Add-support-for-sanlock_strerror.patch +++ /dev/null @@ -1,339 +0,0 @@ -From 6744458379e73967a95507d3c0b91b52a62fc3ec Mon Sep 17 00:00:00 2001 -Message-Id: <6744458379e73967a95507d3c0b91b52a62fc3ec@dist-git> -From: Jiri Denemark -Date: Thu, 27 Apr 2017 11:54:44 +0200 -Subject: [PATCH] locking: Add support for sanlock_strerror - -The recently added sanlock_strerror function can be used to translate -sanlock's numeric errors into human readable strings. - -https://bugzilla.redhat.com/show_bug.cgi?id=1409511 - -Signed-off-by: Jiri Denemark -(cherry picked from commit 23377c539b72a7fc4e2749a068711fe1f626998d) -Signed-off-by: Jiri Denemark ---- - m4/virt-sanlock.m4 | 7 ++ - src/locking/lock_driver_sanlock.c | 154 ++++++++++++++++++++++++++------------ - 2 files changed, 115 insertions(+), 46 deletions(-) - -diff --git a/m4/virt-sanlock.m4 b/m4/virt-sanlock.m4 -index e4476cae4..00de7980e 100644 ---- a/m4/virt-sanlock.m4 -+++ b/m4/virt-sanlock.m4 -@@ -61,6 +61,13 @@ AC_DEFUN([LIBVIRT_CHECK_SANLOCK],[ - [whether sanlock supports sanlock_write_lockspace]) - fi - -+ AC_CHECK_LIB([sanlock_client], [sanlock_strerror], -+ [sanlock_strerror=yes], [sanlock_strerror=no]) -+ if test "x$sanlock_strerror" = "xyes" ; then -+ AC_DEFINE_UNQUOTED([HAVE_SANLOCK_STRERROR], 1, -+ [whether sanlock supports sanlock_strerror]) -+ fi -+ - CPPFLAGS="$old_cppflags" - LIBS="$old_libs" - fi -diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c -index 280219f72..b5e69c472 100644 ---- a/src/locking/lock_driver_sanlock.c -+++ b/src/locking/lock_driver_sanlock.c -@@ -97,6 +97,25 @@ struct _virLockManagerSanlockPrivate { - bool registered; - }; - -+ -+static bool -+ATTRIBUTE_NONNULL(2) -+virLockManagerSanlockError(int err, -+ char **message) -+{ -+ if (err <= -200) { -+#if HAVE_SANLOCK_STRERROR -+ ignore_value(VIR_STRDUP_QUIET(*message, sanlock_strerror(err))); -+#else -+ ignore_value(virAsprintfQuiet(message, _("sanlock error %d"), err)); -+#endif -+ return true; -+ } else { -+ return false; -+ } -+} -+ -+ - /* - * sanlock plugin for the libvirt virLockManager API - */ -@@ -263,14 +282,17 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver) - } - - if ((rv = sanlock_align(&ls.host_id_disk)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to query sector size %s: error %d"), -- path, rv); -- else -+ _("Unable to query sector size %s: %s"), -+ path, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to query sector size %s"), - path); -+ } - goto error_unlink; - } - -@@ -292,14 +314,17 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver) - } - - if ((rv = virLockManagerSanlockInitLockspace(driver, &ls) < 0)) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to initialize lockspace %s: error %d"), -- path, rv); -- else -+ _("Unable to initialize lockspace %s: %s"), -+ path, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to initialize lockspace %s"), - path); -+ } - goto error_unlink; - } - VIR_DEBUG("Lockspace %s has been initialized", path); -@@ -362,14 +387,17 @@ virLockManagerSanlockSetupLockspace(virLockManagerSanlockDriverPtr driver) - goto retry; - } - if (-rv != EEXIST) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to add lockspace %s: error %d"), -- path, rv); -- else -+ _("Unable to add lockspace %s: %s"), -+ path, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to add lockspace %s"), - path); -+ } - goto error; - } else { - VIR_DEBUG("Lockspace %s is already registered", path); -@@ -694,14 +722,17 @@ virLockManagerSanlockCreateLease(virLockManagerSanlockDriverPtr driver, - } - - if ((rv = sanlock_align(&res->disks[0])) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to query sector size %s: error %d"), -- res->disks[0].path, rv); -- else -+ _("Unable to query sector size %s: %s"), -+ res->disks[0].path, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to query sector size %s"), - res->disks[0].path); -+ } - goto error_unlink; - } - -@@ -723,14 +754,17 @@ virLockManagerSanlockCreateLease(virLockManagerSanlockDriverPtr driver, - } - - if ((rv = sanlock_init(NULL, res, 0, 0)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to initialize lease %s: error %d"), -- res->disks[0].path, rv); -- else -+ _("Unable to initialize lease %s: %s"), -+ res->disks[0].path, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to initialize lease %s"), - res->disks[0].path); -+ } - goto error_unlink; - } - VIR_DEBUG("Lease %s has been initialized", res->disks[0].path); -@@ -867,10 +901,12 @@ virLockManagerSanlockRegisterKillscript(int sock, - } - - if ((rv = sanlock_killpath(sock, 0, path, args)) < 0) { -- if (rv <= -200) { -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to register lock failure action:" -- " error %d"), rv); -+ _("Failed to register lock failure action: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); - } else { - virReportSystemError(-rv, "%s", - _("Failed to register lock failure" -@@ -934,13 +970,16 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, - if (priv->vm_pid == getpid()) { - VIR_DEBUG("Register sanlock %d", flags); - if ((sock = sanlock_register()) < 0) { -- if (sock <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(sock, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to open socket to sanlock daemon: error %d"), -- sock); -- else -+ _("Failed to open socket to sanlock daemon: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-sock, "%s", - _("Failed to open socket to sanlock daemon")); -+ } - goto error; - } - -@@ -971,14 +1010,17 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, - if ((rv = sanlock_state_to_args((char *)state, - &res_count, - &res_args)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unable to parse lock state %s: error %d"), -- state, rv); -- else -+ _("Unable to parse lock state %s: %s"), -+ state, NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, - _("Unable to parse lock state %s"), - state); -+ } - goto error; - } - res_free = true; -@@ -992,12 +1034,16 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, - if ((rv = sanlock_acquire(sock, priv->vm_pid, 0, - priv->res_count, priv->res_args, - opt)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_RESOURCE_BUSY, -- _("Failed to acquire lock: error %d"), rv); -- else -+ _("Failed to acquire lock: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, "%s", - _("Failed to acquire lock")); -+ } - goto error; - } - } -@@ -1016,12 +1062,16 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, - - if (flags & VIR_LOCK_MANAGER_ACQUIRE_RESTRICT) { - if ((rv = sanlock_restrict(sock, SANLK_RESTRICT_ALL)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to restrict process: error %d"), rv); -- else -+ _("Failed to restrict process: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, "%s", - _("Failed to restrict process")); -+ } - goto error; - } - } -@@ -1068,12 +1118,16 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, - - if (state) { - if ((rv = sanlock_inquire(-1, priv->vm_pid, 0, &res_count, state)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to inquire lock: error %d"), rv); -- else -+ _("Failed to inquire lock: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, "%s", - _("Failed to inquire lock")); -+ } - return -1; - } - -@@ -1083,12 +1137,16 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, - - if ((rv = sanlock_release(-1, priv->vm_pid, 0, res_count, - priv->res_args)) < 0) { -- if (rv <= -200) -+ char *err = NULL; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to release lock: error %d"), rv); -- else -+ _("Failed to release lock: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, "%s", - _("Failed to release lock")); -+ } - return -1; - } - -@@ -1118,12 +1176,16 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock, - } - - if ((rv = sanlock_inquire(-1, priv->vm_pid, 0, &res_count, state)) < 0) { -- if (rv <= -200) -+ char *err; -+ if (virLockManagerSanlockError(rv, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to inquire lock: error %d"), rv); -- else -+ _("Failed to inquire lock: %s"), -+ NULLSTR(err)); -+ VIR_FREE(err); -+ } else { - virReportSystemError(-rv, "%s", - _("Failed to inquire lock")); -+ } - return -1; - } - --- -2.12.2 - diff --git a/SOURCES/libvirt-logical-Increase-the-size-of-the-data-to-wipe.patch b/SOURCES/libvirt-logical-Increase-the-size-of-the-data-to-wipe.patch deleted file mode 100644 index 87be249..0000000 --- a/SOURCES/libvirt-logical-Increase-the-size-of-the-data-to-wipe.patch +++ /dev/null @@ -1,35 +0,0 @@ -From f4b39613c3c345e33fa749911f34127cf91c07fc Mon Sep 17 00:00:00 2001 -Message-Id: -From: John Ferlan -Date: Wed, 26 Apr 2017 08:41:13 -0400 -Subject: [PATCH] logical: Increase the size of the data to wipe - -https://bugzilla.redhat.com/show_bug.cgi?id=1439132 -https://bugzilla.redhat.com/show_bug.cgi?id=1373711 - -Since a sector size may be larger than 512 bytes, let's just increase -the size to wipe to 1MB rather than 2KB - -(cherry picked from commit d942bf6e9e8e3991808ca5185098257e84acab5d) -Signed-off-by: John Ferlan -Signed-off-by: Jiri Denemark ---- - src/storage/storage_backend_logical.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c -index a8650368b..ed26c2450 100644 ---- a/src/storage/storage_backend_logical.c -+++ b/src/storage/storage_backend_logical.c -@@ -100,7 +100,7 @@ virStorageBackendLogicalInitializeDevice(const char *path) - * a whole disk as a PV. So we just blank them out regardless - * rather than trying to figure out if we're a disk or partition - */ -- if (virStorageBackendZeroPartitionTable(path, 4 * PV_BLANK_SECTOR_SIZE) < 0) -+ if (virStorageBackendZeroPartitionTable(path, 1024 * 1024) < 0) - return -1; - - /* --- -2.12.2 - diff --git a/SOURCES/libvirt-logical-Use-virStorageBackendZeroPartitionTable.patch b/SOURCES/libvirt-logical-Use-virStorageBackendZeroPartitionTable.patch deleted file mode 100644 index 78c876e..0000000 --- a/SOURCES/libvirt-logical-Use-virStorageBackendZeroPartitionTable.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0ea93040c8172ff8848b6295e53b7bd26f66ef05 Mon Sep 17 00:00:00 2001 -Message-Id: <0ea93040c8172ff8848b6295e53b7bd26f66ef05@dist-git> -From: John Ferlan -Date: Wed, 26 Apr 2017 08:41:12 -0400 -Subject: [PATCH] logical: Use virStorageBackendZeroPartitionTable - -https://bugzilla.redhat.com/show_bug.cgi?id=1439132 -https://bugzilla.redhat.com/show_bug.cgi?id=1373711 - -Rather than open code it, use the new function which uses the wipe algorithm -in order to zero the front and tail of the partition. - -(cherry picked from commit c6aa81c65abe3f327af870d5789a98a0c9b276d1) -Signed-off-by: John Ferlan -Signed-off-by: Jiri Denemark ---- - src/storage/storage_backend_logical.c | 44 +---------------------------------- - 1 file changed, 1 insertion(+), 43 deletions(-) - -diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c -index d87aaf0b6..a8650368b 100644 ---- a/src/storage/storage_backend_logical.c -+++ b/src/storage/storage_backend_logical.c -@@ -92,9 +92,6 @@ virStorageBackendLogicalRemoveDevice(const char *path) - static int - virStorageBackendLogicalInitializeDevice(const char *path) - { -- int fd = -1; -- char zeros[4 * PV_BLANK_SECTOR_SIZE] = {0}; -- off_t size; - int ret = -1; - virCommandPtr pvcmd = NULL; - -@@ -103,46 +100,8 @@ virStorageBackendLogicalInitializeDevice(const char *path) - * a whole disk as a PV. So we just blank them out regardless - * rather than trying to figure out if we're a disk or partition - */ -- if ((fd = open(path, O_WRONLY)) < 0) { -- virReportSystemError(errno, _("cannot open device '%s'"), path); -+ if (virStorageBackendZeroPartitionTable(path, 4 * PV_BLANK_SECTOR_SIZE) < 0) - return -1; -- } -- -- if ((size = lseek(fd, 0, SEEK_END)) == (off_t)-1) { -- virReportSystemError(errno, -- _("failed to seek to end of %s"), path); -- goto cleanup; -- } -- -- if (size < 4 * PV_BLANK_SECTOR_SIZE) { -- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, -- _("cannot initialize '%s' detected size='%zd' less " -- "than minimum required='%d"), -- path, (ssize_t) size, 4 * PV_BLANK_SECTOR_SIZE); -- goto cleanup; -- } -- if ((size = lseek(fd, 0, SEEK_SET)) == (off_t)-1) { -- virReportSystemError(errno, -- _("failed to seek to start of %s"), path); -- goto cleanup; -- } -- -- if (safewrite(fd, zeros, sizeof(zeros)) < 0) { -- virReportSystemError(errno, _("cannot clear device header of '%s'"), -- path); -- goto cleanup; -- } -- -- if (fsync(fd) < 0) { -- virReportSystemError(errno, _("cannot flush header of device'%s'"), -- path); -- goto cleanup; -- } -- -- if (VIR_CLOSE(fd) < 0) { -- virReportSystemError(errno, _("cannot close device '%s'"), path); -- goto cleanup; -- } - - /* - * Initialize the physical volume because vgcreate is not -@@ -155,7 +114,6 @@ virStorageBackendLogicalInitializeDevice(const char *path) - ret = 0; - - cleanup: -- VIR_FORCE_CLOSE(fd); - virCommandFree(pvcmd); - - return ret; --- -2.12.2 - diff --git a/SOURCES/libvirt-mdev-Fix-daemon-crash-on-domain-shutdown-after-reconnect.patch b/SOURCES/libvirt-mdev-Fix-daemon-crash-on-domain-shutdown-after-reconnect.patch deleted file mode 100644 index 3162d40..0000000 --- a/SOURCES/libvirt-mdev-Fix-daemon-crash-on-domain-shutdown-after-reconnect.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 2122aadba5eb30ae466a3e825bbe9ed75b8d9735 Mon Sep 17 00:00:00 2001 -Message-Id: <2122aadba5eb30ae466a3e825bbe9ed75b8d9735@dist-git> -From: Erik Skultety -Date: Thu, 4 May 2017 13:50:00 +0200 -Subject: [PATCH] mdev: Fix daemon crash on domain shutdown after reconnect - -The problem resides in virHostdevUpdateActiveMediatedDevices which gets -called during qemuProcessReconnect. The issue here is that -virMediatedDeviceListAdd takes a pointer to the item to be added to the -list to which VIR_APPEND_ELEMENT is used, which also clears the pointer. -However, in this case only the local copy of the pointer got cleared, -leaving the original pointing to valid memory. To sum it up, during -cleanup phase, the original pointer is freed and the daemon crashes -basically any time it would access it. - -Backtrace: -0x00007ffff3ccdeba in __strcmp_sse2_unaligned -0x00007ffff72a444a in virMediatedDeviceListFindIndex -0x00007ffff7241446 in virHostdevReAttachMediatedDevices -0x00007fffc60215d9 in qemuHostdevReAttachMediatedDevices -0x00007fffc60216dc in qemuHostdevReAttachDomainDevices -0x00007fffc6046e6f in qemuProcessStop -0x00007fffc6091596 in processMonitorEOFEvent -0x00007fffc6091793 in qemuProcessEventHandler -0x00007ffff7294bf5 in virThreadPoolWorker -0x00007ffff7294184 in virThreadHelper -0x00007ffff3fdc3c4 in start_thread () from /lib64/libpthread.so.0 -0x00007ffff3d269cf in clone () from /lib64/libc.so.6 - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1446455 - -Signed-off-by: Erik Skultety -Reviewed-by: Laine Stump -(cherry picked from commit 92e30a4dace54d06433f763e1acba0a81bb5c82e) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/util/virhostdev.c | 4 ++-- - src/util/virmdev.c | 13 ++++++++----- - src/util/virmdev.h | 2 +- - 3 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c -index 2c557f5bb..579563c3f 100644 ---- a/src/util/virhostdev.c -+++ b/src/util/virhostdev.c -@@ -1294,7 +1294,7 @@ virHostdevUpdateActiveMediatedDevices(virHostdevManagerPtr mgr, - - virMediatedDeviceSetUsedBy(mdev, drv_name, dom_name); - -- if (virMediatedDeviceListAdd(mgr->activeMediatedHostdevs, mdev) < 0) -+ if (virMediatedDeviceListAdd(mgr->activeMediatedHostdevs, &mdev) < 0) - goto cleanup; - } - -@@ -1790,7 +1790,7 @@ virHostdevPrepareMediatedDevices(virHostdevManagerPtr mgr, - if (!(mdev = virMediatedDeviceNew(src->uuidstr, src->model))) - goto cleanup; - -- if (virMediatedDeviceListAdd(list, mdev) < 0) { -+ if (virMediatedDeviceListAdd(list, &mdev) < 0) { - virMediatedDeviceFree(mdev); - goto cleanup; - } -diff --git a/src/util/virmdev.c b/src/util/virmdev.c -index c1499d238..c861d21c9 100644 ---- a/src/util/virmdev.c -+++ b/src/util/virmdev.c -@@ -312,16 +312,19 @@ virMediatedDeviceListDispose(void *obj) - } - - -+/* The reason for @dev to be double pointer is that VIR_APPEND_ELEMENT clears -+ * the pointer and we need to clear the original not a copy on the stack -+ */ - int - virMediatedDeviceListAdd(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev) -+ virMediatedDevicePtr *dev) - { -- if (virMediatedDeviceListFind(list, dev)) { -+ if (virMediatedDeviceListFind(list, *dev)) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("device %s is already in use"), dev->path); -+ _("device %s is already in use"), (*dev)->path); - return -1; - } -- return VIR_APPEND_ELEMENT(list->devs, list->count, dev); -+ return VIR_APPEND_ELEMENT(list->devs, list->count, *dev); - } - - -@@ -457,7 +460,7 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst, - * - caller is responsible for NOT freeing devices in @src on success - * - we're responsible for performing a rollback on failure - */ -- if (virMediatedDeviceListAdd(dst, mdev) < 0) -+ if (virMediatedDeviceListAdd(dst, &mdev) < 0) - goto rollback; - - VIR_DEBUG("'%s' added to list of active mediated devices used by '%s'", -diff --git a/src/util/virmdev.h b/src/util/virmdev.h -index 2f3d6bb84..8bb46b9c5 100644 ---- a/src/util/virmdev.h -+++ b/src/util/virmdev.h -@@ -86,7 +86,7 @@ virMediatedDeviceListNew(void); - - int - virMediatedDeviceListAdd(virMediatedDeviceListPtr list, -- virMediatedDevicePtr dev); -+ virMediatedDevicePtr *dev); - - virMediatedDevicePtr - virMediatedDeviceListGet(virMediatedDeviceListPtr list, --- -2.13.0 - diff --git a/SOURCES/libvirt-mdev-Pass-a-uuidstr-rather-than-an-mdev-object-to-some-util-functions.patch b/SOURCES/libvirt-mdev-Pass-a-uuidstr-rather-than-an-mdev-object-to-some-util-functions.patch deleted file mode 100644 index 1f4d74a..0000000 --- a/SOURCES/libvirt-mdev-Pass-a-uuidstr-rather-than-an-mdev-object-to-some-util-functions.patch +++ /dev/null @@ -1,269 +0,0 @@ -From ebb336d5b22b9707b53bcc4fd2e24845666fdc4f Mon Sep 17 00:00:00 2001 -Message-Id: -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:50 +0200 -Subject: [PATCH] mdev: Pass a uuidstr rather than an mdev object to some util - functions - -Namely, this patch is about virMediatedDeviceGetIOMMUGroup{Dev,Num} -functions. There's no compelling reason why these functions should take -an object, on the contrary, having to create an object every time one -needs to query the IOMMU group number, discarding the object afterwards, -seems odd. - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit 3a2a2a7401d06a8f06fa75359190f59737c5dc5d) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_domain.c | 8 +------- - src/security/security_apparmor.c | 10 +--------- - src/security/security_dac.c | 20 ++------------------ - src/security/security_selinux.c | 20 ++------------------ - src/util/virmdev.c | 21 +++++++++++++-------- - src/util/virmdev.h | 4 ++-- - 6 files changed, 21 insertions(+), 62 deletions(-) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 117c6142b..04d1b39db 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -7216,7 +7216,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, - virUSBDevicePtr usb = NULL; - virSCSIDevicePtr scsi = NULL; - virSCSIVHostDevicePtr host = NULL; -- virMediatedDevicePtr mdev = NULL; - char *tmpPath = NULL; - bool freeTmpPath = false; - bool includeVFIO = false; -@@ -7317,11 +7316,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, - } - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: -- if (!(mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model))) -- goto cleanup; -- -- if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdev))) -+ if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto cleanup; - - freeTmpPath = true; -@@ -7377,7 +7372,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, - virUSBDeviceFree(usb); - virSCSIDeviceFree(scsi); - virSCSIVHostDeviceFree(host); -- virMediatedDeviceFree(mdev); - if (freeTmpPath) - VIR_FREE(tmpPath); - return ret; -diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c -index fc5581526..62672b0af 100644 ---- a/src/security/security_apparmor.c -+++ b/src/security/security_apparmor.c -@@ -905,21 +905,13 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr, - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: { - char *vfiodev = NULL; -- virMediatedDevicePtr mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model); - -- if (!mdev) -+ if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto done; - -- if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdev))) { -- virMediatedDeviceFree(mdev); -- goto done; -- } -- - ret = AppArmorSetSecurityHostdevLabelHelper(vfiodev, ptr); - - VIR_FREE(vfiodev); -- virMediatedDeviceFree(mdev); - break; - } - -diff --git a/src/security/security_dac.c b/src/security/security_dac.c -index 922e48494..7dcf4c15f 100644 ---- a/src/security/security_dac.c -+++ b/src/security/security_dac.c -@@ -968,21 +968,13 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: { - char *vfiodev = NULL; -- virMediatedDevicePtr mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model); - -- if (!mdev) -+ if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto done; - -- if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdev))) { -- virMediatedDeviceFree(mdev); -- goto done; -- } -- - ret = virSecurityDACSetHostdevLabelHelper(vfiodev, &cbdata); - - VIR_FREE(vfiodev); -- virMediatedDeviceFree(mdev); - break; - } - -@@ -1144,21 +1136,13 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr mgr, - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: { - char *vfiodev = NULL; -- virMediatedDevicePtr mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model); - -- if (!mdev) -+ if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto done; - -- if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdev))) { -- virMediatedDeviceFree(mdev); -- goto done; -- } -- - ret = virSecurityDACRestoreFileLabel(virSecurityManagerGetPrivateData(mgr), - vfiodev); - VIR_FREE(vfiodev); -- virMediatedDeviceFree(mdev); - break; - } - -diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c -index df7c96833..c7a2dfe98 100644 ---- a/src/security/security_selinux.c -+++ b/src/security/security_selinux.c -@@ -1843,21 +1843,13 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManagerPtr mgr, - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: { - char *vfiodev = NULL; -- virMediatedDevicePtr mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model); - -- if (!mdev) -+ if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto done; - -- if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdev))) { -- virMediatedDeviceFree(mdev); -- goto done; -- } -- - ret = virSecuritySELinuxSetHostdevLabelHelper(vfiodev, &data); - - VIR_FREE(vfiodev); -- virMediatedDeviceFree(mdev); - break; - } - -@@ -2092,21 +2084,13 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManagerPtr mgr, - - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: { - char *vfiodev = NULL; -- virMediatedDevicePtr mdev = virMediatedDeviceNew(mdevsrc->uuidstr, -- mdevsrc->model); - -- if (!mdev) -+ if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr))) - goto done; - -- if (!(vfiodev = virMediatedDeviceGetIOMMUGroupDev(mdev))) { -- virMediatedDeviceFree(mdev); -- goto done; -- } -- - ret = virSecuritySELinuxRestoreFileLabel(mgr, vfiodev); - - VIR_FREE(vfiodev); -- virMediatedDeviceFree(mdev); - break; - } - -diff --git a/src/util/virmdev.c b/src/util/virmdev.c -index c861d21c9..169deedfd 100644 ---- a/src/util/virmdev.c -+++ b/src/util/virmdev.c -@@ -209,43 +209,48 @@ virMediatedDeviceGetPath(virMediatedDevicePtr dev) - * for freeing the result. - */ - char * --virMediatedDeviceGetIOMMUGroupDev(virMediatedDevicePtr dev) -+virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr) - { -- char *resultpath = NULL; -+ char *result_path = NULL; - char *iommu_path = NULL; - char *vfio_path = NULL; -+ char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr); - -- if (virAsprintf(&iommu_path, "%s/iommu_group", dev->path) < 0) -+ if (!dev_path) - return NULL; - -+ if (virAsprintf(&iommu_path, "%s/iommu_group", dev_path) < 0) -+ goto cleanup; -+ - if (!virFileExists(iommu_path)) { - virReportSystemError(errno, _("failed to access '%s'"), iommu_path); - goto cleanup; - } - -- if (virFileResolveLink(iommu_path, &resultpath) < 0) { -+ if (virFileResolveLink(iommu_path, &result_path) < 0) { - virReportSystemError(errno, _("failed to resolve '%s'"), iommu_path); - goto cleanup; - } - -- if (virAsprintf(&vfio_path, "/dev/vfio/%s", last_component(resultpath)) < 0) -+ if (virAsprintf(&vfio_path, "/dev/vfio/%s", last_component(result_path)) < 0) - goto cleanup; - - cleanup: -- VIR_FREE(resultpath); -+ VIR_FREE(result_path); - VIR_FREE(iommu_path); -+ VIR_FREE(dev_path); - return vfio_path; - } - - - int --virMediatedDeviceGetIOMMUGroupNum(virMediatedDevicePtr dev) -+virMediatedDeviceGetIOMMUGroupNum(const char *uuidstr) - { - char *vfio_path = NULL; - char *group_num_str = NULL; - unsigned int group_num = -1; - -- if (!(vfio_path = virMediatedDeviceGetIOMMUGroupDev(dev))) -+ if (!(vfio_path = virMediatedDeviceGetIOMMUGroupDev(uuidstr))) - return -1; - - group_num_str = last_component(vfio_path); -diff --git a/src/util/virmdev.h b/src/util/virmdev.h -index 8bb46b9c5..0b8e830f4 100644 ---- a/src/util/virmdev.h -+++ b/src/util/virmdev.h -@@ -65,10 +65,10 @@ virMediatedDeviceSetUsedBy(virMediatedDevicePtr dev, - const char *domname); - - char * --virMediatedDeviceGetIOMMUGroupDev(virMediatedDevicePtr dev); -+virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr); - - int --virMediatedDeviceGetIOMMUGroupNum(virMediatedDevicePtr dev); -+virMediatedDeviceGetIOMMUGroupNum(const char *uuidstr); - - char * - virMediatedDeviceGetSysfsPath(const char *uuidstr); --- -2.13.0 - diff --git a/SOURCES/libvirt-migration.html-Clarify-configuration-file-handling-docs.patch b/SOURCES/libvirt-migration.html-Clarify-configuration-file-handling-docs.patch new file mode 100644 index 0000000..bf807c0 --- /dev/null +++ b/SOURCES/libvirt-migration.html-Clarify-configuration-file-handling-docs.patch @@ -0,0 +1,162 @@ +From d52ae79470eb8725b63a6470e393149b48f508da Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Fri, 8 Dec 2017 10:31:38 +0100 +Subject: [PATCH] migration.html: Clarify configuration file handling docs + +Migration never removes any configuration files on the destination host. +Thus when the domain is already defined on the destination, it will stay +persistent even after migration without --persist. + +https://bugzilla.redhat.com/show_bug.cgi?id=1514930 + +Signed-off-by: Jiri Denemark +(cherry picked from commit 2c01e4febcd161226ce707892d8e53f4e66f708f) +Signed-off-by: Jiri Denemark +--- + docs/migration.html.in | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/docs/migration.html.in b/docs/migration.html.in +index de7d4def75..7c345b65b7 100644 +--- a/docs/migration.html.in ++++ b/docs/migration.html.in +@@ -206,14 +206,14 @@ +

        Configuration file handling

        + +

        +- There are two types of virtual machine known to libvirt. A transient ++ There are two types of virtual machines known to libvirt. A transient + guest only exists while it is running, and has no configuration file stored + on disk. A persistent guest maintains a configuration file on disk + even when it is not running. +

        + +

        +- By default, a migration operation will not attempt to change any configuration ++ By default, a migration operation will not attempt to modify any configuration + files that may be stored on either the source or destination host. It is the + administrator, or management application's, responsibility to manage distribution + of configuration files (if desired). It is important to note that the /etc/libvirt +@@ -230,14 +230,14 @@ + host and removed on the original. + +

      • Centralized configuration files outside libvirt, in a database. A data center +- management application may not storage configuration files at all. Instead it ++ management application may not store configuration files at all. Instead it + may generate libvirt XML on the fly when a guest is booted. It will typically + use transient guests, and thus not have to consider configuration files during + migration. +
      • +
      • Distributed configuration inside libvirt. The configuration file for each + guest is copied to every host where the guest is able to run. Upon migration +- the existing config merely needs to be updated with any changes ++ the existing config merely needs to be updated with any changes. +
      • +
      • Ad-hoc configuration management inside libvirt. Each guest is tied to a + specific host and rarely migrated. When migration is required, the config +@@ -246,7 +246,7 @@ +
      + +

      +- As mentioned above, libvirt will not touch configuration files during ++ As mentioned above, libvirt will not modify configuration files during + migration by default. The virsh command has two flags to + influence this behaviour. The --undefine-source flag + will cause the configuration file to be removed on the source host +@@ -265,12 +265,12 @@ + After migration + + +- Guest type ++ Source type + Source config + Dest config + --undefine-source + --persist +- Guest type ++ Dest type + Source config + Dest config + +@@ -325,9 +325,9 @@ + Y + N + N +- Transient +- N ++ Persistent + N ++ Y
      (unchanged dest config) + + + Transient +@@ -335,9 +335,9 @@ + Y + Y + N +- Transient +- N ++ Persistent + N ++ Y
      (unchanged dest config) + + + Transient +@@ -347,7 +347,7 @@ + Y + Persistent + N +- Y ++ Y
      (replaced with source) + + + Transient +@@ -357,7 +357,7 @@ + Y + Persistent + N +- Y ++ Y
      (replaced with source) + + + +@@ -411,7 +411,7 @@ + N + Persistent + Y +- Y ++ Y
      (unchanged dest config) + + + Persistent +@@ -421,7 +421,7 @@ + N + Persistent + N +- Y ++ Y
      (unchanged dest config) + + + Persistent +@@ -431,7 +431,7 @@ + Y + Persistent + Y +- Y ++ Y
      (replaced with source) + + + Persistent +@@ -441,7 +441,7 @@ + Y + Persistent + N +- Y ++ Y
      (replaced with source) + + + +-- +2.15.1 + diff --git a/SOURCES/libvirt-network-better-log-message-when-network-is-inactive-during-reconnect.patch b/SOURCES/libvirt-network-better-log-message-when-network-is-inactive-during-reconnect.patch deleted file mode 100644 index 6689d63..0000000 --- a/SOURCES/libvirt-network-better-log-message-when-network-is-inactive-during-reconnect.patch +++ /dev/null @@ -1,42 +0,0 @@ -From c85276bfbfda6818ae1dddbe91d971cb26669044 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Laine Stump -Date: Tue, 2 May 2017 12:31:52 -0400 -Subject: [PATCH] network: better log message when network is inactive during - reconnect - -If the network isn't active during networkNotifyActualDevice(), we -would log an error message stating that the bridge device didn't -exist. This patch adds a check to see if the network is active, making -the logs more useful in the case that it isn't. - -Partially resolves: https://bugzilla.redhat.com/1442700 - -(cherry picked from commit 7949de960eaba07661c1e0ab6e4aa945db8c1b25) - -Signed-off-by: Jiri Denemark ---- - src/network/bridge_driver.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c -index cb91a2c90..41bce794a 100644 ---- a/src/network/bridge_driver.c -+++ b/src/network/bridge_driver.c -@@ -4682,6 +4682,13 @@ networkNotifyActualDevice(virDomainDefPtr dom, - } - netdef = network->def; - -+ if (!virNetworkObjIsActive(network)) { -+ virReportError(VIR_ERR_OPERATION_INVALID, -+ _("network '%s' is not active"), -+ netdef->name); -+ goto error; -+ } -+ - /* if we're restarting libvirtd after an upgrade from a version - * that didn't save bridge name in actualNetDef for - * actualType==network, we need to copy it in so that it will be --- -2.12.2 - diff --git a/SOURCES/libvirt-nodedev-Increase-the-netlink-socket-buffer-size-to-the-one-used-by-udev.patch b/SOURCES/libvirt-nodedev-Increase-the-netlink-socket-buffer-size-to-the-one-used-by-udev.patch deleted file mode 100644 index 526a99f..0000000 --- a/SOURCES/libvirt-nodedev-Increase-the-netlink-socket-buffer-size-to-the-one-used-by-udev.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c0b489c317a0cd3b709008d742d6653634455ded Mon Sep 17 00:00:00 2001 -Message-Id: -From: "ning.bo" -Date: Mon, 29 May 2017 16:22:50 +0200 -Subject: [PATCH] nodedev: Increase the netlink socket buffer size to the one - used by udev - -When a number of SRIOV VFs (up to 128 on Intel XL710) is created: -for i in `seq 0 1`; do - echo 63 > /sys/class/net//device/sriov_numvfs -done - -libvirtd will then report "udev_monitor_receive_device returned NULL" -error because the netlink socket buffer is not big enough (using GDB on -libudev confirmed this with ENOBUFFS) and thus some udev events were -dropped. This results in some devices being missing in the nodedev-list -output. This patch overrides the system's rmem_max limit but for that, -we need to make sure we've got root privileges. - -https://bugzilla.redhat.com/show_bug.cgi?id=1450960 - -Signed-off-by: ning.bo -Signed-off-by: Erik Skultety -(cherry picked from commit d1eea6c12aad5cb503562a52915138bf0d0a70a2) - -https://bugzilla.redhat.com/show_bug.cgi?id=1442307 -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/node_device/node_device_udev.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index 37528ee48..20c0fc837 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -1732,6 +1732,13 @@ static int nodeStateInitialize(bool privileged, - - udev_monitor_enable_receiving(priv->udev_monitor); - -+ /* mimic udevd's behaviour and override the systems rmem_max limit in case -+ * there's a significant number of device 'add' events -+ */ -+ if (geteuid() == 0) -+ udev_monitor_set_receive_buffer_size(priv->udev_monitor, -+ 128 * 1024 * 1024); -+ - /* We register the monitor with the event callback so we are - * notified by udev of device changes before we enumerate existing - * devices because libvirt will simply recreate the device if we --- -2.13.0 - diff --git a/SOURCES/libvirt-nodedev-Introduce-mdev-capability-for-mediated-devices.patch b/SOURCES/libvirt-nodedev-Introduce-mdev-capability-for-mediated-devices.patch deleted file mode 100644 index 9db594c..0000000 --- a/SOURCES/libvirt-nodedev-Introduce-mdev-capability-for-mediated-devices.patch +++ /dev/null @@ -1,282 +0,0 @@ -From 8e5ac9cdbe38dd3b3320b97385d8e2cf0e862ef7 Mon Sep 17 00:00:00 2001 -Message-Id: <8e5ac9cdbe38dd3b3320b97385d8e2cf0e862ef7@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:54 +0200 -Subject: [PATCH] nodedev: Introduce mdev capability for mediated devices - -Start discovering the mediated devices on the host system and format the -attributes for the mediated device into the XML. Compared to the parent -device which reports generic information about the abstract mediated -devices types, a child device only reports the type name it has been -instantiated from and the IOMMU group number, since that's device -specific compared to the rest of the info that can be gathered about -mediated devices at the moment. -This patch introduces both the formatting and parsing routines, updates -nodedev.rng schema, adding a testcase as well. - -The resulting mdev child device XML: - - mdev_4b20d080_1b54_4048_85b3_a6a62d165c01 - /sys/devices/.../4b20d080-1b54-4048-85b3-a6a62d165c01 - pci_0000_06_00_0 - - vfio_mdev - - - - - - - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit 88ef73e13cddc8c0ff01dfe7a914342f8720c517) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - docs/schemas/nodedev.rng | 17 +++++++++ - src/conf/node_device_conf.c | 41 +++++++++++++++++++++ - src/conf/node_device_conf.h | 8 ++++ - src/node_device/node_device_udev.c | 43 +++++++++++++++++++++- - .../mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml | 8 ++++ - tests/nodedevxml2xmltest.c | 1 + - 6 files changed, 117 insertions(+), 1 deletion(-) - create mode 100644 tests/nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml - -diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng -index e0a2c5032..924f73861 100644 ---- a/docs/schemas/nodedev.rng -+++ b/docs/schemas/nodedev.rng -@@ -83,6 +83,7 @@ - - - -+ - - - -@@ -580,6 +581,22 @@ - - - -+ -+ -+ mdev -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index de8ba8f9d..ac61db34c 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -577,6 +577,10 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) - virBufferEscapeString(&buf, "%s\n", virNodeDevDRMTypeToString(data->drm.type)); - break; - case VIR_NODE_DEV_CAP_MDEV: -+ virBufferEscapeString(&buf, "\n", data->mdev.type); -+ virBufferAsprintf(&buf, "\n", -+ data->mdev.iommuGroupNumber); -+ break; - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: -@@ -1647,6 +1651,39 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, - } - - -+static int -+virNodeDevCapMdevParseXML(xmlXPathContextPtr ctxt, -+ virNodeDeviceDefPtr def, -+ xmlNodePtr node, -+ virNodeDevCapMdevPtr mdev) -+{ -+ xmlNodePtr orignode; -+ int ret = -1; -+ -+ orignode = ctxt->node; -+ ctxt->node = node; -+ -+ if (!(mdev->type = virXPathString("string(./type[1]/@id)", ctxt))) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("missing type id attribute for '%s'"), def->name); -+ goto out; -+ } -+ -+ if (virNodeDevCapsDefParseULong("number(./iommuGroup[1]/@number)", ctxt, -+ &mdev->iommuGroupNumber, def, -+ _("missing iommuGroup number attribute for " -+ "'%s'"), -+ _("invalid iommuGroup number attribute for " -+ "'%s'")) < 0) -+ goto out; -+ -+ ret = 0; -+ out: -+ ctxt->node = orignode; -+ return ret; -+} -+ -+ - static virNodeDevCapsDefPtr - virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, - virNodeDeviceDefPtr def, -@@ -1715,6 +1752,8 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, - ret = virNodeDevCapDRMParseXML(ctxt, def, node, &caps->data.drm); - break; - case VIR_NODE_DEV_CAP_MDEV: -+ ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev); -+ break; - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: -@@ -2037,6 +2076,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) - VIR_FREE(data->sg.path); - break; - case VIR_NODE_DEV_CAP_MDEV: -+ VIR_FREE(data->mdev.type); -+ break; - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_DRM: - case VIR_NODE_DEV_CAP_FC_HOST: -diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h -index 18aaff8b5..5743f9d3e 100644 ---- a/src/conf/node_device_conf.h -+++ b/src/conf/node_device_conf.h -@@ -143,6 +143,13 @@ struct _virNodeDevCapMdevType { - unsigned int available_instances; - }; - -+typedef struct _virNodeDevCapMdev virNodeDevCapMdev; -+typedef virNodeDevCapMdev *virNodeDevCapMdevPtr; -+struct _virNodeDevCapMdev { -+ char *type; -+ unsigned int iommuGroupNumber; -+}; -+ - typedef struct _virNodeDevCapPCIDev virNodeDevCapPCIDev; - typedef virNodeDevCapPCIDev *virNodeDevCapPCIDevPtr; - struct _virNodeDevCapPCIDev { -@@ -276,6 +283,7 @@ struct _virNodeDevCapData { - virNodeDevCapStorage storage; - virNodeDevCapSCSIGeneric sg; - virNodeDevCapDRM drm; -+ virNodeDevCapMdev mdev; - }; - }; - -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index b89099c82..37528ee48 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -1073,6 +1073,42 @@ udevProcessSCSIGeneric(struct udev_device *dev, - } - - static int -+udevProcessMediatedDevice(struct udev_device *dev, -+ virNodeDeviceDefPtr def) -+{ -+ int ret = -1; -+ const char *uuidstr = NULL; -+ int iommugrp = -1; -+ char *linkpath = NULL; -+ char *realpath = NULL; -+ virNodeDevCapMdevPtr data = &def->caps->data.mdev; -+ -+ if (virAsprintf(&linkpath, "%s/mdev_type", udev_device_get_syspath(dev)) < 0) -+ goto cleanup; -+ -+ if (virFileResolveLink(linkpath, &realpath) < 0) -+ goto cleanup; -+ -+ if (VIR_STRDUP(data->type, last_component(realpath)) < 0) -+ goto cleanup; -+ -+ uuidstr = udev_device_get_sysname(dev); -+ if ((iommugrp = virMediatedDeviceGetIOMMUGroupNum(uuidstr)) < 0) -+ goto cleanup; -+ -+ if (udevGenerateDeviceName(dev, def, NULL) != 0) -+ goto cleanup; -+ -+ data->iommuGroupNumber = iommugrp; -+ -+ ret = 0; -+ cleanup: -+ VIR_FREE(linkpath); -+ VIR_FREE(realpath); -+ return ret; -+} -+ -+static int - udevGetDeviceNodes(struct udev_device *device, - virNodeDeviceDefPtr def) - { -@@ -1140,12 +1176,16 @@ udevGetDeviceType(struct udev_device *device, - if (udevHasDeviceProperty(device, "INTERFACE")) - *type = VIR_NODE_DEV_CAP_NET; - -- /* SCSI generic device doesn't set DEVTYPE property */ -+ /* Neither SCSI generic devices nor mediated devices set DEVTYPE -+ * property, therefore we need to rely on the SUBSYSTEM property */ - if (udevGetStringProperty(device, "SUBSYSTEM", &subsystem) < 0) - return -1; - - if (STREQ_NULLABLE(subsystem, "scsi_generic")) - *type = VIR_NODE_DEV_CAP_SCSI_GENERIC; -+ else if (STREQ_NULLABLE(subsystem, "mdev")) -+ *type = VIR_NODE_DEV_CAP_MDEV; -+ - VIR_FREE(subsystem); - } - -@@ -1185,6 +1225,7 @@ static int udevGetDeviceDetails(struct udev_device *device, - case VIR_NODE_DEV_CAP_DRM: - return udevProcessDRMDevice(device, def); - case VIR_NODE_DEV_CAP_MDEV: -+ return udevProcessMediatedDevice(device, def); - case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_SYSTEM: - case VIR_NODE_DEV_CAP_FC_HOST: -diff --git a/tests/nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml b/tests/nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml -new file mode 100644 -index 000000000..470e5917e ---- /dev/null -+++ b/tests/nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml -@@ -0,0 +1,8 @@ -+ -+ mdev_3627463d_b7f0_4fea_b468_f1da537d301b -+ computer -+ -+ -+ -+ -+ -diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c -index eb5c50b86..26f0d25bc 100644 ---- a/tests/nodedevxml2xmltest.c -+++ b/tests/nodedevxml2xmltest.c -@@ -102,6 +102,7 @@ mymain(void) - DO_TEST("pci_0000_02_10_7_sriov_pf_vfs_all_header_type"); - DO_TEST("drm_renderD129"); - DO_TEST("pci_0000_02_10_7_mdev_types"); -+ DO_TEST("mdev_3627463d_b7f0_4fea_b468_f1da537d301b"); - - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; - } --- -2.13.0 - diff --git a/SOURCES/libvirt-nodedev-Introduce-new-mdev_types-and-mdev-nodedev-capabilities.patch b/SOURCES/libvirt-nodedev-Introduce-new-mdev_types-and-mdev-nodedev-capabilities.patch deleted file mode 100644 index 11333ed..0000000 --- a/SOURCES/libvirt-nodedev-Introduce-new-mdev_types-and-mdev-nodedev-capabilities.patch +++ /dev/null @@ -1,193 +0,0 @@ -From 74e4d42a25e8e8823ce4e7c3544b8f1944cdb471 Mon Sep 17 00:00:00 2001 -Message-Id: <74e4d42a25e8e8823ce4e7c3544b8f1944cdb471@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:52 +0200 -Subject: [PATCH] nodedev: Introduce new mdev_types and mdev nodedev - capabilities - -The reason for introducing two capabilities, one for the device itself -(cap 'mdev') and one for the parent device listing the available types -('mdev_types'), is that we should be able to do -'virsh nodedev-list --cap' not only for existing mdev devices but also -for devices that support creation of mdev devices, since one day libvirt -might be actually able to create the mdev devices in an automated way -(just like we do for NPIV/vHBA). - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit 4385df97fed24279fa8595a1a49c9f9b3eba5be1) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - include/libvirt/libvirt-nodedev.h | 2 ++ - src/conf/node_device_conf.c | 10 +++++++++- - src/conf/node_device_conf.h | 6 +++++- - src/conf/virnodedeviceobj.c | 4 +++- - src/libvirt-nodedev.c | 2 ++ - src/node_device/node_device_driver.c | 2 ++ - src/node_device/node_device_udev.c | 3 +++ - tools/virsh-nodedev.c | 6 ++++++ - 8 files changed, 32 insertions(+), 3 deletions(-) - -diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h -index 85003903d..1e3043787 100644 ---- a/include/libvirt/libvirt-nodedev.h -+++ b/include/libvirt/libvirt-nodedev.h -@@ -79,6 +79,8 @@ typedef enum { - VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS = 1 << 10, /* Capable of vport */ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC = 1 << 11, /* Capable of scsi_generic */ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM = 1 << 12, /* DRM device */ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = 1 << 13, /* Capable of mediated devices */ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV = 1 << 14, /* Mediated device */ - } virConnectListAllNodeDeviceFlags; - - int virConnectListAllNodeDevices (virConnectPtr conn, -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index 56a26b578..90a087a37 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -60,7 +60,9 @@ VIR_ENUM_IMPL(virNodeDevCap, VIR_NODE_DEV_CAP_LAST, - "fc_host", - "vports", - "scsi_generic", -- "drm") -+ "drm", -+ "mdev_types", -+ "mdev") - - VIR_ENUM_IMPL(virNodeDevNetCap, VIR_NODE_DEV_CAP_NET_LAST, - "80203", -@@ -540,6 +542,8 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) - case VIR_NODE_DEV_CAP_DRM: - virBufferEscapeString(&buf, "%s\n", virNodeDevDRMTypeToString(data->drm.type)); - break; -+ case VIR_NODE_DEV_CAP_MDEV: -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: - case VIR_NODE_DEV_CAP_LAST: -@@ -1612,6 +1616,8 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, - case VIR_NODE_DEV_CAP_DRM: - ret = virNodeDevCapDRMParseXML(ctxt, def, node, &caps->data.drm); - break; -+ case VIR_NODE_DEV_CAP_MDEV: -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: - case VIR_NODE_DEV_CAP_SCSI_GENERIC: -@@ -1929,6 +1935,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) - case VIR_NODE_DEV_CAP_SCSI_GENERIC: - VIR_FREE(data->sg.path); - break; -+ case VIR_NODE_DEV_CAP_MDEV: -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_DRM: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: -diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h -index a5d5cdd2a..e168f2e27 100644 ---- a/src/conf/node_device_conf.h -+++ b/src/conf/node_device_conf.h -@@ -64,6 +64,8 @@ typedef enum { - VIR_NODE_DEV_CAP_VPORTS, /* HBA which is capable of vports */ - VIR_NODE_DEV_CAP_SCSI_GENERIC, /* SCSI generic device */ - VIR_NODE_DEV_CAP_DRM, /* DRM device */ -+ VIR_NODE_DEV_CAP_MDEV_TYPES, /* Device capable of mediated devices */ -+ VIR_NODE_DEV_CAP_MDEV, /* Mediated device */ - - VIR_NODE_DEV_CAP_LAST - } virNodeDevCapType; -@@ -351,7 +353,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); - VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC | \ -- VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM) -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM | \ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES | \ -+ VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV) - - char * - virNodeDeviceGetParentName(virConnectPtr conn, -diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c -index 3fe3ae5fe..21d5d3f75 100644 ---- a/src/conf/virnodedeviceobj.c -+++ b/src/conf/virnodedeviceobj.c -@@ -494,7 +494,9 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, - MATCH(FC_HOST) || - MATCH(VPORTS) || - MATCH(SCSI_GENERIC) || -- MATCH(DRM))) -+ MATCH(DRM) || -+ MATCH(MDEV_TYPES) || -+ MATCH(MDEV))) - return false; - } - -diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c -index 83376b0d9..44e2b4efd 100644 ---- a/src/libvirt-nodedev.c -+++ b/src/libvirt-nodedev.c -@@ -98,6 +98,8 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) - * VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS - * VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC - * VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM -+ * VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES -+ * VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV - * - * Returns the number of node devices found or -1 and sets @devices to NULL in - * case of error. On success, the array stored into @devices is guaranteed to -diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c -index 99f7bc547..082160d98 100644 ---- a/src/node_device/node_device_driver.c -+++ b/src/node_device/node_device_driver.c -@@ -82,6 +82,8 @@ static int update_caps(virNodeDeviceObjPtr dev) - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: - case VIR_NODE_DEV_CAP_SCSI_GENERIC: -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: -+ case VIR_NODE_DEV_CAP_MDEV: - case VIR_NODE_DEV_CAP_LAST: - break; - } -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index 591da8db2..d4489e2a5 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -43,6 +43,7 @@ - #include "virpci.h" - #include "virstring.h" - #include "virnetdev.h" -+#include "virmdev.h" - - #define VIR_FROM_THIS VIR_FROM_NODEDEV - -@@ -1064,6 +1065,8 @@ static int udevGetDeviceDetails(struct udev_device *device, - return udevProcessSCSIGeneric(device, def); - case VIR_NODE_DEV_CAP_DRM: - return udevProcessDRMDevice(device, def); -+ case VIR_NODE_DEV_CAP_MDEV: -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: - case VIR_NODE_DEV_CAP_SYSTEM: - case VIR_NODE_DEV_CAP_FC_HOST: - case VIR_NODE_DEV_CAP_VPORTS: -diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c -index c69144021..ad96dda1f 100644 ---- a/tools/virsh-nodedev.c -+++ b/tools/virsh-nodedev.c -@@ -454,6 +454,12 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) - case VIR_NODE_DEV_CAP_DRM: - flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM; - break; -+ case VIR_NODE_DEV_CAP_MDEV_TYPES: -+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES; -+ break; -+ case VIR_NODE_DEV_CAP_MDEV: -+ flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV; -+ break; - case VIR_NODE_DEV_CAP_LAST: - break; - } --- -2.13.0 - diff --git a/SOURCES/libvirt-nodedev-Introduce-the-mdev-capability-to-a-PCI-parent-device.patch b/SOURCES/libvirt-nodedev-Introduce-the-mdev-capability-to-a-PCI-parent-device.patch deleted file mode 100644 index 32d38c3..0000000 --- a/SOURCES/libvirt-nodedev-Introduce-the-mdev-capability-to-a-PCI-parent-device.patch +++ /dev/null @@ -1,522 +0,0 @@ -From 909d3ff4c0e4ab7486c60dade9900462c896d3ba Mon Sep 17 00:00:00 2001 -Message-Id: <909d3ff4c0e4ab7486c60dade9900462c896d3ba@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:53 +0200 -Subject: [PATCH] nodedev: Introduce the mdev capability to a PCI parent device - -The parent device needs to report the generic stuff about the supported -mediated devices types, like device API, available instances, type name, -etc. Therefore this patch introduces a new nested capability element of -type 'mdev_types' with the resulting XML of the following format: - - - ... - - ... - - - optional_vendor_supplied_codename - vfio-pci - NUM - - ... - - ... - - - - ... - - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit 500cbc066a5362834462c4eefb260b7c96a8554f) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - docs/schemas/nodedev.rng | 26 +++++ - src/conf/node_device_conf.c | 101 +++++++++++++++++ - src/conf/node_device_conf.h | 15 +++ - src/conf/virnodedeviceobj.c | 20 +++- - src/libvirt_private.syms | 1 + - src/node_device/node_device_udev.c | 119 +++++++++++++++++++++ - .../pci_0000_02_10_7_mdev_types.xml | 32 ++++++ - tests/nodedevxml2xmltest.c | 1 + - 8 files changed, 313 insertions(+), 2 deletions(-) - create mode 100644 tests/nodedevschemadata/pci_0000_02_10_7_mdev_types.xml - -diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng -index 0f90a73c8..e0a2c5032 100644 ---- a/docs/schemas/nodedev.rng -+++ b/docs/schemas/nodedev.rng -@@ -205,6 +205,32 @@ - - - -+ -+ -+ mdev_types -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ vfio-pci -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index 90a087a37..de8ba8f9d 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -89,6 +89,19 @@ virNodeDevCapsDefParseString(const char *xpath, - - - void -+virNodeDevCapMdevTypeFree(virNodeDevCapMdevTypePtr type) -+{ -+ if (!type) -+ return; -+ -+ VIR_FREE(type->id); -+ VIR_FREE(type->name); -+ VIR_FREE(type->device_api); -+ VIR_FREE(type); -+} -+ -+ -+void - virNodeDeviceDefFree(virNodeDeviceDefPtr def) - { - virNodeDevCapsDefPtr caps; -@@ -265,6 +278,27 @@ virNodeDeviceCapPCIDefFormat(virBufferPtr buf, - virBufferAsprintf(buf, "\n", - virPCIHeaderTypeToString(data->pci_dev.hdrType)); - } -+ if (data->pci_dev.flags & VIR_NODE_DEV_CAP_FLAG_PCI_MDEV) { -+ virBufferAddLit(buf, "\n"); -+ virBufferAdjustIndent(buf, 2); -+ for (i = 0; i < data->pci_dev.nmdev_types; i++) { -+ virNodeDevCapMdevTypePtr type = data->pci_dev.mdev_types[i]; -+ virBufferEscapeString(buf, "\n", type->id); -+ virBufferAdjustIndent(buf, 2); -+ if (type->name) -+ virBufferEscapeString(buf, "%s\n", -+ type->name); -+ virBufferEscapeString(buf, "%s\n", -+ type->device_api); -+ virBufferAsprintf(buf, -+ "%u\n", -+ type->available_instances); -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } -+ virBufferAdjustIndent(buf, -2); -+ virBufferAddLit(buf, "\n"); -+ } - if (data->pci_dev.nIommuGroupDevices) { - virBufferAsprintf(buf, "\n", - data->pci_dev.iommuGroupNumber); -@@ -1365,6 +1399,67 @@ virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt, - - - static int -+virNodeDevPCICapMdevTypesParseXML(xmlXPathContextPtr ctxt, -+ virNodeDevCapPCIDevPtr pci_dev) -+{ -+ int ret = -1; -+ xmlNodePtr orignode = NULL; -+ xmlNodePtr *nodes = NULL; -+ int nmdev_types = -1; -+ virNodeDevCapMdevTypePtr type = NULL; -+ size_t i; -+ -+ if ((nmdev_types = virXPathNodeSet("./type", ctxt, &nodes)) < 0) -+ goto cleanup; -+ -+ orignode = ctxt->node; -+ for (i = 0; i < nmdev_types; i++) { -+ ctxt->node = nodes[i]; -+ -+ if (VIR_ALLOC(type) < 0) -+ goto cleanup; -+ -+ if (!(type->id = virXPathString("string(./@id[1])", ctxt))) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("missing 'id' attribute for mediated device's " -+ " element")); -+ goto cleanup; -+ } -+ -+ if (!(type->device_api = virXPathString("string(./deviceAPI[1])", ctxt))) { -+ virReportError(VIR_ERR_XML_ERROR, -+ _("missing device API for mediated device type '%s'"), -+ type->id); -+ goto cleanup; -+ } -+ -+ if (virXPathUInt("number(./availableInstances)", ctxt, -+ &type->available_instances) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, -+ _("missing number of available instances for " -+ "mediated device type '%s'"), -+ type->id); -+ goto cleanup; -+ } -+ -+ type->name = virXPathString("string(./name)", ctxt); -+ -+ if (VIR_APPEND_ELEMENT(pci_dev->mdev_types, -+ pci_dev->nmdev_types, type) < 0) -+ goto cleanup; -+ } -+ -+ pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; -+ ret = 0; -+ cleanup: -+ VIR_FREE(nodes); -+ virNodeDevCapMdevTypeFree(type); -+ ctxt->node = orignode; -+ return ret; -+} -+ -+ -+static int - virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, - xmlNodePtr node, - virNodeDevCapPCIDevPtr pci_dev) -@@ -1386,6 +1481,9 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, - } else if (STREQ(type, "virt_functions") && - virNodeDevPCICapSRIOVVirtualParseXML(ctxt, pci_dev) < 0) { - goto cleanup; -+ } else if (STREQ(type, "mdev_types") && -+ virNodeDevPCICapMdevTypesParseXML(ctxt, pci_dev) < 0) { -+ goto cleanup; - } else { - int hdrType = virPCIHeaderTypeFromString(type); - -@@ -1898,6 +1996,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) - VIR_FREE(data->pci_dev.iommuGroupDevices[i]); - VIR_FREE(data->pci_dev.iommuGroupDevices); - virPCIEDeviceInfoFree(data->pci_dev.pci_express); -+ for (i = 0; i < data->pci_dev.nmdev_types; i++) -+ virNodeDevCapMdevTypeFree(data->pci_dev.mdev_types[i]); -+ VIR_FREE(data->pci_dev.mdev_types); - break; - case VIR_NODE_DEV_CAP_USB_DEV: - VIR_FREE(data->usb_dev.product_name); -diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h -index e168f2e27..18aaff8b5 100644 ---- a/src/conf/node_device_conf.h -+++ b/src/conf/node_device_conf.h -@@ -95,6 +95,7 @@ typedef enum { - VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION = (1 << 0), - VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION = (1 << 1), - VIR_NODE_DEV_CAP_FLAG_PCIE = (1 << 2), -+ VIR_NODE_DEV_CAP_FLAG_PCI_MDEV = (1 << 3), - } virNodeDevPCICapFlags; - - typedef enum { -@@ -133,6 +134,15 @@ struct _virNodeDevCapSystem { - virNodeDevCapSystemFirmware firmware; - }; - -+typedef struct _virNodeDevCapMdevType virNodeDevCapMdevType; -+typedef virNodeDevCapMdevType *virNodeDevCapMdevTypePtr; -+struct _virNodeDevCapMdevType { -+ char *id; -+ char *name; -+ char *device_api; -+ unsigned int available_instances; -+}; -+ - typedef struct _virNodeDevCapPCIDev virNodeDevCapPCIDev; - typedef virNodeDevCapPCIDev *virNodeDevCapPCIDevPtr; - struct _virNodeDevCapPCIDev { -@@ -156,6 +166,8 @@ struct _virNodeDevCapPCIDev { - int numa_node; - virPCIEDeviceInfoPtr pci_express; - int hdrType; /* enum virPCIHeaderType or -1 */ -+ virNodeDevCapMdevTypePtr *mdev_types; -+ size_t nmdev_types; - }; - - typedef struct _virNodeDevCapUSBDev virNodeDevCapUSBDev; -@@ -340,6 +352,9 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def); - void - virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); - -+void -+virNodeDevCapMdevTypeFree(virNodeDevCapMdevTypePtr type); -+ - # define VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP \ - (VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV | \ -diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c -index 21d5d3f75..ac25fb598 100644 ---- a/src/conf/virnodedeviceobj.c -+++ b/src/conf/virnodedeviceobj.c -@@ -42,11 +42,13 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *dev, - virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_FC_HOST); - const char *vports_cap = - virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_VPORTS); -+ const char *mdev_types = -+ virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_MDEV_TYPES); - - while (caps) { -- if (STREQ(cap, virNodeDevCapTypeToString(caps->data.type))) -+ if (STREQ(cap, virNodeDevCapTypeToString(caps->data.type))) { - return 1; -- else if (caps->data.type == VIR_NODE_DEV_CAP_SCSI_HOST) -+ } else if (caps->data.type == VIR_NODE_DEV_CAP_SCSI_HOST) { - if ((STREQ(cap, fc_host_cap) && - (caps->data.scsi_host.flags & - VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST)) || -@@ -54,6 +56,13 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *dev, - (caps->data.scsi_host.flags & - VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS))) - return 1; -+ } else if (caps->data.type == VIR_NODE_DEV_CAP_PCI_DEV) { -+ if ((STREQ(cap, mdev_types)) && -+ (caps->data.pci_dev.flags & -+ VIR_NODE_DEV_CAP_FLAG_PCI_MDEV)) -+ return 1; -+ } -+ - caps = caps->next; - } - return 0; -@@ -468,6 +477,13 @@ virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj, - VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS)) - return true; - } -+ -+ if (cap->data.type == VIR_NODE_DEV_CAP_PCI_DEV) { -+ if (type == VIR_NODE_DEV_CAP_MDEV_TYPES && -+ (cap->data.pci_dev.flags & -+ VIR_NODE_DEV_CAP_FLAG_PCI_MDEV)) -+ return true; -+ } - } - - return false; -diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms -index 7e1a06db3..343966cd0 100644 ---- a/src/libvirt_private.syms -+++ b/src/libvirt_private.syms -@@ -692,6 +692,7 @@ virNetDevIPRouteParseXML; - - - # conf/node_device_conf.h -+virNodeDevCapMdevTypeFree; - virNodeDevCapsDefFree; - virNodeDevCapTypeFromString; - virNodeDevCapTypeToString; -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index d4489e2a5..b89099c82 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -314,6 +314,119 @@ static int udevTranslatePCIIds(unsigned int vendor, - } - - -+static int -+udevFillMdevType(struct udev_device *device, -+ const char *dir, -+ virNodeDevCapMdevTypePtr type) -+{ -+ int ret = -1; -+ char *attrpath = NULL; -+ -+#define MDEV_GET_SYSFS_ATTR(attr_name, cb, ...) \ -+ do { \ -+ if (virAsprintf(&attrpath, "%s/%s", dir, #attr_name) < 0) \ -+ goto cleanup; \ -+ \ -+ if (cb(device, attrpath, __VA_ARGS__) < 0) \ -+ goto cleanup; \ -+ \ -+ VIR_FREE(attrpath); \ -+ } while (0) \ -+ -+ if (VIR_STRDUP(type->id, last_component(dir)) < 0) -+ goto cleanup; -+ -+ /* query udev for the attributes under subdirectories using the relative -+ * path stored in @dir, i.e. 'mdev_supported_types/' -+ */ -+ MDEV_GET_SYSFS_ATTR(name, udevGetStringSysfsAttr, &type->name); -+ MDEV_GET_SYSFS_ATTR(device_api, udevGetStringSysfsAttr, &type->device_api); -+ MDEV_GET_SYSFS_ATTR(available_instances, udevGetUintSysfsAttr, -+ &type->available_instances, 10); -+ -+#undef MDEV_GET_SYSFS_ATTR -+ -+ ret = 0; -+ cleanup: -+ VIR_FREE(attrpath); -+ return ret; -+} -+ -+ -+static int -+udevPCIGetMdevTypesCap(struct udev_device *device, -+ virNodeDevCapPCIDevPtr pcidata) -+{ -+ int ret = -1; -+ int dirret = -1; -+ DIR *dir = NULL; -+ struct dirent *entry; -+ char *path = NULL; -+ char *tmppath = NULL; -+ virNodeDevCapMdevTypePtr type = NULL; -+ virNodeDevCapMdevTypePtr *types = NULL; -+ size_t ntypes = 0; -+ size_t i; -+ -+ if (virAsprintf(&path, "%s/mdev_supported_types", -+ udev_device_get_syspath(device)) < 0) -+ return -1; -+ -+ if ((dirret = virDirOpenIfExists(&dir, path)) < 0) -+ goto cleanup; -+ -+ if (dirret == 0) { -+ ret = 0; -+ goto cleanup; -+ } -+ -+ if (VIR_ALLOC(types) < 0) -+ goto cleanup; -+ -+ /* UDEV doesn't report attributes under subdirectories by default but is -+ * able to query them if the path to the attribute is relative to the -+ * device's base path, e.g. /sys/devices/../0000:00:01.0/ is the device's -+ * base path as udev reports it, but we're interested in attributes under -+ * /sys/devices/../0000:00:01.0/mdev_supported_types//. So, we need to -+ * scan the subdirectories ourselves. -+ */ -+ while ((dirret = virDirRead(dir, &entry, path)) > 0) { -+ if (VIR_ALLOC(type) < 0) -+ goto cleanup; -+ -+ /* construct the relative mdev type path bit for udev */ -+ if (virAsprintf(&tmppath, "mdev_supported_types/%s", entry->d_name) < 0) -+ goto cleanup; -+ -+ if (udevFillMdevType(device, tmppath, type) < 0) -+ goto cleanup; -+ -+ if (VIR_APPEND_ELEMENT(types, ntypes, type) < 0) -+ goto cleanup; -+ -+ VIR_FREE(tmppath); -+ } -+ -+ if (dirret < 0) -+ goto cleanup; -+ -+ VIR_STEAL_PTR(pcidata->mdev_types, types); -+ pcidata->nmdev_types = ntypes; -+ pcidata->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; -+ ntypes = 0; -+ ret = 0; -+ cleanup: -+ virNodeDevCapMdevTypeFree(type); -+ for (i = 0; i < ntypes; i++) -+ virNodeDevCapMdevTypeFree(types[i]); -+ VIR_FREE(types); -+ VIR_FREE(path); -+ VIR_FREE(tmppath); -+ VIR_DIR_CLOSE(dir); -+ return ret; -+} -+ -+ - static int udevProcessPCI(struct udev_device *device, - virNodeDeviceDefPtr def) - { -@@ -404,6 +517,12 @@ static int udevProcessPCI(struct udev_device *device, - } - } - -+ /* check whether the device is mediated devices framework capable, if so, -+ * process it -+ */ -+ if (udevPCIGetMdevTypesCap(device, pci_dev) < 0) -+ goto cleanup; -+ - ret = 0; - - cleanup: -diff --git a/tests/nodedevschemadata/pci_0000_02_10_7_mdev_types.xml b/tests/nodedevschemadata/pci_0000_02_10_7_mdev_types.xml -new file mode 100644 -index 000000000..a2d57569a ---- /dev/null -+++ b/tests/nodedevschemadata/pci_0000_02_10_7_mdev_types.xml -@@ -0,0 +1,32 @@ -+ -+ pci_0000_02_10_7 -+ pci_0000_00_04_0 -+ -+ 0 -+ 2 -+ 16 -+ 7 -+ 82576 Virtual Function -+ Intel Corporation -+ -+ -+ bar1 -+ vfio-pci -+ 1 -+ -+ -+ bar2 -+ vfio-pci -+ 2 -+ -+ -+ -+

      -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c -index 5e1ae170c..eb5c50b86 100644 ---- a/tests/nodedevxml2xmltest.c -+++ b/tests/nodedevxml2xmltest.c -@@ -101,6 +101,7 @@ mymain(void) - DO_TEST("pci_0000_02_10_7_sriov_pf_vfs_all"); - DO_TEST("pci_0000_02_10_7_sriov_pf_vfs_all_header_type"); - DO_TEST("drm_renderD129"); -+ DO_TEST("pci_0000_02_10_7_mdev_types"); - - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; - } --- -2.13.0 - diff --git a/SOURCES/libvirt-nodedev-Make-use-of-the-compile-time-missing-enum-in-switch-error.patch b/SOURCES/libvirt-nodedev-Make-use-of-the-compile-time-missing-enum-in-switch-error.patch deleted file mode 100644 index 36c618b..0000000 --- a/SOURCES/libvirt-nodedev-Make-use-of-the-compile-time-missing-enum-in-switch-error.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 403371cc06cd9ac36bbe7e7a2e046de82c09e762 Mon Sep 17 00:00:00 2001 -Message-Id: <403371cc06cd9ac36bbe7e7a2e046de82c09e762@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:47 +0200 -Subject: [PATCH] nodedev: Make use of the compile-time missing enum in switch - error - -So udevGetDeviceDetails was one those functions using an enum in a -switch, but since it had a 'default' case, compiler didn't warn about an -unhandled enum. Moreover, the error about an unsupported device type -reported in the default case is unnecessary, since by the time we get -there, udevGetDeviceType (which was called before) already made sure -that any unrecognized device types had been handled properly. - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit 364c912cf384d2fb7575ba2f71a041297210e0e2) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/node_device/node_device_udev.c | 45 +++++++++++++------------------------- - 1 file changed, 15 insertions(+), 30 deletions(-) - -diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c -index bcae444d8..591da8db2 100644 ---- a/src/node_device/node_device_udev.c -+++ b/src/node_device/node_device_udev.c -@@ -1043,50 +1043,35 @@ udevGetDeviceType(struct udev_device *device, - static int udevGetDeviceDetails(struct udev_device *device, - virNodeDeviceDefPtr def) - { -- int ret = 0; -- - switch (def->caps->data.type) { -- case VIR_NODE_DEV_CAP_SYSTEM: -- /* There's no libudev equivalent of system, so ignore it. */ -- break; - case VIR_NODE_DEV_CAP_PCI_DEV: -- ret = udevProcessPCI(device, def); -- break; -+ return udevProcessPCI(device, def); - case VIR_NODE_DEV_CAP_USB_DEV: -- ret = udevProcessUSBDevice(device, def); -- break; -+ return udevProcessUSBDevice(device, def); - case VIR_NODE_DEV_CAP_USB_INTERFACE: -- ret = udevProcessUSBInterface(device, def); -- break; -+ return udevProcessUSBInterface(device, def); - case VIR_NODE_DEV_CAP_NET: -- ret = udevProcessNetworkInterface(device, def); -- break; -+ return udevProcessNetworkInterface(device, def); - case VIR_NODE_DEV_CAP_SCSI_HOST: -- ret = udevProcessSCSIHost(device, def); -- break; -+ return udevProcessSCSIHost(device, def); - case VIR_NODE_DEV_CAP_SCSI_TARGET: -- ret = udevProcessSCSITarget(device, def); -- break; -+ return udevProcessSCSITarget(device, def); - case VIR_NODE_DEV_CAP_SCSI: -- ret = udevProcessSCSIDevice(device, def); -- break; -+ return udevProcessSCSIDevice(device, def); - case VIR_NODE_DEV_CAP_STORAGE: -- ret = udevProcessStorage(device, def); -- break; -+ return udevProcessStorage(device, def); - case VIR_NODE_DEV_CAP_SCSI_GENERIC: -- ret = udevProcessSCSIGeneric(device, def); -- break; -+ return udevProcessSCSIGeneric(device, def); - case VIR_NODE_DEV_CAP_DRM: -- ret = udevProcessDRMDevice(device, def); -- break; -- default: -- virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Unknown device type %d"), def->caps->data.type); -- ret = -1; -+ return udevProcessDRMDevice(device, def); -+ case VIR_NODE_DEV_CAP_SYSTEM: -+ case VIR_NODE_DEV_CAP_FC_HOST: -+ case VIR_NODE_DEV_CAP_VPORTS: -+ case VIR_NODE_DEV_CAP_LAST: - break; - } - -- return ret; -+ return 0; - } - - --- -2.13.0 - diff --git a/SOURCES/libvirt-nodedev-Restore-setting-of-privileged.patch b/SOURCES/libvirt-nodedev-Restore-setting-of-privileged.patch new file mode 100644 index 0000000..94e6ada --- /dev/null +++ b/SOURCES/libvirt-nodedev-Restore-setting-of-privileged.patch @@ -0,0 +1,36 @@ +From be8c0df9c361446003821c35af1531187d0080b9 Mon Sep 17 00:00:00 2001 +Message-Id: +From: John Ferlan +Date: Fri, 24 Nov 2017 12:13:52 -0500 +Subject: [PATCH] nodedev: Restore setting of privileged + +https://bugzilla.redhat.com/show_bug.cgi?id=1517372 + +Commit id '36555364' removed the setting of the driver->privileged, +which the udevProcessPCI would need in order to read the PCI device +configs. + +Signed-off-by: John Ferlan +(cherry picked from commit 9bfcf3ccdd2a0bb599dff27f97d5c1524cba1b79) +Reviewed-by: Erik Skultety +Signed-off-by: Jiri Denemark +--- + src/node_device/node_device_udev.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c +index d48334b857..ed012200f5 100644 +--- a/src/node_device/node_device_udev.c ++++ b/src/node_device/node_device_udev.c +@@ -1933,6 +1933,8 @@ nodeStateInitialize(bool privileged, + return -1; + } + ++ driver->privileged = privileged; ++ + if (!(driver->devs = virNodeDeviceObjListNew()) || + !(priv = udevEventDataNew())) + goto cleanup; +-- +2.15.1 + diff --git a/SOURCES/libvirt-nodedev-conf-Split-PCI-sub-capability-parsing-to-separate-methods.patch b/SOURCES/libvirt-nodedev-conf-Split-PCI-sub-capability-parsing-to-separate-methods.patch deleted file mode 100644 index 9a5e2d4..0000000 --- a/SOURCES/libvirt-nodedev-conf-Split-PCI-sub-capability-parsing-to-separate-methods.patch +++ /dev/null @@ -1,198 +0,0 @@ -From 309e27ed960e7ac34177aa1fcac34cc6faf149fb Mon Sep 17 00:00:00 2001 -Message-Id: <309e27ed960e7ac34177aa1fcac34cc6faf149fb@dist-git> -From: Erik Skultety -Date: Thu, 18 May 2017 14:02:51 +0200 -Subject: [PATCH] nodedev: conf: Split PCI sub-capability parsing to separate - methods - -Since there's at least SRIOV and MDEV sub-capabilities to be parsed, -let's make the code more readable by splitting it to several logical -blocks. - -https://bugzilla.redhat.com/show_bug.cgi?id=1452072 - -Signed-off-by: Erik Skultety -(cherry picked from commit a5c1f3b7e028193e8cb9f9a420ac2fdd5f4a66fe) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/conf/node_device_conf.c | 142 ++++++++++++++++++++++++++------------------ - 1 file changed, 83 insertions(+), 59 deletions(-) - -diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c -index 02215f32d..56a26b578 100644 ---- a/src/conf/node_device_conf.c -+++ b/src/conf/node_device_conf.c -@@ -1286,76 +1286,102 @@ virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, - - - static int -+virNodeDevPCICapSRIOVPhysicalParseXML(xmlXPathContextPtr ctxt, -+ virNodeDevCapPCIDevPtr pci_dev) -+{ -+ xmlNodePtr address = virXPathNode("./address[1]", ctxt); -+ -+ if (VIR_ALLOC(pci_dev->physical_function) < 0) -+ return -1; -+ -+ if (!address) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("Missing address in 'phys_function' capability")); -+ return -1; -+ } -+ -+ if (virPCIDeviceAddressParseXML(address, -+ pci_dev->physical_function) < 0) -+ return -1; -+ -+ pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION; -+ -+ return 0; -+} -+ -+ -+static int -+virNodeDevPCICapSRIOVVirtualParseXML(xmlXPathContextPtr ctxt, -+ virNodeDevCapPCIDevPtr pci_dev) -+{ -+ int ret = -1; -+ xmlNodePtr *addresses = NULL; -+ int naddresses = virXPathNodeSet("./address", ctxt, &addresses); -+ char *maxFuncsStr = virXPathString("string(./@maxCount)", ctxt); -+ size_t i; -+ -+ if (naddresses < 0) -+ goto cleanup; -+ -+ if (maxFuncsStr && -+ virStrToLong_uip(maxFuncsStr, NULL, 10, -+ &pci_dev->max_virtual_functions) < 0) { -+ virReportError(VIR_ERR_XML_ERROR, "%s", -+ _("Malformed 'maxCount' parameter")); -+ goto cleanup; -+ } -+ -+ if (VIR_ALLOC_N(pci_dev->virtual_functions, naddresses) < 0) -+ goto cleanup; -+ -+ for (i = 0; i < naddresses; i++) { -+ virPCIDeviceAddressPtr addr = NULL; -+ -+ if (VIR_ALLOC(addr) < 0) -+ goto cleanup; -+ -+ if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0) { -+ VIR_FREE(addr); -+ goto cleanup; -+ } -+ -+ if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions, -+ pci_dev->num_virtual_functions, -+ addr) < 0) -+ goto cleanup; -+ } -+ -+ pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION; -+ ret = 0; -+ cleanup: -+ VIR_FREE(addresses); -+ VIR_FREE(maxFuncsStr); -+ return ret; -+} -+ -+ -+static int - virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, - xmlNodePtr node, - virNodeDevCapPCIDevPtr pci_dev) - { -- char *maxFuncsStr = virXMLPropString(node, "maxCount"); - char *type = virXMLPropString(node, "type"); -- xmlNodePtr *addresses = NULL; - xmlNodePtr orignode = ctxt->node; - int ret = -1; -- size_t i = 0; - - ctxt->node = node; - - if (!type) { - virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing capability type")); -- goto out; -+ goto cleanup; - } - -- if (STREQ(type, "phys_function")) { -- xmlNodePtr address = virXPathNode("./address[1]", ctxt); -- -- if (VIR_ALLOC(pci_dev->physical_function) < 0) -- goto out; -- -- if (!address) { -- virReportError(VIR_ERR_XML_ERROR, "%s", -- _("Missing address in 'phys_function' capability")); -- goto out; -- } -- -- if (virPCIDeviceAddressParseXML(address, -- pci_dev->physical_function) < 0) -- goto out; -- -- pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION; -- } else if (STREQ(type, "virt_functions")) { -- int naddresses; -- -- if ((naddresses = virXPathNodeSet("./address", ctxt, &addresses)) < 0) -- goto out; -- -- if (maxFuncsStr && -- virStrToLong_uip(maxFuncsStr, NULL, 10, -- &pci_dev->max_virtual_functions) < 0) { -- virReportError(VIR_ERR_XML_ERROR, "%s", -- _("Malformed 'maxCount' parameter")); -- goto out; -- } -- -- if (VIR_ALLOC_N(pci_dev->virtual_functions, naddresses) < 0) -- goto out; -- -- for (i = 0; i < naddresses; i++) { -- virPCIDeviceAddressPtr addr = NULL; -- -- if (VIR_ALLOC(addr) < 0) -- goto out; -- -- if (virPCIDeviceAddressParseXML(addresses[i], addr) < 0) { -- VIR_FREE(addr); -- goto out; -- } -- -- if (VIR_APPEND_ELEMENT(pci_dev->virtual_functions, -- pci_dev->num_virtual_functions, -- addr) < 0) -- goto out; -- } -- -- pci_dev->flags |= VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION; -+ if (STREQ(type, "phys_function") && -+ virNodeDevPCICapSRIOVPhysicalParseXML(ctxt, pci_dev) < 0) { -+ goto cleanup; -+ } else if (STREQ(type, "virt_functions") && -+ virNodeDevPCICapSRIOVVirtualParseXML(ctxt, pci_dev) < 0) { -+ goto cleanup; - } else { - int hdrType = virPCIHeaderTypeFromString(type); - -@@ -1364,9 +1390,7 @@ virNodeDevPCICapabilityParseXML(xmlXPathContextPtr ctxt, - } - - ret = 0; -- out: -- VIR_FREE(addresses); -- VIR_FREE(maxFuncsStr); -+ cleanup: - VIR_FREE(type); - ctxt->node = orignode; - return ret; --- -2.13.0 - diff --git a/SOURCES/libvirt-numa-Introduce-virDomainNumaNodeDistanceIsUsingDefaults.patch b/SOURCES/libvirt-numa-Introduce-virDomainNumaNodeDistanceIsUsingDefaults.patch new file mode 100644 index 0000000..ee21082 --- /dev/null +++ b/SOURCES/libvirt-numa-Introduce-virDomainNumaNodeDistanceIsUsingDefaults.patch @@ -0,0 +1,84 @@ +From 8af3d229190faed68beda2a1493badc1eb78e108 Mon Sep 17 00:00:00 2001 +Message-Id: <8af3d229190faed68beda2a1493badc1eb78e108@dist-git> +From: Michal Privoznik +Date: Mon, 4 Dec 2017 13:38:50 +0100 +Subject: [PATCH] numa: Introduce virDomainNumaNodeDistanceIsUsingDefaults + +https://bugzilla.redhat.com/show_bug.cgi?id=1454889 + +The function returns true/false depending on distance +configuration being present in the domain XML. + +Signed-off-by: Michal Privoznik +Reviewed-by: John Ferlan +(cherry picked from commit ab9baab7290a4a009e4e8ddfb63a2ddd19bb8091) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + src/conf/numa_conf.c | 21 +++++++++++++++++++++ + src/conf/numa_conf.h | 4 ++++ + src/libvirt_private.syms | 1 + + 3 files changed, 26 insertions(+) + +diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c +index c2f0d1ca8c..8fc3b0a196 100644 +--- a/src/conf/numa_conf.c ++++ b/src/conf/numa_conf.c +@@ -1137,6 +1137,27 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes) + return numa->nmem_nodes; + } + ++ ++bool ++virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa, ++ size_t node, ++ size_t sibling) ++{ ++ if (node >= numa->nmem_nodes || ++ sibling >= numa->nmem_nodes) ++ return false; ++ ++ if (!numa->mem_nodes[node].distances) ++ return true; ++ ++ if (numa->mem_nodes[node].distances[sibling].value == LOCAL_DISTANCE || ++ numa->mem_nodes[node].distances[sibling].value == REMOTE_DISTANCE) ++ return true; ++ ++ return false; ++} ++ ++ + size_t + virDomainNumaGetNodeDistance(virDomainNumaPtr numa, + size_t node, +diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h +index 4655de3aa7..7947fdb219 100644 +--- a/src/conf/numa_conf.h ++++ b/src/conf/numa_conf.h +@@ -87,6 +87,10 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune, + + size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa); + ++bool virDomainNumaNodeDistanceIsUsingDefaults(virDomainNumaPtr numa, ++ size_t node, ++ size_t sibling) ++ ATTRIBUTE_NONNULL(1); + size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa, + size_t node, + size_t sibling) +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 19543e06ae..0449b0185f 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -727,6 +727,7 @@ virDomainNumaGetNodeDistance; + virDomainNumaGetNodeMemoryAccessMode; + virDomainNumaGetNodeMemorySize; + virDomainNumaNew; ++virDomainNumaNodeDistanceIsUsingDefaults; + virDomainNumaSetNodeCount; + virDomainNumaSetNodeCpumask; + virDomainNumaSetNodeDistance; +-- +2.15.1 + diff --git a/SOURCES/libvirt-numa-describe-siblings-distances-within-cells.patch b/SOURCES/libvirt-numa-describe-siblings-distances-within-cells.patch new file mode 100644 index 0000000..5439b5d --- /dev/null +++ b/SOURCES/libvirt-numa-describe-siblings-distances-within-cells.patch @@ -0,0 +1,461 @@ +From 2ff472bc2ac9d01181c1dbd522153934de79907f Mon Sep 17 00:00:00 2001 +Message-Id: <2ff472bc2ac9d01181c1dbd522153934de79907f@dist-git> +From: Wim ten Have +Date: Mon, 4 Dec 2017 13:38:47 +0100 +Subject: [PATCH] numa: describe siblings distances within cells + +https://bugzilla.redhat.com/show_bug.cgi?id=1454889 + +Add support for describing NUMA distances in a domain's +XML description. + +Below is an example of a 4 node setup: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A defines a NUMA node. describes the NUMA distance +from the to the other NUMA nodes (the s). For example, +in above XML description, the distance between NUMA node0 and NUMA node2 is 31. + +Valid distance values are '10 <= value <= 255'. A distance value of 10 +represents the distance to the node itself. A distance value of 20 +represents the default value for remote nodes but other values are +possible depending on the physical topology of the system. + +When distances are not fully described, any missing sibling distance +values will default to 10 for local nodes and 20 for remote nodes. + +If distance is given for A -> B, then we default B -> A to the same +value instead of 20. + +Signed-off-by: Wim ten Have +Reviewed-by: Daniel P. Berrange +Signed-off-by: Jim Fehlig +(cherry picked from commit 74119a03f184b79dcad28aa1e6f4ede6dc444998) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + docs/formatdomain.html.in | 64 ++++++++++++++- + docs/schemas/basictypes.rng | 7 ++ + docs/schemas/cputypes.rng | 18 +++++ + src/conf/numa_conf.c | 191 +++++++++++++++++++++++++++++++++++++++++++- + 4 files changed, 276 insertions(+), 4 deletions(-) + +diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in +index 62dd6e1ec4..a5adf5d9aa 100644 +--- a/docs/formatdomain.html.in ++++ b/docs/formatdomain.html.in +@@ -1529,7 +1529,69 @@ +

      + +

      +- This guest NUMA specification is currently available only for QEMU/KVM. ++ This guest NUMA specification is currently available only for ++ QEMU/KVM and Xen. ++

      ++ ++

      ++ A NUMA hardware architecture supports the notion of distances ++ between NUMA cells. Since 3.10.0 it ++ is possible to define the distance between NUMA cells using the ++ distances element within a NUMA cell ++ description. The sibling sub-element is used to ++ specify the distance value between sibling NUMA cells. For more ++ details, see the chapter explaining the system's SLIT (System ++ Locality Information Table) within the ACPI (Advanced ++ Configuration and Power Interface) specification. ++

      ++ ++
      ++...
      ++<cpu>
      ++  ...
      ++  <numa>
      ++    <cell id='0' cpus='0,4-7' memory='512000' unit='KiB'>
      ++      <distances>
      ++        <sibling id='0' value='10'/>
      ++        <sibling id='1' value='21'/>
      ++        <sibling id='2' value='31'/>
      ++        <sibling id='3' value='41'/>
      ++      </distances>
      ++    </cell>
      ++    <cell id='1' cpus='1,8-10,12-15' memory='512000' unit='KiB' memAccess='shared'>
      ++      <distances>
      ++        <sibling id='0' value='21'/>
      ++        <sibling id='1' value='10'/>
      ++        <sibling id='2' value='21'/>
      ++        <sibling id='3' value='31'/>
      ++      </distances>
      ++    </cell>
      ++    <cell id='2' cpus='2,11' memory='512000' unit='KiB' memAccess='shared'>
      ++      <distances>
      ++        <sibling id='0' value='31'/>
      ++        <sibling id='1' value='21'/>
      ++        <sibling id='2' value='10'/>
      ++        <sibling id='3' value='21'/>
      ++      </distances>
      ++    </cell>
      ++    <cell id='3' cpus='3' memory='512000' unit='KiB'>
      ++      <distances>
      ++        <sibling id='0' value='41'/>
      ++        <sibling id='1' value='31'/>
      ++        <sibling id='2' value='21'/>
      ++        <sibling id='3' value='10'/>
      ++      </distances>
      ++    </cell>
      ++  </numa>
      ++  ...
      ++</cpu>
      ++...
      ++ ++

      ++ Describing distances between NUMA cells is currently only supported ++ by Xen. If no distances are given to describe ++ the SLIT data between different cells, it will default to a scheme ++ using 10 for local and 20 for remote distances. +

      + +

      Events configuration

      +diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng +index 1ea667cdf6..1a18cd31b1 100644 +--- a/docs/schemas/basictypes.rng ++++ b/docs/schemas/basictypes.rng +@@ -77,6 +77,13 @@ + + + ++ ++ ++ 10 ++ 255 ++ ++ ++ + + + +diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng +index 3eef16abce..c45b6dfb28 100644 +--- a/docs/schemas/cputypes.rng ++++ b/docs/schemas/cputypes.rng +@@ -129,6 +129,24 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c +index b71dc012c5..5fbcc72041 100644 +--- a/src/conf/numa_conf.c ++++ b/src/conf/numa_conf.c +@@ -29,6 +29,15 @@ + #include "virnuma.h" + #include "virstring.h" + ++/* ++ * Distance definitions defined Conform ACPI 2.0 SLIT. ++ * See include/linux/topology.h ++ */ ++#define LOCAL_DISTANCE 10 ++#define REMOTE_DISTANCE 20 ++/* SLIT entry value is a one-byte unsigned integer. */ ++#define UNREACHABLE 255 ++ + #define VIR_FROM_THIS VIR_FROM_DOMAIN + + VIR_ENUM_IMPL(virDomainNumatuneMemMode, +@@ -48,6 +57,8 @@ VIR_ENUM_IMPL(virDomainMemoryAccess, VIR_DOMAIN_MEMORY_ACCESS_LAST, + "shared", + "private") + ++typedef struct _virDomainNumaDistance virDomainNumaDistance; ++typedef virDomainNumaDistance *virDomainNumaDistancePtr; + + typedef struct _virDomainNumaNode virDomainNumaNode; + typedef virDomainNumaNode *virDomainNumaNodePtr; +@@ -66,6 +77,12 @@ struct _virDomainNuma { + virBitmapPtr nodeset; /* host memory nodes where this guest node resides */ + virDomainNumatuneMemMode mode; /* memory mode selection */ + virDomainMemoryAccess memAccess; /* shared memory access configuration */ ++ ++ struct _virDomainNumaDistance { ++ unsigned int value; /* locality value for node i->j or j->i */ ++ unsigned int cellid; ++ } *distances; /* remote node distances */ ++ size_t ndistances; + } *mem_nodes; /* guest node configuration */ + size_t nmem_nodes; + +@@ -686,6 +703,144 @@ virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune, + } + + ++static int ++virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr def, ++ xmlXPathContextPtr ctxt, ++ unsigned int cur_cell) ++{ ++ int ret = -1; ++ int sibling; ++ char *tmp = NULL; ++ xmlNodePtr *nodes = NULL; ++ size_t i, ndistances = def->nmem_nodes; ++ ++ if (!ndistances) ++ return 0; ++ ++ /* check if NUMA distances definition is present */ ++ if (!virXPathNode("./distances[1]", ctxt)) ++ return 0; ++ ++ if ((sibling = virXPathNodeSet("./distances[1]/sibling", ctxt, &nodes)) <= 0) { ++ virReportError(VIR_ERR_XML_ERROR, "%s", ++ _("NUMA distances defined without siblings")); ++ goto cleanup; ++ } ++ ++ for (i = 0; i < sibling; i++) { ++ virDomainNumaDistancePtr ldist, rdist; ++ unsigned int sibling_id, sibling_value; ++ ++ /* siblings are in order of parsing or explicitly numbered */ ++ if (!(tmp = virXMLPropString(nodes[i], "id"))) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Missing 'id' attribute in NUMA " ++ "distances under 'cell id %d'"), ++ cur_cell); ++ goto cleanup; ++ } ++ ++ /* The "id" needs to be applicable */ ++ if (virStrToLong_uip(tmp, NULL, 10, &sibling_id) < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Invalid 'id' attribute in NUMA " ++ "distances for sibling: '%s'"), ++ tmp); ++ goto cleanup; ++ } ++ VIR_FREE(tmp); ++ ++ /* The "id" needs to be within numa/cell range */ ++ if (sibling_id >= ndistances) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("'sibling_id %d' does not refer to a " ++ "valid cell within NUMA 'cell id %d'"), ++ sibling_id, cur_cell); ++ goto cleanup; ++ } ++ ++ /* We need a locality value. Check and correct ++ * distance to local and distance to remote node. ++ */ ++ if (!(tmp = virXMLPropString(nodes[i], "value"))) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("Missing 'value' attribute in NUMA distances " ++ "under 'cell id %d' for 'sibling id %d'"), ++ cur_cell, sibling_id); ++ goto cleanup; ++ } ++ ++ /* The "value" needs to be applicable */ ++ if (virStrToLong_uip(tmp, NULL, 10, &sibling_value) < 0) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("'value %s' is invalid for " ++ "'sibling id %d' under NUMA 'cell id %d'"), ++ tmp, sibling_id, cur_cell); ++ goto cleanup; ++ } ++ VIR_FREE(tmp); ++ ++ /* Assure LOCAL_DISTANCE <= "value" <= UNREACHABLE ++ * and correct LOCAL_DISTANCE setting if such applies. ++ */ ++ if ((sibling_value < LOCAL_DISTANCE || ++ sibling_value > UNREACHABLE) || ++ (sibling_id == cur_cell && ++ sibling_value != LOCAL_DISTANCE) || ++ (sibling_id != cur_cell && ++ sibling_value == LOCAL_DISTANCE)) { ++ virReportError(VIR_ERR_XML_ERROR, ++ _("'value %d' is invalid for " ++ "'sibling id %d' under NUMA 'cell id %d'"), ++ sibling_value, sibling_id, cur_cell); ++ goto cleanup; ++ } ++ ++ /* Apply the local / remote distance */ ++ ldist = def->mem_nodes[cur_cell].distances; ++ if (!ldist) { ++ if (VIR_ALLOC_N(ldist, ndistances) < 0) ++ goto cleanup; ++ ++ ldist[cur_cell].value = LOCAL_DISTANCE; ++ ldist[cur_cell].cellid = cur_cell; ++ def->mem_nodes[cur_cell].ndistances = ndistances; ++ } ++ ++ ldist[sibling_id].cellid = sibling_id; ++ ldist[sibling_id].value = sibling_value; ++ def->mem_nodes[cur_cell].distances = ldist; ++ ++ /* Apply symmetry if none given */ ++ rdist = def->mem_nodes[sibling_id].distances; ++ if (!rdist) { ++ if (VIR_ALLOC_N(rdist, ndistances) < 0) ++ goto cleanup; ++ ++ rdist[sibling_id].value = LOCAL_DISTANCE; ++ rdist[sibling_id].cellid = sibling_id; ++ def->mem_nodes[sibling_id].ndistances = ndistances; ++ } ++ ++ rdist[cur_cell].cellid = cur_cell; ++ if (!rdist[cur_cell].value) ++ rdist[cur_cell].value = sibling_value; ++ def->mem_nodes[sibling_id].distances = rdist; ++ } ++ ++ ret = 0; ++ ++ cleanup: ++ if (ret) { ++ for (i = 0; i < ndistances; i++) ++ VIR_FREE(def->mem_nodes[i].distances); ++ } ++ VIR_FREE(nodes); ++ VIR_FREE(tmp); ++ ++ return ret; ++} ++ + int + virDomainNumaDefCPUParseXML(virDomainNumaPtr def, + xmlXPathContextPtr ctxt) +@@ -694,7 +849,7 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def, + xmlNodePtr oldNode = ctxt->node; + char *tmp = NULL; + int n; +- size_t i; ++ size_t i, j; + int ret = -1; + + /* check if NUMA definition is present */ +@@ -712,7 +867,6 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def, + def->nmem_nodes = n; + + for (i = 0; i < n; i++) { +- size_t j; + int rc; + unsigned int cur_cell = i; + +@@ -788,6 +942,10 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def, + def->mem_nodes[cur_cell].memAccess = rc; + VIR_FREE(tmp); + } ++ ++ /* Parse NUMA distances info */ ++ if (virDomainNumaDefNodeDistanceParseXML(def, ctxt, cur_cell) < 0) ++ goto cleanup; + } + + ret = 0; +@@ -815,6 +973,8 @@ virDomainNumaDefCPUFormatXML(virBufferPtr buf, + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + for (i = 0; i < ncells; i++) { ++ int ndistances; ++ + memAccess = virDomainNumaGetNodeMemoryAccessMode(def, i); + + if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i)))) +@@ -829,7 +989,32 @@ virDomainNumaDefCPUFormatXML(virBufferPtr buf, + if (memAccess) + virBufferAsprintf(buf, " memAccess='%s'", + virDomainMemoryAccessTypeToString(memAccess)); +- virBufferAddLit(buf, "/>\n"); ++ ++ ndistances = def->mem_nodes[i].ndistances; ++ if (!ndistances) { ++ virBufferAddLit(buf, "/>\n"); ++ } else { ++ size_t j; ++ virDomainNumaDistancePtr distances = def->mem_nodes[i].distances; ++ ++ virBufferAddLit(buf, ">\n"); ++ virBufferAdjustIndent(buf, 2); ++ virBufferAddLit(buf, "\n"); ++ virBufferAdjustIndent(buf, 2); ++ for (j = 0; j < ndistances; j++) { ++ if (distances[j].value) { ++ virBufferAddLit(buf, "\n"); ++ } ++ } ++ virBufferAdjustIndent(buf, -2); ++ virBufferAddLit(buf, "\n"); ++ virBufferAdjustIndent(buf, -2); ++ virBufferAddLit(buf, "
      \n"); ++ } ++ + VIR_FREE(cpustr); + } + virBufferAdjustIndent(buf, -2); +-- +2.15.1 + diff --git a/SOURCES/libvirt-nwfilter-don-t-crash-listing-filters-in-unprivileged-daemon.patch b/SOURCES/libvirt-nwfilter-don-t-crash-listing-filters-in-unprivileged-daemon.patch new file mode 100644 index 0000000..a41ed00 --- /dev/null +++ b/SOURCES/libvirt-nwfilter-don-t-crash-listing-filters-in-unprivileged-daemon.patch @@ -0,0 +1,75 @@ +From 5bb56c9849bdef1f7108895a20a9f348107dbfb2 Mon Sep 17 00:00:00 2001 +Message-Id: <5bb56c9849bdef1f7108895a20a9f348107dbfb2@dist-git> +From: "Daniel P. Berrange" +Date: Wed, 6 Dec 2017 12:11:17 -0500 +Subject: [PATCH] nwfilter: don't crash listing filters in unprivileged daemon + +https://bugzilla.redhat.com/show_bug.cgi?id=1522879 + +The unprivileged libvirtd does not support nwfilter config, by leaves the +driver active. It is supposed to result in all APIs being an effective +no-op, but several APIs rely on driver->nwfilters being non-NULL, or they +will reference a NULL pointer. Rather than adding checks for NULL in many +places, just make sure driver->nwfilters is always initialized. + +Reviewed-by: John Ferlan +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 7993554f70fd8d512dfde484490bcd1601b60b33) +Signed-off-by: John Ferlan +Reviewed-by: Daniel P. Berrange +Signed-off-by: Jiri Denemark +--- + src/nwfilter/nwfilter_driver.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c +index 2f9a51c405..885dbcc282 100644 +--- a/src/nwfilter/nwfilter_driver.c ++++ b/src/nwfilter/nwfilter_driver.c +@@ -189,6 +189,8 @@ nwfilterStateInitialize(bool privileged, + /* remember that we are going to use firewalld */ + driver->watchingFirewallD = (sysbus != NULL); + driver->privileged = privileged; ++ if (!(driver->nwfilters = virNWFilterObjListNew())) ++ goto error; + + if (!privileged) + return 0; +@@ -244,9 +246,6 @@ nwfilterStateInitialize(bool privileged, + goto error; + } + +- if (!(driver->nwfilters = virNWFilterObjListNew())) +- goto error; +- + if (virNWFilterObjListLoadAllConfigs(driver->nwfilters, driver->configDir) < 0) + goto error; + +@@ -271,6 +270,7 @@ nwfilterStateInitialize(bool privileged, + virNWFilterIPAddrMapShutdown(); + + err_free_driverstate: ++ virNWFilterObjListFree(driver->nwfilters); + VIR_FREE(driver); + + return -1; +@@ -349,13 +349,13 @@ nwfilterStateCleanup(void) + + nwfilterDriverRemoveDBusMatches(); + +- /* free inactive nwfilters */ +- virNWFilterObjListFree(driver->nwfilters); +- + VIR_FREE(driver->configDir); + nwfilterDriverUnlock(); + } + ++ /* free inactive nwfilters */ ++ virNWFilterObjListFree(driver->nwfilters); ++ + virMutexDestroy(&driver->lock); + VIR_FREE(driver); + +-- +2.15.1 + diff --git a/SOURCES/libvirt-pci-fix-link-maximum-speed-detection.patch b/SOURCES/libvirt-pci-fix-link-maximum-speed-detection.patch deleted file mode 100644 index 928b70b..0000000 --- a/SOURCES/libvirt-pci-fix-link-maximum-speed-detection.patch +++ /dev/null @@ -1,39 +0,0 @@ -From e971b5b913bc215ffb82419ae3db24a17ea094e8 Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= - -Date: Wed, 24 May 2017 12:56:09 -0400 -Subject: [PATCH] pci: fix link maximum speed detection -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit 8e09663 "pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link -speed" introduced another speed into enum, but mistakenly also altered -field width, so one bit of link width was included there. - -Resolves: https://bugzilla.redhat.com/1455017 - -Signed-off-by: Marek Marczykowski-Górecki -(cherry picked from commit 1128769f9ee50bb250333a5a5d276afbe74711ea) -Signed-off-by: Jiri Denemark ---- - src/util/virpci.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/util/virpci.c b/src/util/virpci.c -index c89b94b5f..a2db65d7d 100644 ---- a/src/util/virpci.c -+++ b/src/util/virpci.c -@@ -147,7 +147,7 @@ struct _virPCIDeviceList { - #define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ - #define PCI_EXP_DEVCAP_FLR (1<<28) /* Function Level Reset */ - #define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ --#define PCI_EXP_LNKCAP_SPEED 0x0001f /* Maximum Link Speed */ -+#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ - #define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ - #define PCI_EXP_LNKSTA 0x12 /* Link Status */ - #define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ --- -2.13.0 - diff --git a/SOURCES/libvirt-pci-recognize-report-GEN4-PCIe-4.0-card-16GT-s-Link-speed.patch b/SOURCES/libvirt-pci-recognize-report-GEN4-PCIe-4.0-card-16GT-s-Link-speed.patch deleted file mode 100644 index 843d60c..0000000 --- a/SOURCES/libvirt-pci-recognize-report-GEN4-PCIe-4.0-card-16GT-s-Link-speed.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 7cdf18b541dfdbbbe4ed1e35179dd41c0d473648 Mon Sep 17 00:00:00 2001 -Message-Id: <7cdf18b541dfdbbbe4ed1e35179dd41c0d473648@dist-git> -From: Shivaprasad G Bhat -Date: Mon, 17 Apr 2017 17:16:44 -0400 -Subject: [PATCH] pci: recognize/report GEN4 (PCIe 4.0) card 16GT/s Link speed - -Without this added enum value, nodedev-dumpxml of a GEN4 (PCIe 4.0) -card will fail (due to the unrecognized link speed), and since -nodedev-detach and nodedev-reattach internally do a dumpxml+parse, -they will also fail. With this patch, all those operations succeed. - -Resolves: https://bugzilla.redhat.com/1442831 - -Signed-off-by: Shivaprasad G Bhat -(cherry picked from commit 8e09663f7ff70b10a560746f17897d2c67c8460d) ---- - src/util/virpci.c | 4 ++-- - src/util/virpci.h | 1 + - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/util/virpci.c b/src/util/virpci.c -index 65c108f2e..c89b94b5f 100644 ---- a/src/util/virpci.c -+++ b/src/util/virpci.c -@@ -53,7 +53,7 @@ VIR_LOG_INIT("util.pci"); - #define PCI_ADDR_LEN 13 /* "XXXX:XX:XX.X" */ - - VIR_ENUM_IMPL(virPCIELinkSpeed, VIR_PCIE_LINK_SPEED_LAST, -- "", "2.5", "5", "8") -+ "", "2.5", "5", "8", "16") - - VIR_ENUM_IMPL(virPCIStubDriver, VIR_PCI_STUB_DRIVER_LAST, - "none", -@@ -147,7 +147,7 @@ struct _virPCIDeviceList { - #define PCI_EXP_DEVCAP 0x4 /* Device capabilities */ - #define PCI_EXP_DEVCAP_FLR (1<<28) /* Function Level Reset */ - #define PCI_EXP_LNKCAP 0xc /* Link Capabilities */ --#define PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */ -+#define PCI_EXP_LNKCAP_SPEED 0x0001f /* Maximum Link Speed */ - #define PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */ - #define PCI_EXP_LNKSTA 0x12 /* Link Status */ - #define PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */ -diff --git a/src/util/virpci.h b/src/util/virpci.h -index 8637c2c68..570684e75 100644 ---- a/src/util/virpci.h -+++ b/src/util/virpci.h -@@ -58,6 +58,7 @@ typedef enum { - VIR_PCIE_LINK_SPEED_25, - VIR_PCIE_LINK_SPEED_5, - VIR_PCIE_LINK_SPEED_8, -+ VIR_PCIE_LINK_SPEED_16, - VIR_PCIE_LINK_SPEED_LAST - } virPCIELinkSpeed; - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_ISA_SERIAL.patch b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_ISA_SERIAL.patch new file mode 100644 index 0000000..30a9a3f --- /dev/null +++ b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_ISA_SERIAL.patch @@ -0,0 +1,361 @@ +From 62fe4cb859c0e86460879bcf676f1107ccd93129 Mon Sep 17 00:00:00 2001 +Message-Id: <62fe4cb859c0e86460879bcf676f1107ccd93129@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:17 +0100 +Subject: [PATCH] qemu: Add QEMU_CAPS_DEVICE_ISA_SERIAL + +All serial devices shoule have an associated capability. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit b0f1c291a0d3cbf2881a308a39f3f390f1cabcf5) + + Conflicts: + src/qemu/qemu_capabilities.c + src/qemu/qemu_capabilities.h + tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml + tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml + + Insert the new capability in the right place, both in the + declaration and in the caps. + +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_capabilities.c | 3 +++ + src/qemu/qemu_capabilities.h | 2 ++ + tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + + tests/qemuhelptest.c | 5 +++++ + 22 files changed, 29 insertions(+) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 322e0423d6..08c6653424 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -451,6 +451,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, + "sclplmconsole", + + "disk-share-rw", ++ ++ "isa-serial", + ); + + +@@ -1681,6 +1683,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, + { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, + { "sclplmconsole", QEMU_CAPS_DEVICE_SCLPLMCONSOLE }, ++ { "isa-serial", QEMU_CAPS_DEVICE_ISA_SERIAL }, + }; + + static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = { +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index c3a15948cf..f0bd88f897 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -438,6 +438,8 @@ typedef enum { + + QEMU_CAPS_DISK_SHARE_RW, /* share-rw=on for concurrent disk access */ + ++ QEMU_CAPS_DEVICE_ISA_SERIAL, /* -device isa-serial */ ++ + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; + +diff --git a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml +index 956284d5d3..d560811ab7 100644 +--- a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml +@@ -109,6 +109,7 @@ + + + ++ + 1002002 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml +index 99384ce5e6..576475f7fa 100644 +--- a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml +@@ -127,6 +127,7 @@ + + + ++ + 1003001 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml +index aea043c57d..0c271d3e41 100644 +--- a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml +@@ -128,6 +128,7 @@ + + + ++ + 1004002 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +index 6f860e4f25..5c667975bf 100644 +--- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +@@ -140,6 +140,7 @@ + + + ++ + 1005003 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +index e5dc8360de..8ae07a91db 100644 +--- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +@@ -145,6 +145,7 @@ + + + ++ + 1006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +index 86d87eaf0c..34bd6be1cd 100644 +--- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +@@ -147,6 +147,7 @@ + + + ++ + 1007000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +index 2fa551b1a0..0d7c144ff7 100644 +--- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +@@ -163,6 +163,7 @@ + + + ++ + 2001001 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +index c95025b41f..23356f4092 100644 +--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +@@ -180,6 +180,7 @@ + + + ++ + 2010000 + 0 + (v2.10.0) +diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +index 33db3e6674..e04e530b95 100644 +--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml +@@ -225,6 +225,7 @@ + + + ++ + 2010000 + 0 + (v2.10.0) +diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +index f97e4cb813..5007523c1f 100644 +--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +@@ -188,6 +188,7 @@ + + + ++ + 2004000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +index 2ba40fc494..a9ad292d01 100644 +--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +@@ -194,6 +194,7 @@ + + + ++ + 2005000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +index 0b34fa30d4..e699bdbafd 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +@@ -172,6 +172,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +index d41d578c7e..f4c1de7e1d 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +@@ -172,6 +172,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +index 5ff8598fc8..27d99bd937 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +@@ -168,6 +168,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +index bdf006f6be..97621612ab 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +@@ -204,6 +204,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +index 59adff6c97..e4ea9452c5 100644 +--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +@@ -208,6 +208,7 @@ + + + ++ + 2007000 + 0 + (v2.7.0) +diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +index 3165b2dee3..c6d3e21d5c 100644 +--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +@@ -210,6 +210,7 @@ + + + ++ + 2008000 + 0 + (v2.8.0) +diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +index 3b70b1a407..f5cf0ba932 100644 +--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +@@ -175,6 +175,7 @@ + + + ++ + 2009000 + 0 + (v2.9.0) +diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +index 0ea9a2fce3..82cc4e79f4 100644 +--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +@@ -222,6 +222,7 @@ + + + ++ + 2009000 + 0 + (v2.9.0) +diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c +index 1a6e7092fd..0e05aa9d8a 100644 +--- a/tests/qemuhelptest.c ++++ b/tests/qemuhelptest.c +@@ -174,6 +174,7 @@ mymain(void) + QEMU_CAPS_DEVICE_USB_KBD, + QEMU_CAPS_DEVICE_RTL8139, + QEMU_CAPS_DEVICE_E1000, ++ QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DEVICE_VIRTIO_NET); + DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0, + QEMU_CAPS_DRIVE_BOOT, +@@ -210,6 +211,7 @@ mymain(void) + QEMU_CAPS_DEVICE_USB_KBD, + QEMU_CAPS_DEVICE_RTL8139, + QEMU_CAPS_DEVICE_E1000, ++ QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DEVICE_VIRTIO_NET); + DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0, + QEMU_CAPS_DRIVE_BOOT, +@@ -258,6 +260,7 @@ mymain(void) + QEMU_CAPS_DEVICE_IVSHMEM, + QEMU_CAPS_DEVICE_RTL8139, + QEMU_CAPS_DEVICE_E1000, ++ QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DEVICE_VIRTIO_NET); + DO_TEST("qemu-1.0", 1000000, 0, 0, + QEMU_CAPS_DRIVE_CACHE_UNSAFE, +@@ -328,6 +331,7 @@ mymain(void) + QEMU_CAPS_DEVICE_RTL8139, + QEMU_CAPS_DEVICE_E1000, + QEMU_CAPS_DEVICE_VIRTIO_NET, ++ QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DISPLAY); + DO_TEST("qemu-1.1.0", 1001000, 0, 0, + QEMU_CAPS_DRIVE_CACHE_UNSAFE, +@@ -411,6 +415,7 @@ mymain(void) + QEMU_CAPS_DEVICE_RTL8139, + QEMU_CAPS_DEVICE_E1000, + QEMU_CAPS_DEVICE_VIRTIO_NET, ++ QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DISPLAY); + DO_TEST_FULL("qemu-1.2.0", 1002000, 0, 0, VIR_ERR_CONFIG_UNSUPPORTED, + QEMU_CAPS_LAST); +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_PL011.patch b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_PL011.patch new file mode 100644 index 0000000..df40ba1 --- /dev/null +++ b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_PL011.patch @@ -0,0 +1,90 @@ +From 5b5832decc253ce95535c9a6cf1eee6b5ed475fc Mon Sep 17 00:00:00 2001 +Message-Id: <5b5832decc253ce95535c9a6cf1eee6b5ed475fc@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:19 +0100 +Subject: [PATCH] qemu: Add QEMU_CAPS_DEVICE_PL011 + +All serial devices shoule have an associated capability. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit a45ecb7bf6b43a863ef0980156e822d414975994) + + Conflicts: + tests/qemucapabilitiesdata/caps_2.10.0-gicv2.aarch64.xml + tests/qemucapabilitiesdata/caps_2.10.0-gicv3.aarch64.xml + + These caps do not exists in the current version. + +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_capabilities.c | 4 ++++ + src/qemu/qemu_capabilities.h | 3 +++ + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + + 4 files changed, 9 insertions(+) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 08c6653424..ae5448eaaa 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -453,6 +453,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, + "disk-share-rw", + + "isa-serial", ++ ++ /* 280 */ ++ "pl011", + ); + + +@@ -1684,6 +1687,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, + { "sclplmconsole", QEMU_CAPS_DEVICE_SCLPLMCONSOLE }, + { "isa-serial", QEMU_CAPS_DEVICE_ISA_SERIAL }, ++ { "pl011", QEMU_CAPS_DEVICE_PL011 }, + }; + + static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = { +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index f0bd88f897..c809f83404 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -440,6 +440,9 @@ typedef enum { + + QEMU_CAPS_DEVICE_ISA_SERIAL, /* -device isa-serial */ + ++ /* 280 */ ++ QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ ++ + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +index e699bdbafd..d3e2e18faa 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +@@ -173,6 +173,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +index f4c1de7e1d..bc86d03537 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +@@ -173,6 +173,7 @@ + + + ++ + 2006000 + 0 + +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_SPAPR_VTY.patch b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_SPAPR_VTY.patch new file mode 100644 index 0000000..7599fd4 --- /dev/null +++ b/SOURCES/libvirt-qemu-Add-QEMU_CAPS_DEVICE_SPAPR_VTY.patch @@ -0,0 +1,195 @@ +From a8befcda79640ae13c9787cb3be54ca2ee861077 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:51 +0100 +Subject: [PATCH] qemu: Add QEMU_CAPS_DEVICE_SPAPR_VTY + +Up until now we assumed the spapr-vty device would always be +present, which is not very nice. Check for its availability before +using it instead. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 87eabeb17d637b753dbb1e63e417e25bbd0f7d61) + + Conflicts: + src/qemu/qemu_capabilities.c + src/qemu/qemu_capabilities.h + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml + + Insert the new capability in the right place, in both + declarations and caps. + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_capabilities.c | 3 ++- + src/qemu/qemu_capabilities.h | 2 +- + src/qemu/qemu_command.c | 6 ++++++ + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 + + tests/qemuxml2argvtest.c | 12 ++++++++++++ + 7 files changed, 24 insertions(+), 2 deletions(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 2f41e076cb..0defa9a3e4 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -445,7 +445,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, + "virtio-blk.num-queues", + "machine.pseries.resize-hpt", + +- ++ "spapr-vty", + + /* 275 */ + +@@ -1679,6 +1679,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "pcie-root-port", QEMU_CAPS_DEVICE_PCIE_ROOT_PORT }, + { "qemu-xhci", QEMU_CAPS_DEVICE_QEMU_XHCI }, + { "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, ++ { "spapr-vty", QEMU_CAPS_DEVICE_SPAPR_VTY }, + }; + + static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = { +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index 60818daa1c..65b969a0ea 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -431,7 +431,7 @@ typedef enum { + QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */ + QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */ + +- ++ QEMU_CAPS_DEVICE_SPAPR_VTY, /* -device spapr-vty */ + + /* 275 */ + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index fc7f54e81e..65b6a59d3f 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -10308,6 +10308,12 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + if (qemuDomainIsPSeries(def)) { + if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL && + serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_VTY)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("spapr-vty not supported in this QEMU binary")); ++ goto error; ++ } ++ + virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s", + serial->info.alias); + } +diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +index c01777a5a3..c95025b41f 100644 +--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +@@ -178,6 +178,7 @@ + + + ++ + + 2010000 + 0 +diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +index f1c9fc98a4..5ff8598fc8 100644 +--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml +@@ -167,6 +167,7 @@ + + + ++ + 2006000 + 0 + +diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +index e912211f40..3b70b1a407 100644 +--- a/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml +@@ -173,6 +173,7 @@ + + + ++ + + 2009000 + 0 +diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c +index 4e981c9fab..70c72e4e64 100644 +--- a/tests/qemuxml2argvtest.c ++++ b/tests/qemuxml2argvtest.c +@@ -1756,50 +1756,62 @@ mymain(void) + DO_TEST_PARSE_ERROR("seclabel-device-duplicates", NONE); + + DO_TEST("pseries-basic", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-vio", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-usb-default", + QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_PIIX3_USB_UHCI, + QEMU_CAPS_PCI_OHCI, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("pseries-usb-multi", + QEMU_CAPS_NODEFCONFIG, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_PIIX3_USB_UHCI, + QEMU_CAPS_PCI_OHCI, + QEMU_CAPS_PCI_MULTIFUNCTION); + DO_TEST("pseries-vio-user-assigned", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST_PARSE_ERROR("pseries-vio-address-clash", + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_NVRAM); + DO_TEST("pseries-usb-kbd", QEMU_CAPS_PCI_OHCI, + QEMU_CAPS_DEVICE_USB_KBD, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-cpu-exact", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST_PARSE_ERROR("pseries-no-parallel", + QEMU_CAPS_NODEFCONFIG); + + qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64); + DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-cpu-le", QEMU_CAPS_KVM, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST_FAILURE("pseries-cpu-compat-power9", QEMU_CAPS_KVM); + + qemuTestSetHostCPU(driver.caps, cpuPower9); + DO_TEST("pseries-cpu-compat-power9", + QEMU_CAPS_KVM, ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + qemuTestSetHostCPU(driver.caps, NULL); + + qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE); + + DO_TEST("pseries-panic-missing", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-panic-no-address", ++ QEMU_CAPS_DEVICE_SPAPR_VTY, + QEMU_CAPS_NODEFCONFIG); + DO_TEST_FAILURE("pseries-panic-address", + QEMU_CAPS_NODEFCONFIG); +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Add-device-id-for-mediated-devices-on-qemu-command-line.patch b/SOURCES/libvirt-qemu-Add-device-id-for-mediated-devices-on-qemu-command-line.patch deleted file mode 100644 index 939482a..0000000 --- a/SOURCES/libvirt-qemu-Add-device-id-for-mediated-devices-on-qemu-command-line.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 23a4263e7611fa3f1e69f5bab7056a85e48d6b23 Mon Sep 17 00:00:00 2001 -Message-Id: <23a4263e7611fa3f1e69f5bab7056a85e48d6b23@dist-git> -From: Erik Skultety -Date: Tue, 4 Apr 2017 08:54:51 +0200 -Subject: [PATCH] qemu: Add device id for mediated devices on qemu command line - -Like all devices, add the 'id' option for mdevs as well. Patch also -adjusts the test accordingly. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1438431 - -(cherry picked from commit c3272e5e12e0bfd43b8101b73ae13d264c13337f) -Signed-off-by: Erik Skultety ---- - src/qemu/qemu_command.c | 3 ++- - tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 1a2984e56..59fedaaaf 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -5231,7 +5231,8 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def, - char *ret = NULL; - - virBufferAddLit(&buf, "vfio-pci"); -- virBufferAsprintf(&buf, ",sysfsdev=%s", -+ virBufferAsprintf(&buf, ",id=%s,sysfsdev=%s", -+ dev->info->alias, - virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr)); - - if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args -index fdefeb610..76e77707b 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-precreated.args -@@ -20,6 +20,6 @@ QEMU_AUDIO_DRV=none \ - -usb \ - -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \ - -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ ---device vfio-pci,\ -+-device vfio-pci,id=hostdev0,\ - sysfsdev=/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,bus=pci.0,\ - addr=0x3 --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Add-migratable-parameter-to-virQEMUCapsInitCPUModel.patch b/SOURCES/libvirt-qemu-Add-migratable-parameter-to-virQEMUCapsInitCPUModel.patch deleted file mode 100644 index 48e7c6e..0000000 --- a/SOURCES/libvirt-qemu-Add-migratable-parameter-to-virQEMUCapsInitCPUModel.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 241d9b0d3945072ad74f9a0a5dcdb541cc2ad50b Mon Sep 17 00:00:00 2001 -Message-Id: <241d9b0d3945072ad74f9a0a5dcdb541cc2ad50b@dist-git> -From: Jiri Denemark -Date: Wed, 29 Mar 2017 13:33:50 +0200 -Subject: [PATCH] qemu: Add migratable parameter to virQEMUCapsInitCPUModel - -The caller can ask for a migratable CPU model by passing true for the -new parameter. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 00e0cbcb567a57c7b5a145d7fd3fb662779f6bec) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 36 +++++++++++++++++++++++++----------- - src/qemu/qemu_capspriv.h | 3 ++- - tests/cputest.c | 2 +- - 3 files changed, 28 insertions(+), 13 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index b71de9633..eb6b674b4 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -3118,7 +3118,8 @@ virQEMUCapsCPUFilterFeatures(const char *name, - static int - virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, - qemuMonitorCPUModelInfoPtr modelInfo, -- virCPUDefPtr cpu) -+ virCPUDefPtr cpu, -+ bool migratable) - { - size_t i; - -@@ -3146,8 +3147,12 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, - - if (VIR_STRDUP(feature->name, prop->name) < 0) - return -1; -- feature->policy = prop->value.boolean ? VIR_CPU_FEATURE_REQUIRE -- : VIR_CPU_FEATURE_DISABLE; -+ -+ if (!prop->value.boolean || -+ (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO)) -+ feature->policy = VIR_CPU_FEATURE_DISABLE; -+ else -+ feature->policy = VIR_CPU_FEATURE_REQUIRE; - cpu->nfeatures++; - } - -@@ -3164,7 +3169,8 @@ static int - virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - qemuMonitorCPUModelInfoPtr model, -- virCPUDefPtr cpu) -+ virCPUDefPtr cpu, -+ bool migratable) - { - virCPUDataPtr data = NULL; - unsigned long long sigFamily = 0; -@@ -3185,9 +3191,13 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, - - switch (prop->type) { - case QEMU_MONITOR_CPU_PROPERTY_BOOLEAN: -- if (prop->value.boolean && -- virCPUx86DataAddFeature(data, prop->name) < 0) -+ if (!prop->value.boolean || -+ (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO)) -+ continue; -+ -+ if (virCPUx86DataAddFeature(data, prop->name) < 0) - goto cleanup; -+ - break; - - case QEMU_MONITOR_CPU_PROPERTY_STRING: -@@ -3226,13 +3236,14 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, - - /** - * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps, -- * 1 when the caller should fall back to using virCapsPtr->host.cpu, -+ * 1 when the caller should fall back to other methods - * -1 on error. - */ - int - virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, -- virCPUDefPtr cpu) -+ virCPUDefPtr cpu, -+ bool migratable) - { - qemuMonitorCPUModelInfoPtr model; - int ret = 1; -@@ -3242,10 +3253,13 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - else - model = qemuCaps->tcgCPUModelInfo; - -+ if (migratable && model && !model->migratability) -+ return 1; -+ - if (ARCH_IS_S390(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu); -+ ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu, migratable); - else if (ARCH_IS_X86(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu); -+ ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu, migratable); - - if (ret == 0) - cpu->fallback = VIR_CPU_FALLBACK_FORBID; -@@ -3274,7 +3288,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - cpu->match = VIR_CPU_MATCH_EXACT; - cpu->fallback = VIR_CPU_FALLBACK_ALLOW; - -- if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu)) < 0) { -+ if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) { - goto error; - } else if (rc == 1) { - VIR_DEBUG("No host CPU model info from QEMU; probing host CPU directly"); -diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h -index 61ccd4517..1baaaf334 100644 ---- a/src/qemu/qemu_capspriv.h -+++ b/src/qemu/qemu_capspriv.h -@@ -81,7 +81,8 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - int - virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, -- virCPUDefPtr cpu); -+ virCPUDefPtr cpu, -+ bool migratable); - - void - virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps, -diff --git a/tests/cputest.c b/tests/cputest.c -index 3d3e43f16..8c07cf4f6 100644 ---- a/tests/cputest.c -+++ b/tests/cputest.c -@@ -709,7 +709,7 @@ cpuTestJSONCPUID(const void *arg) - cpu->match = VIR_CPU_MATCH_EXACT; - cpu->fallback = VIR_CPU_FALLBACK_FORBID; - -- if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu) != 0) -+ if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false) != 0) - goto cleanup; - - ret = cpuTestCompareXML(data->arch, cpu, result, false); --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Add-qemuDomainCheckABIStability.patch b/SOURCES/libvirt-qemu-Add-qemuDomainCheckABIStability.patch deleted file mode 100644 index 581dc7c..0000000 --- a/SOURCES/libvirt-qemu-Add-qemuDomainCheckABIStability.patch +++ /dev/null @@ -1,110 +0,0 @@ -From bf20b6cf07e5462c892b5e3c3d76a3c354606ea4 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Wed, 14 Jun 2017 13:43:37 +0200 -Subject: [PATCH] qemu: Add qemuDomainCheckABIStability - -When making ABI stability checks for an active domain, we need to make -sure we use the same migratable definition which virDomainGetXMLDesc -with the MIGRATABLE flag provides, otherwise the ABI check will fail. -This is implemented in the new qemuDomainCheckABIStability which takes a -domain object and generates the right migratable definition from it. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 063b2b8788db204d0ac2e1d367fd0c5eb9b81451) - -https://bugzilla.redhat.com/show_bug.cgi?id=1460952 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_domain.c | 41 ++++++++++++++++++++++++++++++++++++----- - src/qemu/qemu_domain.h | 4 ++++ - 2 files changed, 40 insertions(+), 5 deletions(-) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index b3dc2bc3ac..1528c6a137 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -5909,6 +5909,10 @@ qemuDomainMigratableDefCheckABIStability(virQEMUDriverPtr driver, - } - - -+#define COPY_FLAGS (VIR_DOMAIN_XML_SECURE | \ -+ VIR_DOMAIN_XML_UPDATE_CPU | \ -+ VIR_DOMAIN_XML_MIGRATABLE) -+ - bool - qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - virDomainDefPtr src, -@@ -5916,13 +5920,10 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - { - virDomainDefPtr migratableDefSrc = NULL; - virDomainDefPtr migratableDefDst = NULL; -- const unsigned int flags = VIR_DOMAIN_XML_SECURE | -- VIR_DOMAIN_XML_UPDATE_CPU | -- VIR_DOMAIN_XML_MIGRATABLE; - bool ret = false; - -- if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, flags)) || -- !(migratableDefDst = qemuDomainDefCopy(driver, dst, flags))) -+ if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, COPY_FLAGS)) || -+ !(migratableDefDst = qemuDomainDefCopy(driver, dst, COPY_FLAGS))) - goto cleanup; - - ret = qemuDomainMigratableDefCheckABIStability(driver, -@@ -5935,6 +5936,36 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - return ret; - } - -+ -+bool -+qemuDomainCheckABIStability(virQEMUDriverPtr driver, -+ virDomainObjPtr vm, -+ virDomainDefPtr dst) -+{ -+ virDomainDefPtr migratableSrc = NULL; -+ virDomainDefPtr migratableDst = NULL; -+ char *xml = NULL; -+ bool ret = false; -+ -+ if (!(xml = qemuDomainFormatXML(driver, vm, COPY_FLAGS)) || -+ !(migratableSrc = qemuDomainDefFromXML(driver, xml)) || -+ !(migratableDst = qemuDomainDefCopy(driver, dst, COPY_FLAGS))) -+ goto cleanup; -+ -+ ret = qemuDomainMigratableDefCheckABIStability(driver, -+ vm->def, migratableSrc, -+ dst, migratableDst); -+ -+ cleanup: -+ VIR_FREE(xml); -+ virDomainDefFree(migratableSrc); -+ virDomainDefFree(migratableDst); -+ return ret; -+} -+ -+#undef COPY_FLAGS -+ -+ - bool - qemuDomainAgentAvailable(virDomainObjPtr vm, - bool reportError) -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index d635d2995f..7ad34e563e 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -668,6 +668,10 @@ bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - virDomainDefPtr src, - virDomainDefPtr dst); - -+bool qemuDomainCheckABIStability(virQEMUDriverPtr driver, -+ virDomainObjPtr vm, -+ virDomainDefPtr dst); -+ - bool qemuDomainAgentAvailable(virDomainObjPtr vm, - bool reportError); - --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Add-qemuDomainMigratableDefCheckABIStability.patch b/SOURCES/libvirt-qemu-Add-qemuDomainMigratableDefCheckABIStability.patch deleted file mode 100644 index 4bd3edf..0000000 --- a/SOURCES/libvirt-qemu-Add-qemuDomainMigratableDefCheckABIStability.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 2e728d3be5792685c38adbd61e80318e51985897 Mon Sep 17 00:00:00 2001 -Message-Id: <2e728d3be5792685c38adbd61e80318e51985897@dist-git> -From: Jiri Denemark -Date: Wed, 14 Jun 2017 13:43:12 +0200 -Subject: [PATCH] qemu: Add qemuDomainMigratableDefCheckABIStability - -This patch separates the actual ABI checks from getting migratable defs -in qemuDomainDefCheckABIStability so that we can create another wrapper -which will use different methods to get the migratable defs. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit a0912df3faac8b58725f45b8cf928990999585a3) - -https://bugzilla.redhat.com/show_bug.cgi?id=1460952 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_domain.c | 34 +++++++++++++++++++++++----------- - 1 file changed, 23 insertions(+), 11 deletions(-) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index ce75105afa..b3dc2bc3ac 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -5889,6 +5889,26 @@ virDomainABIStability virQEMUDriverDomainABIStability = { - }; - - -+static bool -+qemuDomainMigratableDefCheckABIStability(virQEMUDriverPtr driver, -+ virDomainDefPtr src, -+ virDomainDefPtr migratableSrc, -+ virDomainDefPtr dst, -+ virDomainDefPtr migratableDst) -+{ -+ if (!virDomainDefCheckABIStabilityFlags(migratableSrc, -+ migratableDst, -+ driver->xmlopt, -+ VIR_DOMAIN_DEF_ABI_CHECK_SKIP_VOLATILE)) -+ return false; -+ -+ /* Force update any skipped values from the volatile flag */ -+ dst->mem.cur_balloon = src->mem.cur_balloon; -+ -+ return true; -+} -+ -+ - bool - qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - virDomainDefPtr src, -@@ -5899,23 +5919,15 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, - const unsigned int flags = VIR_DOMAIN_XML_SECURE | - VIR_DOMAIN_XML_UPDATE_CPU | - VIR_DOMAIN_XML_MIGRATABLE; -- const unsigned int check_flags = VIR_DOMAIN_DEF_ABI_CHECK_SKIP_VOLATILE; - bool ret = false; - - if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, flags)) || - !(migratableDefDst = qemuDomainDefCopy(driver, dst, flags))) - goto cleanup; - -- if (!virDomainDefCheckABIStabilityFlags(migratableDefSrc, -- migratableDefDst, -- driver->xmlopt, -- check_flags)) -- goto cleanup; -- -- /* Force update any skipped values from the volatile flag */ -- dst->mem.cur_balloon = src->mem.cur_balloon; -- -- ret = true; -+ ret = qemuDomainMigratableDefCheckABIStability(driver, -+ src, migratableDefSrc, -+ dst, migratableDefDst); - - cleanup: - virDomainDefFree(migratableDefSrc); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Add-qemuProcessFetchGuestCPU.patch b/SOURCES/libvirt-qemu-Add-qemuProcessFetchGuestCPU.patch deleted file mode 100644 index 3890b04..0000000 --- a/SOURCES/libvirt-qemu-Add-qemuProcessFetchGuestCPU.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 57a9f46878f57d1602a030cfd8484c8566201c40 Mon Sep 17 00:00:00 2001 -Message-Id: <57a9f46878f57d1602a030cfd8484c8566201c40@dist-git> -From: Jiri Denemark -Date: Tue, 11 Jul 2017 13:18:45 +0200 -Subject: [PATCH] qemu: Add qemuProcessFetchGuestCPU - -Separated from qemuProcessUpdateLiveGuestCPU. Its purpose is to fetch -guest CPU data from a running QEMU process. The data can later be used -to verify and update the active guest CPU definition. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 40d246a22b46f1691d09cbce5904c79d712d8c16) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_process.c | 58 +++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 44 insertions(+), 14 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 4d7c8d8e40..d3fa8ef41e 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3905,6 +3905,47 @@ qemuProcessVerifyCPUFeatures(virDomainDefPtr def, - - - static int -+qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, -+ virDomainObjPtr vm, -+ qemuDomainAsyncJob asyncJob, -+ virCPUDataPtr *enabled, -+ virCPUDataPtr *disabled) -+{ -+ qemuDomainObjPrivatePtr priv = vm->privateData; -+ virCPUDataPtr dataEnabled = NULL; -+ virCPUDataPtr dataDisabled = NULL; -+ int rc; -+ -+ *enabled = NULL; -+ *disabled = NULL; -+ -+ if (!ARCH_IS_X86(vm->def->os.arch)) -+ return 0; -+ -+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) -+ goto error; -+ -+ rc = qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch, -+ &dataEnabled, &dataDisabled); -+ -+ if (qemuDomainObjExitMonitor(driver, vm) < 0) -+ goto error; -+ -+ if (rc == -1) -+ goto error; -+ -+ *enabled = dataEnabled; -+ *disabled = dataDisabled; -+ return 0; -+ -+ error: -+ virCPUDataFree(dataEnabled); -+ virCPUDataFree(dataDisabled); -+ return -1; -+} -+ -+ -+static int - qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) -@@ -3917,21 +3958,10 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - int ret = -1; - virCPUDefPtr orig = NULL; - -- if (ARCH_IS_X86(def->os.arch)) { -- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) -- goto cleanup; -- -- rc = qemuMonitorGetGuestCPU(priv->mon, def->os.arch, &cpu, &disabled); -- -- if (qemuDomainObjExitMonitor(driver, vm) < 0) -- goto cleanup; -- -- if (rc < 0) { -- if (rc == -2) -- ret = 0; -- goto cleanup; -- } -+ if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) -+ goto cleanup; - -+ if (cpu) { - if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 || - qemuProcessVerifyHypervFeatures(def, cpu) < 0) - goto cleanup; --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Add-qemuProcessUpdateLiveGuestCPU.patch b/SOURCES/libvirt-qemu-Add-qemuProcessUpdateLiveGuestCPU.patch deleted file mode 100644 index 33bd482..0000000 --- a/SOURCES/libvirt-qemu-Add-qemuProcessUpdateLiveGuestCPU.patch +++ /dev/null @@ -1,127 +0,0 @@ -From e5840b68e6376a514c6c5de1897ac87dc57e7a58 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 11 Jul 2017 13:51:17 +0200 -Subject: [PATCH] qemu: Add qemuProcessUpdateLiveGuestCPU - -Separated from qemuProcessUpdateAndVerifyCPU to handle updating of an -active guest CPU definition according to live data from QEMU. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit eef9f83b691e0713e4fc480b497b85517aba6ca4) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_process.c | 72 ++++++++++++++++++++++++++++++------------------- - 1 file changed, 44 insertions(+), 28 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 1e7724e784..9df463094e 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3971,17 +3971,55 @@ qemuProcessVerifyCPU(virDomainObjPtr vm, - - - static int -+qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, -+ virCPUDataPtr enabled, -+ virCPUDataPtr disabled) -+{ -+ virDomainDefPtr def = vm->def; -+ qemuDomainObjPrivatePtr priv = vm->privateData; -+ virCPUDefPtr orig = NULL; -+ int rc; -+ int ret = -1; -+ -+ if (!enabled) -+ return 0; -+ -+ if (!def->cpu || -+ (def->cpu->mode == VIR_CPU_MODE_CUSTOM && -+ !def->cpu->model)) -+ return 0; -+ -+ if (!(orig = virCPUDefCopy(def->cpu))) -+ goto cleanup; -+ -+ if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, enabled, disabled)) < 0) { -+ goto cleanup; -+ } else if (rc == 0) { -+ /* Store the original CPU in priv if QEMU changed it and we didn't -+ * get the original CPU via migration, restore, or snapshot revert. -+ */ -+ if (!priv->origCPU && !virCPUDefIsEqual(def->cpu, orig, false)) -+ VIR_STEAL_PTR(priv->origCPU, orig); -+ -+ def->cpu->check = VIR_CPU_CHECK_FULL; -+ } -+ -+ ret = 0; -+ -+ cleanup: -+ virCPUDefFree(orig); -+ return ret; -+} -+ -+ -+static int - qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) - { -- virDomainDefPtr def = vm->def; - virCPUDataPtr cpu = NULL; - virCPUDataPtr disabled = NULL; -- qemuDomainObjPrivatePtr priv = vm->privateData; -- int rc; - int ret = -1; -- virCPUDefPtr orig = NULL; - - if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) - goto cleanup; -@@ -3989,36 +4027,14 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver, - if (qemuProcessVerifyCPU(vm, cpu) < 0) - goto cleanup; - -- if (cpu) { -- if (!def->cpu || -- (def->cpu->mode == VIR_CPU_MODE_CUSTOM && -- !def->cpu->model)) { -- ret = 0; -- goto cleanup; -- } -- -- if (!(orig = virCPUDefCopy(def->cpu))) -- goto cleanup; -- -- if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0) { -- goto cleanup; -- } else if (rc == 0) { -- /* Store the original CPU in priv if QEMU changed it and we didn't -- * get the original CPU via migration, restore, or snapshot revert. -- */ -- if (!priv->origCPU && !virCPUDefIsEqual(def->cpu, orig, false)) -- VIR_STEAL_PTR(priv->origCPU, orig); -- -- def->cpu->check = VIR_CPU_CHECK_FULL; -- } -- } -+ if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) -+ goto cleanup; - - ret = 0; - - cleanup: - virCPUDataFree(cpu); - virCPUDataFree(disabled); -- virCPUDefFree(orig); - return ret; - } - --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Add-qemuProcessVerifyCPU.patch b/SOURCES/libvirt-qemu-Add-qemuProcessVerifyCPU.patch deleted file mode 100644 index c557e14..0000000 --- a/SOURCES/libvirt-qemu-Add-qemuProcessVerifyCPU.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 9d41cae9942d2909be00261b3ae2a2e1ec717808 Mon Sep 17 00:00:00 2001 -Message-Id: <9d41cae9942d2909be00261b3ae2a2e1ec717808@dist-git> -From: Jiri Denemark -Date: Tue, 11 Jul 2017 13:26:12 +0200 -Subject: [PATCH] qemu: Add qemuProcessVerifyCPU - -Separated from qemuProcessUpdateLiveGuestCPU. The function makes sure -a guest CPU provides all features required by a domain definition. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 5cac2fe108f957b2629a29bea1747fdb3c8d7aa3) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_process.c | 35 ++++++++++++++++++++++++++++------- - 1 file changed, 28 insertions(+), 7 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index d3fa8ef41e..3f7a9f4c02 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3946,6 +3946,31 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, - - - static int -+qemuProcessVerifyCPU(virDomainObjPtr vm, -+ virCPUDataPtr cpu) -+{ -+ virDomainDefPtr def = vm->def; -+ -+ if (!cpu) -+ return 0; -+ -+ if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 || -+ qemuProcessVerifyHypervFeatures(def, cpu) < 0) -+ return -1; -+ -+ if (!def->cpu || -+ (def->cpu->mode == VIR_CPU_MODE_CUSTOM && -+ !def->cpu->model)) -+ return 0; -+ -+ if (qemuProcessVerifyCPUFeatures(def, cpu) < 0) -+ return -1; -+ -+ return 0; -+} -+ -+ -+static int - qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) -@@ -3961,11 +3986,10 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) - goto cleanup; - -- if (cpu) { -- if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 || -- qemuProcessVerifyHypervFeatures(def, cpu) < 0) -- goto cleanup; -+ if (qemuProcessVerifyCPU(vm, cpu) < 0) -+ goto cleanup; - -+ if (cpu) { - if (!def->cpu || - (def->cpu->mode == VIR_CPU_MODE_CUSTOM && - !def->cpu->model)) { -@@ -3973,9 +3997,6 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - goto cleanup; - } - -- if (qemuProcessVerifyCPUFeatures(def, cpu) < 0) -- goto cleanup; -- - if (!(orig = virCPUDefCopy(def->cpu))) - goto cleanup; - --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Add-support-for-guest-CPU-cache.patch b/SOURCES/libvirt-qemu-Add-support-for-guest-CPU-cache.patch deleted file mode 100644 index e9c0308..0000000 --- a/SOURCES/libvirt-qemu-Add-support-for-guest-CPU-cache.patch +++ /dev/null @@ -1,667 +0,0 @@ -From b34dc87751a8667f22ea78730a5b678f5bd469a4 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 25 Apr 2017 19:07:19 +0200 -Subject: [PATCH] qemu: Add support for guest CPU cache - -This patch maps /domain/cpu/cache element into -cpu parameters: - -- is translated to host-cache-info=on -- is transformed into l3-cache=on -- is turned in host-cache-info=off,l3-cache=off - -Any other element is forbidden. - -The tricky part is detecting whether QEMU supports the CPU properties. - -The 'host-cache-info' property is introduced in v2.4.0-1389-ge265e3e480, -earlier QEMU releases enabled host-cache-info by default and had no way -to disable it. If the property is present, it defaults to 'off' for any -QEMU until at least 2.9.0. - -The 'l3-cache' property was introduced later by v2.7.0-200-g14c985cffa. -Earlier versions worked as if l3-cache=off was passed. For any QEMU -until at least 2.9.0 l3-cache is 'off' by default. - -QEMU 2.9.0 was the first release which supports probing both properties -by running device-list-properties with typename=host-x86_64-cpu. Older -QEMU releases did not support device-list-properties command for CPU -devices. Thus we can't really rely on probing them and we can just use -query-cpu-model-expansion QMP command as a witness. - -Because the cache property probing is only reliable for QEMU >= 2.9.0 -when both are already supported for quite a few releases, we let QEMU -report an error if a specific cache mode is explicitly requested. The -other mode (or both if a user requested CPU cache to be disabled) is -explicitly turned off for QEMU >= 2.9.0 to avoid any surprises in case -the QEMU defaults change. Any older QEMU already turns them off so not -doing so explicitly does not make any harm. - -Signed-off-by: Jiri Denemark -(cherry picked from commit df13c0b477ffda460eed259c3b8aab7255f11199) - -https://bugzilla.redhat.com/show_bug.cgi?id=1428952 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 5 ++ - src/qemu/qemu_capabilities.h | 1 + - src/qemu/qemu_command.c | 39 ++++++++++++++++ - src/qemu/qemu_domain.c | 54 ++++++++++++++++++++++ - tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + - .../qemuxml2argv-cpu-cache-disable.args | 21 +++++++++ - .../qemuxml2argv-cpu-cache-disable.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-disable2.args | 21 +++++++++ - .../qemuxml2argv-cpu-cache-disable2.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-disable3.args | 22 +++++++++ - .../qemuxml2argv-cpu-cache-disable3.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-emulate-l2.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-emulate-l3.args | 21 +++++++++ - .../qemuxml2argv-cpu-cache-emulate-l3.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-passthrough-l3.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-passthrough.args | 21 +++++++++ - .../qemuxml2argv-cpu-cache-passthrough.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-passthrough2.args | 21 +++++++++ - .../qemuxml2argv-cpu-cache-passthrough2.xml | 20 ++++++++ - .../qemuxml2argv-cpu-cache-passthrough3.xml | 20 ++++++++ - tests/qemuxml2argvtest.c | 10 ++++ - 21 files changed, 417 insertions(+) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 950a42bae..2c845853a 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -364,6 +364,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, - "query-cpu-definitions", /* 250 */ - "block-write-threshold", - "query-named-block-nodes", -+ "cpu-cache", - ); - - -@@ -4648,6 +4649,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) - virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM); - -+ if (ARCH_IS_X86(qemuCaps->arch) && -+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) -+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_CACHE); -+ - ret = 0; - cleanup: - return ret; -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index 24e2f38ee..c466a63e7 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -401,6 +401,7 @@ typedef enum { - QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */ - QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */ - QEMU_CAPS_QUERY_NAMED_BLOCK_NODES, /* qmp query-named-block-nodes */ -+ QEMU_CAPS_CPU_CACHE, /* -cpu supports host-cache-info and l3-cache properties */ - - QEMU_CAPS_LAST /* this must always be the last item */ - } virQEMUCapsFlags; -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index ff7f47e06..2105cde58 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -7071,6 +7071,45 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, - have_cpu = true; - } - -+ if (def->cpu && def->cpu->cache) { -+ virCPUCacheDefPtr cache = def->cpu->cache; -+ bool hostOff = false; -+ bool l3Off = false; -+ -+ if (!have_cpu) { -+ virBufferAdd(&buf, default_model, -1); -+ have_cpu = true; -+ } -+ -+ switch (cache->mode) { -+ case VIR_CPU_CACHE_MODE_EMULATE: -+ virBufferAddLit(&buf, ",l3-cache=on"); -+ hostOff = true; -+ break; -+ -+ case VIR_CPU_CACHE_MODE_PASSTHROUGH: -+ virBufferAddLit(&buf, ",host-cache-info=on"); -+ l3Off = true; -+ break; -+ -+ case VIR_CPU_CACHE_MODE_DISABLE: -+ hostOff = l3Off = true; -+ break; -+ -+ case VIR_CPU_CACHE_MODE_LAST: -+ break; -+ } -+ -+ if (hostOff && -+ def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH && -+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_CACHE)) -+ virBufferAddLit(&buf, ",host-cache-info=off"); -+ -+ if (l3Off && -+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_CACHE)) -+ virBufferAddLit(&buf, ",l3-cache=off"); -+ } -+ - if (virBufferCheckError(&buf) < 0) - goto cleanup; - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 9c09ced0c..d31645fd1 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -2688,6 +2688,60 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def) - if (!def->cpu) - return 0; - -+ if (def->cpu->cache) { -+ virCPUCacheDefPtr cache = def->cpu->cache; -+ -+ if (!ARCH_IS_X86(def->os.arch)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("CPU cache specification is not supported " -+ "for '%s' architecture"), -+ virArchToString(def->os.arch)); -+ return -1; -+ } -+ -+ switch (cache->mode) { -+ case VIR_CPU_CACHE_MODE_EMULATE: -+ if (cache->level != 3) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("CPU cache mode '%s' can only be used with " -+ "level='3'"), -+ virCPUCacheModeTypeToString(cache->mode)); -+ return -1; -+ } -+ break; -+ -+ case VIR_CPU_CACHE_MODE_PASSTHROUGH: -+ if (def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("CPU cache mode '%s' can only be used with " -+ "'%s' CPUs"), -+ virCPUCacheModeTypeToString(cache->mode), -+ virCPUModeTypeToString(VIR_CPU_MODE_HOST_PASSTHROUGH)); -+ return -1; -+ } -+ -+ if (cache->level != -1) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("unsupported CPU cache level for mode '%s'"), -+ virCPUCacheModeTypeToString(cache->mode)); -+ return -1; -+ } -+ break; -+ -+ case VIR_CPU_CACHE_MODE_DISABLE: -+ if (cache->level != -1) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, -+ _("unsupported CPU cache level for mode '%s'"), -+ virCPUCacheModeTypeToString(cache->mode)); -+ return -1; -+ } -+ break; -+ -+ case VIR_CPU_CACHE_MODE_LAST: -+ break; -+ } -+ } -+ - /* Nothing to be done if only CPU topology is specified. */ - if (def->cpu->mode == VIR_CPU_MODE_CUSTOM && - !def->cpu->model) -diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml -index 6386c4ed0..496c9ceb8 100644 ---- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml -+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml -@@ -207,6 +207,7 @@ - - - -+ - 2008090 - 0 - (v2.9.0-rc0-142-g940a8ce) -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args -new file mode 100644 -index 000000000..386e38d37 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.args -@@ -0,0 +1,21 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu host,host-cache-info=off,l3-cache=off \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml -new file mode 100644 -index 000000000..e6f39951c ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args -new file mode 100644 -index 000000000..9348e01f8 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.args -@@ -0,0 +1,21 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu host \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml -new file mode 100644 -index 000000000..e6f39951c ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable2.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args -new file mode 100644 -index 000000000..b882710c1 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.args -@@ -0,0 +1,22 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu core2duo,+ds,+acpi,+ss,+ht,+tm,+pbe,+ds_cpl,+vmx,+est,+tm2,+cx16,+xtpr,\ -++lahf_lm,l3-cache=off \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml -new file mode 100644 -index 000000000..17078a1e8 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-disable3.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml -new file mode 100644 -index 000000000..4757e85ea ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l2.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args -new file mode 100644 -index 000000000..c2f5d19e1 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.args -@@ -0,0 +1,21 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu host,l3-cache=on,host-cache-info=off \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml -new file mode 100644 -index 000000000..17019c673 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-emulate-l3.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml -new file mode 100644 -index 000000000..3471115ea ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough-l3.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args -new file mode 100644 -index 000000000..1d824f6dd ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.args -@@ -0,0 +1,21 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu host,host-cache-info=on,l3-cache=off \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml -new file mode 100644 -index 000000000..74846fdd3 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args -new file mode 100644 -index 000000000..d7863ba2e ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.args -@@ -0,0 +1,21 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/kvm \ -+-name foo \ -+-S \ -+-M pc \ -+-cpu host,host-cache-info=on \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-foo/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml -new file mode 100644 -index 000000000..74846fdd3 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough2.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml -new file mode 100644 -index 000000000..6ad65700b ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-cache-passthrough3.xml -@@ -0,0 +1,20 @@ -+ -+ foo -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ -+ -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index 94be771d3..81cd2a6ec 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -2521,6 +2521,16 @@ mymain(void) - DO_TEST("cpu-check-default-partial", QEMU_CAPS_KVM); - DO_TEST("cpu-check-default-partial2", QEMU_CAPS_KVM); - -+ DO_TEST("cpu-cache-disable", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); -+ DO_TEST("cpu-cache-disable2", QEMU_CAPS_KVM); -+ DO_TEST("cpu-cache-disable3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); -+ DO_TEST("cpu-cache-passthrough", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); -+ DO_TEST("cpu-cache-passthrough2", QEMU_CAPS_KVM); -+ DO_TEST("cpu-cache-emulate-l3", QEMU_CAPS_KVM, QEMU_CAPS_CPU_CACHE); -+ DO_TEST_PARSE_ERROR("cpu-cache-emulate-l2", QEMU_CAPS_KVM); -+ DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM); -+ DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM); -+ - qemuTestDriverFree(&driver); - - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Add-support-for-resctrl.patch b/SOURCES/libvirt-qemu-Add-support-for-resctrl.patch new file mode 100644 index 0000000..7ba1797 --- /dev/null +++ b/SOURCES/libvirt-qemu-Add-support-for-resctrl.patch @@ -0,0 +1,120 @@ +From 72285626fa7b899ceb9c8d4358b4b1b3fa7081a4 Mon Sep 17 00:00:00 2001 +Message-Id: <72285626fa7b899ceb9c8d4358b4b1b3fa7081a4@dist-git> +From: Martin Kletzander +Date: Wed, 31 Jan 2018 16:32:32 +0100 +Subject: [PATCH] qemu: Add support for resctrl + +We've been building up to this. This adds support for cputune/cachetune +settings for domains in the QEMU driver. The addition into +qemuProcessSetupVcpu() automatically adds support for hotplug. For hot-unplug +we need to remove the allocation only if all the vCPUs were unplugged. But +since the threads are left running, we can't really do much about it now. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1289368 + +Signed-off-by: Martin Kletzander +(cherry picked from commit 9a2fc2db8fe18da41c274d52b6e52316a4bbe52d) +Signed-off-by: Martin Kletzander + +https://bugzilla.redhat.com/show_bug.cgi?id=1289368 +Signed-off-by: Martin Kletzander +--- + src/qemu/qemu_process.c | 60 ++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 55 insertions(+), 5 deletions(-) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index c64088e4ca..57faf9cd79 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -2504,6 +2504,32 @@ qemuProcessSetupEmulator(virDomainObjPtr vm) + } + + ++static int ++qemuProcessResctrlCreate(virQEMUDriverPtr driver, ++ virDomainObjPtr vm) ++{ ++ int ret = -1; ++ size_t i = 0; ++ virCapsPtr caps = virQEMUDriverGetCapabilities(driver, false); ++ qemuDomainObjPrivatePtr priv = vm->privateData; ++ ++ if (!caps) ++ return -1; ++ ++ for (i = 0; i < vm->def->ncachetunes; i++) { ++ if (virResctrlAllocCreate(caps->host.resctrl, ++ vm->def->cachetunes[i]->alloc, ++ priv->machineName) < 0) ++ goto cleanup; ++ } ++ ++ ret = 0; ++ cleanup: ++ virObjectUnref(caps); ++ return ret; ++} ++ ++ + static int + qemuProcessInitPasswords(virConnectPtr conn, + virQEMUDriverPtr driver, +@@ -5015,12 +5041,26 @@ qemuProcessSetupVcpu(virDomainObjPtr vm, + { + pid_t vcpupid = qemuDomainGetVcpuPid(vm, vcpuid); + virDomainVcpuDefPtr vcpu = virDomainDefGetVcpu(vm->def, vcpuid); ++ size_t i = 0; + +- return qemuProcessSetupPid(vm, vcpupid, VIR_CGROUP_THREAD_VCPU, +- vcpuid, vcpu->cpumask, +- vm->def->cputune.period, +- vm->def->cputune.quota, +- &vcpu->sched); ++ if (qemuProcessSetupPid(vm, vcpupid, VIR_CGROUP_THREAD_VCPU, ++ vcpuid, vcpu->cpumask, ++ vm->def->cputune.period, ++ vm->def->cputune.quota, ++ &vcpu->sched) < 0) ++ return -1; ++ ++ for (i = 0; i < vm->def->ncachetunes; i++) { ++ virDomainCachetuneDefPtr ct = vm->def->cachetunes[i]; ++ ++ if (virBitmapIsBitSet(ct->vcpus, vcpuid)) { ++ if (virResctrlAllocAddPID(ct->alloc, vcpupid) < 0) ++ return -1; ++ break; ++ } ++ } ++ ++ return 0; + } + + +@@ -5892,6 +5932,10 @@ qemuProcessLaunch(virConnectPtr conn, + if (qemuProcessSetupEmulator(vm) < 0) + goto cleanup; + ++ VIR_DEBUG("Setting up resctrlfs"); ++ if (qemuProcessResctrlCreate(driver, vm) < 0) ++ goto cleanup; ++ + VIR_DEBUG("Setting domain security labels"); + if (qemuSecuritySetAllLabel(driver, + vm, +@@ -6540,6 +6584,12 @@ void qemuProcessStop(virQEMUDriverPtr driver, + vm->def->name); + } + ++ /* Remove resctrl allocation after cgroups are cleaned up which makes it ++ * kind of safer (although removing the allocation should work even with ++ * pids in tasks file */ ++ for (i = 0; i < vm->def->ncachetunes; i++) ++ virResctrlAllocRemove(vm->def->cachetunes[i]->alloc); ++ + qemuProcessRemoveDomainStatus(driver, vm); + + /* Remove VNC and Spice ports from port reservation bitmap, but only if +-- +2.16.1 + diff --git a/SOURCES/libvirt-qemu-Advertise-ACPI-support-for-aarch64-guests.patch b/SOURCES/libvirt-qemu-Advertise-ACPI-support-for-aarch64-guests.patch deleted file mode 100644 index 7abbd4f..0000000 --- a/SOURCES/libvirt-qemu-Advertise-ACPI-support-for-aarch64-guests.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 2106b821cd1eef809853f7424edf8660732b1303 Mon Sep 17 00:00:00 2001 -Message-Id: <2106b821cd1eef809853f7424edf8660732b1303@dist-git> -From: Andrea Bolognani -Date: Tue, 4 Apr 2017 14:59:30 +0200 -Subject: [PATCH] qemu: Advertise ACPI support for aarch64 guests - -So far, libvirt has assumed that only x86 supports ACPI, -but that's inaccurate since aarch64 supports it too. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1429509 - -(cherry picked from commit 560335c35c830344329c16cb1f25f887344bdfd8) -Signed-off-by: Andrea Bolognani ---- - src/qemu/qemu_capabilities.c | 28 ++++++++++++++++------ - .../caps_2.6.0-gicv2.aarch64.xml | 1 + - .../caps_2.6.0-gicv3.aarch64.xml | 1 + - .../qemuxml2argv-aarch64-gic-host.args | 1 + - .../qemuxml2argv-aarch64-gic-v2.args | 1 + - .../qemuxml2argv-aarch64-gic-v3.args | 1 + - 6 files changed, 26 insertions(+), 7 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 9d0a29732..a8125102c 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -1043,13 +1043,17 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, - - machines = NULL; - nmachines = 0; -+ } - -+ if ((ARCH_IS_X86(guestarch) || guestarch == VIR_ARCH_AARCH64) && -+ virCapabilitiesAddGuestFeature(guest, "acpi", true, true) == NULL) { -+ goto cleanup; - } - - if (ARCH_IS_X86(guestarch) && -- (virCapabilitiesAddGuestFeature(guest, "acpi", true, true) == NULL || -- virCapabilitiesAddGuestFeature(guest, "apic", true, false) == NULL)) -+ virCapabilitiesAddGuestFeature(guest, "apic", true, false) == NULL) { - goto cleanup; -+ } - - if ((guestarch == VIR_ARCH_I686) && - (virCapabilitiesAddGuestFeature(guest, "pae", true, false) == NULL || -@@ -4181,10 +4185,15 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid, const c - qmperr) < 0) - goto cleanup; - -- /* -no-acpi is not supported on non-x86 -- * even if qemu reports it in -help */ -- if (!ARCH_IS_X86(qemuCaps->arch)) -+ /* Older QEMU versions reported -no-acpi in the output of -help even -+ * though it was not supported by the architecture. The issue has since -+ * been fixed, but to maintain compatibility with all release we still -+ * need to filter out the capability for architectures that we know -+ * don't support the feature, eg. anything but x86 and aarch64 */ -+ if (!ARCH_IS_X86(qemuCaps->arch) && -+ qemuCaps->arch != VIR_ARCH_AARCH64) { - virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI); -+ } - - /* virQEMUCapsExtractDeviceStr will only set additional caps if qemu - * understands the 0.13.0+ notion of "-device driver,". */ -@@ -4305,9 +4314,14 @@ virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps, - void - virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps) - { -- /* ACPI/HPET/KVM PIT are x86 specific */ -- if (ARCH_IS_X86(qemuCaps->arch)) { -+ /* ACPI only works on x86 and aarch64 */ -+ if (ARCH_IS_X86(qemuCaps->arch) || -+ qemuCaps->arch == VIR_ARCH_AARCH64) { - virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI); -+ } -+ -+ /* HPET and KVM PIT are x86 specific */ -+ if (ARCH_IS_X86(qemuCaps->arch)) { - virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET); - virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT); - } -diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml -index c1e46794a..af3a8e7cb 100644 ---- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml -+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml -@@ -40,6 +40,7 @@ - - - -+ - - - -diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml -index 20dfda216..4402ffa6f 100644 ---- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml -+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml -@@ -40,6 +40,7 @@ - - - -+ - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args -index 5fdaa08ef..23276ad71 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-host.args -@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \ - -nographic \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args -index 2caf1b92c..f79c1c60e 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v2.args -@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \ - -nographic \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args -index 3ae8e5f86..fce9308b0 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-gic-v3.args -@@ -15,4 +15,5 @@ QEMU_AUDIO_DRV=none \ - -nographic \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Allow-live-updates-of-coalesce-settings.patch b/SOURCES/libvirt-qemu-Allow-live-updates-of-coalesce-settings.patch deleted file mode 100644 index 10ba09c..0000000 --- a/SOURCES/libvirt-qemu-Allow-live-updates-of-coalesce-settings.patch +++ /dev/null @@ -1,220 +0,0 @@ -From ec733f7eb1f88d9d030952c764c1ee635ab9060b Mon Sep 17 00:00:00 2001 -Message-Id: -From: Martin Kletzander -Date: Fri, 16 Jun 2017 13:45:30 +0200 -Subject: [PATCH] qemu: Allow live-updates of coalesce settings - -Change the settings from qemuDomainUpdateDeviceLive() as otherwise the -call would succeed even though nothing has changed. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1414627 - -Signed-off-by: Martin Kletzander -(cherry picked from commit 307a205e25ad7db7c895c42ab2e8f59f3839c058) -Signed-off-by: Martin Kletzander - - Conflicts: - src/util/virnetdev.c - non-Linux stubs -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_hotplug.c | 13 +++++++ - src/util/virnetdev.c | 93 ++++++++++++++++++++++++++++++++----------------- - src/util/virnetdev.h | 3 +- - src/util/virnetdevtap.c | 2 +- - 4 files changed, 77 insertions(+), 34 deletions(-) - -diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c -index ab23a575d8..fbc9177669 100644 ---- a/src/qemu/qemu_hotplug.c -+++ b/src/qemu/qemu_hotplug.c -@@ -3005,6 +3005,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, - bool needLinkStateChange = false; - bool needReplaceDevDef = false; - bool needBandwidthSet = false; -+ bool needCoalesceChange = false; - int ret = -1; - int changeidx = -1; - -@@ -3293,6 +3294,12 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, - virDomainNetGetActualBandwidth(newdev))) - needBandwidthSet = true; - -+ if (!!olddev->coalesce != !!newdev->coalesce || -+ (olddev->coalesce && newdev->coalesce && -+ !memcmp(olddev->coalesce, newdev->coalesce, -+ sizeof(*olddev->coalesce)))) -+ needCoalesceChange = true; -+ - /* FINALLY - actually perform the required actions */ - - if (needReconnect) { -@@ -3328,6 +3335,12 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, - needReplaceDevDef = true; - } - -+ if (needCoalesceChange) { -+ if (virNetDevSetCoalesce(newdev->ifname, newdev->coalesce, true) < 0) -+ goto cleanup; -+ needReplaceDevDef = true; -+ } -+ - if (needLinkStateChange && - qemuDomainChangeNetLinkState(driver, vm, olddev, newdev->linkstate) < 0) { - goto cleanup; -diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c -index eb97b705e2..2beb39bb60 100644 ---- a/src/util/virnetdev.c -+++ b/src/util/virnetdev.c -@@ -3093,7 +3093,8 @@ virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap ATTRIBUTE_UNUSED, - /** - * virNetDevSetCoalesce: - * @ifname: interface name to modify -- * @coalesce: Coalesce settings to set and update -+ * @coalesce: Coalesce settings to set or update -+ * @update: Whether this is an update for existing settings or not - * - * This function sets the various coalesce settings for a given interface - * @ifname and updates them back into @coalesce. -@@ -3101,40 +3102,44 @@ virNetDevGetEthtoolGFeatures(virBitmapPtr bitmap ATTRIBUTE_UNUSED, - * Returns 0 in case of success or -1 on failure - */ - int virNetDevSetCoalesce(const char *ifname, -- virNetDevCoalescePtr coalesce) -+ virNetDevCoalescePtr coalesce, -+ bool update) - { - int fd = -1; - int ret = -1; - struct ifreq ifr; - struct ethtool_coalesce coal = {0}; - -- if (!coalesce) -+ if (!coalesce && !update) - return 0; - -- coal = (struct ethtool_coalesce) { -- .cmd = ETHTOOL_SCOALESCE, -- .rx_max_coalesced_frames = coalesce->rx_max_coalesced_frames, -- .rx_coalesce_usecs_irq = coalesce->rx_coalesce_usecs_irq, -- .rx_max_coalesced_frames_irq = coalesce->rx_max_coalesced_frames_irq, -- .tx_coalesce_usecs = coalesce->tx_coalesce_usecs, -- .tx_max_coalesced_frames = coalesce->tx_max_coalesced_frames, -- .tx_coalesce_usecs_irq = coalesce->tx_coalesce_usecs_irq, -- .tx_max_coalesced_frames_irq = coalesce->tx_max_coalesced_frames_irq, -- .stats_block_coalesce_usecs = coalesce->stats_block_coalesce_usecs, -- .use_adaptive_rx_coalesce = coalesce->use_adaptive_rx_coalesce, -- .use_adaptive_tx_coalesce = coalesce->use_adaptive_tx_coalesce, -- .pkt_rate_low = coalesce->pkt_rate_low, -- .rx_coalesce_usecs_low = coalesce->rx_coalesce_usecs_low, -- .rx_max_coalesced_frames_low = coalesce->rx_max_coalesced_frames_low, -- .tx_coalesce_usecs_low = coalesce->tx_coalesce_usecs_low, -- .tx_max_coalesced_frames_low = coalesce->tx_max_coalesced_frames_low, -- .pkt_rate_high = coalesce->pkt_rate_high, -- .rx_coalesce_usecs_high = coalesce->rx_coalesce_usecs_high, -- .rx_max_coalesced_frames_high = coalesce->rx_max_coalesced_frames_high, -- .tx_coalesce_usecs_high = coalesce->tx_coalesce_usecs_high, -- .tx_max_coalesced_frames_high = coalesce->tx_max_coalesced_frames_high, -- .rate_sample_interval = coalesce->rate_sample_interval, -- }; -+ if (coalesce) { -+ coal = (struct ethtool_coalesce) { -+ .rx_max_coalesced_frames = coalesce->rx_max_coalesced_frames, -+ .rx_coalesce_usecs_irq = coalesce->rx_coalesce_usecs_irq, -+ .rx_max_coalesced_frames_irq = coalesce->rx_max_coalesced_frames_irq, -+ .tx_coalesce_usecs = coalesce->tx_coalesce_usecs, -+ .tx_max_coalesced_frames = coalesce->tx_max_coalesced_frames, -+ .tx_coalesce_usecs_irq = coalesce->tx_coalesce_usecs_irq, -+ .tx_max_coalesced_frames_irq = coalesce->tx_max_coalesced_frames_irq, -+ .stats_block_coalesce_usecs = coalesce->stats_block_coalesce_usecs, -+ .use_adaptive_rx_coalesce = coalesce->use_adaptive_rx_coalesce, -+ .use_adaptive_tx_coalesce = coalesce->use_adaptive_tx_coalesce, -+ .pkt_rate_low = coalesce->pkt_rate_low, -+ .rx_coalesce_usecs_low = coalesce->rx_coalesce_usecs_low, -+ .rx_max_coalesced_frames_low = coalesce->rx_max_coalesced_frames_low, -+ .tx_coalesce_usecs_low = coalesce->tx_coalesce_usecs_low, -+ .tx_max_coalesced_frames_low = coalesce->tx_max_coalesced_frames_low, -+ .pkt_rate_high = coalesce->pkt_rate_high, -+ .rx_coalesce_usecs_high = coalesce->rx_coalesce_usecs_high, -+ .rx_max_coalesced_frames_high = coalesce->rx_max_coalesced_frames_high, -+ .tx_coalesce_usecs_high = coalesce->tx_coalesce_usecs_high, -+ .tx_max_coalesced_frames_high = coalesce->tx_max_coalesced_frames_high, -+ .rate_sample_interval = coalesce->rate_sample_interval, -+ }; -+ } -+ -+ coal.cmd = ETHTOOL_SCOALESCE; - - if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0) - return -1; -@@ -3148,12 +3153,36 @@ int virNetDevSetCoalesce(const char *ifname, - goto cleanup; - } - -- coal = (struct ethtool_coalesce) { -- .cmd = ETHTOOL_GCOALESCE, -- }; -+ if (coalesce) { -+ coal = (struct ethtool_coalesce) { -+ .cmd = ETHTOOL_GCOALESCE, -+ }; - -- /* Don't fail if the update itself fails */ -- virNetDevSendEthtoolIoctl(fd, &ifr); -+ /* Don't fail if the update itself fails */ -+ if (virNetDevSendEthtoolIoctl(fd, &ifr) == 0) { -+ coalesce->rx_max_coalesced_frames = coal.rx_max_coalesced_frames; -+ coalesce->rx_coalesce_usecs_irq = coal.rx_coalesce_usecs_irq; -+ coalesce->rx_max_coalesced_frames_irq = coal.rx_max_coalesced_frames_irq; -+ coalesce->tx_coalesce_usecs = coal.tx_coalesce_usecs; -+ coalesce->tx_max_coalesced_frames = coal.tx_max_coalesced_frames; -+ coalesce->tx_coalesce_usecs_irq = coal.tx_coalesce_usecs_irq; -+ coalesce->tx_max_coalesced_frames_irq = coal.tx_max_coalesced_frames_irq; -+ coalesce->stats_block_coalesce_usecs = coal.stats_block_coalesce_usecs; -+ coalesce->use_adaptive_rx_coalesce = coal.use_adaptive_rx_coalesce; -+ coalesce->use_adaptive_tx_coalesce = coal.use_adaptive_tx_coalesce; -+ coalesce->pkt_rate_low = coal.pkt_rate_low; -+ coalesce->rx_coalesce_usecs_low = coal.rx_coalesce_usecs_low; -+ coalesce->rx_max_coalesced_frames_low = coal.rx_max_coalesced_frames_low; -+ coalesce->tx_coalesce_usecs_low = coal.tx_coalesce_usecs_low; -+ coalesce->tx_max_coalesced_frames_low = coal.tx_max_coalesced_frames_low; -+ coalesce->pkt_rate_high = coal.pkt_rate_high; -+ coalesce->rx_coalesce_usecs_high = coal.rx_coalesce_usecs_high; -+ coalesce->rx_max_coalesced_frames_high = coal.rx_max_coalesced_frames_high; -+ coalesce->tx_coalesce_usecs_high = coal.tx_coalesce_usecs_high; -+ coalesce->tx_max_coalesced_frames_high = coal.tx_max_coalesced_frames_high; -+ coalesce->rate_sample_interval = coal.rate_sample_interval; -+ } -+ } - - ret = 0; - cleanup: -diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h -index 97236c170d..c2c09af636 100644 ---- a/src/util/virnetdev.h -+++ b/src/util/virnetdev.h -@@ -180,7 +180,8 @@ int virNetDevRestoreMacAddress(const char *linkdev, - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; - - int virNetDevSetCoalesce(const char *ifname, -- virNetDevCoalescePtr coalesce) -+ virNetDevCoalescePtr coalesce, -+ bool update) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; - - int virNetDevSetMTU(const char *ifname, -diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c -index c8dacfe27b..175dc2bfaa 100644 ---- a/src/util/virnetdevtap.c -+++ b/src/util/virnetdevtap.c -@@ -663,7 +663,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, - if (virNetDevSetOnline(*ifname, !!(flags & VIR_NETDEV_TAP_CREATE_IFUP)) < 0) - goto error; - -- if (virNetDevSetCoalesce(*ifname, coalesce) < 0) -+ if (virNetDevSetCoalesce(*ifname, coalesce, false) < 0) - goto error; - - return 0; --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Allow-memAccess-for-hugepages-again.patch b/SOURCES/libvirt-qemu-Allow-memAccess-for-hugepages-again.patch deleted file mode 100644 index cc85976..0000000 --- a/SOURCES/libvirt-qemu-Allow-memAccess-for-hugepages-again.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 7c4ee4b1708fcd1b9fbfcb9de1be66c8294e6bbb Mon Sep 17 00:00:00 2001 -Message-Id: <7c4ee4b1708fcd1b9fbfcb9de1be66c8294e6bbb@dist-git> -From: Michal Privoznik -Date: Tue, 13 Jun 2017 18:12:13 +0200 -Subject: [PATCH] qemu: Allow memAccess for hugepages again - -https://bugzilla.redhat.com/show_bug.cgi?id=1214369 -https://bugzilla.redhat.com/show_bug.cgi?id=1458638 - -Historically, we've always supported memAccess for domains backed -by hugepages. However, somewhere along the way we've regressed -and stopped allowing such configuration. Fix it. - -Signed-off-by: Michal Privoznik -(cherry picked from commit 671d18594f42f24f7cb3f1b2c574ff4ddba0b183) -Signed-off-by: Michal Privoznik -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_command.c | 18 ++----- - .../qemuxml2argv-fd-memory-numa-topology2.args | 2 +- - .../qemuxml2argv-hugepages-memaccess.args | 42 +++++++++++++++ - .../qemuxml2argv-hugepages-memaccess.xml | 62 ++++++++++++++++++++++ - tests/qemuxml2argvtest.c | 3 ++ - .../qemuxml2xmlout-hugepages-memaccess.xml | 1 + - tests/qemuxml2xmltest.c | 1 + - 7 files changed, 114 insertions(+), 15 deletions(-) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml - create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-memaccess.xml - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index e220bf5ba0..c791214528 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -3345,6 +3345,9 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps, - memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, mem->targetNode); - } - -+ if (memAccess == VIR_DOMAIN_MEMORY_ACCESS_DEFAULT) -+ memAccess = def->mem.access; -+ - if (virDomainNumatuneGetMode(def->numa, mem->targetNode, &mode) < 0 && - virDomainNumatuneGetMode(def->numa, -1, &mode) < 0) - mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT; -@@ -3402,7 +3405,7 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps, - if (!(props = virJSONValueNewObject())) - return -1; - -- if (pagesize || mem->nvdimmPath || -+ if (pagesize || mem->nvdimmPath || memAccess || - def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) { - *backendType = "memory-backend-file"; - -@@ -3439,23 +3442,10 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps, - break; - - case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: -- if (def->mem.access == VIR_DOMAIN_MEMORY_ACCESS_SHARED) { -- if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0) -- goto cleanup; -- } -- break; -- - case VIR_DOMAIN_MEMORY_ACCESS_LAST: - break; - } - } else { -- if (memAccess) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("Shared memory mapping is supported " -- "only with hugepages")); -- goto cleanup; -- } -- - *backendType = "memory-backend-ram"; - } - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args -index 4420b9ab22..e36f98b907 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-fd-memory-numa-topology2.args -@@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \ - -mem-prealloc \ - -smp 20,sockets=1,cores=8,threads=1 \ - -object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram,\ --size=15032385536 \ -+share=no,size=15032385536 \ - -numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \ - -object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram,\ - share=yes,size=15032385536 \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args -new file mode 100644 -index 0000000000..d584d465b5 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.args -@@ -0,0 +1,42 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/qemu-system-i686 \ -+-name QEMUGuest1 \ -+-S \ -+-M pc \ -+-m size=4194304k,slots=16,maxmem=8388608k \ -+-smp 4,sockets=4,cores=1,threads=1 \ -+-object memory-backend-file,id=ram-node0,prealloc=yes,\ -+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,share=no,size=1073741824,\ -+host-nodes=0-3,policy=bind \ -+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \ -+-object memory-backend-file,id=ram-node1,prealloc=yes,\ -+mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=yes,size=1073741824,\ -+host-nodes=0-3,policy=bind \ -+-numa node,nodeid=1,cpus=1,memdev=ram-node1 \ -+-object memory-backend-file,id=ram-node2,prealloc=yes,\ -+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,share=no,size=1073741824,\ -+host-nodes=0-3,policy=bind \ -+-numa node,nodeid=2,cpus=2,memdev=ram-node2 \ -+-object memory-backend-file,id=ram-node3,prealloc=yes,\ -+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,share=no,size=1073741824,\ -+host-nodes=3,policy=bind \ -+-numa node,nodeid=3,cpus=3,memdev=ram-node3 \ -+-object memory-backend-file,id=memdimm0,prealloc=yes,\ -+mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=yes,size=536870912,\ -+host-nodes=0-3,policy=bind \ -+-device pc-dimm,node=1,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml -new file mode 100644 -index 0000000000..db9b9430e1 ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml -@@ -0,0 +1,62 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 8388608 -+ 4194304 -+ 4194304 -+ -+ -+ -+ -+ -+ -+ -+ 4 -+ -+ -+ -+ -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-i686 -+ -+ -+ -+
      -+ -+ -+
      -+ -+ -+
      -+ -+ -+ -+ -+ -+
      -+ -+ -+ -+ 524288 -+ 1 -+ -+
      -+ -+ -+ -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index 175037bf96..77e52bd33b 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -827,6 +827,9 @@ mymain(void) - QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("hugepages-pages5", QEMU_CAPS_MEM_PATH); - DO_TEST("hugepages-pages6", NONE); -+ DO_TEST("hugepages-memaccess", QEMU_CAPS_OBJECT_MEMORY_FILE, -+ QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_DEVICE_PC_DIMM, -+ QEMU_CAPS_NUMA); - DO_TEST("nosharepages", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE); - DO_TEST("disk-cdrom", NONE); - DO_TEST("disk-iscsi", NONE); -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-memaccess.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-memaccess.xml -new file mode 120000 -index 0000000000..23cef8e67d ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hugepages-memaccess.xml -@@ -0,0 +1 @@ -+../qemuxml2argvdata/qemuxml2argv-hugepages-memaccess.xml -\ No newline at end of file -diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c -index 72eac5e716..511d1b3fb9 100644 ---- a/tests/qemuxml2xmltest.c -+++ b/tests/qemuxml2xmltest.c -@@ -420,6 +420,7 @@ mymain(void) - DO_TEST("hugepages-pages2", NONE); - DO_TEST("hugepages-pages3", NONE); - DO_TEST("hugepages-shared", NONE); -+ DO_TEST("hugepages-memaccess", NONE); - DO_TEST("nosharepages", NONE); - DO_TEST("restore-v2", NONE); - DO_TEST("migrate", NONE); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Always-reset-TLS-in-qemuProcessRecoverMigrationOut.patch b/SOURCES/libvirt-qemu-Always-reset-TLS-in-qemuProcessRecoverMigrationOut.patch deleted file mode 100644 index 98ee89c..0000000 --- a/SOURCES/libvirt-qemu-Always-reset-TLS-in-qemuProcessRecoverMigrationOut.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 4b3819d67eaf7c9ed31a2d306968d24fecae68ea Mon Sep 17 00:00:00 2001 -Message-Id: <4b3819d67eaf7c9ed31a2d306968d24fecae68ea@dist-git> -From: Jiri Denemark -Date: Wed, 5 Apr 2017 12:04:09 +0200 -Subject: [PATCH] qemu: Always reset TLS in qemuProcessRecoverMigrationOut - -qemuProcessRecoverMigrationOut doesn't explicitly call -qemuMigrationResetTLS relying on two things: - - - qemuMigrationCancel resets TLS parameters - - our migration code resets TLS before entering - QEMU_MIGRATION_PHASE_PERFORM3_DONE phase - -But this is not obvious and the assumptions will be broken soon. Let's -explicitly reset TLS parameters on all paths which do not kill the -domain. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 9d677e6a6ba075f489f791b6922a5dadf0e0c79f) - -https://bugzilla.redhat.com/show_bug.cgi?id=1425003 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_process.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 70b06a28f..2e0f859ce 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3077,6 +3077,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - } - } - -+ qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL); - return 0; - } - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Always-send-persistent-XML-during-migration.patch b/SOURCES/libvirt-qemu-Always-send-persistent-XML-during-migration.patch deleted file mode 100644 index cc3fa9d..0000000 --- a/SOURCES/libvirt-qemu-Always-send-persistent-XML-during-migration.patch +++ /dev/null @@ -1,45 +0,0 @@ -From d3df2456cfc82cba6afdb2f44dca91f6f553ac76 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Wed, 7 Jun 2017 09:35:25 +0200 -Subject: [PATCH] qemu: Always send persistent XML during migration - -When persistent migration of a transient domain is requested but no -custom XML is passed to the migration API we would just let the -destination daemon make a persistent definition from the live definition -itself. This is not a problem now, but once the destination daemon -starts replacing the original CPU definition with the one from migration -cookie before starting a domain, it would need to add more ugly hacks to -reverse the operation. Let's just always send the persistent definition -in the cookie to make things a bit cleaner. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit b0a16641fa648de23d1fd05a3e89987799550c44) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index ec5af7a612..a7c90a09e8 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -3613,8 +3613,9 @@ qemuMigrationRun(virQEMUDriverPtr driver, - if (!(persistDef = qemuMigrationPrepareDef(driver, persist_xml, - NULL, NULL))) - goto cleanup; -- } else if (vm->newDef) { -- if (!(persistDef = qemuDomainDefCopy(driver, vm->newDef, -+ } else { -+ virDomainDefPtr def = vm->newDef ? vm->newDef : vm->def; -+ if (!(persistDef = qemuDomainDefCopy(driver, def, - VIR_DOMAIN_XML_SECURE | - VIR_DOMAIN_XML_MIGRATABLE))) - goto cleanup; --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Avoid-comparing-size_t-with-1.patch b/SOURCES/libvirt-qemu-Avoid-comparing-size_t-with-1.patch new file mode 100644 index 0000000..057aa65 --- /dev/null +++ b/SOURCES/libvirt-qemu-Avoid-comparing-size_t-with-1.patch @@ -0,0 +1,36 @@ +From a29ee6823d600aaf40c06c67e954233c36624774 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Mon, 11 Dec 2017 14:34:20 +0100 +Subject: [PATCH] qemu: Avoid comparing size_t with -1 + +ncpus would be -1 on error and the cleanup for loop would not be skipped +in this case. + +Signed-off-by: Jiri Denemark +Reviewed-by: John Ferlan +(cherry picked from commit fd754cb69cb073d370d73b9eab65db8ce1400096) + +https://bugzilla.redhat.com/show_bug.cgi?id=1521202 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_capabilities.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 4af1b6c662..165fdbc5ea 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -2965,7 +2965,7 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon) + size_t i; + + if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0) +- goto error; ++ return NULL; + + if (!(models = virDomainCapsCPUModelsNew(ncpus))) + goto error; +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Break-endless-loop-if-qemuMigrationResetTLS-fails.patch b/SOURCES/libvirt-qemu-Break-endless-loop-if-qemuMigrationResetTLS-fails.patch deleted file mode 100644 index 315f05c..0000000 --- a/SOURCES/libvirt-qemu-Break-endless-loop-if-qemuMigrationResetTLS-fails.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e2f2737b6f9aa4ba8399e87e2eecbfbc77f9b2a4 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 4 Apr 2017 12:46:37 +0200 -Subject: [PATCH] qemu: Break endless loop if qemuMigrationResetTLS fails - -Jumping to "endjob" label from a code after this label is not a very -good idea. - -Signed-off-by: Jiri Denemark -(cherry picked from commit d658c8594e05d286de6af22ea88689d1d5e2a82b) - -https://bugzilla.redhat.com/show_bug.cgi?id=1300769 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index fcd3a38a1..992b6bd4a 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -5356,9 +5356,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, - QEMU_ASYNC_JOB_MIGRATION_IN); - } - -- if (qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, -- NULL, NULL) < 0) -- goto endjob; -+ qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, NULL, NULL); - - qemuMigrationJobFinish(driver, vm); - if (!virDomainObjIsActive(vm)) --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Change-coalesce-settings-on-hotplug-when-they-are-different.patch b/SOURCES/libvirt-qemu-Change-coalesce-settings-on-hotplug-when-they-are-different.patch deleted file mode 100644 index 713189e..0000000 --- a/SOURCES/libvirt-qemu-Change-coalesce-settings-on-hotplug-when-they-are-different.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 1ed2c3a16d7a4eaffafa07edf66a5148230726bf Mon Sep 17 00:00:00 2001 -Message-Id: <1ed2c3a16d7a4eaffafa07edf66a5148230726bf@dist-git> -From: Martin Kletzander -Date: Wed, 21 Jun 2017 09:46:25 +0200 -Subject: [PATCH] qemu: Change coalesce settings on hotplug when they are - different - -Part of the condition was reverted so no value update was propagated -through. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1414627 - -Signed-off-by: Martin Kletzander -(cherry picked from commit ff7bae6e4fb74a52239d53af3672900c69801508) -Signed-off-by: Martin Kletzander -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_hotplug.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c -index fbc9177669..a6274273dd 100644 ---- a/src/qemu/qemu_hotplug.c -+++ b/src/qemu/qemu_hotplug.c -@@ -3296,8 +3296,8 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, - - if (!!olddev->coalesce != !!newdev->coalesce || - (olddev->coalesce && newdev->coalesce && -- !memcmp(olddev->coalesce, newdev->coalesce, -- sizeof(*olddev->coalesce)))) -+ memcmp(olddev->coalesce, newdev->coalesce, -+ sizeof(*olddev->coalesce)))) - needCoalesceChange = true; - - /* FINALLY - actually perform the required actions */ --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Conditionally-allow-block-copy-for-persistent-domains.patch b/SOURCES/libvirt-qemu-Conditionally-allow-block-copy-for-persistent-domains.patch deleted file mode 100644 index 1a784c0..0000000 --- a/SOURCES/libvirt-qemu-Conditionally-allow-block-copy-for-persistent-domains.patch +++ /dev/null @@ -1,90 +0,0 @@ -From e88d64a75a55dcd0173ba35b6f100d2ec5fcf312 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Peter Krempa -Date: Wed, 7 Jun 2017 13:31:21 +0200 -Subject: [PATCH] qemu: Conditionally allow block-copy for persistent domains - -Allow starting the block-copy job for a persistent domain if a user -declares by using a flag that the job will not be recovered if the VM is -switched off while the job is active. - -This allows to use the block-copy job with persistent VMs under the same -conditions as would apply to transient domains. - -(cherry picked from commit b7e534c651bfa28c65f7b11661b478613c96598c) - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1459113 - -Signed-off-by: Jiri Denemark ---- - include/libvirt/libvirt-domain.h | 3 +++ - src/libvirt-domain.c | 4 ++++ - src/qemu/qemu_driver.c | 9 ++++++--- - 3 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h -index 720db32f76..45f939a8cc 100644 ---- a/include/libvirt/libvirt-domain.h -+++ b/include/libvirt/libvirt-domain.h -@@ -2428,6 +2428,9 @@ typedef enum { - backing chain */ - VIR_DOMAIN_BLOCK_COPY_REUSE_EXT = 1 << 1, /* Reuse existing external - file for a copy */ -+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB = 1 << 2, /* Don't force usage of -+ recoverable job for the -+ copy operation */ - } virDomainBlockCopyFlags; - - /** -diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c -index 4670c54e5e..0adc9e8cbe 100644 ---- a/src/libvirt-domain.c -+++ b/src/libvirt-domain.c -@@ -10026,6 +10026,10 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk, - * or virDomainDetachDevice(), while a copy job is active; they may - * also restrict a copy job to transient domains. - * -+ * If @flags contains VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB the job will not be -+ * recoverable if the VM is turned off while job is active. This flag will -+ * remove the restriction of copy jobs to transient domains. -+ * - * The @disk parameter is either an unambiguous source name of the - * block device (the sub-element, such as - * "/path/to/image"), or the device target shorthand (the -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index a9ac06a63c..354329fe64 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -16509,7 +16509,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, - - /* Preliminaries: find the disk we are editing, sanity checks */ - virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | -- VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1); -+ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | -+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); - - priv = vm->privateData; - cfg = virQEMUDriverGetConfig(driver); -@@ -16548,7 +16549,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, - _("block copy is not supported with this QEMU binary")); - goto endjob; - } -- if (vm->persistent) { -+ if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) && -+ vm->persistent) { - /* XXX if qemu ever lets us start a new domain with mirroring - * already active, we can relax this; but for now, the risk of - * 'managedsave' due to libvirt-guests means we can't risk -@@ -16775,7 +16777,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml, - size_t i; - - virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW | -- VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, -1); -+ VIR_DOMAIN_BLOCK_COPY_REUSE_EXT | -+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1); - if (virTypedParamsValidate(params, nparams, - VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, - VIR_TYPED_PARAM_ULLONG, --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Destroy-whole-memory-tree.patch b/SOURCES/libvirt-qemu-Destroy-whole-memory-tree.patch new file mode 100644 index 0000000..2e55cb3 --- /dev/null +++ b/SOURCES/libvirt-qemu-Destroy-whole-memory-tree.patch @@ -0,0 +1,42 @@ +From 7207faf95b38811cbf0d19df02066cc06a138822 Mon Sep 17 00:00:00 2001 +Message-Id: <7207faf95b38811cbf0d19df02066cc06a138822@dist-git> +From: Michal Privoznik +Date: Thu, 9 Nov 2017 16:06:46 +0100 +Subject: [PATCH] qemu: Destroy whole memory tree + +https://bugzilla.redhat.com/show_bug.cgi?id=1461214 + +When removing path where huge pages are call virFileDeleteTree +instead of plain rmdir(). The reason is that in the near future +there's going to be more in the path than just files - some +subdirs. Therefore plain rmdir() is not going to be enough. + +Signed-off-by: Michal Privoznik +Reviewed-by: John Ferlan +(cherry picked from commit bb3de478a66edafd130ecca9a45a4d506ca727a0) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_process.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 605f280d0c..3324cc61f1 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3348,10 +3348,8 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver, + return -1; + } + } else { +- if (rmdir(path) < 0 && +- errno != ENOENT) +- VIR_WARN("Unable to remove hugepage path: %s (errno=%d)", +- path, errno); ++ if (virFileDeleteTree(path) < 0) ++ return -1; + } + + return 0; +-- +2.15.0 + diff --git a/SOURCES/libvirt-qemu-Disallow-pivot-of-shared-disks-to-unsupported-storage.patch b/SOURCES/libvirt-qemu-Disallow-pivot-of-shared-disks-to-unsupported-storage.patch new file mode 100644 index 0000000..c6a2dfd --- /dev/null +++ b/SOURCES/libvirt-qemu-Disallow-pivot-of-shared-disks-to-unsupported-storage.patch @@ -0,0 +1,40 @@ +From 9911807f7cf94ab328916fd9f00f20cc09a6455a Mon Sep 17 00:00:00 2001 +Message-Id: <9911807f7cf94ab328916fd9f00f20cc09a6455a@dist-git> +From: Peter Krempa +Date: Thu, 23 Nov 2017 19:02:21 +0100 +Subject: [PATCH] qemu: Disallow pivot of shared disks to unsupported storage + +Pivoting to a unsupported storage type might break the assumption that +shared disks will not corrupt metadata. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1511480 +(cherry picked from commit 2b41c86294786c07f53afa633fe3dce703debc3c) +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 620028fe07..d0d29747cf 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -16509,6 +16509,16 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, + goto cleanup; + } + ++ /* When pivoting to a shareable disk we need to make sure that the disk can ++ * be safely shared, since block copy might have changed the format. */ ++ if (disk->src->shared && !disk->src->readonly && ++ !qemuBlockStorageSourceSupportsConcurrentAccess(disk->mirror)) { ++ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", ++ _("can't pivot a shared disk to a storage volume not " ++ "supporting sharing")); ++ goto cleanup; ++ } ++ + /* For active commit, the mirror is part of the already labeled + * chain. For blockcopy, we previously labeled only the top-level + * image; but if the user is reusing an external image that +-- +2.15.0 + diff --git a/SOURCES/libvirt-qemu-Do-not-skip-virCPUUpdateLive-if-priv-origCPU-is-set.patch b/SOURCES/libvirt-qemu-Do-not-skip-virCPUUpdateLive-if-priv-origCPU-is-set.patch deleted file mode 100644 index 8e78a3c..0000000 --- a/SOURCES/libvirt-qemu-Do-not-skip-virCPUUpdateLive-if-priv-origCPU-is-set.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 6d2400987412f61857070407a43dc88705cf34f6 Mon Sep 17 00:00:00 2001 -Message-Id: <6d2400987412f61857070407a43dc88705cf34f6@dist-git> -From: Jiri Denemark -Date: Wed, 21 Jun 2017 15:31:38 +0200 -Subject: [PATCH] qemu: Do not skip virCPUUpdateLive if priv->origCPU is set - -Even though we got both the original CPU (used for starting a domain) -and the updated version (the CPU really provided by QEMU) during -incoming migration, restore, or snapshot revert, we still need to update -the CPU according to the data we got from the freshly started QEMU. -Otherwise we don't know whether the CPU we got from QEMU matches the one -before migration. We just need to keep the original CPU in -priv->origCPU. - -Messed up by me in v3.4.0-58-g8e34f4781. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit eabb0002ca0bba3c5a94d16fb385783de7b144a5) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_process.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index a7abfc720e..4d7c8d8e40 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3946,20 +3946,16 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, - if (qemuProcessVerifyCPUFeatures(def, cpu) < 0) - goto cleanup; - -- /* Don't update the CPU if we already did so when starting a domain -- * during migration, restore or snapshot revert. */ -- if (priv->origCPU) { -- ret = 0; -- goto cleanup; -- } -- - if (!(orig = virCPUDefCopy(def->cpu))) - goto cleanup; - - if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0) { - goto cleanup; - } else if (rc == 0) { -- if (!virCPUDefIsEqual(def->cpu, orig, false)) -+ /* Store the original CPU in priv if QEMU changed it and we didn't -+ * get the original CPU via migration, restore, or snapshot revert. -+ */ -+ if (!priv->origCPU && !virCPUDefIsEqual(def->cpu, orig, false)) - VIR_STEAL_PTR(priv->origCPU, orig); - - def->cpu->check = VIR_CPU_CHECK_FULL; --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Don-t-error-out-if-allocation-info-can-t-be-queried.patch b/SOURCES/libvirt-qemu-Don-t-error-out-if-allocation-info-can-t-be-queried.patch deleted file mode 100644 index 10f0c04..0000000 --- a/SOURCES/libvirt-qemu-Don-t-error-out-if-allocation-info-can-t-be-queried.patch +++ /dev/null @@ -1,42 +0,0 @@ -From bd25ad4689524e4212a72c7d40a18e91071cfa35 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Peter Krempa -Date: Fri, 2 Jun 2017 12:52:56 +0200 -Subject: [PATCH] qemu: Don't error out if allocation info can't be queried - -qemuDomainGetBlockInfo would error out if qemu did not report -'wr_highest_offset'. This usually does not happen, but can happen -briefly during active layer block commit. There's no need to report the -error, we can simply report that the disk is fully alocated at that -point. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1452045 -(cherry picked from commit c245f558369de5eb404e54728bf69ad27942e912) - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index b741c1b5a6..fdfa4a50e1 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -11555,14 +11555,6 @@ qemuDomainGetBlockInfo(virDomainPtr dom, - } - - if (!entry->wr_highest_offset_valid) { -- if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_BLOCK && -- disk->src->format != VIR_STORAGE_FILE_RAW) { -- virReportError(VIR_ERR_INTERNAL_ERROR, -- _("failed to query the maximum written offset of " -- "block device '%s'"), disk->dst); -- goto endjob; -- } -- - info->allocation = entry->physical; - } else { - if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_FILE && --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Don-t-fail-if-physical-size-can-t-be-updated-in-qemuDomainGetBlockInfo.patch b/SOURCES/libvirt-qemu-Don-t-fail-if-physical-size-can-t-be-updated-in-qemuDomainGetBlockInfo.patch deleted file mode 100644 index 50a2865..0000000 --- a/SOURCES/libvirt-qemu-Don-t-fail-if-physical-size-can-t-be-updated-in-qemuDomainGetBlockInfo.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 19acba61eef5c5caf17e5b75b4e2ea30458a18b3 Mon Sep 17 00:00:00 2001 -Message-Id: <19acba61eef5c5caf17e5b75b4e2ea30458a18b3@dist-git> -From: Peter Krempa -Date: Fri, 28 Apr 2017 10:37:00 +0200 -Subject: [PATCH] qemu: Don't fail if physical size can't be updated in - qemuDomainGetBlockInfo - -Since commit c5f6151390 qemuDomainBlockInfo tries to update the -"physical" storage size for all network storage and not only block -devices. - -Since the storage driver APIs to do this are not implemented for certain -storage types (RBD, iSCSI, ...) the code would fail to retrieve any data -since the failure of qemuDomainStorageUpdatePhysical is fatal. - -Since it's desired to return data even if the total size can't be -updated we need to ignore errors from that function and return plausible -data. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1442344 -(cherry picked from commit 9f16bb7386939c400a7522d2489245f1e6831bae) - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 3f3eca440..2fcf4612e 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -11567,10 +11567,12 @@ qemuDomainGetBlockInfo(virDomainPtr dom, - if (info->allocation == 0) - info->allocation = entry->physical; - -- if (qemuDomainStorageUpdatePhysical(driver, cfg, vm, disk->src) < 0) -- goto endjob; -- -- info->physical = disk->src->physical; -+ if (qemuDomainStorageUpdatePhysical(driver, cfg, vm, disk->src) == 0) { -+ info->physical = disk->src->physical; -+ } else { -+ virResetLastError(); -+ info->physical = entry->physical; -+ } - } else { - info->physical = entry->physical; - } --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Don-t-initialize-struct-utsname.patch b/SOURCES/libvirt-qemu-Don-t-initialize-struct-utsname.patch new file mode 100644 index 0000000..5ed49ef --- /dev/null +++ b/SOURCES/libvirt-qemu-Don-t-initialize-struct-utsname.patch @@ -0,0 +1,34 @@ +From 27e59af45b7e283b94617330e3327eff4bd91bdb Mon Sep 17 00:00:00 2001 +Message-Id: <27e59af45b7e283b94617330e3327eff4bd91bdb@dist-git> +From: Jiri Denemark +Date: Mon, 22 Jan 2018 14:51:11 +0100 +Subject: [PATCH] qemu: Don't initialize struct utsname + +It breaks the build and it is not really useful for anything. + +Signed-off-by: Jiri Denemark +(cherry picked from commit ba9ea2ad7dd15d9a2e9c7a5b9a8a3e7066351015) + +https://bugzilla.redhat.com/show_bug.cgi?id=1525182 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_capabilities.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index af4875f82e..bd80edc978 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -5416,7 +5416,7 @@ virQEMUCapsCacheNew(const char *libDir, + char *capsCacheDir = NULL; + virFileCachePtr cache = NULL; + virQEMUCapsCachePrivPtr priv = NULL; +- struct utsname uts = { 0 }; ++ struct utsname uts; + + if (virAsprintf(&capsCacheDir, "%s/capabilities", cacheDir) < 0) + goto error; +-- +2.16.1 + diff --git a/SOURCES/libvirt-qemu-Don-t-overwrite-existing-error-in-qemuMigrationReset.patch b/SOURCES/libvirt-qemu-Don-t-overwrite-existing-error-in-qemuMigrationReset.patch deleted file mode 100644 index 9e86a07..0000000 --- a/SOURCES/libvirt-qemu-Don-t-overwrite-existing-error-in-qemuMigrationReset.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 28079e51b504ad2e5849d38dc994c41d319bf133 Mon Sep 17 00:00:00 2001 -Message-Id: <28079e51b504ad2e5849d38dc994c41d319bf133@dist-git> -From: Jiri Denemark -Date: Thu, 6 Apr 2017 09:23:18 +0200 -Subject: [PATCH] qemu: Don't overwrite existing error in qemuMigrationReset - -https://bugzilla.redhat.com/show_bug.cgi?id=1439130 - -Signed-off-by: Jiri Denemark -(cherry picked from commit 45b639bdbabe59056a6fc89ee4189fe695d6fae2) -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index ae0ab368d..8c6d1385e 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -5871,15 +5871,22 @@ qemuMigrationReset(virQEMUDriverPtr driver, - qemuDomainAsyncJob job) - { - qemuMonitorMigrationCaps cap; -+ virErrorPtr err = virSaveLastError(); - - if (!virDomainObjIsActive(vm)) -- return; -+ goto cleanup; - - if (qemuMigrationResetTLS(driver, vm, job) < 0) -- return; -+ goto cleanup; - - for (cap = 0; cap < QEMU_MONITOR_MIGRATION_CAPS_LAST; cap++) { - if (qemuMigrationSetOption(driver, vm, cap, false, job) < 0) -- return; -+ goto cleanup; -+ } -+ -+ cleanup: -+ if (err) { -+ virSetError(err); -+ virFreeError(err); - } - } --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationCancel.patch b/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationCancel.patch deleted file mode 100644 index 187a2c4..0000000 --- a/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationCancel.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 4060e79aee023bf56323ad6daf82c4aa1bde308b Mon Sep 17 00:00:00 2001 -Message-Id: <4060e79aee023bf56323ad6daf82c4aa1bde308b@dist-git> -From: Jiri Denemark -Date: Wed, 5 Apr 2017 14:44:26 +0200 -Subject: [PATCH] qemu: Don't reset TLS in qemuMigrationCancel - -Migration parameters are either reset by the main migration code path or -from qemuProcessRecoverMigration* in case libvirtd is restarted during -migration. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 133c73e75f278c4943cbe03333bb9a7ee897c23f) - -https://bugzilla.redhat.com/show_bug.cgi?id=1425003 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index d8d89b011..6c9f14245 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -5560,9 +5560,6 @@ qemuMigrationCancel(virQEMUDriverPtr driver, - if (qemuDomainObjExitMonitor(driver, vm) < 0 || (storage && !blockJobs)) - goto endsyncjob; - -- ignore_value(qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, -- NULL, NULL)); -- - if (!storage) { - ret = 0; - goto cleanup; --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationRun.patch b/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationRun.patch deleted file mode 100644 index 546f10f..0000000 --- a/SOURCES/libvirt-qemu-Don-t-reset-TLS-in-qemuMigrationRun.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0811efa2bcaae69e59fe09432083224e77eafa1d Mon Sep 17 00:00:00 2001 -Message-Id: <0811efa2bcaae69e59fe09432083224e77eafa1d@dist-git> -From: Jiri Denemark -Date: Wed, 5 Apr 2017 10:24:47 +0200 -Subject: [PATCH] qemu: Don't reset TLS in qemuMigrationRun - -Finished qemuMigrationRun does not mean the migration itself finished -(it might have just switched to post-copy mode). While resetting TLS -parameters is probably OK at this point even if migration is still -running, we want to consolidate the code which resets various migration -parameters. Thus qemuMigrationResetTLS will be called from the Confirm -phase (or at the end of the Perform phase in case of v2 protocol), when -migration is either canceled or finished. - -Signed-off-by: Jiri Denemark -(cherry picked from commit a88c250d8693ae198d42cf26e2b7b1e190e94637) - -https://bugzilla.redhat.com/show_bug.cgi?id=1425003 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 992b6bd4a..d8d89b011 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -3216,6 +3216,9 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, - qemuDomainEventQueue(driver, event); - } - -+ qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, -+ NULL, NULL); -+ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) - VIR_WARN("Failed to save status on vm %s", vm->def->name); - } -@@ -3848,10 +3851,6 @@ qemuMigrationRun(virQEMUDriverPtr driver, - ret = -1; - } - -- if (qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, -- tlsAlias, secAlias) < 0) -- ret = -1; -- - VIR_FREE(tlsAlias); - VIR_FREE(secAlias); - virObjectUnref(cfg); -@@ -4827,6 +4826,13 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver, - if (ret < 0) - orig_err = virSaveLastError(); - -+ /* v2 proto has no confirm phase so we need to reset migration parameters -+ * here -+ */ -+ if (!v3proto && ret < 0) -+ qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, -+ NULL, NULL); -+ - if (qemuMigrationRestoreDomainState(conn, vm)) { - event = virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_RESUMED, --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Don-t-reset-events-migration-capability.patch b/SOURCES/libvirt-qemu-Don-t-reset-events-migration-capability.patch deleted file mode 100644 index 32c4544..0000000 --- a/SOURCES/libvirt-qemu-Don-t-reset-events-migration-capability.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e94894df02d97bac7169433fdcf595bd526eafd1 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Fri, 28 Apr 2017 15:56:44 +0200 -Subject: [PATCH] qemu: Don't reset "events" migration capability - -When creating v3.2.0-77-g8be3ccd04 commit, I completely forgot that one -migration capability is very special. It's the "events" capability which -tells QEMU to report "MIGRATION" events. Since libvirt always wants the -events, it is enabled in qemuConnectMonitor and the rest of the code -should not touch it. - -https://bugzilla.redhat.com/show_bug.cgi?id=1439841 -https://bugzilla.redhat.com/show_bug.cgi?id=1441165 - -Messed-up-by: Jiri Denemark -Signed-off-by: Jiri Denemark -(cherry picked from commit fc48fc7930f560c4341f4afe1285848dfdb60278) -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index cadbf9b97..ac7e27319 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -5888,6 +5888,11 @@ qemuMigrationReset(virQEMUDriverPtr driver, - goto cleanup; - - for (cap = 0; cap < QEMU_MONITOR_MIGRATION_CAPS_LAST; cap++) { -+ /* "events" capability is set (when supported) in qemuConnectMonitor -+ * and should never be cleared */ -+ if (cap == QEMU_MONITOR_MIGRATION_CAPS_EVENTS) -+ continue; -+ - if (qemuMigrationSetOption(driver, vm, cap, false, job) < 0) - goto cleanup; - } --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Don-t-try-to-use-hugepages-if-not-enabled.patch b/SOURCES/libvirt-qemu-Don-t-try-to-use-hugepages-if-not-enabled.patch deleted file mode 100644 index 3c17996..0000000 --- a/SOURCES/libvirt-qemu-Don-t-try-to-use-hugepages-if-not-enabled.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 893ebcda06c14d25dd195f53a1467fb243b43838 Mon Sep 17 00:00:00 2001 -Message-Id: <893ebcda06c14d25dd195f53a1467fb243b43838@dist-git> -From: Michal Privoznik -Date: Wed, 14 Jun 2017 16:58:13 +0200 -Subject: [PATCH] qemu: Don't try to use hugepages if not enabled - -https://bugzilla.redhat.com/show_bug.cgi?id=1214369 - -My fix 671d18594f4 was incomplete. If domain doesn't have -hugepages enabled, because of missing condition we would still be -putting hugepages path onto qemu cmd line. Clean up the -conditions so that it's more visible next time. - -Signed-off-by: Michal Privoznik -(cherry picked from commit 1e8d6c6ef07a33ab338c2bf38fa017d4f2123335) -Signed-off-by: Michal Privoznik -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_command.c | 12 +++++----- - .../qemuxml2argv-cpu-numa-memshared.args | 26 ++++++++++++++++++++++ - tests/qemuxml2argvtest.c | 1 + - 3 files changed, 33 insertions(+), 6 deletions(-) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 5013d3149d..88223babeb 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -3409,19 +3409,19 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps, - def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) { - *backendType = "memory-backend-file"; - -- if (mem->nvdimmPath) { -+ if (pagesize) { -+ if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0) -+ goto cleanup; -+ prealloc = true; -+ } else if (mem->nvdimmPath) { - if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0) - goto cleanup; - prealloc = true; -- } else if (!pagesize && def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) { -+ } else { - /* We can have both pagesize and mem source. If that's the case, - * prefer hugepages as those are more specific. */ - if (VIR_STRDUP(memPath, cfg->memoryBackingDir) < 0) - goto cleanup; -- } else { -- if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0) -- goto cleanup; -- prealloc = true; - } - - if (virJSONValueObjectAdd(props, -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args -new file mode 100644 -index 0000000000..677e17e7df ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa-memshared.args -@@ -0,0 +1,26 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/qemu \ -+-name QEMUGuest1 \ -+-S \ -+-M pc \ -+-m 214 \ -+-smp 16,sockets=2,cores=4,threads=2 \ -+-object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram,\ -+share=yes,size=112197632 \ -+-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \ -+-object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram,\ -+share=no,size=112197632 \ -+-numa node,nodeid=1,cpus=8-15,memdev=ram-node1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot n \ -+-usb \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index 98e70033ec..0745d3807a 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -1549,6 +1549,7 @@ mymain(void) - DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA); - DO_TEST_FAILURE("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_RAM); - DO_TEST_FAILURE("cpu-numa-memshared", NONE); -+ DO_TEST("cpu-numa-memshared", QEMU_CAPS_OBJECT_MEMORY_FILE); - DO_TEST("cpu-host-model", NONE); - DO_TEST("cpu-host-model-vendor", NONE); - skipLegacyCPUs = true; --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Don-t-update-CPU-when-checking-ABI-stability.patch b/SOURCES/libvirt-qemu-Don-t-update-CPU-when-checking-ABI-stability.patch deleted file mode 100644 index 85a5901..0000000 --- a/SOURCES/libvirt-qemu-Don-t-update-CPU-when-checking-ABI-stability.patch +++ /dev/null @@ -1,61 +0,0 @@ -From d260867d18aa20c4d79f4319b82453120d209eae Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 27 Jun 2017 15:06:10 +0200 -Subject: [PATCH] qemu: Don't update CPU when checking ABI stability - -When checking ABI stability between two domain definitions, we first -make migratable copies of them. However, we also asked for the guest CPU -to be updated, even though the updated CPU is supposed to be already -included in the original definitions. Moreover, if we do this on the -destination host during migration, we're potentially updating the -definition with according to an incompatible host CPU. - -While updating the CPU when checking ABI stability doesn't make any -sense, it actually just worked because updating the CPU doesn't do -anything for custom CPUs (only host-model CPUs are affected) and we -updated both definitions in the same way. - -Less then a year ago commit v2.3.0-rc1~42 stopped updating the CPU in -the definition we got internally and only the user supplied definition -was updated. However, the same commit started updating host-model CPUs -to custom CPUs which are not affected by the request to update the CPU. -So it still seemed to work right, unless a user upgraded libvirt 2.2.0 -to a newer version while there were some domains with host-model CPUs -running on the host. Such domains couldn't be migrated with a user -supplied XML since libvirt would complain: - - Target CPU mode custom does not match source host-model - -The fix is pretty straightforward, we just need to stop updating the CPU -when checking ABI stability. - -https://bugzilla.redhat.com/show_bug.cgi?id=1463957 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit ee68bb391efb684341edb6286a1278631167f08c) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_domain.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 1528c6a137..6ccc9f6f5b 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -5910,7 +5910,6 @@ qemuDomainMigratableDefCheckABIStability(virQEMUDriverPtr driver, - - - #define COPY_FLAGS (VIR_DOMAIN_XML_SECURE | \ -- VIR_DOMAIN_XML_UPDATE_CPU | \ - VIR_DOMAIN_XML_MIGRATABLE) - - bool --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Drop-resume-label-in-qemuProcessRecoverMigrationOut.patch b/SOURCES/libvirt-qemu-Drop-resume-label-in-qemuProcessRecoverMigrationOut.patch deleted file mode 100644 index 65cb35b..0000000 --- a/SOURCES/libvirt-qemu-Drop-resume-label-in-qemuProcessRecoverMigrationOut.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 7e2bb20a6318c5e7a42b0fe417b6e12862c65d64 Mon Sep 17 00:00:00 2001 -Message-Id: <7e2bb20a6318c5e7a42b0fe417b6e12862c65d64@dist-git> -From: Jiri Denemark -Date: Tue, 4 Apr 2017 20:54:57 +0200 -Subject: [PATCH] qemu: Drop resume label in qemuProcessRecoverMigrationOut - -Let's use a bool variable to create a single shared path returning 0. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 3e803176a3d9242f6833687e305aebd7353ffaa3) - -https://bugzilla.redhat.com/show_bug.cgi?id=1425003 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_process.c | 31 ++++++++++++++++--------------- - 1 file changed, 16 insertions(+), 15 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 0b9b4f76a..70b06a28f 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -2998,6 +2998,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - bool postcopy = state == VIR_DOMAIN_PAUSED && - (reason == VIR_DOMAIN_PAUSED_POSTCOPY || - reason == VIR_DOMAIN_PAUSED_POSTCOPY_FAILED); -+ bool resume = false; - - switch (phase) { - case QEMU_MIGRATION_PHASE_NONE: -@@ -3028,7 +3029,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - VIR_WARN("Could not cancel ongoing migration of domain %s", - vm->def->name); - } -- goto resume; -+ resume = true; - } - break; - -@@ -3051,7 +3052,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - } else { - VIR_DEBUG("Resuming domain %s after failed migration", - vm->def->name); -- goto resume; -+ resume = true; - } - break; - -@@ -3061,21 +3062,21 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - return -1; - } - -- return 0; -- -- resume: -- /* resume the domain but only if it was paused as a result of -- * migration -- */ -- if (state == VIR_DOMAIN_PAUSED && -- (reason == VIR_DOMAIN_PAUSED_MIGRATION || -- reason == VIR_DOMAIN_PAUSED_UNKNOWN)) { -- if (qemuProcessStartCPUs(driver, vm, conn, -- VIR_DOMAIN_RUNNING_UNPAUSED, -- QEMU_ASYNC_JOB_NONE) < 0) { -- VIR_WARN("Could not resume domain %s", vm->def->name); -+ if (resume) { -+ /* resume the domain but only if it was paused as a result of -+ * migration -+ */ -+ if (state == VIR_DOMAIN_PAUSED && -+ (reason == VIR_DOMAIN_PAUSED_MIGRATION || -+ reason == VIR_DOMAIN_PAUSED_UNKNOWN)) { -+ if (qemuProcessStartCPUs(driver, vm, conn, -+ VIR_DOMAIN_RUNNING_UNPAUSED, -+ QEMU_ASYNC_JOB_NONE) < 0) { -+ VIR_WARN("Could not resume domain %s", vm->def->name); -+ } - } - } -+ - return 0; - } - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Enable-configuration-of-HPT-resizing-for-pSeries-guests.patch b/SOURCES/libvirt-qemu-Enable-configuration-of-HPT-resizing-for-pSeries-guests.patch new file mode 100644 index 0000000..e5a971b --- /dev/null +++ b/SOURCES/libvirt-qemu-Enable-configuration-of-HPT-resizing-for-pSeries-guests.patch @@ -0,0 +1,299 @@ +From 6d24efd64d6de00d29f8bf2329940c427f5cc6f9 Mon Sep 17 00:00:00 2001 +Message-Id: <6d24efd64d6de00d29f8bf2329940c427f5cc6f9@dist-git> +From: Andrea Bolognani +Date: Wed, 15 Nov 2017 10:28:54 +0100 +Subject: [PATCH] qemu: Enable configuration of HPT resizing for pSeries guests + +Most of the time it's okay to leave this up to negotiation between +the guest and the host, but in some situations it can be useful to +manually decide the behavior, especially to enforce its availability. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1308743 + +Signed-off-by: Andrea Bolognani +Reviewed-by: John Ferlan +(cherry picked from commit 85b2ae96dfcf7dc324d6782f64c848fa412443e4) +Signed-off-by: Andrea Bolognani +Signed-off-by: Jiri Denemark +--- + docs/schemas/domaincommon.rng | 15 ++++++++ + src/conf/domain_conf.c | 46 +++++++++++++++++++++++- + src/conf/domain_conf.h | 12 +++++++ + src/libvirt_private.syms | 1 + + src/qemu/qemu_capabilities.c | 8 +++++ + src/qemu/qemu_capabilities.h | 1 + + src/qemu/qemu_command.c | 20 +++++++++++ + src/qemu/qemu_domain.c | 8 +++++ + tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 + + 9 files changed, 111 insertions(+), 1 deletion(-) + +diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng +index 710b3af7f7..367861c1ea 100644 +--- a/docs/schemas/domaincommon.rng ++++ b/docs/schemas/domaincommon.rng +@@ -4722,6 +4722,9 @@ + + + ++ ++ ++ + + + +@@ -4910,6 +4913,18 @@ + + + ++ ++ ++ ++ ++ enabled ++ disabled ++ required ++ ++ ++ ++ ++ + + + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index ca5d0bcc54..641a978f07 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -148,7 +148,9 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, + "vmport", + "gic", + "smm", +- "ioapic") ++ "ioapic", ++ "hpt", ++); + + VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, + "default", +@@ -877,6 +879,13 @@ VIR_ENUM_IMPL(virDomainIOAPIC, + "qemu", + "kvm") + ++VIR_ENUM_IMPL(virDomainHPTResizing, ++ VIR_DOMAIN_HPT_RESIZING_LAST, ++ "enabled", ++ "disabled", ++ "required", ++); ++ + /* Internal mapping: subset of block job types that can be present in + * XML (remaining types are not two-phase). */ + VIR_ENUM_DECL(virDomainBlockJob) +@@ -18765,6 +18774,22 @@ virDomainDefParseXML(xmlDocPtr xml, + } + break; + ++ case VIR_DOMAIN_FEATURE_HPT: ++ tmp = virXMLPropString(nodes[i], "resizing"); ++ if (tmp) { ++ int value = virDomainHPTResizingTypeFromString(tmp); ++ if (value < 0) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Unknown HPT resizing setting: %s"), ++ tmp); ++ goto error; ++ } ++ def->hpt_resizing = value; ++ def->features[val] = VIR_TRISTATE_SWITCH_ON; ++ VIR_FREE(tmp); ++ } ++ break; ++ + /* coverity[dead_error_begin] */ + case VIR_DOMAIN_FEATURE_LAST: + break; +@@ -20955,6 +20980,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src, + return false; + } + ++ /* HPT resizing */ ++ if (src->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { ++ if (src->hpt_resizing != dst->hpt_resizing) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("HPT resizing configuration differs: " ++ "source: '%s', destination: '%s'"), ++ virDomainHPTResizingTypeToString(src->hpt_resizing), ++ virDomainHPTResizingTypeToString(dst->hpt_resizing)); ++ return false; ++ } ++ } ++ + return true; + } + +@@ -26204,6 +26241,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, + } + break; + ++ case VIR_DOMAIN_FEATURE_HPT: ++ if (def->features[i] == VIR_TRISTATE_SWITCH_ON) { ++ virBufferAsprintf(buf, "\n", ++ virDomainHPTResizingTypeToString(def->hpt_resizing)); ++ } ++ break; ++ + /* coverity[dead_error_begin] */ + case VIR_DOMAIN_FEATURE_LAST: + break; +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 388fa92dda..f967e603d1 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -1715,6 +1715,7 @@ typedef enum { + VIR_DOMAIN_FEATURE_GIC, + VIR_DOMAIN_FEATURE_SMM, + VIR_DOMAIN_FEATURE_IOAPIC, ++ VIR_DOMAIN_FEATURE_HPT, + + VIR_DOMAIN_FEATURE_LAST + } virDomainFeature; +@@ -1843,6 +1844,16 @@ typedef enum { + + VIR_ENUM_DECL(virDomainIOAPIC); + ++typedef enum { ++ VIR_DOMAIN_HPT_RESIZING_ENABLED = 0, ++ VIR_DOMAIN_HPT_RESIZING_DISABLED, ++ VIR_DOMAIN_HPT_RESIZING_REQUIRED, ++ ++ VIR_DOMAIN_HPT_RESIZING_LAST ++} virDomainHPTResizing; ++ ++VIR_ENUM_DECL(virDomainHPTResizing); ++ + /* Operating system configuration data & machine / arch */ + typedef struct _virDomainOSEnv virDomainOSEnv; + typedef virDomainOSEnv *virDomainOSEnvPtr; +@@ -2315,6 +2326,7 @@ struct _virDomainDef { + virGICVersion gic_version; + char *hyperv_vendor_id; + virDomainIOAPIC ioapic; ++ virDomainHPTResizing hpt_resizing; + + /* These options are of type virTristateSwitch: ON = keep, OFF = drop */ + int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; +diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms +index 6653f95722..8d1d4a896b 100644 +--- a/src/libvirt_private.syms ++++ b/src/libvirt_private.syms +@@ -385,6 +385,7 @@ virDomainHostdevModeTypeToString; + virDomainHostdevRemove; + virDomainHostdevSubsysPCIBackendTypeToString; + virDomainHostdevSubsysTypeToString; ++virDomainHPTResizingTypeToString; + virDomainHubTypeFromString; + virDomainHubTypeToString; + virDomainHypervTypeFromString; +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 37a58b3640..3793f16590 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -443,6 +443,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, + /* 270 */ + "vxhs", + "virtio-blk.num-queues", ++ "machine.pseries.resize-hpt", + ); + + +@@ -4780,6 +4781,13 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, + if (qemuCaps->version >= 2006000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT); + ++ /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately ++ * there's no sane way to probe for it */ ++ if (qemuCaps->version >= 2010000 && ++ ARCH_IS_PPC64(qemuCaps->arch)) { ++ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); ++ } ++ + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) + goto cleanup; + +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index cacc2b77ed..f0e2e9016f 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -429,6 +429,7 @@ typedef enum { + /* 270 */ + QEMU_CAPS_VXHS, /* -drive file.driver=vxhs via query-qmp-schema */ + QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES, /* virtio-blk-*.num-queues */ ++ QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT, /* -machine pseries,resize-hpt */ + + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index e60f93083f..aa7079229f 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -7566,6 +7566,26 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, + } + } + ++ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON) { ++ const char *str; ++ ++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("HTP resizing is not supported by this " ++ "QEMU binary")); ++ goto cleanup; ++ } ++ ++ str = virDomainHPTResizingTypeToString(def->hpt_resizing); ++ if (!str) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("Invalid setting for HPT resizing")); ++ goto cleanup; ++ } ++ ++ virBufferAsprintf(&buf, ",resize-hpt=%s", str); ++ } ++ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_LOADPARM)) + qemuAppendLoadparmMachineParm(&buf, def); +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 81f45516af..485e085cea 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3109,6 +3109,14 @@ qemuDomainDefVerifyFeatures(const virDomainDef *def) + return -1; + } + ++ if (def->features[VIR_DOMAIN_FEATURE_HPT] == VIR_TRISTATE_SWITCH_ON && ++ !qemuDomainIsPSeries(def)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ "%s", ++ _("HPT tuning is only supported for pSeries guests")); ++ return -1; ++ } ++ + return 0; + } + +diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +index 0dfa20726c..b0ee3f1523 100644 +--- a/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml +@@ -177,6 +177,7 @@ + + + ++ + 2010000 + 0 + (v2.10.0) +-- +2.15.0 + diff --git a/SOURCES/libvirt-qemu-Enforce-ACPI-UEFI-requirements.patch b/SOURCES/libvirt-qemu-Enforce-ACPI-UEFI-requirements.patch deleted file mode 100644 index ea7dca6..0000000 --- a/SOURCES/libvirt-qemu-Enforce-ACPI-UEFI-requirements.patch +++ /dev/null @@ -1,411 +0,0 @@ -From 00e9313798b4e830b372d0069fc211019d67f978 Mon Sep 17 00:00:00 2001 -Message-Id: <00e9313798b4e830b372d0069fc211019d67f978@dist-git> -From: Andrea Bolognani -Date: Tue, 4 Apr 2017 14:59:31 +0200 -Subject: [PATCH] qemu: Enforce ACPI, UEFI requirements - -Depending on the architecture, requirements for ACPI and UEFI can -be different; more specifically, while on x86 UEFI requires ACPI, -on aarch64 it's the other way around. - -Enforce these requirements when validating the domain, and make -the error message more accurate by mentioning that they're not -necessarily applicable to all architectures. - -Several aarch64 test cases had to be tweaked because they would -have failed the validation step otherwise. - -(cherry picked from commit 396ca36cb0be87bdf6c337bbc8098920eddea065) - -Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1429509 - -Signed-off-by: Andrea Bolognani ---- - src/qemu/qemu_command.c | 20 ++++---------------- - src/qemu/qemu_domain.c | 20 ++++++++++++++++++++ - .../qemuxml2argv-aarch64-aavmf-virtio-mmio.args | 1 + - .../qemuxml2argv-aarch64-aavmf-virtio-mmio.xml | 1 - - .../qemuxml2argv-aarch64-cpu-passthrough.args | 1 + - .../qemuxml2argv-aarch64-cpu-passthrough.xml | 1 - - .../qemuxml2argv-aarch64-video-virtio-gpu-pci.args | 1 + - .../qemuxml2argv-aarch64-video-virtio-gpu-pci.xml | 3 --- - ...xml2argv-aarch64-virt-2.6-virtio-pci-default.args | 1 + - ...uxml2argv-aarch64-virt-2.6-virtio-pci-default.xml | 1 - - .../qemuxml2argv-aarch64-virt-default-nic.args | 1 + - .../qemuxml2argv-aarch64-virt-default-nic.xml | 3 --- - .../qemuxml2argv-aarch64-virt-virtio.args | 1 + - .../qemuxml2argv-aarch64-virt-virtio.xml | 1 - - .../qemuxml2argv-aarch64-virtio-pci-default.args | 1 + - .../qemuxml2argv-aarch64-virtio-pci-default.xml | 1 - - ...xml2argv-aarch64-virtio-pci-manual-addresses.args | 1 + - ...uxml2argv-aarch64-virtio-pci-manual-addresses.xml | 1 - - .../qemuxml2argv-balloon-mmio-deflate.args | 1 + - .../qemuxml2argv-balloon-mmio-deflate.xml | 1 - - .../qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml | 1 - - .../qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml | 1 - - .../qemuxml2xmlout-aarch64-virtio-pci-default.xml | 1 - - ...ml2xmlout-aarch64-virtio-pci-manual-addresses.xml | 1 - - 24 files changed, 33 insertions(+), 33 deletions(-) - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 59fedaaaf..8ec4ec3a6 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -9346,18 +9346,16 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager, - } - - --static int -+static void - qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, -- virDomainDefPtr def, -- virQEMUCapsPtr qemuCaps) -+ virDomainDefPtr def) - { -- int ret = -1; - virDomainLoaderDefPtr loader = def->os.loader; - virBuffer buf = VIR_BUFFER_INITIALIZER; - int unit = 0; - - if (!loader) -- return 0; -+ return; - - switch ((virDomainLoader) loader->type) { - case VIR_DOMAIN_LOADER_TYPE_ROM: -@@ -9366,12 +9364,6 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - break; - - case VIR_DOMAIN_LOADER_TYPE_PFLASH: -- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI) && -- def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("ACPI must be enabled in order to use UEFI")); -- goto cleanup; -- } - - if (loader->secure == VIR_TRISTATE_BOOL_YES) { - virCommandAddArgList(cmd, -@@ -9409,10 +9401,7 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - break; - } - -- ret = 0; -- cleanup: - virBufferFreeAndReset(&buf); -- return ret; - } - - -@@ -9849,8 +9838,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, - if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0) - goto error; - -- if (qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps) < 0) -- goto error; -+ qemuBuildDomainLoaderCommandLine(cmd, def); - - if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0) - goto error; -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 9f165c1da..f383a6cf2 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -2884,6 +2884,26 @@ qemuDomainDefValidate(const virDomainDef *def, - goto cleanup; - } - -+ /* On x86, UEFI requires ACPI */ -+ if (def->os.loader && -+ def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH && -+ ARCH_IS_X86(def->os.arch) && -+ def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("UEFI requires ACPI on this architecture")); -+ goto cleanup; -+ } -+ -+ /* On aarch64, ACPI requires UEFI */ -+ if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON && -+ def->os.arch == VIR_ARCH_AARCH64 && -+ (!def->os.loader || -+ def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("ACPI requires UEFI on this architecture")); -+ goto cleanup; -+ } -+ - if (def->os.loader && - def->os.loader->secure == VIR_TRISTATE_BOOL_YES) { - /* These are the QEMU implementation limitations. But we -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args -index bf4b2f793..68fb61b1e 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml -index 8c7428cf8..5d7217307 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-aavmf-virtio-mmio.xml -@@ -13,7 +13,6 @@ - - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args -index 52d2112b8..9c8c001f1 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \ - -device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml -index 4cdf387f3..0dda09504 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-cpu-passthrough.xml -@@ -8,7 +8,6 @@ - hvm - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args -index 76ee977a3..2f8c51610 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64-vgpu/monitor.sock,server,nowait \ -+-no-acpi \ - -device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\ - addr=0x1 \ - -device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,multifunction=on,\ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml -index 4b52a731b..d9a012893 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-video-virtio-gpu-pci.xml -@@ -7,9 +7,6 @@ - - hvm - -- -- -- - - cortex-a57 - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args -index df03c6e02..e99d412a7 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml -index e745101f1..43bc0089c 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-2.6-virtio-pci-default.xml -@@ -12,7 +12,6 @@ - earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args -index 29f65f6b9..47d77618b 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.args -@@ -17,6 +17,7 @@ QEMU_AUDIO_DRV=none \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64-virt-default/monitor.sock,server,\ - nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml -index 3a6f098d0..17ddc9096 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-default-nic.xml -@@ -4,9 +4,6 @@ - 1048576 - 1048576 - 1 -- -- -- - - cortex-a53 - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args -index b5b010ca4..5fef3b488 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml -index ad3461512..2692e61c4 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml -@@ -12,7 +12,6 @@ - earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args -index 46ac51d50..23a5fffd0 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml -index 2a84a9669..72bf0c95c 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-default.xml -@@ -12,7 +12,6 @@ - earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args -index 06403996e..54244fdcf 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml -index 5e1b494ed..fee32588f 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virtio-pci-manual-addresses.xml -@@ -13,7 +13,6 @@ - - - -- - - - -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args -index 10d136258..e568e3c39 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args -+++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.args -@@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \ - -nodefconfig \ - -nodefaults \ - -monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \ -+-no-acpi \ - -boot c \ - -kernel /aarch64.kernel \ - -initrd /aarch64.initrd \ -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml -index 1b5b48c42..49b7d2c60 100644 ---- a/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml -+++ b/tests/qemuxml2argvdata/qemuxml2argv-balloon-mmio-deflate.xml -@@ -12,7 +12,6 @@ - earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait - - -- - - - -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml -index bea65990e..9e728300e 100644 ---- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-aavmf-virtio-mmio.xml -@@ -13,7 +13,6 @@ - - - -- - - - -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml -index 2c765e7c3..8590f485e 100644 ---- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-video-virtio-gpu-pci.xml -@@ -8,7 +8,6 @@ - hvm - - -- - - - -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml -index 88a6a6a0c..e5496424b 100644 ---- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-default.xml -@@ -13,7 +13,6 @@ - - - -- - - - -diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml -index 83cf0d1f5..83d8dcc4a 100644 ---- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml -+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-aarch64-virtio-pci-manual-addresses.xml -@@ -13,7 +13,6 @@ - - - -- - - - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Export-virQEMUCapsGuestIsNative.patch b/SOURCES/libvirt-qemu-Export-virQEMUCapsGuestIsNative.patch deleted file mode 100644 index 75fc214..0000000 --- a/SOURCES/libvirt-qemu-Export-virQEMUCapsGuestIsNative.patch +++ /dev/null @@ -1,47 +0,0 @@ -From b06befbc433e1b6dc1a8ee5ee0814a20a2288685 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 11 Jul 2017 15:15:01 +0200 -Subject: [PATCH] qemu: Export virQEMUCapsGuestIsNative - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit ee4180bef124cbc08a702689dda6fd95b21b1387) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_capabilities.c | 2 +- - src/qemu/qemu_capabilities.h | 3 +++ - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index eea57e4c9c..f22c11941c 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -491,7 +491,7 @@ static const char *virQEMUCapsArchToString(virArch arch) - - /* Checks whether a domain with @guest arch can run natively on @host. - */ --static bool -+bool - virQEMUCapsGuestIsNative(virArch host, - virArch guest) - { -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index bbc6f6812f..c28c80d40a 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -569,4 +569,7 @@ int virQEMUCapsFillDomainCaps(virCapsPtr caps, - virFirmwarePtr *firmwares, - size_t nfirmwares); - -+bool virQEMUCapsGuestIsNative(virArch host, -+ virArch guest); -+ - #endif /* __QEMU_CAPABILITIES_H__*/ --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Filter-CPU-features-when-using-host-CPU.patch b/SOURCES/libvirt-qemu-Filter-CPU-features-when-using-host-CPU.patch deleted file mode 100644 index 49a5404..0000000 --- a/SOURCES/libvirt-qemu-Filter-CPU-features-when-using-host-CPU.patch +++ /dev/null @@ -1,71 +0,0 @@ -From f05df8ca745a00a1c8bc783dcf25f648cbe5d508 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Fri, 6 Oct 2017 13:23:36 +0200 -Subject: [PATCH] qemu: Filter CPU features when using host CPU - -When reconnecting to a domain started with a host-model CPU which was -started by old libvirt that did not replace host-model with the real CPU -definition, libvirt replaces the host-model CPU with the CPU from -capabilities (because this is what the old libvirt did when it started -the domain). Without this patch libvirt could use features unknown to -QEMU in the CPU definition which replaced the original host-model CPU. -Such domain would keep running just fine, but any attempt to migrate it -will fail and once the domain is saved or snapshotted, restoring it -would fail too. - -In other words whenever we want to use the CPU definition from host -capabilities as a guest CPU definition, we have to filter the unknown -features. - -https://bugzilla.redhat.com/show_bug.cgi?id=1495171 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit e26cc8f82ff346c9ec90409bac06581b64e42b20) - -https://bugzilla.redhat.com/show_bug.cgi?id=1508549 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_process.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 4a8c4421a3..0bed084381 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -6668,6 +6668,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, - { - virCapsPtr caps = virQEMUDriverGetCapabilities(driver, false); - virCPUDefPtr host = NULL; -+ virCPUDefPtr cpu = NULL; - int ret = -1; - - if (!caps) -@@ -6689,7 +6690,13 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, - if (!(host = virCPUCopyMigratable(caps->host.cpu->arch, caps->host.cpu))) - goto cleanup; - -- if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, host) < 0) -+ if (!(cpu = virCPUDefCopyWithoutModel(host)) || -+ virCPUDefCopyModelFilter(cpu, host, false, -+ virQEMUCapsCPUFilterFeatures, -+ &caps->host.cpu->arch) < 0) -+ goto cleanup; -+ -+ if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, cpu) < 0) - goto cleanup; - - if (qemuProcessUpdateCPU(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) -@@ -6699,6 +6706,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, - ret = 0; - - cleanup: -+ virCPUDefFree(cpu); - virCPUDefFree(host); - virObjectUnref(caps); - return ret; --- -2.15.0 - diff --git a/SOURCES/libvirt-qemu-Fix-CPU-model-broken-by-older-libvirt.patch b/SOURCES/libvirt-qemu-Fix-CPU-model-broken-by-older-libvirt.patch deleted file mode 100644 index a67107f..0000000 --- a/SOURCES/libvirt-qemu-Fix-CPU-model-broken-by-older-libvirt.patch +++ /dev/null @@ -1,194 +0,0 @@ -From e7f6fc0ea19e73e1ecd9a54f12ac9f2df7cb30cf Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Fri, 6 Oct 2017 14:49:07 +0200 -Subject: [PATCH] qemu: Fix CPU model broken by older libvirt - -When libvirt older than 3.9.0 reconnected to a running domain started by -old libvirt it could have messed up the expansion of host-model by -adding features QEMU does not support (such as cmt). Thus whenever we -reconnect to a running domain, revert to an active snapshot, or restore -a saved domain we need to check the guest CPU model and remove the -CPU features unknown to QEMU. We can do this because we know the domain -was successfully started, which means the CPU did not contain the -features when libvirt started the domain. - -https://bugzilla.redhat.com/show_bug.cgi?id=1495171 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 6a6f6b91e0e76480ea961f83135efcb4faf3284a) - -Conflicts: - src/qemu/qemu_domain.c, - src/qemu/qemu_domain.h -- context, one more function new - function upstream - -https://bugzilla.redhat.com/show_bug.cgi?id=1508549 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_domain.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ - src/qemu/qemu_domain.h | 4 +++ - src/qemu/qemu_driver.c | 14 +++++++++ - src/qemu/qemu_process.c | 9 ++++++ - 4 files changed, 102 insertions(+) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index a41657099f..68c1f3b7c5 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -9324,3 +9324,78 @@ qemuDomainUpdateCPU(virDomainObjPtr vm, - - return 0; - } -+ -+ -+/** -+ * qemuDomainFixupCPUS: -+ * @vm: domain object -+ * @origCPU: original CPU used when the domain was started -+ * -+ * Libvirt older than 3.9.0 could have messed up the expansion of host-model -+ * CPU when reconnecting to a running domain by adding features QEMU does not -+ * support (such as cmt). This API fixes both the actual CPU provided by QEMU -+ * (stored in the domain object) and the @origCPU used when starting the -+ * domain. -+ * -+ * This is safe even if the original CPU definition used mode='custom' (rather -+ * than host-model) since we know QEMU was able to start the domain and thus -+ * the CPU definitions do not contain any features unknown to QEMU. -+ * -+ * This function can only be used on an active domain or when restoring a -+ * domain which was running. -+ * -+ * Returns 0 on success, -1 on error. -+ */ -+int -+qemuDomainFixupCPUs(virDomainObjPtr vm, -+ virCPUDefPtr *origCPU) -+{ -+ virCPUDefPtr fixedCPU = NULL; -+ virCPUDefPtr fixedOrig = NULL; -+ virArch arch = vm->def->os.arch; -+ int ret = 0; -+ -+ if (!ARCH_IS_X86(arch)) -+ return 0; -+ -+ if (!vm->def->cpu || -+ vm->def->cpu->mode != VIR_CPU_MODE_CUSTOM || -+ !vm->def->cpu->model) -+ return 0; -+ -+ /* Missing origCPU means QEMU created exactly the same virtual CPU which -+ * we asked for or libvirt was too old to mess up the translation from -+ * host-model. -+ */ -+ if (!*origCPU) -+ return 0; -+ -+ if (virCPUDefFindFeature(vm->def->cpu, "cmt") && -+ (!(fixedCPU = virCPUDefCopyWithoutModel(vm->def->cpu)) || -+ virCPUDefCopyModelFilter(fixedCPU, vm->def->cpu, false, -+ virQEMUCapsCPUFilterFeatures, &arch) < 0)) -+ goto cleanup; -+ -+ if (virCPUDefFindFeature(*origCPU, "cmt") && -+ (!(fixedOrig = virCPUDefCopyWithoutModel(*origCPU)) || -+ virCPUDefCopyModelFilter(fixedOrig, *origCPU, false, -+ virQEMUCapsCPUFilterFeatures, &arch) < 0)) -+ goto cleanup; -+ -+ if (fixedCPU) { -+ virCPUDefFree(vm->def->cpu); -+ VIR_STEAL_PTR(vm->def->cpu, fixedCPU); -+ } -+ -+ if (fixedOrig) { -+ virCPUDefFree(*origCPU); -+ VIR_STEAL_PTR(*origCPU, fixedOrig); -+ } -+ -+ ret = 0; -+ -+ cleanup: -+ virCPUDefFree(fixedCPU); -+ virCPUDefFree(fixedOrig); -+ return ret; -+} -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index 7ad34e563e..1a658bcf7e 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -930,4 +930,8 @@ qemuDomainUpdateCPU(virDomainObjPtr vm, - virCPUDefPtr cpu, - virCPUDefPtr *origCPU); - -+int -+qemuDomainFixupCPUs(virDomainObjPtr vm, -+ virCPUDefPtr *origCPU); -+ - #endif /* __QEMU_DOMAIN_H__ */ -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index b6d72303ca..bfd7ff6c09 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -6500,6 +6500,13 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, - } - } - -+ /* No cookie means libvirt which saved the domain was too old to mess up -+ * the CPU definitions. -+ */ -+ if (cookie && -+ qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) -+ goto cleanup; -+ - if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, - asyncJob, "stdio", *fd, path, NULL, - VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, -@@ -15520,6 +15527,13 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, - if (config) - virDomainObjAssignDef(vm, config, false, NULL); - -+ /* No cookie means libvirt which saved the domain was too old to -+ * mess up the CPU definitions. -+ */ -+ if (cookie && -+ qemuDomainFixupCPUs(vm, &cookie->cpu) < 0) -+ goto cleanup; -+ - rc = qemuProcessStart(snapshot->domain->conn, driver, vm, - cookie ? cookie->cpu : NULL, - QEMU_ASYNC_JOB_START, NULL, -1, NULL, snap, -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 0bed084381..5802a553cf 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -6667,6 +6667,7 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm) - { - virCapsPtr caps = virQEMUDriverGetCapabilities(driver, false); -+ qemuDomainObjPrivatePtr priv = vm->privateData; - virCPUDefPtr host = NULL; - virCPUDefPtr cpu = NULL; - int ret = -1; -@@ -6701,6 +6702,14 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver, - - if (qemuProcessUpdateCPU(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) - goto cleanup; -+ } else if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) { -+ /* We only try to fix CPUs when the libvirt/QEMU combo used to start -+ * the domain did not know about query-cpu-model-expansion in which -+ * case the host-model is known to not contain features which QEMU -+ * doesn't know about. -+ */ -+ if (qemuDomainFixupCPUs(vm, &priv->origCPU) < 0) -+ goto cleanup; - } - - ret = 0; --- -2.15.0 - diff --git a/SOURCES/libvirt-qemu-Fix-crash-in-offline-migration.patch b/SOURCES/libvirt-qemu-Fix-crash-in-offline-migration.patch index 11da599..d2997ea 100644 --- a/SOURCES/libvirt-qemu-Fix-crash-in-offline-migration.patch +++ b/SOURCES/libvirt-qemu-Fix-crash-in-offline-migration.patch @@ -1,7 +1,7 @@ -From 3a47e083b2e118cb338442721a73ed8506e4c0ed Mon Sep 17 00:00:00 2001 -Message-Id: <3a47e083b2e118cb338442721a73ed8506e4c0ed@dist-git> +From e41b2f83ca98fe352e9901d99b5cb9bf62d79845 Mon Sep 17 00:00:00 2001 +Message-Id: From: Jiri Denemark -Date: Fri, 19 Jan 2018 10:32:44 +0100 +Date: Fri, 19 Jan 2018 14:33:16 +0100 Subject: [PATCH] qemu: Fix crash in offline migration When migrating a shutoff domain (i.e., offline migration), we have no @@ -15,19 +15,16 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1536351 Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina (cherry picked from commit bcc5710708ec90146b71bdb00d8705cb4a9e0088) - -https://bugzilla.redhat.com/show_bug.cgi?id=1530130 - Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 120b79415e..2b1e8dd9fd 100644 +index b814cc6608..a50bb7206c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c -@@ -5372,8 +5372,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver, +@@ -5459,8 +5459,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } if (dom) { @@ -41,5 +38,5 @@ index 120b79415e..2b1e8dd9fd 100644 if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, QEMU_MIGRATION_COOKIE_STATS) < 0) -- -2.16.0 +2.16.1 diff --git a/SOURCES/libvirt-qemu-Fix-mdev-checking-for-VFIO-support.patch b/SOURCES/libvirt-qemu-Fix-mdev-checking-for-VFIO-support.patch deleted file mode 100644 index 535da81..0000000 --- a/SOURCES/libvirt-qemu-Fix-mdev-checking-for-VFIO-support.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0642cb0d5040df1e483752e15ba724fe04b3afca Mon Sep 17 00:00:00 2001 -Message-Id: <0642cb0d5040df1e483752e15ba724fe04b3afca@dist-git> -From: Erik Skultety -Date: Wed, 12 Apr 2017 13:07:14 +0200 -Subject: [PATCH] qemu: Fix mdev checking for VFIO support - -Commit a4a39d90 added a check that checks for VFIO support with mediated -devices. The problem is that the hostdev preparing functions behave like -a fallthrough if device of that specific type doesn't exist. However, -the check for VFIO support was independent of the existence of a mdev -device which caused the guest to fail to start with any device to be -directly assigned if VFIO was disabled/unavailable in the kernel. -The proposed change first ensures that it makes sense to check for VFIO -support in the first place, and only then performs the VFIO support check -itself. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441291 - -(cherry picked from commit b4c2ac8d56124428d9329643a68625465094c5a7) -Signed-off-by: Erik Skultety ---- - src/qemu/qemu_hostdev.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c -index 685bf5b59..73d26f4c6 100644 ---- a/src/qemu/qemu_hostdev.c -+++ b/src/qemu/qemu_hostdev.c -@@ -330,11 +330,20 @@ qemuHostdevPrepareMediatedDevices(virQEMUDriverPtr driver, - int nhostdevs) - { - virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; -+ bool supportsVFIO = qemuHostdevHostSupportsPassthroughVFIO(); -+ size_t i; - -- if (!qemuHostdevHostSupportsPassthroughVFIO()) { -- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- _("host doesn't support VFIO PCI interface")); -- return -1; -+ for (i = 0; i < nhostdevs; i++) { -+ if (hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && -+ hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) { -+ if (!supportsVFIO) { -+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -+ _("Mediated host device assignment requires " -+ "VFIO support")); -+ return -1; -+ } -+ break; -+ } - } - - return virHostdevPrepareMediatedDevices(hostdev_mgr, QEMU_DRIVER_NAME, --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Fix-memory-leaks-in-qemuDomainSaveImageOpen.patch b/SOURCES/libvirt-qemu-Fix-memory-leaks-in-qemuDomainSaveImageOpen.patch deleted file mode 100644 index f9384ea..0000000 --- a/SOURCES/libvirt-qemu-Fix-memory-leaks-in-qemuDomainSaveImageOpen.patch +++ /dev/null @@ -1,55 +0,0 @@ -From a72554edcb64726b27ea51b4983ec8d9aaec4eaa Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 6 Jun 2017 22:27:57 +0200 -Subject: [PATCH] qemu: Fix memory leaks in qemuDomainSaveImageOpen - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit ac793bd7195ab99445cf6c6d6053439c56cef922) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index c8a84503c1..5db92b04a1 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -6229,12 +6229,13 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - virReportSystemError(errno, - _("cannot remove corrupt file: %s"), - path); -- goto error; -+ } else { -+ fd = -3; - } -- return -3; -+ } else { -+ virReportError(VIR_ERR_OPERATION_FAILED, -+ "%s", _("failed to read qemu header")); - } -- virReportError(VIR_ERR_OPERATION_FAILED, -- "%s", _("failed to read qemu header")); - goto error; - } - -@@ -6249,9 +6250,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - virReportSystemError(errno, - _("cannot remove corrupt file: %s"), - path); -- goto error; -+ } else { -+ fd = -3; - } -- return -3; -+ goto error; - } - } - virReportError(VIR_ERR_OPERATION_FAILED, "%s", msg); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Fix-persistent-migration-of-transient-domains.patch b/SOURCES/libvirt-qemu-Fix-persistent-migration-of-transient-domains.patch deleted file mode 100644 index 2aa645f..0000000 --- a/SOURCES/libvirt-qemu-Fix-persistent-migration-of-transient-domains.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 82a4218a06697ee5beaa6ba76704b0156b1a806c Mon Sep 17 00:00:00 2001 -Message-Id: <82a4218a06697ee5beaa6ba76704b0156b1a806c@dist-git> -From: Jiri Denemark -Date: Tue, 2 May 2017 18:56:06 +0200 -Subject: [PATCH] qemu: Fix persistent migration of transient domains - -While fixing a bug with incorrectly freed memory in commit -v3.1.0-399-g5498aa29a, I accidentally broke persistent migration of -transient domains. Before adding qemuDomainDefCopy in the path, the code -just took NULL from vm->newDef and used it as the persistent def, which -resulted in no persistent XML being sent in the migration cookie. This -scenario is perfectly valid and the destination correctly handles it by -using the incoming live definition and storing it as the persistent one. - -After the mentioned commit libvirtd would just segfault in the described -scenario. - -https://bugzilla.redhat.com/show_bug.cgi?id=1446205 - -Signed-off-by: Jiri Denemark -(cherry picked from commit 59307fade86fb74db1f8f572433962233f7ac123) -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index ac7e27319..5bf9bd10f 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -3609,15 +3609,15 @@ qemuMigrationRun(virQEMUDriverPtr driver, - - if (flags & VIR_MIGRATE_PERSIST_DEST) { - if (persist_xml) { -- persistDef = qemuMigrationPrepareDef(driver, persist_xml, -- NULL, NULL); -- } else { -- persistDef = qemuDomainDefCopy(driver, vm->newDef, -- VIR_DOMAIN_XML_SECURE | -- VIR_DOMAIN_XML_MIGRATABLE); -+ if (!(persistDef = qemuMigrationPrepareDef(driver, persist_xml, -+ NULL, NULL))) -+ goto cleanup; -+ } else if (vm->newDef) { -+ if (!(persistDef = qemuDomainDefCopy(driver, vm->newDef, -+ VIR_DOMAIN_XML_SECURE | -+ VIR_DOMAIN_XML_MIGRATABLE))) -+ goto cleanup; - } -- if (!persistDef) -- goto cleanup; - } - - mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Fix-qemuDomainGetBlockInfo-allocation-value-setting.patch b/SOURCES/libvirt-qemu-Fix-qemuDomainGetBlockInfo-allocation-value-setting.patch deleted file mode 100644 index eb82b29..0000000 --- a/SOURCES/libvirt-qemu-Fix-qemuDomainGetBlockInfo-allocation-value-setting.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0220b2fed9ab4b07f32e8ebe4ab048d64a27e948 Mon Sep 17 00:00:00 2001 -Message-Id: <0220b2fed9ab4b07f32e8ebe4ab048d64a27e948@dist-git> -From: John Ferlan -Date: Wed, 12 Jul 2017 16:31:10 +0200 -Subject: [PATCH] qemu: Fix qemuDomainGetBlockInfo allocation value setting - -https://bugzilla.redhat.com/show_bug.cgi?id=1467826 - -Commit id 'b9b1aa639' was supposed to add logic to set the allocation -for sparse files when wr_highest_offset was zero; however, an unconditional -setting was done just prior. For block devices, this means allocation is -always returning 0 since 'actual-size' will be zero. - -Remove the unconditional setting and add the note about it being possible -to still be zero for block devices. As soon as the guest starts writing to -the volume, the allocation value will then be obtainable from qemu via -the wr_highest_offset. - -(cherry picked from commit fde654be5307a570b7b0f31537e18e70a274cd50) - -https://bugzilla.redhat.com/show_bug.cgi?id=1470127 [7.4.z - 0day] - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index a2fb41b91a..b6d72303ca 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -11715,10 +11715,9 @@ qemuDomainGetBlockInfo(virDomainPtr dom, - * Additionally, if qemu hasn't written to the file yet, then set the - * allocation to whatever qemu returned for physical (e.g. the "actual- - * size" from the json query) as that will match the expected allocation -- * value for this API. */ -+ * value for this API. NB: May still be 0 for block. */ - if (entry->physical == 0 || info->allocation == 0 || - info->allocation == entry->physical) { -- info->allocation = entry->physical; - if (info->allocation == 0) - info->allocation = entry->physical; - --- -2.13.3 - diff --git a/SOURCES/libvirt-qemu-Fix-regression-when-hyperv-vendor_id-feature-is-used.patch b/SOURCES/libvirt-qemu-Fix-regression-when-hyperv-vendor_id-feature-is-used.patch deleted file mode 100644 index 488fc3d..0000000 --- a/SOURCES/libvirt-qemu-Fix-regression-when-hyperv-vendor_id-feature-is-used.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 552fbd4c0707d08e4b67b64a462f0d1609a5ac38 Mon Sep 17 00:00:00 2001 -Message-Id: <552fbd4c0707d08e4b67b64a462f0d1609a5ac38@dist-git> -From: Jiri Denemark -Date: Thu, 6 Apr 2017 13:52:30 +0200 -Subject: [PATCH] qemu: Fix regression when hyperv/vendor_id feature is used - -qemuProcessVerifyHypervFeatures is supposed to check whether all -requested hyperv features were actually honored by QEMU/KVM. This is -done by checking the corresponding CPUID bits reported by the virtual -CPU. In other words, it doesn't work for string properties, such as -VIR_DOMAIN_HYPERV_VENDOR_ID (there is no CPUID bit we could check). We -could theoretically check all 96 bits corresponding to the vendor -string, but luckily we don't have to check the feature at all. If QEMU -is too old to support hyperv features, the domain won't even start. -Otherwise, it is always supported. - -Without this patch, libvirt refuses to start a domain which contains - - - - - - - -reporting internal error: "unknown CPU feature __kvm_hv_vendor_id. - -This regression was introduced by commit v3.1.0-186-ge9dbe7011, which -(by fixing the virCPUDataCheckFeature condition in -qemuProcessVerifyHypervFeatures) revealed an old bug in the feature -verification code. It's been there ever since the verification was -implemented by commit v1.3.3-rc1-5-g95bbe4bf5, which effectively did not -check VIR_DOMAIN_HYPERV_VENDOR_ID at all. - -https://bugzilla.redhat.com/show_bug.cgi?id=1439424 - -Signed-off-by: Jiri Denemark -(cherry picked from commit ae102b5d7bccd29bc6015a3e0acefeaa90d097ac) - -https://bugzilla.redhat.com/show_bug.cgi?id=1439736 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_process.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index a20beb13c..039b3911c 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3793,6 +3793,10 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, - int rc; - - for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { -+ /* always supported string property */ -+ if (i == VIR_DOMAIN_HYPERV_VENDOR_ID) -+ continue; -+ - if (def->hyperv_features[i] != VIR_TRISTATE_SWITCH_ON) - continue; - -@@ -3821,13 +3825,13 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, - case VIR_DOMAIN_HYPERV_SYNIC: - case VIR_DOMAIN_HYPERV_STIMER: - case VIR_DOMAIN_HYPERV_RESET: -- case VIR_DOMAIN_HYPERV_VENDOR_ID: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("host doesn't support hyperv '%s' feature"), - virDomainHypervTypeToString(i)); - return -1; - - /* coverity[dead_error_begin] */ -+ case VIR_DOMAIN_HYPERV_VENDOR_ID: - case VIR_DOMAIN_HYPERV_LAST: - break; - } --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Fix-resource-leak-in-qemuDomainAddChardevTLSObjects-error-path.patch b/SOURCES/libvirt-qemu-Fix-resource-leak-in-qemuDomainAddChardevTLSObjects-error-path.patch deleted file mode 100644 index aa7ab0d..0000000 --- a/SOURCES/libvirt-qemu-Fix-resource-leak-in-qemuDomainAddChardevTLSObjects-error-path.patch +++ /dev/null @@ -1,55 +0,0 @@ -From f032a2a22052128bd0b3d41d2b5574ce27259eef Mon Sep 17 00:00:00 2001 -Message-Id: -From: John Ferlan -Date: Mon, 3 Apr 2017 12:53:33 -0400 -Subject: [PATCH] qemu: Fix resource leak in qemuDomainAddChardevTLSObjects - error path - -On any failure, call virJSONValueFree for the *Props. - -Signed-off-by: John Ferlan -(cherry picked from commit 2e8c60958ac32624296eee263bf34bb21a32360c) - -https://bugzilla.redhat.com/show_bug.cgi?id=1300769 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index dabfe10c0..fcd3a38a1 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -213,7 +213,7 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver, - cfg->migrateTLSx509verify, - QEMU_MIGRATION_TLS_ALIAS_BASE, - &tlsProps, tlsAlias, &secProps, secAlias) < 0) -- return -1; -+ goto error; - - /* Ensure the domain doesn't already have the TLS objects defined... - * This should prevent any issues just in case some cleanup wasn't -@@ -223,12 +223,17 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver, - - if (qemuDomainAddTLSObjects(driver, vm, asyncJob, *secAlias, &secProps, - *tlsAlias, &tlsProps) < 0) -- return -1; -+ goto error; - - if (VIR_STRDUP(migParams->migrateTLSAlias, *tlsAlias) < 0) -- return -1; -+ goto error; - - return 0; -+ -+ error: -+ virJSONValueFree(tlsProps); -+ virJSONValueFree(secProps); -+ return -1; - } - - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Fix-serial-stub-console-allocation.patch b/SOURCES/libvirt-qemu-Fix-serial-stub-console-allocation.patch deleted file mode 100644 index 1cd4a56..0000000 --- a/SOURCES/libvirt-qemu-Fix-serial-stub-console-allocation.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 096f83e7910c2c8553044d27918955b278e5ab8d Mon Sep 17 00:00:00 2001 -Message-Id: <096f83e7910c2c8553044d27918955b278e5ab8d@dist-git> -From: Erik Skultety -Date: Wed, 7 Jun 2017 14:29:29 +0200 -Subject: [PATCH] qemu: Fix serial stub console allocation - -When adding the aliased serial stub console, the structure wasn't -properly allocated (VIR_ALLOC instead of virDomainChrDefNew) which then -resulted in SIGSEGV in virDomainChrSourceIsEqual during a serial device -coldplug. - -https://bugzilla.redhat.com/show_bug.cgi?id=1434278 - -Signed-off-by: Erik Skultety -(cherry picked from commit ff6e94de60b081ae7e9d304e38c63346828c5dbe) -Signed-off-by: Erik Skultety -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_hotplug.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c -index cdeb0617a7..094a5644e0 100644 ---- a/src/qemu/qemu_hotplug.c -+++ b/src/qemu/qemu_hotplug.c -@@ -1802,15 +1802,17 @@ qemuDomainChrPreInsert(virDomainDefPtr vmdef, - if (virDomainChrPreAlloc(vmdef, chr) < 0) - return -1; - -- /* Due to some crazy backcompat stuff, the first serial device is an alias -- * to the first console too. If this is the case, the definition must be -- * duplicated as first console device. */ -+ /* Due to historical reasons, the first console is an alias to the -+ * first serial device (if such exists). If this is the case, we need to -+ * create an object for the first console as well. -+ */ - if (vmdef->nserials == 0 && vmdef->nconsoles == 0 && - chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { - if (!vmdef->consoles && VIR_ALLOC(vmdef->consoles) < 0) - return -1; - -- if (VIR_ALLOC(vmdef->consoles[0]) < 0) { -+ /* We'll be dealing with serials[0] directly, so NULL is fine here. */ -+ if (!(vmdef->consoles[0] = virDomainChrDefNew(NULL))) { - VIR_FREE(vmdef->consoles); - return -1; - } -@@ -1841,7 +1843,7 @@ qemuDomainChrInsertPreAllocCleanup(virDomainDefPtr vmdef, - /* Remove the stub console added by qemuDomainChrPreInsert */ - if (vmdef->nserials == 0 && vmdef->nconsoles == 1 && - chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { -- VIR_FREE(vmdef->consoles[0]); -+ virDomainChrDefFree(vmdef->consoles[0]); - VIR_FREE(vmdef->consoles); - vmdef->nconsoles = 0; - } --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Fix-type-of-a-completed-job.patch b/SOURCES/libvirt-qemu-Fix-type-of-a-completed-job.patch index 1f5cd14..e473be6 100644 --- a/SOURCES/libvirt-qemu-Fix-type-of-a-completed-job.patch +++ b/SOURCES/libvirt-qemu-Fix-type-of-a-completed-job.patch @@ -1,5 +1,5 @@ -From 684d747a6c5ea03dc05e6324ff8cba42b5873a15 Mon Sep 17 00:00:00 2001 -Message-Id: <684d747a6c5ea03dc05e6324ff8cba42b5873a15@dist-git> +From 92867e9b9ff1d9a163c6c166e710ba7c444be520 Mon Sep 17 00:00:00 2001 +Message-Id: <92867e9b9ff1d9a163c6c166e710ba7c444be520@dist-git> From: Jiri Denemark Date: Thu, 11 Jan 2018 20:47:50 +0100 Subject: [PATCH] qemu: Fix type of a completed job @@ -20,20 +20,17 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1523036 Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina (cherry picked from commit e8784e7868d44a2ce796b376cf78f0f6c61c114a) - -https://bugzilla.redhat.com/show_bug.cgi?id=1530130 - Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index aabd0913ad..120b79415e 100644 +index af744661f4..b814cc6608 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c -@@ -1590,8 +1590,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, - +@@ -1623,8 +1623,10 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, + qemuDomainJobInfoUpdateTime(jobInfo); qemuDomainJobInfoUpdateDowntime(jobInfo); VIR_FREE(priv->job.completed); - if (VIR_ALLOC(priv->job.completed) == 0) @@ -44,7 +41,7 @@ index aabd0913ad..120b79415e 100644 if (asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT && jobInfo->status == QEMU_DOMAIN_JOB_STATUS_QEMU_COMPLETED) -@@ -5370,8 +5372,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver, +@@ -5457,8 +5459,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } if (dom) { diff --git a/SOURCES/libvirt-qemu-Format-targetModel-for-serial-devices.patch b/SOURCES/libvirt-qemu-Format-targetModel-for-serial-devices.patch new file mode 100644 index 0000000..4e3fa17 --- /dev/null +++ b/SOURCES/libvirt-qemu-Format-targetModel-for-serial-devices.patch @@ -0,0 +1,78 @@ +From 506c50ee610cae51d09bf7e26af850a395da0e1f Mon Sep 17 00:00:00 2001 +Message-Id: <506c50ee610cae51d09bf7e26af850a395da0e1f@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:10 +0100 +Subject: [PATCH] qemu: Format targetModel for serial devices + +Now that we've created a distinction between target type and target +model, with the latter being the concrete device name, it's time to +switch to formatting the model instead of the type. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 7c76c30465ff6038df3b7aa27b40a3348ec599c9) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_command.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 8142834afd..7fd2afb1e0 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -10346,8 +10346,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + serial->info.alias); + } + } else { +- switch ((virDomainChrSerialTargetType) serial->targetType) { +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ switch ((virDomainChrSerialTargetModel) serial->targetModel) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_SERIAL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("usb-serial is not supported in this QEMU binary")); +@@ -10355,10 +10355,10 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + } + break; + +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL: + break; + +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_SERIAL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pci-serial is not supported with this QEMU binary")); +@@ -10366,19 +10366,19 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + } + break; + +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST: + /* Except from _LAST, which is just a guard value and will never + * be used, all of the above are platform devices, which means + * qemuBuildSerialCommandLine() will have taken the appropriate + * branch and we will not have ended up here. */ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +- _("Invalid target type for serial device")); ++ _("Invalid target model for serial device")); + goto error; + } + + virBufferAsprintf(&cmd, "%s,chardev=char%s,id=%s", +- virDomainChrSerialTargetTypeToString(serial->targetType), ++ virDomainChrSerialTargetModelTypeToString(serial->targetModel), + serial->info.alias, serial->info.alias); + } + +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Ignore-fallback-CPU-attribute-on-reconnect.patch b/SOURCES/libvirt-qemu-Ignore-fallback-CPU-attribute-on-reconnect.patch new file mode 100644 index 0000000..650b157 --- /dev/null +++ b/SOURCES/libvirt-qemu-Ignore-fallback-CPU-attribute-on-reconnect.patch @@ -0,0 +1,40 @@ +From 267d4074f4c6a543643e1fe8cd726953273a5bc6 Mon Sep 17 00:00:00 2001 +Message-Id: <267d4074f4c6a543643e1fe8cd726953273a5bc6@dist-git> +From: Jiri Denemark +Date: Wed, 10 Jan 2018 15:56:21 +0100 +Subject: [PATCH] qemu: Ignore fallback CPU attribute on reconnect + +When reconnecting to a running domain with host-model CPU started by old +libvirt which did not store the actual CPU in the status XML, we need to +ignore the fallback attribute to make sure we can translate the detected +host CPU model to a model which is supported by the running QEMU. + +https://bugzilla.redhat.com/show_bug.cgi?id=1532980 + +Signed-off-by: Jiri Denemark +Reviewed-by: Pavel Hrdina +(cherry picked from commit 237f045d9a9d84a52e645b490d14ad0b66e5b8ed) +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_process.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 701528c42c..c64088e4ca 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3884,6 +3884,11 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, + virDomainCapsCPUModelsPtr models = NULL; + int ret = -1; + ++ /* The host CPU model comes from host caps rather than QEMU caps so ++ * fallback must be allowed no matter what the user specified in the XML. ++ */ ++ vm->def->cpu->fallback = VIR_CPU_FALLBACK_ALLOW; ++ + if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) + goto cleanup; + +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Ignore-missing-query-migrate-parameters.patch b/SOURCES/libvirt-qemu-Ignore-missing-query-migrate-parameters.patch deleted file mode 100644 index f178208..0000000 --- a/SOURCES/libvirt-qemu-Ignore-missing-query-migrate-parameters.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 2d8e0d2cc979534be0149841e8bed07c0a4ba048 Mon Sep 17 00:00:00 2001 -Message-Id: <2d8e0d2cc979534be0149841e8bed07c0a4ba048@dist-git> -From: Jiri Denemark -Date: Thu, 27 Apr 2017 10:38:41 +0200 -Subject: [PATCH] qemu: Ignore missing query-migrate-parameters - -Migration with old QEMU which does not support query-migrate-parameters -would fail because the QMP command is called unconditionally since the -introduction of TLS migration. Previously it was only called if the user -explicitly requested a feature which uses QEMU migration parameters. And -even then the situation was not ideal, instead of reporting an -unsupported feature we'd just complain about missing QMP command. - -Trivially no migration parameters are supported when -query-migrate-parameters QMP command is missing. There's no need to -report an error if it is missing, the callers will report better error -if needed. - -https://bugzilla.redhat.com/show_bug.cgi?id=1441934 - -Signed-off-by: Jiri Denemark -(cherry picked from commit ac58c036065ff1d53bc05b796093287c27c71762) -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_monitor_json.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c -index 405f79fec..601aa3e74 100644 ---- a/src/qemu/qemu_monitor_json.c -+++ b/src/qemu/qemu_monitor_json.c -@@ -2666,6 +2666,11 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; - -+ if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { -+ ret = 0; -+ goto cleanup; -+ } -+ - if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Implement-virSaveCookie-object-and-callbacks.patch b/SOURCES/libvirt-qemu-Implement-virSaveCookie-object-and-callbacks.patch deleted file mode 100644 index fa0ffbe..0000000 --- a/SOURCES/libvirt-qemu-Implement-virSaveCookie-object-and-callbacks.patch +++ /dev/null @@ -1,166 +0,0 @@ -From e43851128b407dea2a55a813bdbefc5a639f1914 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Fri, 2 Jun 2017 22:50:18 +0200 -Subject: [PATCH] qemu: Implement virSaveCookie object and callbacks - -This patch implements a new save cookie object and callbacks for qemu -driver. The actual useful content will be added in the object later. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 215476b64226275ac090ca0e957bfca76ba1549e) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Conflicts: - src/qemu/qemu_domain.c - no qemuDomainLogContextClass in 7.4 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_conf.c | 2 +- - src/qemu/qemu_domain.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ - src/qemu/qemu_domain.h | 9 ++++++ - 3 files changed, 93 insertions(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c -index 96956b7779..51a42883dc 100644 ---- a/src/qemu/qemu_conf.c -+++ b/src/qemu/qemu_conf.c -@@ -909,7 +909,7 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver) - &virQEMUDriverPrivateDataCallbacks, - &virQEMUDriverDomainXMLNamespace, - &virQEMUDriverDomainABIStability, -- NULL); -+ &virQEMUDriverDomainSaveCookie); - } - - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 09903bdd5f..63fcde8024 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -120,6 +120,24 @@ struct _qemuDomainLogContext { - virLogManagerPtr manager; - }; - -+static virClassPtr qemuDomainSaveCookieClass; -+ -+static void qemuDomainSaveCookieDispose(void *obj); -+ -+static int -+qemuDomainOnceInit(void) -+{ -+ if (!(qemuDomainSaveCookieClass = virClassNew(virClassForObject(), -+ "qemuDomainSaveCookie", -+ sizeof(qemuDomainSaveCookie), -+ qemuDomainSaveCookieDispose))) -+ return -1; -+ -+ return 0; -+} -+ -+VIR_ONCE_GLOBAL_INIT(qemuDomain) -+ - const char * - qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, - int phase ATTRIBUTE_UNUSED) -@@ -9080,3 +9098,68 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr, - VIR_FREE(target); - return src; - } -+ -+ -+static void -+qemuDomainSaveCookieDispose(void *obj) -+{ -+ qemuDomainSaveCookiePtr cookie = obj; -+ -+ VIR_DEBUG("cookie=%p", cookie); -+} -+ -+ -+qemuDomainSaveCookiePtr -+qemuDomainSaveCookieNew(virDomainObjPtr vm ATTRIBUTE_UNUSED) -+{ -+ qemuDomainSaveCookiePtr cookie = NULL; -+ -+ if (qemuDomainInitialize() < 0) -+ goto error; -+ -+ if (!(cookie = virObjectNew(qemuDomainSaveCookieClass))) -+ goto error; -+ -+ VIR_DEBUG("Save cookie %p", cookie); -+ -+ return cookie; -+ -+ error: -+ virObjectUnref(cookie); -+ return NULL; -+} -+ -+ -+static int -+qemuDomainSaveCookieParse(xmlXPathContextPtr ctxt ATTRIBUTE_UNUSED, -+ virObjectPtr *obj) -+{ -+ qemuDomainSaveCookiePtr cookie = NULL; -+ -+ if (qemuDomainInitialize() < 0) -+ goto error; -+ -+ if (!(cookie = virObjectNew(qemuDomainSaveCookieClass))) -+ goto error; -+ -+ *obj = (virObjectPtr) cookie; -+ return 0; -+ -+ error: -+ virObjectUnref(cookie); -+ return -1; -+} -+ -+ -+static int -+qemuDomainSaveCookieFormat(virBufferPtr buf ATTRIBUTE_UNUSED, -+ virObjectPtr obj ATTRIBUTE_UNUSED) -+{ -+ return 0; -+} -+ -+ -+virSaveCookieCallbacks virQEMUDriverDomainSaveCookie = { -+ .parse = qemuDomainSaveCookieParse, -+ .format = qemuDomainSaveCookieFormat, -+}; -diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h -index 4db92fac8a..80d80e4554 100644 ---- a/src/qemu/qemu_domain.h -+++ b/src/qemu/qemu_domain.h -@@ -416,6 +416,14 @@ struct qemuProcessEvent { - typedef struct _qemuDomainLogContext qemuDomainLogContext; - typedef qemuDomainLogContext *qemuDomainLogContextPtr; - -+typedef struct _qemuDomainSaveCookie qemuDomainSaveCookie; -+typedef qemuDomainSaveCookie *qemuDomainSaveCookiePtr; -+struct _qemuDomainSaveCookie { -+ virObject parent; -+}; -+ -+qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm); -+ - const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, - int phase); - int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job, -@@ -640,6 +648,7 @@ extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks; - extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace; - extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; - extern virDomainABIStability virQEMUDriverDomainABIStability; -+extern virSaveCookieCallbacks virQEMUDriverDomainSaveCookie; - - int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm, int asyncJob); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Improve-qemuDomainChrTargetDefValidate.patch b/SOURCES/libvirt-qemu-Improve-qemuDomainChrTargetDefValidate.patch new file mode 100644 index 0000000..f14a292 --- /dev/null +++ b/SOURCES/libvirt-qemu-Improve-qemuDomainChrTargetDefValidate.patch @@ -0,0 +1,104 @@ +From 04e24e8cb39c0a3b3d3203985fa0ec824195d1ab Mon Sep 17 00:00:00 2001 +Message-Id: <04e24e8cb39c0a3b3d3203985fa0ec824195d1ab@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:06 +0100 +Subject: [PATCH] qemu: Improve qemuDomainChrTargetDefValidate() + +Instead of validating each target type / address type combination +separately, create a small helper to perform the matching and +collapse all existing checks into a single one. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 9ae116eadf7578282d284635fa23a4265b8db734) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_domain.c | 50 ++++++++++++++++++++++++++++++-------------------- + 1 file changed, 30 insertions(+), 20 deletions(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 35eb19ca32..bb25255b94 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3456,43 +3456,53 @@ qemuDomainChrSourceDefValidate(const virDomainChrSourceDef *def) + } + + ++static int ++qemuDomainChrSerialTargetTypeToAddressType(int targetType) ++{ ++ switch ((virDomainChrSerialTargetType) targetType) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: ++ break; ++ } ++ ++ return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; ++} ++ ++ + static int + qemuDomainChrTargetDefValidate(const virDomainDef *def, + const virDomainChrDef *chr) + { ++ int expected; ++ + switch ((virDomainChrDeviceType) chr->deviceType) { + case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: + + /* Validate target type */ + switch ((virDomainChrSerialTargetType) chr->targetType) { + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ + /* Hack required until we have a proper type for pSeries + * serial consoles */ + if (qemuDomainIsPSeries(def)) + return 0; + +- if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("isa-serial requires address of isa type")); +- return -1; +- } +- break; ++ expected = qemuDomainChrSerialTargetTypeToAddressType(chr->targetType); + +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: + if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("usb-serial requires address of usb type")); +- return -1; +- } +- break; +- +- case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: +- if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("pci-serial requires address of pci type")); ++ chr->info.type != expected) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, ++ _("Target type '%s' requires address type '%s'"), ++ virDomainChrSerialTargetTypeToString(chr->targetType), ++ virDomainDeviceAddressTypeToString(expected)); + return -1; + } + break; +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Introduce-functions-for-input-device-cgroup-manipulation.patch b/SOURCES/libvirt-qemu-Introduce-functions-for-input-device-cgroup-manipulation.patch new file mode 100644 index 0000000..47d5789 --- /dev/null +++ b/SOURCES/libvirt-qemu-Introduce-functions-for-input-device-cgroup-manipulation.patch @@ -0,0 +1,85 @@ +From 0a7264a2f791329f1c041594dfc17328040b8299 Mon Sep 17 00:00:00 2001 +Message-Id: <0a7264a2f791329f1c041594dfc17328040b8299@dist-git> +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Mon, 27 Nov 2017 14:21:00 +0100 +Subject: [PATCH] qemu: Introduce functions for input device cgroup + manipulation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Export qemuSetupInputCgroup and introduce qemuTeardownInputCgroup +for hotunplug. + +(cherry picked from commit f29612fd353db074a0b963ed53ef9c29c562bb36) + +https://bugzilla.redhat.com/show_bug.cgi?id=1509866 + +Signed-off-by: Ján Tomko +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_cgroup.c | 25 ++++++++++++++++++++++++- + src/qemu/qemu_cgroup.h | 4 ++++ + 2 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c +index 0f75e22f98..19252ea239 100644 +--- a/src/qemu/qemu_cgroup.c ++++ b/src/qemu/qemu_cgroup.c +@@ -246,7 +246,7 @@ qemuSetupTPMCgroup(virDomainObjPtr vm) + } + + +-static int ++int + qemuSetupInputCgroup(virDomainObjPtr vm, + virDomainInputDefPtr dev) + { +@@ -269,6 +269,29 @@ qemuSetupInputCgroup(virDomainObjPtr vm, + } + + ++int ++qemuTeardownInputCgroup(virDomainObjPtr vm, ++ virDomainInputDefPtr dev) ++{ ++ qemuDomainObjPrivatePtr priv = vm->privateData; ++ int ret = 0; ++ ++ if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES)) ++ return 0; ++ ++ switch (dev->type) { ++ case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: ++ VIR_DEBUG("Process path '%s' for input device", dev->source.evdev); ++ ret = virCgroupDenyDevicePath(priv->cgroup, dev->source.evdev, ++ VIR_CGROUP_DEVICE_RWM, false); ++ virDomainAuditCgroupPath(vm, priv->cgroup, "deny", dev->source.evdev, "rwm", ret == 0); ++ break; ++ } ++ ++ return ret; ++} ++ ++ + int + qemuSetupHostdevCgroup(virDomainObjPtr vm, + virDomainHostdevDefPtr dev) +diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h +index 3fc1583612..3b8ff6055d 100644 +--- a/src/qemu/qemu_cgroup.h ++++ b/src/qemu/qemu_cgroup.h +@@ -37,6 +37,10 @@ int qemuSetupDiskCgroup(virDomainObjPtr vm, + virDomainDiskDefPtr disk); + int qemuTeardownDiskCgroup(virDomainObjPtr vm, + virDomainDiskDefPtr disk); ++int qemuSetupInputCgroup(virDomainObjPtr vm, ++ virDomainInputDefPtr dev); ++int qemuTeardownInputCgroup(virDomainObjPtr vm, ++ virDomainInputDefPtr dev); + int qemuSetupHostdevCgroup(virDomainObjPtr vm, + virDomainHostdevDefPtr dev) + ATTRIBUTE_RETURN_CHECK; +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Introduce-qemuDomainChrDefPostParse.patch b/SOURCES/libvirt-qemu-Introduce-qemuDomainChrDefPostParse.patch new file mode 100644 index 0000000..966ace4 --- /dev/null +++ b/SOURCES/libvirt-qemu-Introduce-qemuDomainChrDefPostParse.patch @@ -0,0 +1,108 @@ +From 06cb6ae1254842377d0b17f9fdd52e0d2b6b23eb Mon Sep 17 00:00:00 2001 +Message-Id: <06cb6ae1254842377d0b17f9fdd52e0d2b6b23eb@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:22:56 +0100 +Subject: [PATCH] qemu: Introduce qemuDomainChrDefPostParse() + +Having a separate function for char device handling is better than +adding even more code to qemuDomainDeviceDefPostParse(). + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +Reviewed-by: Marc Hartmayer +(cherry picked from commit f4b50cc1b994e44c793f4dea59489ba51e2d1fe0) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++++++-------------------- + 1 file changed, 34 insertions(+), 23 deletions(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 138f773c22..b15d994774 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -4082,6 +4082,35 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, + return 0; + } + ++static int ++qemuDomainChrDefPostParse(virDomainChrDefPtr chr, ++ const virDomainDef *def, ++ virQEMUDriverPtr driver, ++ unsigned int parseFlags) ++{ ++ /* set the default console type for S390 arches */ ++ if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && ++ chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE && ++ ARCH_IS_S390(def->os.arch)) { ++ chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; ++ } ++ ++ /* clear auto generated unix socket path for inactive definitions */ ++ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { ++ if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) ++ return -1; ++ ++ /* For UNIX chardev if no path is provided we generate one. ++ * This also implies that the mode is 'bind'. */ ++ if (chr->source && ++ chr->source->type == VIR_DOMAIN_CHR_TYPE_UNIX && ++ !chr->source->data.nix.path) { ++ chr->source->data.nix.listen = true; ++ } ++ } ++ ++ return 0; ++} + + static int + qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, +@@ -4142,29 +4171,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, + } + } + +- /* set the default console type for S390 arches */ +- if (dev->type == VIR_DOMAIN_DEVICE_CHR && +- dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && +- dev->data.chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE && +- ARCH_IS_S390(def->os.arch)) +- dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO; +- +- /* clear auto generated unix socket path for inactive definitions */ +- if ((parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && +- dev->type == VIR_DOMAIN_DEVICE_CHR) { +- virDomainChrDefPtr chr = dev->data.chr; +- if (qemuDomainChrDefDropDefaultPath(chr, driver) < 0) +- goto cleanup; +- +- /* For UNIX chardev if no path is provided we generate one. +- * This also implies that the mode is 'bind'. */ +- if (chr->source && +- chr->source->type == VIR_DOMAIN_CHR_TYPE_UNIX && +- !chr->source->data.nix.path) { +- chr->source->data.nix.listen = true; +- } +- } +- + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) { + if (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) { + if ARCH_IS_PPC64(def->os.arch) +@@ -4200,6 +4206,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, + qemuDomainShmemDefPostParse(dev->data.shmem) < 0) + goto cleanup; + ++ if (dev->type == VIR_DOMAIN_DEVICE_CHR && ++ qemuDomainChrDefPostParse(dev->data.chr, def, driver, parseFlags) < 0) { ++ goto cleanup; ++ } ++ + ret = 0; + + cleanup: +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Introduce-qemuDomainChrTargetDefValidate.patch b/SOURCES/libvirt-qemu-Introduce-qemuDomainChrTargetDefValidate.patch new file mode 100644 index 0000000..b5555be --- /dev/null +++ b/SOURCES/libvirt-qemu-Introduce-qemuDomainChrTargetDefValidate.patch @@ -0,0 +1,151 @@ +From 9ec1516a227445872bf5bcb8a535c1a71f644739 Mon Sep 17 00:00:00 2001 +Message-Id: <9ec1516a227445872bf5bcb8a535c1a71f644739@dist-git> +From: Andrea Bolognani +Date: Wed, 29 Nov 2017 16:23:05 +0100 +Subject: [PATCH] qemu: Introduce qemuDomainChrTargetDefValidate() + +Instead of waiting until we get to command line generation, we can +validate the target for a char device much earlier. + +Move all the checks out of qemuBuildSerialChrDeviceStr() and into +the new fuction. This will later allow us to validate the target +for platform devices. + +Signed-off-by: Andrea Bolognani +Reviewed-by: Pavel Hrdina +(cherry picked from commit 81e14caf60ac28acf9b7147617ef26bb99955757) + +https://bugzilla.redhat.com/show_bug.cgi?id=1449265 +https://bugzilla.redhat.com/show_bug.cgi?id=1511421 +https://bugzilla.redhat.com/show_bug.cgi?id=1512929 +https://bugzilla.redhat.com/show_bug.cgi?id=1512934 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_command.c | 20 ---------------- + src/qemu/qemu_domain.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 62 insertions(+), 20 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index d593e60198..8142834afd 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -10353,22 +10353,9 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + _("usb-serial is not supported in this QEMU binary")); + goto error; + } +- +- if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("usb-serial requires address of usb type")); +- goto error; +- } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: +- if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("isa-serial requires address of isa type")); +- goto error; +- } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: +@@ -10377,13 +10364,6 @@ qemuBuildSerialChrDeviceStr(char **deviceStr, + _("pci-serial is not supported with this QEMU binary")); + goto error; + } +- +- if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && +- serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("pci-serial requires address of pci type")); +- goto error; +- } + break; + + case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index e43f7496c2..35eb19ca32 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -3456,6 +3456,65 @@ qemuDomainChrSourceDefValidate(const virDomainChrSourceDef *def) + } + + ++static int ++qemuDomainChrTargetDefValidate(const virDomainDef *def, ++ const virDomainChrDef *chr) ++{ ++ switch ((virDomainChrDeviceType) chr->deviceType) { ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL: ++ ++ /* Validate target type */ ++ switch ((virDomainChrSerialTargetType) chr->targetType) { ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA: ++ /* Hack required until we have a proper type for pSeries ++ * serial consoles */ ++ if (qemuDomainIsPSeries(def)) ++ return 0; ++ ++ if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && ++ chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("isa-serial requires address of isa type")); ++ return -1; ++ } ++ break; ++ ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB: ++ if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && ++ chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("usb-serial requires address of usb type")); ++ return -1; ++ } ++ break; ++ ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI: ++ if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && ++ chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("pci-serial requires address of pci type")); ++ return -1; ++ } ++ break; ++ ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: ++ case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST: ++ break; ++ } ++ break; ++ ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL: ++ case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST: ++ /* Nothing to do */ ++ break; ++ } ++ ++ return 0; ++} ++ ++ + static int + qemuDomainChrDefValidate(const virDomainChrDef *dev, + const virDomainDef *def) +@@ -3463,6 +3522,9 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev, + if (qemuDomainChrSourceDefValidate(dev->source) < 0) + return -1; + ++ if (qemuDomainChrTargetDefValidate(def, dev) < 0) ++ return -1; ++ + if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL && + (ARCH_IS_S390(def->os.arch) || qemuDomainIsPSeries(def))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Introduce-qemuDomainDefFromXML-helper.patch b/SOURCES/libvirt-qemu-Introduce-qemuDomainDefFromXML-helper.patch deleted file mode 100644 index c7692ca..0000000 --- a/SOURCES/libvirt-qemu-Introduce-qemuDomainDefFromXML-helper.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0085fabfc81c097d0307b307ac0441c2448fbb16 Mon Sep 17 00:00:00 2001 -Message-Id: <0085fabfc81c097d0307b307ac0441c2448fbb16@dist-git> -From: Jiri Denemark -Date: Wed, 14 Jun 2017 13:42:16 +0200 -Subject: [PATCH] qemu: Introduce qemuDomainDefFromXML helper - -The main goal of this function is to enable reusing the parsing code -from qemuDomainDefCopy. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 0810d4f5e0d77354cdf7ad56e1e8b7748bdb1501) - -https://bugzilla.redhat.com/show_bug.cgi?id=1460952 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_domain.c | 33 +++++++++++++++++++++------------ - 1 file changed, 21 insertions(+), 12 deletions(-) - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index 82dacb3c9c..ce75105afa 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -4146,6 +4146,25 @@ void qemuDomainObjExitRemote(virDomainObjPtr obj) - } - - -+static virDomainDefPtr -+qemuDomainDefFromXML(virQEMUDriverPtr driver, -+ const char *xml) -+{ -+ virCapsPtr caps; -+ virDomainDefPtr def; -+ -+ if (!(caps = virQEMUDriverGetCapabilities(driver, false))) -+ return NULL; -+ -+ def = virDomainDefParseString(xml, caps, driver->xmlopt, NULL, -+ VIR_DOMAIN_DEF_PARSE_INACTIVE | -+ VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); -+ -+ virObjectUnref(caps); -+ return def; -+} -+ -+ - virDomainDefPtr - qemuDomainDefCopy(virQEMUDriverPtr driver, - virDomainDefPtr src, -@@ -4153,25 +4172,15 @@ qemuDomainDefCopy(virQEMUDriverPtr driver, - { - virBuffer buf = VIR_BUFFER_INITIALIZER; - virDomainDefPtr ret = NULL; -- virCapsPtr caps = NULL; - char *xml = NULL; - - if (qemuDomainDefFormatBuf(driver, src, flags, &buf) < 0) -- goto cleanup; -+ return NULL; - - xml = virBufferContentAndReset(&buf); -+ ret = qemuDomainDefFromXML(driver, xml); - -- if (!(caps = virQEMUDriverGetCapabilities(driver, false))) -- goto cleanup; -- -- if (!(ret = virDomainDefParseString(xml, caps, driver->xmlopt, NULL, -- VIR_DOMAIN_DEF_PARSE_INACTIVE | -- VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) -- goto cleanup; -- -- cleanup: - VIR_FREE(xml); -- virObjectUnref(caps); - return ret; - } - --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Introduce-qemuMigrationReset.patch b/SOURCES/libvirt-qemu-Introduce-qemuMigrationReset.patch deleted file mode 100644 index 8a73a17..0000000 --- a/SOURCES/libvirt-qemu-Introduce-qemuMigrationReset.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0c3a8fd16a2081ba0a07bf8c8bfdf26e4922da31 Mon Sep 17 00:00:00 2001 -Message-Id: <0c3a8fd16a2081ba0a07bf8c8bfdf26e4922da31@dist-git> -From: Jiri Denemark -Date: Wed, 5 Apr 2017 14:48:43 +0200 -Subject: [PATCH] qemu: Introduce qemuMigrationReset - -This new API is supposed to reset all migration parameters to make sure -future migrations won't accidentally use them. This patch makes the -first step and moves qemuMigrationResetTLS call inside -qemuMigrationReset. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 439a1795fd3dc8a47ad794bf10a4c86a3ee14e61) - -https://bugzilla.redhat.com/show_bug.cgi?id=1425003 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_migration.c | 31 +++++++++++++++++++++++-------- - src/qemu/qemu_migration.h | 5 +++++ - src/qemu/qemu_process.c | 4 ++-- - 3 files changed, 30 insertions(+), 10 deletions(-) - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 6c9f14245..27156cc78 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -2836,9 +2836,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, - return ret; - - stopjob: -- ignore_value(qemuMigrationResetTLS(driver, vm, -- QEMU_ASYNC_JOB_MIGRATION_IN, -- tlsAlias, secAlias)); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN); - - if (stopProcess) { - unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED; -@@ -3216,8 +3214,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, - qemuDomainEventQueue(driver, event); - } - -- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, -- NULL, NULL); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT); - - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) - VIR_WARN("Failed to save status on vm %s", vm->def->name); -@@ -4830,8 +4827,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver, - * here - */ - if (!v3proto && ret < 0) -- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, -- NULL, NULL); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT); - - if (qemuMigrationRestoreDomainState(conn, vm)) { - event = virDomainEventLifecycleNewFromObj(vm, -@@ -5362,7 +5358,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, - QEMU_ASYNC_JOB_MIGRATION_IN); - } - -- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, NULL, NULL); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN); - - qemuMigrationJobFinish(driver, vm); - if (!virDomainObjIsActive(vm)) -@@ -5875,3 +5871,22 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression, - - return 0; - } -+ -+ -+/* -+ * qemuMigrationReset: -+ * -+ * Reset all migration parameters so that the next job which internally uses -+ * migration (save, managedsave, snapshots, dump) will not try to use them. -+ */ -+void -+qemuMigrationReset(virQEMUDriverPtr driver, -+ virDomainObjPtr vm, -+ qemuDomainAsyncJob job) -+{ -+ if (!virDomainObjIsActive(vm)) -+ return; -+ -+ if (qemuMigrationResetTLS(driver, vm, job, NULL, NULL) < 0) -+ return; -+} -diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h -index 5248f399d..28eb55056 100644 ---- a/src/qemu/qemu_migration.h -+++ b/src/qemu/qemu_migration.h -@@ -285,4 +285,9 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver, - char *in_tlsAlias, - char *in_secAlias); - -+void -+qemuMigrationReset(virQEMUDriverPtr driver, -+ virDomainObjPtr vm, -+ qemuDomainAsyncJob job); -+ - #endif /* __QEMU_MIGRATION_H__ */ -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 2e0f859ce..027c831e6 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -2982,7 +2982,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver, - break; - } - -- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE); - return 0; - } - -@@ -3077,7 +3077,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, - } - } - -- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL); -+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE); - return 0; - } - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Introduce-virQEMUCapsHostCPUDataClear.patch b/SOURCES/libvirt-qemu-Introduce-virQEMUCapsHostCPUDataClear.patch deleted file mode 100644 index 5afde71..0000000 --- a/SOURCES/libvirt-qemu-Introduce-virQEMUCapsHostCPUDataClear.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 393675b4e08f2ff8a685d9bd02a83079d32e6eee Mon Sep 17 00:00:00 2001 -Message-Id: <393675b4e08f2ff8a685d9bd02a83079d32e6eee@dist-git> -From: Jiri Denemark -Date: Fri, 7 Apr 2017 17:43:59 +0200 -Subject: [PATCH] qemu: Introduce virQEMUCapsHostCPUDataClear - -To keep freeing of host CPU data in one place. - -Signed-off-by: Jiri Denemark -(cherry picked from commit b0605e848724c5dc478382398b734398abff674c) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 30 +++++++++++++++++------------- - 1 file changed, 17 insertions(+), 13 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 98a9a0f1d..8e7cbb590 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -2112,6 +2112,21 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst, - } - - -+static void -+virQEMUCapsHostCPUDataClear(virQEMUCapsPtr qemuCaps) -+{ -+ qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); -+ qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); -+ qemuCaps->kvmCPUModelInfo = NULL; -+ qemuCaps->tcgCPUModelInfo = NULL; -+ -+ virCPUDefFree(qemuCaps->kvmCPUModel); -+ virCPUDefFree(qemuCaps->tcgCPUModel); -+ qemuCaps->kvmCPUModel = NULL; -+ qemuCaps->tcgCPUModel = NULL; -+} -+ -+ - virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) - { - virQEMUCapsPtr ret = virQEMUCapsNew(); -@@ -2198,10 +2213,7 @@ void virQEMUCapsDispose(void *obj) - - VIR_FREE(qemuCaps->gicCapabilities); - -- qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); -- qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); -- virCPUDefFree(qemuCaps->kvmCPUModel); -- virCPUDefFree(qemuCaps->tcgCPUModel); -+ virQEMUCapsHostCPUDataClear(qemuCaps); - } - - void -@@ -4074,15 +4086,7 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) - VIR_FREE(qemuCaps->gicCapabilities); - qemuCaps->ngicCapabilities = 0; - -- qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); -- qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); -- qemuCaps->kvmCPUModelInfo = NULL; -- qemuCaps->tcgCPUModelInfo = NULL; -- -- virCPUDefFree(qemuCaps->kvmCPUModel); -- virCPUDefFree(qemuCaps->tcgCPUModel); -- qemuCaps->kvmCPUModel = NULL; -- qemuCaps->tcgCPUModel = NULL; -+ virQEMUCapsHostCPUDataClear(qemuCaps); - } - - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Introduce-virQEMUCapsSetHostModel.patch b/SOURCES/libvirt-qemu-Introduce-virQEMUCapsSetHostModel.patch deleted file mode 100644 index b25cf96..0000000 --- a/SOURCES/libvirt-qemu-Introduce-virQEMUCapsSetHostModel.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 08d9d5f63f03898772fd8c636d217d2d00e14919 Mon Sep 17 00:00:00 2001 -Message-Id: <08d9d5f63f03898772fd8c636d217d2d00e14919@dist-git> -From: Jiri Denemark -Date: Fri, 7 Apr 2017 17:03:38 +0200 -Subject: [PATCH] qemu: Introduce virQEMUCapsSetHostModel - -A simple helper as a complement to virQEMUCapsGetHostModel. - -Signed-off-by: Jiri Denemark -(cherry picked from commit bffc3b9fe501ff122ad81ddf42ecdb69f70ff70a) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index eb6b674b4..2bbc9253a 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -2425,6 +2425,18 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - } - - -+static void -+virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps, -+ virDomainVirtType type, -+ virCPUDefPtr cpu) -+{ -+ if (type == VIR_DOMAIN_VIRT_KVM) -+ qemuCaps->kvmCPUModel = cpu; -+ else -+ qemuCaps->tcgCPUModel = cpu; -+} -+ -+ - bool - virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, - virCapsPtr caps, -@@ -3301,10 +3313,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - goto error; - } - -- if (type == VIR_DOMAIN_VIRT_KVM) -- qemuCaps->kvmCPUModel = cpu; -- else -- qemuCaps->tcgCPUModel = cpu; -+ virQEMUCapsSetHostModel(qemuCaps, type, cpu); - - cleanup: - virCPUDefFree(hostCPU); --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-New-Free.patch b/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-New-Free.patch deleted file mode 100644 index 6356951..0000000 --- a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-New-Free.patch +++ /dev/null @@ -1,405 +0,0 @@ -From d37bad5cb5da2804d51cd6c45903f538d9ec85c5 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Tue, 6 Jun 2017 22:29:24 +0200 -Subject: [PATCH] qemu: Introduce virQEMUSaveData{New,Free} - -This is a preparation for creating a new virQEMUSaveData structure which -will encapsulate all save image header data. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit a2d2aae148980f00dd83093d61b1aa06c54fbe96) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 128 ++++++++++++++++++++++++++++++++----------------- - 1 file changed, 83 insertions(+), 45 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 5db92b04a1..4a05793339 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -2826,6 +2826,36 @@ bswap_header(virQEMUSaveHeaderPtr hdr) - } - - -+static void -+virQEMUSaveDataFree(virQEMUSaveHeaderPtr header) -+{ -+ if (!header) -+ return; -+ -+ VIR_FREE(header); -+} -+ -+ -+static virQEMUSaveHeaderPtr -+virQEMUSaveDataNew(char *domXML, -+ bool running, -+ int compressed) -+{ -+ virQEMUSaveHeaderPtr header = NULL; -+ -+ if (VIR_ALLOC(header) < 0) -+ return NULL; -+ -+ memcpy(header->magic, QEMU_SAVE_PARTIAL, sizeof(header->magic)); -+ header->version = QEMU_SAVE_VERSION; -+ header->was_running = running ? 1 : 0; -+ header->compressed = compressed; -+ header->data_len = strlen(domXML) + 1; -+ -+ return header; -+} -+ -+ - /* return -errno on failure, or 0 on success */ - static int - qemuDomainSaveHeader(int fd, const char *path, const char *xml, -@@ -3048,13 +3078,11 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - virDomainObjPtr vm, - const char *path, - const char *domXML, -- int compressed, -+ virQEMUSaveHeaderPtr header, - const char *compressedpath, -- bool was_running, - unsigned int flags, - qemuDomainAsyncJob asyncJob) - { -- virQEMUSaveHeader header; - bool bypassSecurityDriver = false; - bool needUnlink = false; - int ret = -1; -@@ -3063,13 +3091,6 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - virFileWrapperFdPtr wrapperFd = NULL; - unsigned int wrapperFlags = VIR_FILE_WRAPPER_NON_BLOCKING; - -- memset(&header, 0, sizeof(header)); -- memcpy(header.magic, QEMU_SAVE_PARTIAL, sizeof(header.magic)); -- header.version = QEMU_SAVE_VERSION; -- header.was_running = was_running ? 1 : 0; -- header.compressed = compressed; -- header.data_len = strlen(domXML) + 1; -- - /* Obtain the file handle. */ - if ((flags & VIR_DOMAIN_SAVE_BYPASS_CACHE)) { - wrapperFlags |= VIR_FILE_WRAPPER_BYPASS_CACHE; -@@ -3093,7 +3114,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - goto cleanup; - - /* Write header to file, followed by XML */ -- if (qemuDomainSaveHeader(fd, path, domXML, &header) < 0) -+ if (qemuDomainSaveHeader(fd, path, domXML, header) < 0) - goto cleanup; - - /* Perform the migration */ -@@ -3117,7 +3138,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0) - goto cleanup; - -- memcpy(header.magic, QEMU_SAVE_MAGIC, sizeof(header.magic)); -+ memcpy(header->magic, QEMU_SAVE_MAGIC, sizeof(header->magic)); - - if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) { - virReportSystemError(errno, _("unable to write %s"), path); -@@ -3158,6 +3179,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - virObjectEventPtr event = NULL; - qemuDomainObjPrivatePtr priv = vm->privateData; - virCapsPtr caps; -+ virQEMUSaveHeaderPtr header = NULL; - - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; -@@ -3223,9 +3245,11 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - goto endjob; - } - -- ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed, -- compressedpath, was_running, flags, -- QEMU_ASYNC_JOB_SAVE); -+ if (!(header = virQEMUSaveDataNew(xml, was_running, compressed))) -+ goto endjob; -+ -+ ret = qemuDomainSaveMemory(driver, vm, path, xml, header, compressedpath, -+ flags, QEMU_ASYNC_JOB_SAVE); - if (ret < 0) - goto endjob; - -@@ -3258,6 +3282,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - - cleanup: - VIR_FREE(xml); -+ virQEMUSaveDataFree(header); - qemuDomainEventQueue(driver, event); - virObjectUnref(caps); - return ret; -@@ -6189,7 +6214,7 @@ static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) - qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - const char *path, - virDomainDefPtr *ret_def, -- virQEMUSaveHeaderPtr ret_header, -+ virQEMUSaveHeaderPtr *ret_header, - char **xmlout, - bool bypass_cache, - virFileWrapperFdPtr *wrapperFd, -@@ -6197,8 +6222,8 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - bool unlink_corrupt) - { - int fd = -1; -- virQEMUSaveHeader header; - char *xml = NULL; -+ virQEMUSaveHeaderPtr header = NULL; - virDomainDefPtr def = NULL; - int oflags = open_write ? O_RDWR : O_RDONLY; - virCapsPtr caps = NULL; -@@ -6223,7 +6248,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - VIR_FILE_WRAPPER_BYPASS_CACHE))) - goto error; - -- if (saferead(fd, &header, sizeof(header)) != sizeof(header)) { -+ if (VIR_ALLOC(header) < 0) -+ goto error; -+ -+ if (saferead(fd, header, sizeof(*header)) != sizeof(*header)) { - if (unlink_corrupt) { - if (VIR_CLOSE(fd) < 0 || unlink(path) < 0) { - virReportSystemError(errno, -@@ -6239,11 +6267,11 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - goto error; - } - -- if (memcmp(header.magic, QEMU_SAVE_MAGIC, sizeof(header.magic)) != 0) { -+ if (memcmp(header->magic, QEMU_SAVE_MAGIC, sizeof(header->magic)) != 0) { - const char *msg = _("image magic is incorrect"); - -- if (memcmp(header.magic, QEMU_SAVE_PARTIAL, -- sizeof(header.magic)) == 0) { -+ if (memcmp(header->magic, QEMU_SAVE_PARTIAL, -+ sizeof(header->magic)) == 0) { - msg = _("save image is incomplete"); - if (unlink_corrupt) { - if (VIR_CLOSE(fd) < 0 || unlink(path) < 0) { -@@ -6260,28 +6288,28 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - goto error; - } - -- if (header.version > QEMU_SAVE_VERSION) { -+ if (header->version > QEMU_SAVE_VERSION) { - /* convert endianess and try again */ -- bswap_header(&header); -+ bswap_header(header); - } - -- if (header.version > QEMU_SAVE_VERSION) { -+ if (header->version > QEMU_SAVE_VERSION) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("image version is not supported (%d > %d)"), -- header.version, QEMU_SAVE_VERSION); -+ header->version, QEMU_SAVE_VERSION); - goto error; - } - -- if (header.data_len <= 0) { -+ if (header->data_len <= 0) { - virReportError(VIR_ERR_OPERATION_FAILED, -- _("invalid XML length: %d"), header.data_len); -+ _("invalid XML length: %d"), header->data_len); - goto error; - } - -- if (VIR_ALLOC_N(xml, header.data_len) < 0) -+ if (VIR_ALLOC_N(xml, header->data_len) < 0) - goto error; - -- if (saferead(fd, xml, header.data_len) != header.data_len) { -+ if (saferead(fd, xml, header->data_len) != header->data_len) { - virReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to read XML")); - goto error; -@@ -6308,6 +6336,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - error: - virDomainDefFree(def); - VIR_FREE(xml); -+ virQEMUSaveDataFree(header); - VIR_FORCE_CLOSE(fd); - virObjectUnref(caps); - -@@ -6319,7 +6348,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, - virQEMUDriverPtr driver, - virDomainObjPtr vm, - int *fd, -- const virQEMUSaveHeader *header, -+ virQEMUSaveHeaderPtr header, - const char *path, - bool start_paused, - qemuDomainAsyncJob asyncJob) -@@ -6445,7 +6474,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - const char *newxml = dxml; - int fd = -1; - int ret = -1; -- virQEMUSaveHeader header; -+ virQEMUSaveHeaderPtr header = NULL; - virFileWrapperFdPtr wrapperFd = NULL; - bool hook_taint = false; - -@@ -6502,9 +6531,9 @@ qemuDomainRestoreFlags(virConnectPtr conn, - def = NULL; - - if (flags & VIR_DOMAIN_SAVE_RUNNING) -- header.was_running = 1; -+ header->was_running = 1; - else if (flags & VIR_DOMAIN_SAVE_PAUSED) -- header.was_running = 0; -+ header->was_running = 0; - - if (hook_taint) { - priv = vm->privateData; -@@ -6514,7 +6543,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_RESTORE) < 0) - goto cleanup; - -- ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, &header, path, -+ ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, header, path, - false, QEMU_ASYNC_JOB_START); - if (virFileWrapperFdClose(wrapperFd) < 0) - VIR_WARN("Failed to close %s", path); -@@ -6525,6 +6554,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); - VIR_FREE(xml); -+ virQEMUSaveDataFree(header); - VIR_FREE(xmlout); - virFileWrapperFdFree(wrapperFd); - if (vm && ret < 0) -@@ -6549,7 +6579,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path, - char *ret = NULL; - virDomainDefPtr def = NULL; - int fd = -1; -- virQEMUSaveHeader header; -+ virQEMUSaveHeaderPtr header = NULL; - - /* We only take subset of virDomainDefFormat flags. */ - virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL); -@@ -6566,6 +6596,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path, - ret = qemuDomainDefFormatXML(driver, def, flags); - - cleanup: -+ virQEMUSaveDataFree(header); - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); - return ret; -@@ -6580,9 +6611,9 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - virDomainDefPtr def = NULL; - virDomainDefPtr newdef = NULL; - int fd = -1; -- virQEMUSaveHeader header; - char *xml = NULL; - size_t len; -+ virQEMUSaveHeaderPtr header = NULL; - int state = -1; - - virCheckFlags(VIR_DOMAIN_SAVE_RUNNING | -@@ -6603,14 +6634,14 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - goto cleanup; - - if (STREQ(xml, dxml) && -- (state < 0 || state == header.was_running)) { -+ (state < 0 || state == header->was_running)) { - /* no change to the XML */ - ret = 0; - goto cleanup; - } - - if (state >= 0) -- header.was_running = state; -+ header->was_running = state; - - if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml))) - goto cleanup; -@@ -6625,12 +6656,12 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - goto cleanup; - len = strlen(xml) + 1; - -- if (len > header.data_len) { -+ if (len > header->data_len) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("new xml too large to fit in file")); - goto cleanup; - } -- if (VIR_EXPAND_N(xml, len, header.data_len - len) < 0) -+ if (VIR_EXPAND_N(xml, len, header->data_len - len) < 0) - goto cleanup; - - if (lseek(fd, 0, SEEK_SET) != 0) { -@@ -6651,6 +6682,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - virDomainDefFree(newdef); - VIR_FORCE_CLOSE(fd); - VIR_FREE(xml); -+ virQEMUSaveDataFree(header); - return ret; - } - -@@ -6671,7 +6703,7 @@ qemuDomainObjRestore(virConnectPtr conn, - int ret = -1; - char *xml = NULL; - char *xmlout = NULL; -- virQEMUSaveHeader header; -+ virQEMUSaveHeaderPtr header = NULL; - virFileWrapperFdPtr wrapperFd = NULL; - - fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml, -@@ -6722,13 +6754,14 @@ qemuDomainObjRestore(virConnectPtr conn, - virDomainObjAssignDef(vm, def, true, NULL); - def = NULL; - -- ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, &header, path, -+ ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, header, path, - start_paused, asyncJob); - if (virFileWrapperFdClose(wrapperFd) < 0) - VIR_WARN("Failed to close %s", path); - - cleanup: - VIR_FREE(xml); -+ virQEMUSaveDataFree(header); - VIR_FREE(xmlout); - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); -@@ -14301,6 +14334,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - virQEMUDriverConfigPtr cfg = NULL; - int compressed; - char *compressedpath = NULL; -+ virQEMUSaveHeaderPtr header = NULL; - - /* If quiesce was requested, then issue a freeze command, and a - * counterpart thaw command when it is actually sent to agent. -@@ -14372,9 +14406,12 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true))) - goto cleanup; - -- if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, xml, -- compressed, compressedpath, resume, -- 0, QEMU_ASYNC_JOB_SNAPSHOT)) < 0) -+ if (!(header = virQEMUSaveDataNew(xml, resume, compressed))) -+ goto cleanup; -+ -+ if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, xml, header, -+ compressedpath, 0, -+ QEMU_ASYNC_JOB_SNAPSHOT)) < 0) - goto cleanup; - - /* the memory image was created, remove it on errors */ -@@ -14442,6 +14479,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - ret = -1; - } - -+ virQEMUSaveDataFree(header); - VIR_FREE(xml); - VIR_FREE(compressedpath); - virObjectUnref(cfg); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-structure.patch b/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-structure.patch deleted file mode 100644 index 59b0e46..0000000 --- a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveData-structure.patch +++ /dev/null @@ -1,534 +0,0 @@ -From 56a60bd1b230c86195778e4fda2f44052faae10c Mon Sep 17 00:00:00 2001 -Message-Id: <56a60bd1b230c86195778e4fda2f44052faae10c@dist-git> -From: Jiri Denemark -Date: Wed, 7 Jun 2017 00:08:25 +0200 -Subject: [PATCH] qemu: Introduce virQEMUSaveData structure - -The new structure encapsulates save image header and associated data -(domain XML). - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit 47e60ac306273559b8c14527ea15a92c6ac6dd91) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 165 ++++++++++++++++++++++++++----------------------- - 1 file changed, 86 insertions(+), 79 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 1629f27470..7ce0f01f70 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -2816,6 +2816,14 @@ struct _virQEMUSaveHeader { - uint32_t unused[15]; - }; - -+typedef struct _virQEMUSaveData virQEMUSaveData; -+typedef virQEMUSaveData *virQEMUSaveDataPtr; -+struct _virQEMUSaveData { -+ virQEMUSaveHeader header; -+ char *xml; -+}; -+ -+ - static inline void - bswap_header(virQEMUSaveHeaderPtr hdr) - { -@@ -2827,31 +2835,39 @@ bswap_header(virQEMUSaveHeaderPtr hdr) - - - static void --virQEMUSaveDataFree(virQEMUSaveHeaderPtr header) -+virQEMUSaveDataFree(virQEMUSaveDataPtr data) - { -- if (!header) -+ if (!data) - return; - -- VIR_FREE(header); -+ VIR_FREE(data->xml); -+ VIR_FREE(data); - } - - --static virQEMUSaveHeaderPtr --virQEMUSaveDataNew(char *domXML ATTRIBUTE_UNUSED, -+/** -+ * This function steals @domXML on success. -+ */ -+static virQEMUSaveDataPtr -+virQEMUSaveDataNew(char *domXML, - bool running, - int compressed) - { -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; -+ virQEMUSaveHeaderPtr header; - -- if (VIR_ALLOC(header) < 0) -+ if (VIR_ALLOC(data) < 0) - return NULL; - -+ VIR_STEAL_PTR(data->xml, domXML); -+ -+ header = &data->header; - memcpy(header->magic, QEMU_SAVE_PARTIAL, sizeof(header->magic)); - header->version = QEMU_SAVE_VERSION; - header->was_running = running ? 1 : 0; - header->compressed = compressed; - -- return header; -+ return data; - } - - -@@ -2865,17 +2881,17 @@ virQEMUSaveDataNew(char *domXML ATTRIBUTE_UNUSED, - * Returns -1 on failure, or 0 on success. - */ - static int --virQEMUSaveDataWrite(virQEMUSaveHeaderPtr header, -- const char *xml, -+virQEMUSaveDataWrite(virQEMUSaveDataPtr data, - int fd, - const char *path) - { -+ virQEMUSaveHeaderPtr header = &data->header; - size_t len; - int ret = -1; - size_t zerosLen = 0; - char *zeros = NULL; - -- len = strlen(xml) + 1; -+ len = strlen(data->xml) + 1; - - if (header->data_len > 0) { - if (len > header->data_len) { -@@ -2898,7 +2914,7 @@ virQEMUSaveDataWrite(virQEMUSaveHeaderPtr header, - goto cleanup; - } - -- if (safewrite(fd, xml, header->data_len) != header->data_len || -+ if (safewrite(fd, data->xml, header->data_len) != header->data_len || - safewrite(fd, zeros, zerosLen) != zerosLen) { - virReportSystemError(errno, - _("failed to write domain xml to '%s'"), -@@ -2915,10 +2931,12 @@ virQEMUSaveDataWrite(virQEMUSaveHeaderPtr header, - - - static int --virQEMUSaveDataFinish(virQEMUSaveHeaderPtr header, -+virQEMUSaveDataFinish(virQEMUSaveDataPtr data, - int *fd, - const char *path) - { -+ virQEMUSaveHeaderPtr header = &data->header; -+ - memcpy(header->magic, QEMU_SAVE_MAGIC, sizeof(header->magic)); - - if (safewrite(*fd, header, sizeof(*header)) != sizeof(*header) || -@@ -3128,8 +3146,7 @@ static int - qemuDomainSaveMemory(virQEMUDriverPtr driver, - virDomainObjPtr vm, - const char *path, -- const char *domXML, -- virQEMUSaveHeaderPtr header, -+ virQEMUSaveDataPtr data, - const char *compressedpath, - unsigned int flags, - qemuDomainAsyncJob asyncJob) -@@ -3164,7 +3181,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - if (!(wrapperFd = virFileWrapperFdNew(&fd, path, wrapperFlags))) - goto cleanup; - -- if (virQEMUSaveDataWrite(header, domXML, fd, path) < 0) -+ if (virQEMUSaveDataWrite(data, fd, path) < 0) - goto cleanup; - - /* Perform the migration */ -@@ -3186,7 +3203,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - goto cleanup; - - if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0 || -- virQEMUSaveDataFinish(header, &fd, path) < 0) -+ virQEMUSaveDataFinish(data, &fd, path) < 0) - goto cleanup; - - ret = 0; -@@ -3218,7 +3235,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - virObjectEventPtr event = NULL; - qemuDomainObjPrivatePtr priv = vm->privateData; - virCapsPtr caps; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; -@@ -3284,10 +3301,11 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - goto endjob; - } - -- if (!(header = virQEMUSaveDataNew(xml, was_running, compressed))) -+ if (!(data = virQEMUSaveDataNew(xml, was_running, compressed))) - goto endjob; -+ xml = NULL; - -- ret = qemuDomainSaveMemory(driver, vm, path, xml, header, compressedpath, -+ ret = qemuDomainSaveMemory(driver, vm, path, data, compressedpath, - flags, QEMU_ASYNC_JOB_SAVE); - if (ret < 0) - goto endjob; -@@ -3321,7 +3339,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, - - cleanup: - VIR_FREE(xml); -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - qemuDomainEventQueue(driver, event); - virObjectUnref(caps); - return ret; -@@ -6238,8 +6256,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver, - * @driver: qemu driver data - * @path: path of the save image - * @ret_def: returns domain definition created from the XML stored in the image -- * @ret_header: returns structure filled with data from the image header -- * @xmlout: returns the XML from the image file (may be NULL) -+ * @ret_data: returns structure filled with data from the image header - * @bypass_cache: bypass cache when opening the file - * @wrapperFd: returns the file wrapper structure - * @open_write: open the file for writing (for updates) -@@ -6253,16 +6270,15 @@ static int ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) - qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - const char *path, - virDomainDefPtr *ret_def, -- virQEMUSaveHeaderPtr *ret_header, -- char **xmlout, -+ virQEMUSaveDataPtr *ret_data, - bool bypass_cache, - virFileWrapperFdPtr *wrapperFd, - bool open_write, - bool unlink_corrupt) - { - int fd = -1; -- char *xml = NULL; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; -+ virQEMUSaveHeaderPtr header; - virDomainDefPtr def = NULL; - int oflags = open_write ? O_RDWR : O_RDONLY; - virCapsPtr caps = NULL; -@@ -6287,9 +6303,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - VIR_FILE_WRAPPER_BYPASS_CACHE))) - goto error; - -- if (VIR_ALLOC(header) < 0) -+ if (VIR_ALLOC(data) < 0) - goto error; - -+ header = &data->header; - if (saferead(fd, header, sizeof(*header)) != sizeof(*header)) { - if (unlink_corrupt) { - if (VIR_CLOSE(fd) < 0 || unlink(path) < 0) { -@@ -6341,32 +6358,27 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - - if (header->data_len <= 0) { - virReportError(VIR_ERR_OPERATION_FAILED, -- _("invalid XML length: %d"), header->data_len); -+ _("invalid header data length: %d"), header->data_len); - goto error; - } - -- if (VIR_ALLOC_N(xml, header->data_len) < 0) -+ if (VIR_ALLOC_N(data->xml, header->data_len) < 0) - goto error; - -- if (saferead(fd, xml, header->data_len) != header->data_len) { -+ if (saferead(fd, data->xml, header->data_len) != header->data_len) { - virReportError(VIR_ERR_OPERATION_FAILED, -- "%s", _("failed to read XML")); -+ "%s", _("failed to read domain XML")); - goto error; - } - - /* Create a domain from this XML */ -- if (!(def = virDomainDefParseString(xml, caps, driver->xmlopt, NULL, -+ if (!(def = virDomainDefParseString(data->xml, caps, driver->xmlopt, NULL, - VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) - goto error; - -- if (xmlout) -- *xmlout = xml; -- else -- VIR_FREE(xml); -- - *ret_def = def; -- *ret_header = header; -+ *ret_data = data; - - virObjectUnref(caps); - -@@ -6374,8 +6386,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, - - error: - virDomainDefFree(def); -- VIR_FREE(xml); -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - VIR_FORCE_CLOSE(fd); - virObjectUnref(caps); - -@@ -6387,7 +6398,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, - virQEMUDriverPtr driver, - virDomainObjPtr vm, - int *fd, -- virQEMUSaveHeaderPtr header, -+ virQEMUSaveDataPtr data, - const char *path, - bool start_paused, - qemuDomainAsyncJob asyncJob) -@@ -6399,6 +6410,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, - virCommandPtr cmd = NULL; - char *errbuf = NULL; - virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); -+ virQEMUSaveHeaderPtr header = &data->header; - - if ((header->version == 2) && - (header->compressed != QEMU_SAVE_FORMAT_RAW)) { -@@ -6508,12 +6520,11 @@ qemuDomainRestoreFlags(virConnectPtr conn, - qemuDomainObjPrivatePtr priv = NULL; - virDomainDefPtr def = NULL; - virDomainObjPtr vm = NULL; -- char *xml = NULL; - char *xmlout = NULL; - const char *newxml = dxml; - int fd = -1; - int ret = -1; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - virFileWrapperFdPtr wrapperFd = NULL; - bool hook_taint = false; - -@@ -6524,7 +6535,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - - virNWFilterReadLockFilterUpdates(); - -- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml, -+ fd = qemuDomainSaveImageOpen(driver, path, &def, &data, - (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0, - &wrapperFd, false, false); - if (fd < 0) -@@ -6540,7 +6551,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - VIR_HOOK_QEMU_OP_RESTORE, - VIR_HOOK_SUBOP_BEGIN, - NULL, -- dxml ? dxml : xml, -+ dxml ? dxml : data->xml, - &xmlout)) < 0) - goto cleanup; - -@@ -6570,9 +6581,9 @@ qemuDomainRestoreFlags(virConnectPtr conn, - def = NULL; - - if (flags & VIR_DOMAIN_SAVE_RUNNING) -- header->was_running = 1; -+ data->header.was_running = 1; - else if (flags & VIR_DOMAIN_SAVE_PAUSED) -- header->was_running = 0; -+ data->header.was_running = 0; - - if (hook_taint) { - priv = vm->privateData; -@@ -6582,7 +6593,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_RESTORE) < 0) - goto cleanup; - -- ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, header, path, -+ ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, data, path, - false, QEMU_ASYNC_JOB_START); - if (virFileWrapperFdClose(wrapperFd) < 0) - VIR_WARN("Failed to close %s", path); -@@ -6592,8 +6603,7 @@ qemuDomainRestoreFlags(virConnectPtr conn, - cleanup: - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); -- VIR_FREE(xml); -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - VIR_FREE(xmlout); - virFileWrapperFdFree(wrapperFd); - if (vm && ret < 0) -@@ -6618,12 +6628,12 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path, - char *ret = NULL; - virDomainDefPtr def = NULL; - int fd = -1; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - - /* We only take subset of virDomainDefFormat flags. */ - virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL); - -- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL, -+ fd = qemuDomainSaveImageOpen(driver, path, &def, &data, - false, NULL, false, false); - - if (fd < 0) -@@ -6635,7 +6645,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path, - ret = qemuDomainDefFormatXML(driver, def, flags); - - cleanup: -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); - return ret; -@@ -6650,8 +6660,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - virDomainDefPtr def = NULL; - virDomainDefPtr newdef = NULL; - int fd = -1; -- char *xml = NULL; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - int state = -1; - - virCheckFlags(VIR_DOMAIN_SAVE_RUNNING | -@@ -6662,7 +6671,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - else if (flags & VIR_DOMAIN_SAVE_PAUSED) - state = 0; - -- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml, -+ fd = qemuDomainSaveImageOpen(driver, path, &def, &data, - false, NULL, true, false); - - if (fd < 0) -@@ -6671,25 +6680,25 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - if (virDomainSaveImageDefineXMLEnsureACL(conn, def) < 0) - goto cleanup; - -- if (STREQ(xml, dxml) && -- (state < 0 || state == header->was_running)) { -+ if (STREQ(data->xml, dxml) && -+ (state < 0 || state == data->header.was_running)) { - /* no change to the XML */ - ret = 0; - goto cleanup; - } - - if (state >= 0) -- header->was_running = state; -+ data->header.was_running = state; - - if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml))) - goto cleanup; - -- VIR_FREE(xml); -+ VIR_FREE(data->xml); - -- if (!(xml = qemuDomainDefFormatXML(driver, newdef, -- VIR_DOMAIN_XML_INACTIVE | -- VIR_DOMAIN_XML_SECURE | -- VIR_DOMAIN_XML_MIGRATABLE))) -+ if (!(data->xml = qemuDomainDefFormatXML(driver, newdef, -+ VIR_DOMAIN_XML_INACTIVE | -+ VIR_DOMAIN_XML_SECURE | -+ VIR_DOMAIN_XML_MIGRATABLE))) - goto cleanup; - - if (lseek(fd, 0, SEEK_SET) != 0) { -@@ -6697,7 +6706,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - goto cleanup; - } - -- if (virQEMUSaveDataWrite(header, xml, fd, path) < 0) -+ if (virQEMUSaveDataWrite(data, fd, path) < 0) - goto cleanup; - - if (VIR_CLOSE(fd) < 0) { -@@ -6711,8 +6720,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, - virDomainDefFree(def); - virDomainDefFree(newdef); - VIR_FORCE_CLOSE(fd); -- VIR_FREE(xml); -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - return ret; - } - -@@ -6731,12 +6739,11 @@ qemuDomainObjRestore(virConnectPtr conn, - qemuDomainObjPrivatePtr priv = vm->privateData; - int fd = -1; - int ret = -1; -- char *xml = NULL; - char *xmlout = NULL; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - virFileWrapperFdPtr wrapperFd = NULL; - -- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, &xml, -+ fd = qemuDomainSaveImageOpen(driver, path, &def, &data, - bypass_cache, &wrapperFd, false, true); - if (fd < 0) { - if (fd == -3) -@@ -6750,7 +6757,7 @@ qemuDomainObjRestore(virConnectPtr conn, - if ((hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, def->name, - VIR_HOOK_QEMU_OP_RESTORE, - VIR_HOOK_SUBOP_BEGIN, -- NULL, xml, &xmlout)) < 0) -+ NULL, data->xml, &xmlout)) < 0) - goto cleanup; - - if (hookret == 0 && !virStringIsEmpty(xmlout)) { -@@ -6784,14 +6791,13 @@ qemuDomainObjRestore(virConnectPtr conn, - virDomainObjAssignDef(vm, def, true, NULL); - def = NULL; - -- ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, header, path, -+ ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, data, path, - start_paused, asyncJob); - if (virFileWrapperFdClose(wrapperFd) < 0) - VIR_WARN("Failed to close %s", path); - - cleanup: -- VIR_FREE(xml); -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - VIR_FREE(xmlout); - virDomainDefFree(def); - VIR_FORCE_CLOSE(fd); -@@ -14364,7 +14370,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - virQEMUDriverConfigPtr cfg = NULL; - int compressed; - char *compressedpath = NULL; -- virQEMUSaveHeaderPtr header = NULL; -+ virQEMUSaveDataPtr data = NULL; - - /* If quiesce was requested, then issue a freeze command, and a - * counterpart thaw command when it is actually sent to agent. -@@ -14436,10 +14442,11 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true))) - goto cleanup; - -- if (!(header = virQEMUSaveDataNew(xml, resume, compressed))) -+ if (!(data = virQEMUSaveDataNew(xml, resume, compressed))) - goto cleanup; -+ xml = NULL; - -- if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, xml, header, -+ if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, data, - compressedpath, 0, - QEMU_ASYNC_JOB_SNAPSHOT)) < 0) - goto cleanup; -@@ -14509,7 +14516,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, - ret = -1; - } - -- virQEMUSaveDataFree(header); -+ virQEMUSaveDataFree(data); - VIR_FREE(xml); - VIR_FREE(compressedpath); - virObjectUnref(cfg); --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveDataFinish.patch b/SOURCES/libvirt-qemu-Introduce-virQEMUSaveDataFinish.patch deleted file mode 100644 index 507c98d..0000000 --- a/SOURCES/libvirt-qemu-Introduce-virQEMUSaveDataFinish.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 81bbd5e5673d2ed1b10b3a54876ed7945cd5f97c Mon Sep 17 00:00:00 2001 -Message-Id: <81bbd5e5673d2ed1b10b3a54876ed7945cd5f97c@dist-git> -From: Jiri Denemark -Date: Tue, 6 Jun 2017 22:49:11 +0200 -Subject: [PATCH] qemu: Introduce virQEMUSaveDataFinish - -The function is supposed to update the save image header after a -successful migration to the save image file. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit ec986bc5727b88b0631236ad0cdecb0a8568d5cd) - -https://bugzilla.redhat.com/show_bug.cgi?id=1441662 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_driver.c | 34 +++++++++++++++++++++------------- - 1 file changed, 21 insertions(+), 13 deletions(-) - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 4a05793339..a0b607b419 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -2882,6 +2882,25 @@ qemuDomainSaveHeader(int fd, const char *path, const char *xml, - } - - -+static int -+virQEMUSaveDataFinish(virQEMUSaveHeaderPtr header, -+ int *fd, -+ const char *path) -+{ -+ memcpy(header->magic, QEMU_SAVE_MAGIC, sizeof(header->magic)); -+ -+ if (safewrite(*fd, header, sizeof(*header)) != sizeof(*header) || -+ VIR_CLOSE(*fd) < 0) { -+ virReportSystemError(errno, -+ _("failed to write header to domain save file '%s'"), -+ path); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+ - static virCommandPtr - qemuCompressGetCommand(virQEMUSaveFormat compression) - { -@@ -3135,21 +3154,10 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, - if (virFileWrapperFdClose(wrapperFd) < 0) - goto cleanup; - -- if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0) -+ if ((fd = qemuOpenFile(driver, vm, path, O_WRONLY, NULL, NULL)) < 0 || -+ virQEMUSaveDataFinish(header, &fd, path) < 0) - goto cleanup; - -- memcpy(header->magic, QEMU_SAVE_MAGIC, sizeof(header->magic)); -- -- if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) { -- virReportSystemError(errno, _("unable to write %s"), path); -- goto cleanup; -- } -- -- if (VIR_CLOSE(fd) < 0) { -- virReportSystemError(errno, _("unable to close %s"), path); -- goto cleanup; -- } -- - ret = 0; - - cleanup: --- -2.13.1 - diff --git a/SOURCES/libvirt-qemu-Limit-refresh-of-CPU-halted-state-to-s390.patch b/SOURCES/libvirt-qemu-Limit-refresh-of-CPU-halted-state-to-s390.patch new file mode 100644 index 0000000..1ca212e --- /dev/null +++ b/SOURCES/libvirt-qemu-Limit-refresh-of-CPU-halted-state-to-s390.patch @@ -0,0 +1,37 @@ +From bda9cc7585816a5233beba2661510ecc4d69c4e2 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Viktor Mihajlovski +Date: Wed, 7 Feb 2018 14:16:02 +0100 +Subject: [PATCH] qemu: Limit refresh of CPU halted state to s390 + +Refreshing the halted state can cause VM performance issues. Since +s390 is currently the only architecture with a known interest in +the halted state, we're avoiding to call QEMU on other platforms. + +Signed-off-by: Viktor Mihajlovski +(cherry picked from commit 818a29e0c7d6840e87e9ca6019b9f0bc1983566e) + +https://bugzilla.redhat.com/show_bug.cgi?id=1534585 +--- + src/qemu/qemu_domain.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index e87c7d030c..0f7f3b7f50 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -7989,6 +7989,11 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, + if (vm->def->virtType == VIR_DOMAIN_VIRT_QEMU) + return 0; + ++ /* The halted state is interresting only on s390(x). On other platforms ++ * the data would be stale at the time when it would be used. */ ++ if (!ARCH_IS_S390(vm->def->os.arch)) ++ return 0; ++ + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + +-- +2.16.1 + diff --git a/SOURCES/libvirt-qemu-Make-sure-host-model-uses-CPU-model-supported-by-QEMU.patch b/SOURCES/libvirt-qemu-Make-sure-host-model-uses-CPU-model-supported-by-QEMU.patch new file mode 100644 index 0000000..2dd998d --- /dev/null +++ b/SOURCES/libvirt-qemu-Make-sure-host-model-uses-CPU-model-supported-by-QEMU.patch @@ -0,0 +1,85 @@ +From dbdc7ec536154af91ae897663d82c57d11500d23 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Thu, 7 Dec 2017 11:23:50 +0100 +Subject: [PATCH] qemu: Make sure host-model uses CPU model supported by QEMU + +When reconnecting to a running domain started by old libvirt, which did +not change host-model into a custom CPU definition, we replace the CPU +definition with a specific CPU model from host capabilities. However, +that CPU model may not be supported by the running qemu process. We need +to translate the CPU model to one of the models which libvirt could have +used when starting the domain. + +https://bugzilla.redhat.com/show_bug.cgi?id=1521202 + +Signed-off-by: Jiri Denemark +(cherry picked from commit ce73de441d35e17a29b83b8741e668a6ddc013ba) +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_process.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 91426ad3c3..701528c42c 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3850,6 +3850,30 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriverPtr driver, + } + + ++static virDomainCapsCPUModelsPtr ++qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver, ++ virDomainObjPtr vm, ++ qemuDomainAsyncJob asyncJob) ++{ ++ qemuDomainObjPrivatePtr priv = vm->privateData; ++ virDomainCapsCPUModelsPtr models = NULL; ++ ++ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) ++ goto error; ++ ++ models = virQEMUCapsFetchCPUDefinitions(priv->mon); ++ ++ if (qemuDomainObjExitMonitor(driver, vm) < 0) ++ goto error; ++ ++ return models; ++ ++ error: ++ virObjectUnref(models); ++ return NULL; ++} ++ ++ + static int + qemuProcessUpdateCPU(virQEMUDriverPtr driver, + virDomainObjPtr vm, +@@ -3857,6 +3881,7 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, + { + virCPUDataPtr cpu = NULL; + virCPUDataPtr disabled = NULL; ++ virDomainCapsCPUModelsPtr models = NULL; + int ret = -1; + + if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) +@@ -3865,11 +3890,16 @@ qemuProcessUpdateCPU(virQEMUDriverPtr driver, + if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) + goto cleanup; + ++ if (!(models = qemuProcessFetchCPUDefinitions(driver, vm, asyncJob)) || ++ virCPUTranslate(vm->def->os.arch, vm->def->cpu, models) < 0) ++ goto cleanup; ++ + ret = 0; + + cleanup: + virCPUDataFree(cpu); + virCPUDataFree(disabled); ++ virObjectUnref(models); + return ret; + } + +-- +2.15.1 + diff --git a/SOURCES/libvirt-qemu-Move-common-code-in-virQEMUCapsInitCPUModel-one-layer-up.patch b/SOURCES/libvirt-qemu-Move-common-code-in-virQEMUCapsInitCPUModel-one-layer-up.patch deleted file mode 100644 index 540e4d9..0000000 --- a/SOURCES/libvirt-qemu-Move-common-code-in-virQEMUCapsInitCPUModel-one-layer-up.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 739fd2eac238497276f752689a7e619e298cb746 Mon Sep 17 00:00:00 2001 -Message-Id: <739fd2eac238497276f752689a7e619e298cb746@dist-git> -From: Jiri Denemark -Date: Thu, 30 Mar 2017 13:50:44 +0200 -Subject: [PATCH] qemu: Move common code in virQEMUCapsInitCPUModel one layer - up - -Signed-off-by: Jiri Denemark -(cherry picked from commit d84b93fad51b190238e18b1daac82ea6e28869e9) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 25 ++++++++++--------------- - 1 file changed, 10 insertions(+), 15 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 2c845853a..b71de9633 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -3117,17 +3117,11 @@ virQEMUCapsCPUFilterFeatures(const char *name, - */ - static int - virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, -- virDomainVirtType type, -+ qemuMonitorCPUModelInfoPtr modelInfo, - virCPUDefPtr cpu) - { -- qemuMonitorCPUModelInfoPtr modelInfo; - size_t i; - -- if (type == VIR_DOMAIN_VIRT_KVM) -- modelInfo = qemuCaps->kvmCPUModelInfo; -- else -- modelInfo = qemuCaps->tcgCPUModelInfo; -- - if (!modelInfo) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing host CPU model info from QEMU capabilities " -@@ -3169,9 +3163,9 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps, - static int - virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, -+ qemuMonitorCPUModelInfoPtr model, - virCPUDefPtr cpu) - { -- qemuMonitorCPUModelInfoPtr model; - virCPUDataPtr data = NULL; - unsigned long long sigFamily = 0; - unsigned long long sigModel = 0; -@@ -3180,11 +3174,6 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps, - int ret = -1; - size_t i; - -- if (type == VIR_DOMAIN_VIRT_KVM) -- model = qemuCaps->kvmCPUModelInfo; -- else -- model = qemuCaps->tcgCPUModelInfo; -- - if (!model) - return 1; - -@@ -3245,12 +3234,18 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - virCPUDefPtr cpu) - { -+ qemuMonitorCPUModelInfoPtr model; - int ret = 1; - -+ if (type == VIR_DOMAIN_VIRT_KVM) -+ model = qemuCaps->kvmCPUModelInfo; -+ else -+ model = qemuCaps->tcgCPUModelInfo; -+ - if (ARCH_IS_S390(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelS390(qemuCaps, type, cpu); -+ ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu); - else if (ARCH_IS_X86(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, cpu); -+ ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu); - - if (ret == 0) - cpu->fallback = VIR_CPU_FALLBACK_FORBID; --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Move-memPath-generation-from-memoryBackingDir-to-a-separate-function.patch b/SOURCES/libvirt-qemu-Move-memPath-generation-from-memoryBackingDir-to-a-separate-function.patch new file mode 100644 index 0000000..6b12efc --- /dev/null +++ b/SOURCES/libvirt-qemu-Move-memPath-generation-from-memoryBackingDir-to-a-separate-function.patch @@ -0,0 +1,78 @@ +From f6772178504ef0c3f02a3d18208bf7ab88402f81 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Thu, 9 Nov 2017 16:06:43 +0100 +Subject: [PATCH] qemu: Move memPath generation from memoryBackingDir to a + separate function + +https://bugzilla.redhat.com/show_bug.cgi?id=1461214 + +In near future we will need more than just a plain VIR_STRDUP(). +Better implement that in a separate function and in +qemuBuildMemoryBackendStr() which is complicated enough already. + +Signed-off-by: Michal Privoznik +Reviewed-by: John Ferlan +(cherry picked from commit ae1b5d47e5f032a9a11688105e70198a0a160a50) +Signed-off-by: Michal Privoznik +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_command.c | 2 +- + src/qemu/qemu_conf.c | 18 ++++++++++++++++++ + src/qemu/qemu_conf.h | 3 +++ + 3 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 365555ca87..9f346c3649 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -3439,7 +3439,7 @@ qemuBuildMemoryBackendStr(virJSONValuePtr *backendProps, + } else { + /* We can have both pagesize and mem source. If that's the case, + * prefer hugepages as those are more specific. */ +- if (VIR_STRDUP(memPath, cfg->memoryBackingDir) < 0) ++ if (qemuGetMemoryBackingPath(cfg, &memPath) < 0) + goto cleanup; + } + +diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c +index 66f9761eea..3b670a68c5 100644 +--- a/src/qemu/qemu_conf.c ++++ b/src/qemu/qemu_conf.c +@@ -1765,3 +1765,21 @@ qemuGetDomainHupageMemPath(const virDomainDef *def, + + return 0; + } ++ ++ ++/** ++ * qemuGetMemoryBackingPath: ++ * @cfg: the driver config ++ * @memPath: constructed path ++ * ++ * Constructs path to memory backing dir and stores it at @memPath. ++ * ++ * Returns: 0 on success, ++ * -1 otherwise (with error reported). ++ */ ++int ++qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, ++ char **memPath) ++{ ++ return VIR_STRDUP(*memPath, cfg->memoryBackingDir); ++} +diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h +index 13b6f818a2..9d6866816f 100644 +--- a/src/qemu/qemu_conf.h ++++ b/src/qemu/qemu_conf.h +@@ -363,4 +363,7 @@ int qemuGetDomainHupageMemPath(const virDomainDef *def, + virQEMUDriverConfigPtr cfg, + unsigned long long pagesize, + char **memPath); ++ ++int qemuGetMemoryBackingPath(virQEMUDriverConfigPtr cfg, ++ char **memPath); + #endif /* __QEMUD_CONF_H */ +-- +2.15.0 + diff --git a/SOURCES/libvirt-qemu-Move-qemuCaps-CPU-data-copying-into-a-separate-function.patch b/SOURCES/libvirt-qemu-Move-qemuCaps-CPU-data-copying-into-a-separate-function.patch deleted file mode 100644 index 1446740..0000000 --- a/SOURCES/libvirt-qemu-Move-qemuCaps-CPU-data-copying-into-a-separate-function.patch +++ /dev/null @@ -1,79 +0,0 @@ -From e10845824c98d0996ced6a8eac5d62ac99ceedd3 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Fri, 7 Apr 2017 17:40:31 +0200 -Subject: [PATCH] qemu: Move qemuCaps CPU data copying into a separate function - -This introduces virQEMUCapsHostCPUDataCopy which will later be -refactored a bit and called twice from virQEMUCapsNewCopy. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 8be4346ca5ae4b568b3e8ce3de9cf46f2e94b416) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 39 +++++++++++++++++++++++++-------------- - 1 file changed, 25 insertions(+), 14 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 2bbc9253a..98a9a0f1d 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -2088,6 +2088,30 @@ virQEMUCapsNew(void) - } - - -+static int -+virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst, -+ virQEMUCapsPtr src) -+{ -+ if (src->kvmCPUModel && -+ !(dst->kvmCPUModel = virCPUDefCopy(src->kvmCPUModel))) -+ return -1; -+ -+ if (src->tcgCPUModel && -+ !(dst->tcgCPUModel = virCPUDefCopy(src->tcgCPUModel))) -+ return -1; -+ -+ if (src->kvmCPUModelInfo && -+ !(dst->kvmCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->kvmCPUModelInfo))) -+ return -1; -+ -+ if (src->tcgCPUModelInfo && -+ !(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo))) -+ return -1; -+ -+ return 0; -+} -+ -+ - virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) - { - virQEMUCapsPtr ret = virQEMUCapsNew(); -@@ -2125,20 +2149,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) - goto error; - } - -- if (qemuCaps->kvmCPUModel && -- !(ret->kvmCPUModel = virCPUDefCopy(qemuCaps->kvmCPUModel))) -- goto error; -- -- if (qemuCaps->tcgCPUModel && -- !(ret->tcgCPUModel = virCPUDefCopy(qemuCaps->tcgCPUModel))) -- goto error; -- -- if (qemuCaps->kvmCPUModelInfo && -- !(ret->kvmCPUModelInfo = qemuMonitorCPUModelInfoCopy(qemuCaps->kvmCPUModelInfo))) -- goto error; -- -- if (qemuCaps->tcgCPUModelInfo && -- !(ret->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(qemuCaps->tcgCPUModelInfo))) -+ if (virQEMUCapsHostCPUDataCopy(ret, qemuCaps) < 0) - goto error; - - if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0) --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Move-qemuCaps-host-CPU-data-in-a-struct.patch b/SOURCES/libvirt-qemu-Move-qemuCaps-host-CPU-data-in-a-struct.patch deleted file mode 100644 index 23e4e06..0000000 --- a/SOURCES/libvirt-qemu-Move-qemuCaps-host-CPU-data-in-a-struct.patch +++ /dev/null @@ -1,350 +0,0 @@ -From 988e2340fa307179fc6f896af33c4376187b90f8 Mon Sep 17 00:00:00 2001 -Message-Id: <988e2340fa307179fc6f896af33c4376187b90f8@dist-git> -From: Jiri Denemark -Date: Fri, 7 Apr 2017 18:15:26 +0200 -Subject: [PATCH] qemu: Move qemuCaps host CPU data in a struct - -We need to store several CPU related data structure for both KVM and -TCG. So instead of keeping two different copies of everything let's -make a virQEMUCapsHostCPUData struct and use it twice. - -Signed-off-by: Jiri Denemark -(cherry picked from commit b0a84ffb7f38f990120c231cfb74956a0ed10d95) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 166 +++++++++++++++++++++---------------------- - 1 file changed, 81 insertions(+), 85 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index 8e7cbb590..0db149018 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -374,6 +374,19 @@ struct virQEMUCapsMachineType { - unsigned int maxCpus; - bool hotplugCpus; - }; -+ -+typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; -+typedef virQEMUCapsHostCPUData *virQEMUCapsHostCPUDataPtr; -+struct _virQEMUCapsHostCPUData { -+ /* Only the "info" part is stored in the capabilities cache, the rest is -+ * re-computed from other fields and external data sources everytime we -+ * probe QEMU or load the cache. -+ */ -+ qemuMonitorCPUModelInfoPtr info; -+ /* Host CPU definition reported in domain capabilities. */ -+ virCPUDefPtr reported; -+}; -+ - /* - * Update the XML parser/formatter when adding more - * information to this struct so that it gets cached -@@ -408,15 +421,8 @@ struct _virQEMUCaps { - size_t ngicCapabilities; - virGICCapability *gicCapabilities; - -- qemuMonitorCPUModelInfoPtr kvmCPUModelInfo; -- qemuMonitorCPUModelInfoPtr tcgCPUModelInfo; -- -- /* Anything below is not stored in the cache since the values are -- * re-computed from the other fields or external data sources every -- * time we probe QEMU or load the results from the cache. -- */ -- virCPUDefPtr kvmCPUModel; -- virCPUDefPtr tcgCPUModel; -+ virQEMUCapsHostCPUData kvmCPU; -+ virQEMUCapsHostCPUData tcgCPU; - }; - - struct virQEMUCapsSearchData { -@@ -2089,23 +2095,15 @@ virQEMUCapsNew(void) - - - static int --virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst, -- virQEMUCapsPtr src) -+virQEMUCapsHostCPUDataCopy(virQEMUCapsHostCPUDataPtr dst, -+ virQEMUCapsHostCPUDataPtr src) - { -- if (src->kvmCPUModel && -- !(dst->kvmCPUModel = virCPUDefCopy(src->kvmCPUModel))) -+ if (src->info && -+ !(dst->info = qemuMonitorCPUModelInfoCopy(src->info))) - return -1; - -- if (src->tcgCPUModel && -- !(dst->tcgCPUModel = virCPUDefCopy(src->tcgCPUModel))) -- return -1; -- -- if (src->kvmCPUModelInfo && -- !(dst->kvmCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->kvmCPUModelInfo))) -- return -1; -- -- if (src->tcgCPUModelInfo && -- !(dst->tcgCPUModelInfo = qemuMonitorCPUModelInfoCopy(src->tcgCPUModelInfo))) -+ if (src->reported && -+ !(dst->reported = virCPUDefCopy(src->reported))) - return -1; - - return 0; -@@ -2113,17 +2111,12 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsPtr dst, - - - static void --virQEMUCapsHostCPUDataClear(virQEMUCapsPtr qemuCaps) -+virQEMUCapsHostCPUDataClear(virQEMUCapsHostCPUDataPtr cpuData) - { -- qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo); -- qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo); -- qemuCaps->kvmCPUModelInfo = NULL; -- qemuCaps->tcgCPUModelInfo = NULL; -+ qemuMonitorCPUModelInfoFree(cpuData->info); -+ virCPUDefFree(cpuData->reported); - -- virCPUDefFree(qemuCaps->kvmCPUModel); -- virCPUDefFree(qemuCaps->tcgCPUModel); -- qemuCaps->kvmCPUModel = NULL; -- qemuCaps->tcgCPUModel = NULL; -+ memset(cpuData, 0, sizeof(*cpuData)); - } - - -@@ -2164,7 +2157,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) - goto error; - } - -- if (virQEMUCapsHostCPUDataCopy(ret, qemuCaps) < 0) -+ if (virQEMUCapsHostCPUDataCopy(&ret->kvmCPU, &qemuCaps->kvmCPU) < 0 || -+ virQEMUCapsHostCPUDataCopy(&ret->tcgCPU, &qemuCaps->tcgCPU) < 0) - goto error; - - if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0) -@@ -2213,7 +2207,8 @@ void virQEMUCapsDispose(void *obj) - - VIR_FREE(qemuCaps->gicCapabilities); - -- virQEMUCapsHostCPUDataClear(qemuCaps); -+ virQEMUCapsHostCPUDataClear(&qemuCaps->kvmCPU); -+ virQEMUCapsHostCPUDataClear(&qemuCaps->tcgCPU); - } - - void -@@ -2437,14 +2432,24 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, - } - - -+static virQEMUCapsHostCPUDataPtr -+virQEMUCapsGetHostCPUData(virQEMUCapsPtr qemuCaps, -+ virDomainVirtType type) -+{ -+ if (type == VIR_DOMAIN_VIRT_KVM) -+ return &qemuCaps->kvmCPU; -+ else -+ return &qemuCaps->tcgCPU; -+} -+ -+ - virCPUDefPtr - virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type) - { -- if (type == VIR_DOMAIN_VIRT_KVM) -- return qemuCaps->kvmCPUModel; -- else -- return qemuCaps->tcgCPUModel; -+ virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); -+ -+ return cpuData->reported; - } - - -@@ -2453,10 +2458,9 @@ virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - virCPUDefPtr cpu) - { -- if (type == VIR_DOMAIN_VIRT_KVM) -- qemuCaps->kvmCPUModel = cpu; -- else -- qemuCaps->tcgCPUModel = cpu; -+ virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); -+ -+ cpuData->reported = cpu; - } - - -@@ -2847,24 +2851,28 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, - qemuMonitorPtr mon, - bool tcg) - { -- qemuMonitorCPUModelInfoPtr *modelInfo; -+ qemuMonitorCPUModelInfoPtr modelInfo = NULL; - qemuMonitorCPUModelInfoPtr nonMigratable = NULL; - virHashTablePtr hash = NULL; - const char *model; - qemuMonitorCPUModelExpansionType type; -+ virDomainVirtType virtType; -+ virQEMUCapsHostCPUDataPtr cpuData; - int ret = -1; - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) - return 0; - - if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { -- modelInfo = &qemuCaps->tcgCPUModelInfo; -+ virtType = VIR_DOMAIN_VIRT_QEMU; - model = "max"; - } else { -- modelInfo = &qemuCaps->kvmCPUModelInfo; -+ virtType = VIR_DOMAIN_VIRT_KVM; - model = "host"; - } - -+ cpuData = virQEMUCapsGetHostCPUData(qemuCaps, virtType); -+ - /* Some x86_64 features defined in cpu_map.xml use spelling which differ - * from the one preferred by QEMU. Static expansion would give us only the - * preferred spelling, thus we need to do a full expansion on the result of -@@ -2875,14 +2883,14 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, - else - type = QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC; - -- if (qemuMonitorGetCPUModelExpansion(mon, type, model, true, modelInfo) < 0) -- return -1; -+ if (qemuMonitorGetCPUModelExpansion(mon, type, model, true, &modelInfo) < 0) -+ goto cleanup; - - /* Try to check migratability of each feature. */ -- if (*modelInfo && -+ if (modelInfo && - qemuMonitorGetCPUModelExpansion(mon, type, model, false, - &nonMigratable) < 0) -- goto error; -+ goto cleanup; - - if (nonMigratable) { - qemuMonitorCPUPropertyPtr prop; -@@ -2890,12 +2898,12 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, - size_t i; - - if (!(hash = virHashCreate(0, NULL))) -- goto error; -+ goto cleanup; - -- for (i = 0; i < (*modelInfo)->nprops; i++) { -- prop = (*modelInfo)->props + i; -+ for (i = 0; i < modelInfo->nprops; i++) { -+ prop = modelInfo->props + i; - if (virHashAddEntry(hash, prop->name, prop) < 0) -- goto error; -+ goto cleanup; - } - - for (i = 0; i < nonMigratable->nprops; i++) { -@@ -2913,21 +2921,18 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, - } - } - -- (*modelInfo)->migratability = true; -+ modelInfo->migratability = true; - } - -+ VIR_STEAL_PTR(cpuData->info, modelInfo); - ret = 0; - - cleanup: - virHashFree(hash); - qemuMonitorCPUModelInfoFree(nonMigratable); -+ qemuMonitorCPUModelInfoFree(modelInfo); - - return ret; -- -- error: -- qemuMonitorCPUModelInfoFree(*modelInfo); -- *modelInfo = NULL; -- goto cleanup; - } - - struct tpmTypeToCaps { -@@ -3280,21 +3285,19 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - virCPUDefPtr cpu, - bool migratable) - { -- qemuMonitorCPUModelInfoPtr model; -+ virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); - int ret = 1; - -- if (type == VIR_DOMAIN_VIRT_KVM) -- model = qemuCaps->kvmCPUModelInfo; -- else -- model = qemuCaps->tcgCPUModelInfo; -- -- if (migratable && model && !model->migratability) -+ if (migratable && cpuData->info && !cpuData->info->migratability) - return 1; - -- if (ARCH_IS_S390(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu, migratable); -- else if (ARCH_IS_X86(qemuCaps->arch)) -- ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu, migratable); -+ if (ARCH_IS_S390(qemuCaps->arch)) { -+ ret = virQEMUCapsInitCPUModelS390(qemuCaps, cpuData->info, -+ cpu, migratable); -+ } else if (ARCH_IS_X86(qemuCaps->arch)) { -+ ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, cpuData->info, -+ cpu, migratable); -+ } - - if (ret == 0) - cpu->fallback = VIR_CPU_FALLBACK_FORBID; -@@ -3354,10 +3357,9 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, - qemuMonitorCPUModelInfoPtr modelInfo) - { -- if (type == VIR_DOMAIN_VIRT_KVM) -- qemuCaps->kvmCPUModelInfo = modelInfo; -- else -- qemuCaps->tcgCPUModelInfo = modelInfo; -+ virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); -+ -+ cpuData->info = modelInfo; - } - - -@@ -3816,18 +3818,11 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps, - virBufferPtr buf, - virDomainVirtType type) - { -- qemuMonitorCPUModelInfoPtr model; -- const char *typeStr; -+ virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); -+ qemuMonitorCPUModelInfoPtr model = cpuData->info; -+ const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg"; - size_t i; - -- if (type == VIR_DOMAIN_VIRT_KVM) { -- typeStr = "kvm"; -- model = qemuCaps->kvmCPUModelInfo; -- } else { -- typeStr = "tcg"; -- model = qemuCaps->tcgCPUModelInfo; -- } -- - if (!model) - return; - -@@ -4086,7 +4081,8 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) - VIR_FREE(qemuCaps->gicCapabilities); - qemuCaps->ngicCapabilities = 0; - -- virQEMUCapsHostCPUDataClear(qemuCaps); -+ virQEMUCapsHostCPUDataClear(&qemuCaps->kvmCPU); -+ virQEMUCapsHostCPUDataClear(&qemuCaps->tcgCPU); - } - - --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Move-qemuProcessReconnect-to-the-end-of-qemu_process.c.patch b/SOURCES/libvirt-qemu-Move-qemuProcessReconnect-to-the-end-of-qemu_process.c.patch deleted file mode 100644 index facaf96..0000000 --- a/SOURCES/libvirt-qemu-Move-qemuProcessReconnect-to-the-end-of-qemu_process.c.patch +++ /dev/null @@ -1,687 +0,0 @@ -From 6f532f2e3615bb573a186cfcfddf8fcc1eec7efd Mon Sep 17 00:00:00 2001 -Message-Id: <6f532f2e3615bb573a186cfcfddf8fcc1eec7efd@dist-git> -From: Jiri Denemark -Date: Tue, 11 Jul 2017 15:53:58 +0200 -Subject: [PATCH] qemu: Move qemuProcessReconnect to the end of qemu_process.c - -qemuProcessReconnect will need to call additional functions which were -originally defined further in qemu_process.c. - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina -(cherry picked from commit aad362f93b4451e2f3c98923e5e44c4fe6d26d75) - -Conflicts: - src/qemu/qemu_process.c - -https://bugzilla.redhat.com/show_bug.cgi?id=1470582 - -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_process.c | 645 ++++++++++++++++++++++++------------------------ - 1 file changed, 323 insertions(+), 322 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 9df463094e..e6f56dc484 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -3331,328 +3331,6 @@ qemuProcessBuildDestroyHugepagesPath(virQEMUDriverPtr driver, - } - - --struct qemuProcessReconnectData { -- virConnectPtr conn; -- virQEMUDriverPtr driver; -- virDomainObjPtr obj; --}; --/* -- * Open an existing VM's monitor, re-detect VCPU threads -- * and re-reserve the security labels in use -- * -- * We own the virConnectPtr we are passed here - whoever started -- * this thread function has increased the reference counter to it -- * so that we now have to close it. -- * -- * This function also inherits a locked and ref'd domain object. -- * -- * This function needs to: -- * 1. Enter job -- * 1. just before monitor reconnect do lightweight MonitorEnter -- * (increase VM refcount and unlock VM) -- * 2. reconnect to monitor -- * 3. do lightweight MonitorExit (lock VM) -- * 4. continue reconnect process -- * 5. EndJob -- * -- * We can't do normal MonitorEnter & MonitorExit because these two lock the -- * monitor lock, which does not exists in this early phase. -- */ --static void --qemuProcessReconnect(void *opaque) --{ -- struct qemuProcessReconnectData *data = opaque; -- virQEMUDriverPtr driver = data->driver; -- virDomainObjPtr obj = data->obj; -- qemuDomainObjPrivatePtr priv; -- virConnectPtr conn = data->conn; -- struct qemuDomainJobObj oldjob; -- int state; -- int reason; -- virQEMUDriverConfigPtr cfg; -- size_t i; -- unsigned int stopFlags = 0; -- bool jobStarted = false; -- virCapsPtr caps = NULL; -- -- VIR_FREE(data); -- -- qemuDomainObjRestoreJob(obj, &oldjob); -- if (oldjob.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) -- stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; -- -- cfg = virQEMUDriverGetConfig(driver); -- priv = obj->privateData; -- -- if (!(caps = virQEMUDriverGetCapabilities(driver, false))) -- goto error; -- -- if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0) -- goto error; -- jobStarted = true; -- -- /* XXX If we ever gonna change pid file pattern, come up with -- * some intelligence here to deal with old paths. */ -- if (!(priv->pidfile = virPidFileBuildPath(cfg->stateDir, obj->def->name))) -- goto error; -- -- /* Restore the masterKey */ -- if (qemuDomainMasterKeyReadFile(priv) < 0) -- goto error; -- -- virNWFilterReadLockFilterUpdates(); -- -- VIR_DEBUG("Reconnect monitor to %p '%s'", obj, obj->def->name); -- -- /* XXX check PID liveliness & EXE path */ -- if (qemuConnectMonitor(driver, obj, QEMU_ASYNC_JOB_NONE, NULL) < 0) -- goto error; -- -- if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) -- goto error; -- -- if (qemuConnectCgroup(driver, obj) < 0) -- goto error; -- -- if (qemuDomainPerfRestart(obj) < 0) -- goto error; -- -- /* XXX: Need to change as long as lock is introduced for -- * qemu_driver->sharedDevices. -- */ -- for (i = 0; i < obj->def->ndisks; i++) { -- virDomainDeviceDef dev; -- -- if (virStorageTranslateDiskSourcePool(conn, obj->def->disks[i]) < 0) -- goto error; -- -- /* XXX we should be able to restore all data from XML in the future. -- * This should be the only place that calls qemuDomainDetermineDiskChain -- * with @report_broken == false to guarantee best-effort domain -- * reconnect */ -- if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i], -- true, false) < 0) -- goto error; -- -- dev.type = VIR_DOMAIN_DEVICE_DISK; -- dev.data.disk = obj->def->disks[i]; -- if (qemuAddSharedDevice(driver, &dev, obj->def->name) < 0) -- goto error; -- } -- -- if (qemuProcessUpdateState(driver, obj) < 0) -- goto error; -- -- state = virDomainObjGetState(obj, &reason); -- if (state == VIR_DOMAIN_SHUTOFF || -- (state == VIR_DOMAIN_PAUSED && -- reason == VIR_DOMAIN_PAUSED_STARTING_UP)) { -- VIR_DEBUG("Domain '%s' wasn't fully started yet, killing it", -- obj->def->name); -- goto error; -- } -- -- /* If upgrading from old libvirtd we won't have found any -- * caps in the domain status, so re-query them -- */ -- if (!priv->qemuCaps && -- !(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps, -- driver->qemuCapsCache, -- obj->def->emulator, -- obj->def->os.machine))) -- goto error; -- -- /* In case the domain shutdown while we were not running, -- * we need to finish the shutdown process. And we need to do it after -- * we have virQEMUCaps filled in. -- */ -- if (state == VIR_DOMAIN_SHUTDOWN || -- (state == VIR_DOMAIN_PAUSED && -- reason == VIR_DOMAIN_PAUSED_SHUTTING_DOWN)) { -- VIR_DEBUG("Finishing shutdown sequence for domain %s", -- obj->def->name); -- qemuProcessShutdownOrReboot(driver, obj); -- goto cleanup; -- } -- -- if (qemuProcessBuildDestroyHugepagesPath(driver, obj, true) < 0) -- goto error; -- -- if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, -- driver, obj, false)) < 0) { -- goto error; -- } -- -- /* if domain requests security driver we haven't loaded, report error, but -- * do not kill the domain -- */ -- ignore_value(qemuSecurityCheckAllLabel(driver->securityManager, -- obj->def)); -- -- if (qemuDomainRefreshVcpuInfo(driver, obj, QEMU_ASYNC_JOB_NONE, true) < 0) -- goto error; -- -- qemuDomainVcpuPersistOrder(obj->def); -- -- if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) -- goto error; -- -- qemuProcessNotifyNets(obj->def); -- -- if (qemuProcessFiltersInstantiate(obj->def)) -- goto error; -- -- if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -- goto error; -- -- if (qemuBlockNodeNamesDetect(driver, obj) < 0) -- goto error; -- -- if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -- goto error; -- -- /* If querying of guest's RTC failed, report error, but do not kill the domain. */ -- qemuRefreshRTC(driver, obj); -- -- if (qemuProcessRefreshBalloonState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -- goto error; -- -- if (qemuProcessRecoverJob(driver, obj, conn, &oldjob, &stopFlags) < 0) -- goto error; -- -- if (qemuProcessUpdateDevices(driver, obj) < 0) -- goto error; -- -- qemuProcessReconnectCheckMemAliasOrderMismatch(obj); -- -- if (qemuConnectAgent(driver, obj) < 0) -- goto error; -- -- /* update domain state XML with possibly updated state in virDomainObj */ -- if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0) -- goto error; -- -- /* Run an hook to allow admins to do some magic */ -- if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { -- char *xml = qemuDomainDefFormatXML(driver, obj->def, 0); -- int hookret; -- -- hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, obj->def->name, -- VIR_HOOK_QEMU_OP_RECONNECT, VIR_HOOK_SUBOP_BEGIN, -- NULL, xml, NULL); -- VIR_FREE(xml); -- -- /* -- * If the script raised an error abort the launch -- */ -- if (hookret < 0) -- goto error; -- } -- -- if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback) -- driver->inhibitCallback(true, driver->inhibitOpaque); -- -- cleanup: -- if (jobStarted) -- qemuDomainObjEndJob(driver, obj); -- if (!virDomainObjIsActive(obj)) -- qemuDomainRemoveInactive(driver, obj); -- virDomainObjEndAPI(&obj); -- virObjectUnref(conn); -- virObjectUnref(cfg); -- virObjectUnref(caps); -- virNWFilterUnlockFilterUpdates(); -- return; -- -- error: -- if (virDomainObjIsActive(obj)) { -- /* We can't get the monitor back, so must kill the VM -- * to remove danger of it ending up running twice if -- * user tries to start it again later -- */ -- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { -- /* If we couldn't get the monitor and qemu supports -- * no-shutdown, we can safely say that the domain -- * crashed ... */ -- state = VIR_DOMAIN_SHUTOFF_CRASHED; -- } else { -- /* ... but if it doesn't we can't say what the state -- * really is and FAILED means "failed to start" */ -- state = VIR_DOMAIN_SHUTOFF_UNKNOWN; -- } -- /* If BeginJob failed, we jumped here without a job, let's hope another -- * thread didn't have a chance to start playing with the domain yet -- * (it's all we can do anyway). -- */ -- qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags); -- } -- goto cleanup; --} -- --static int --qemuProcessReconnectHelper(virDomainObjPtr obj, -- void *opaque) --{ -- virThread thread; -- struct qemuProcessReconnectData *src = opaque; -- struct qemuProcessReconnectData *data; -- -- /* If the VM was inactive, we don't need to reconnect */ -- if (!obj->pid) -- return 0; -- -- if (VIR_ALLOC(data) < 0) -- return -1; -- -- memcpy(data, src, sizeof(*data)); -- data->obj = obj; -- -- /* this lock and reference will be eventually transferred to the thread -- * that handles the reconnect */ -- virObjectLock(obj); -- virObjectRef(obj); -- -- /* Since we close the connection later on, we have to make sure that the -- * threads we start see a valid connection throughout their lifetime. We -- * simply increase the reference counter here. -- */ -- virObjectRef(data->conn); -- -- if (virThreadCreate(&thread, false, qemuProcessReconnect, data) < 0) { -- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -- _("Could not create thread. QEMU initialization " -- "might be incomplete")); -- /* We can't spawn a thread and thus connect to monitor. Kill qemu. -- * It's safe to call qemuProcessStop without a job here since there -- * is no thread that could be doing anything else with the same domain -- * object. -- */ -- qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, -- QEMU_ASYNC_JOB_NONE, 0); -- qemuDomainRemoveInactive(src->driver, obj); -- -- virDomainObjEndAPI(&obj); -- virObjectUnref(data->conn); -- VIR_FREE(data); -- return -1; -- } -- -- return 0; --} -- --/** -- * qemuProcessReconnectAll -- * -- * Try to re-open the resources for live VMs that we care -- * about. -- */ --void --qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver) --{ -- struct qemuProcessReconnectData data = {.conn = conn, .driver = driver}; -- virDomainObjListForEach(driver->domains, qemuProcessReconnectHelper, &data); --} -- - static int - qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver, - virDomainGraphicsDefPtr graphics, -@@ -6958,3 +6636,326 @@ qemuProcessRefreshDisks(virQEMUDriverPtr driver, - virHashFree(table); - return ret; - } -+ -+ -+struct qemuProcessReconnectData { -+ virConnectPtr conn; -+ virQEMUDriverPtr driver; -+ virDomainObjPtr obj; -+}; -+/* -+ * Open an existing VM's monitor, re-detect VCPU threads -+ * and re-reserve the security labels in use -+ * -+ * We own the virConnectPtr we are passed here - whoever started -+ * this thread function has increased the reference counter to it -+ * so that we now have to close it. -+ * -+ * This function also inherits a locked and ref'd domain object. -+ * -+ * This function needs to: -+ * 1. Enter job -+ * 1. just before monitor reconnect do lightweight MonitorEnter -+ * (increase VM refcount and unlock VM) -+ * 2. reconnect to monitor -+ * 3. do lightweight MonitorExit (lock VM) -+ * 4. continue reconnect process -+ * 5. EndJob -+ * -+ * We can't do normal MonitorEnter & MonitorExit because these two lock the -+ * monitor lock, which does not exists in this early phase. -+ */ -+static void -+qemuProcessReconnect(void *opaque) -+{ -+ struct qemuProcessReconnectData *data = opaque; -+ virQEMUDriverPtr driver = data->driver; -+ virDomainObjPtr obj = data->obj; -+ qemuDomainObjPrivatePtr priv; -+ virConnectPtr conn = data->conn; -+ struct qemuDomainJobObj oldjob; -+ int state; -+ int reason; -+ virQEMUDriverConfigPtr cfg; -+ size_t i; -+ unsigned int stopFlags = 0; -+ bool jobStarted = false; -+ virCapsPtr caps = NULL; -+ -+ VIR_FREE(data); -+ -+ qemuDomainObjRestoreJob(obj, &oldjob); -+ if (oldjob.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) -+ stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; -+ -+ cfg = virQEMUDriverGetConfig(driver); -+ priv = obj->privateData; -+ -+ if (!(caps = virQEMUDriverGetCapabilities(driver, false))) -+ goto error; -+ -+ if (qemuDomainObjBeginJob(driver, obj, QEMU_JOB_MODIFY) < 0) -+ goto error; -+ jobStarted = true; -+ -+ /* XXX If we ever gonna change pid file pattern, come up with -+ * some intelligence here to deal with old paths. */ -+ if (!(priv->pidfile = virPidFileBuildPath(cfg->stateDir, obj->def->name))) -+ goto error; -+ -+ /* Restore the masterKey */ -+ if (qemuDomainMasterKeyReadFile(priv) < 0) -+ goto error; -+ -+ virNWFilterReadLockFilterUpdates(); -+ -+ VIR_DEBUG("Reconnect monitor to %p '%s'", obj, obj->def->name); -+ -+ /* XXX check PID liveliness & EXE path */ -+ if (qemuConnectMonitor(driver, obj, QEMU_ASYNC_JOB_NONE, NULL) < 0) -+ goto error; -+ -+ if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) -+ goto error; -+ -+ if (qemuConnectCgroup(driver, obj) < 0) -+ goto error; -+ -+ if (qemuDomainPerfRestart(obj) < 0) -+ goto error; -+ -+ /* XXX: Need to change as long as lock is introduced for -+ * qemu_driver->sharedDevices. -+ */ -+ for (i = 0; i < obj->def->ndisks; i++) { -+ virDomainDeviceDef dev; -+ -+ if (virStorageTranslateDiskSourcePool(conn, obj->def->disks[i]) < 0) -+ goto error; -+ -+ /* XXX we should be able to restore all data from XML in the future. -+ * This should be the only place that calls qemuDomainDetermineDiskChain -+ * with @report_broken == false to guarantee best-effort domain -+ * reconnect */ -+ if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i], -+ true, false) < 0) -+ goto error; -+ -+ dev.type = VIR_DOMAIN_DEVICE_DISK; -+ dev.data.disk = obj->def->disks[i]; -+ if (qemuAddSharedDevice(driver, &dev, obj->def->name) < 0) -+ goto error; -+ } -+ -+ if (qemuProcessUpdateState(driver, obj) < 0) -+ goto error; -+ -+ state = virDomainObjGetState(obj, &reason); -+ if (state == VIR_DOMAIN_SHUTOFF || -+ (state == VIR_DOMAIN_PAUSED && -+ reason == VIR_DOMAIN_PAUSED_STARTING_UP)) { -+ VIR_DEBUG("Domain '%s' wasn't fully started yet, killing it", -+ obj->def->name); -+ goto error; -+ } -+ -+ /* If upgrading from old libvirtd we won't have found any -+ * caps in the domain status, so re-query them -+ */ -+ if (!priv->qemuCaps && -+ !(priv->qemuCaps = virQEMUCapsCacheLookupCopy(caps, -+ driver->qemuCapsCache, -+ obj->def->emulator, -+ obj->def->os.machine))) -+ goto error; -+ -+ /* In case the domain shutdown while we were not running, -+ * we need to finish the shutdown process. And we need to do it after -+ * we have virQEMUCaps filled in. -+ */ -+ if (state == VIR_DOMAIN_SHUTDOWN || -+ (state == VIR_DOMAIN_PAUSED && -+ reason == VIR_DOMAIN_PAUSED_SHUTTING_DOWN)) { -+ VIR_DEBUG("Finishing shutdown sequence for domain %s", -+ obj->def->name); -+ qemuProcessShutdownOrReboot(driver, obj); -+ goto cleanup; -+ } -+ -+ if (qemuProcessBuildDestroyHugepagesPath(driver, obj, true) < 0) -+ goto error; -+ -+ if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, -+ driver, obj, false)) < 0) { -+ goto error; -+ } -+ -+ /* if domain requests security driver we haven't loaded, report error, but -+ * do not kill the domain -+ */ -+ ignore_value(qemuSecurityCheckAllLabel(driver->securityManager, -+ obj->def)); -+ -+ if (qemuDomainRefreshVcpuInfo(driver, obj, QEMU_ASYNC_JOB_NONE, true) < 0) -+ goto error; -+ -+ qemuDomainVcpuPersistOrder(obj->def); -+ -+ if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) -+ goto error; -+ -+ qemuProcessNotifyNets(obj->def); -+ -+ if (qemuProcessFiltersInstantiate(obj->def)) -+ goto error; -+ -+ if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -+ goto error; -+ -+ if (qemuBlockNodeNamesDetect(driver, obj) < 0) -+ goto error; -+ -+ if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -+ goto error; -+ -+ /* If querying of guest's RTC failed, report error, but do not kill the domain. */ -+ qemuRefreshRTC(driver, obj); -+ -+ if (qemuProcessRefreshBalloonState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) -+ goto error; -+ -+ if (qemuProcessRecoverJob(driver, obj, conn, &oldjob, &stopFlags) < 0) -+ goto error; -+ -+ if (qemuProcessUpdateDevices(driver, obj) < 0) -+ goto error; -+ -+ qemuProcessReconnectCheckMemAliasOrderMismatch(obj); -+ -+ if (qemuConnectAgent(driver, obj) < 0) -+ goto error; -+ -+ /* update domain state XML with possibly updated state in virDomainObj */ -+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, obj, driver->caps) < 0) -+ goto error; -+ -+ /* Run an hook to allow admins to do some magic */ -+ if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { -+ char *xml = qemuDomainDefFormatXML(driver, obj->def, 0); -+ int hookret; -+ -+ hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, obj->def->name, -+ VIR_HOOK_QEMU_OP_RECONNECT, VIR_HOOK_SUBOP_BEGIN, -+ NULL, xml, NULL); -+ VIR_FREE(xml); -+ -+ /* -+ * If the script raised an error abort the launch -+ */ -+ if (hookret < 0) -+ goto error; -+ } -+ -+ if (virAtomicIntInc(&driver->nactive) == 1 && driver->inhibitCallback) -+ driver->inhibitCallback(true, driver->inhibitOpaque); -+ -+ cleanup: -+ if (jobStarted) -+ qemuDomainObjEndJob(driver, obj); -+ if (!virDomainObjIsActive(obj)) -+ qemuDomainRemoveInactive(driver, obj); -+ virDomainObjEndAPI(&obj); -+ virObjectUnref(conn); -+ virObjectUnref(cfg); -+ virObjectUnref(caps); -+ virNWFilterUnlockFilterUpdates(); -+ return; -+ -+ error: -+ if (virDomainObjIsActive(obj)) { -+ /* We can't get the monitor back, so must kill the VM -+ * to remove danger of it ending up running twice if -+ * user tries to start it again later -+ */ -+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { -+ /* If we couldn't get the monitor and qemu supports -+ * no-shutdown, we can safely say that the domain -+ * crashed ... */ -+ state = VIR_DOMAIN_SHUTOFF_CRASHED; -+ } else { -+ /* ... but if it doesn't we can't say what the state -+ * really is and FAILED means "failed to start" */ -+ state = VIR_DOMAIN_SHUTOFF_UNKNOWN; -+ } -+ /* If BeginJob failed, we jumped here without a job, let's hope another -+ * thread didn't have a chance to start playing with the domain yet -+ * (it's all we can do anyway). -+ */ -+ qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags); -+ } -+ goto cleanup; -+} -+ -+static int -+qemuProcessReconnectHelper(virDomainObjPtr obj, -+ void *opaque) -+{ -+ virThread thread; -+ struct qemuProcessReconnectData *src = opaque; -+ struct qemuProcessReconnectData *data; -+ -+ /* If the VM was inactive, we don't need to reconnect */ -+ if (!obj->pid) -+ return 0; -+ -+ if (VIR_ALLOC(data) < 0) -+ return -1; -+ -+ memcpy(data, src, sizeof(*data)); -+ data->obj = obj; -+ -+ /* this lock and reference will be eventually transferred to the thread -+ * that handles the reconnect */ -+ virObjectLock(obj); -+ virObjectRef(obj); -+ -+ /* Since we close the connection later on, we have to make sure that the -+ * threads we start see a valid connection throughout their lifetime. We -+ * simply increase the reference counter here. -+ */ -+ virObjectRef(data->conn); -+ -+ if (virThreadCreate(&thread, false, qemuProcessReconnect, data) < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("Could not create thread. QEMU initialization " -+ "might be incomplete")); -+ /* We can't spawn a thread and thus connect to monitor. Kill qemu. -+ * It's safe to call qemuProcessStop without a job here since there -+ * is no thread that could be doing anything else with the same domain -+ * object. -+ */ -+ qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, -+ QEMU_ASYNC_JOB_NONE, 0); -+ qemuDomainRemoveInactive(src->driver, obj); -+ -+ virDomainObjEndAPI(&obj); -+ virObjectUnref(data->conn); -+ VIR_FREE(data); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+/** -+ * qemuProcessReconnectAll -+ * -+ * Try to re-open the resources for live VMs that we care -+ * about. -+ */ -+void -+qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver) -+{ -+ struct qemuProcessReconnectData data = {.conn = conn, .driver = driver}; -+ virDomainObjListForEach(driver->domains, qemuProcessReconnectHelper, &data); -+} --- -2.13.2 - diff --git a/SOURCES/libvirt-qemu-Move-snapshot-disk-validation-functions-into-one.patch b/SOURCES/libvirt-qemu-Move-snapshot-disk-validation-functions-into-one.patch new file mode 100644 index 0000000..6a163ae --- /dev/null +++ b/SOURCES/libvirt-qemu-Move-snapshot-disk-validation-functions-into-one.patch @@ -0,0 +1,185 @@ +From 53d9458b2d6095e376f2b5cacf30da7b2227f69d Mon Sep 17 00:00:00 2001 +Message-Id: <53d9458b2d6095e376f2b5cacf30da7b2227f69d@dist-git> +From: Peter Krempa +Date: Thu, 23 Nov 2017 19:02:13 +0100 +Subject: [PATCH] qemu: Move snapshot disk validation functions into one + +Move the code so that both the new image and old image can be verified +in the same function. + +(cherry picked from commit 8ffdeed455650557df531aafc66c20b31bd4e0c4) + +https://bugzilla.redhat.com/show_bug.cgi?id=1511480 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 91 ++++++++++++++++++++------------------------------ + 1 file changed, 36 insertions(+), 55 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index b35ab6d30e..aa6a326bb4 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -13953,17 +13953,19 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, + + + static int +-qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) ++qemuDomainSnapshotPrepareDiskExternalInactive(virDomainSnapshotDiskDefPtr snapdisk, ++ virDomainDiskDefPtr domdisk) + { +- int actualType = virStorageSourceGetActualType(disk->src); ++ int domDiskType = virStorageSourceGetActualType(domdisk->src); ++ int snapDiskType = virStorageSourceGetActualType(snapdisk->src); + +- switch ((virStorageType) actualType) { ++ switch ((virStorageType) domDiskType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: +- return 0; ++ break; + + case VIR_STORAGE_TYPE_NETWORK: +- switch ((virStorageNetProtocol) disk->src->protocol) { ++ switch ((virStorageNetProtocol) domdisk->src->protocol) { + case VIR_STORAGE_NET_PROTOCOL_NONE: + case VIR_STORAGE_NET_PROTOCOL_NBD: + case VIR_STORAGE_NET_PROTOCOL_RBD: +@@ -13981,7 +13983,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("external inactive snapshots are not supported on " + "'network' disks using '%s' protocol"), +- virStorageNetProtocolTypeToString(disk->src->protocol)); ++ virStorageNetProtocolTypeToString(domdisk->src->protocol)); + return -1; + } + break; +@@ -13992,7 +13994,23 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) + case VIR_STORAGE_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("external inactive snapshots are not supported on " +- "'%s' disks"), virStorageTypeToString(actualType)); ++ "'%s' disks"), virStorageTypeToString(domDiskType)); ++ return -1; ++ } ++ ++ switch ((virStorageType) snapDiskType) { ++ case VIR_STORAGE_TYPE_BLOCK: ++ case VIR_STORAGE_TYPE_FILE: ++ break; ++ ++ case VIR_STORAGE_TYPE_NETWORK: ++ case VIR_STORAGE_TYPE_DIR: ++ case VIR_STORAGE_TYPE_VOLUME: ++ case VIR_STORAGE_TYPE_NONE: ++ case VIR_STORAGE_TYPE_LAST: ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("external inactive snapshots are not supported on " ++ "'%s' disks"), virStorageTypeToString(snapDiskType)); + return -1; + } + +@@ -14001,33 +14019,27 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) + + + static int +-qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk) ++qemuDomainSnapshotPrepareDiskExternalActive(virDomainSnapshotDiskDefPtr snapdisk, ++ virDomainDiskDefPtr domdisk) + { +- if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { ++ int actualType = virStorageSourceGetActualType(snapdisk->src); ++ ++ if (domdisk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("external active snapshots are not supported on scsi " + "passthrough devices")); + return -1; + } + +- return 0; +-} +- +- +-static int +-qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr disk) +-{ +- int actualType = virStorageSourceGetActualType(disk->src); +- + switch ((virStorageType) actualType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: +- return 0; ++ break; + + case VIR_STORAGE_TYPE_NETWORK: +- switch ((virStorageNetProtocol) disk->src->protocol) { ++ switch ((virStorageNetProtocol) snapdisk->src->protocol) { + case VIR_STORAGE_NET_PROTOCOL_GLUSTER: +- return 0; ++ break; + + case VIR_STORAGE_NET_PROTOCOL_NONE: + case VIR_STORAGE_NET_PROTOCOL_NBD: +@@ -14045,7 +14057,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d + virReportError(VIR_ERR_INTERNAL_ERROR, + _("external active snapshots are not supported on " + "'network' disks using '%s' protocol"), +- virStorageNetProtocolTypeToString(disk->src->protocol)); ++ virStorageNetProtocolTypeToString(snapdisk->src->protocol)); + return -1; + + } +@@ -14065,31 +14077,6 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d + } + + +-static int +-qemuDomainSnapshotPrepareDiskExternalOverlayInactive(virDomainSnapshotDiskDefPtr disk) +-{ +- int actualType = virStorageSourceGetActualType(disk->src); +- +- switch ((virStorageType) actualType) { +- case VIR_STORAGE_TYPE_BLOCK: +- case VIR_STORAGE_TYPE_FILE: +- return 0; +- +- case VIR_STORAGE_TYPE_NETWORK: +- case VIR_STORAGE_TYPE_DIR: +- case VIR_STORAGE_TYPE_VOLUME: +- case VIR_STORAGE_TYPE_NONE: +- case VIR_STORAGE_TYPE_LAST: +- virReportError(VIR_ERR_INTERNAL_ERROR, +- _("external inactive snapshots are not supported on " +- "'%s' disks"), virStorageTypeToString(actualType)); +- return -1; +- } +- +- return 0; +-} +- +- + static int + qemuDomainSnapshotPrepareDiskExternal(virConnectPtr conn, + virDomainDiskDefPtr disk, +@@ -14107,16 +14094,10 @@ qemuDomainSnapshotPrepareDiskExternal(virConnectPtr conn, + if (virStorageTranslateDiskSourcePool(conn, disk) < 0) + return -1; + +- if (qemuDomainSnapshotPrepareDiskExternalBackingInactive(disk) < 0) +- return -1; +- +- if (qemuDomainSnapshotPrepareDiskExternalOverlayInactive(snapdisk) < 0) ++ if (qemuDomainSnapshotPrepareDiskExternalInactive(snapdisk, disk) < 0) + return -1; + } else { +- if (qemuDomainSnapshotPrepareDiskExternalBackingActive(disk) < 0) +- return -1; +- +- if (qemuDomainSnapshotPrepareDiskExternalOverlayActive(snapdisk) < 0) ++ if (qemuDomainSnapshotPrepareDiskExternalActive(snapdisk, disk) < 0) + return -1; + } + +-- +2.15.0 + diff --git a/SOURCES/libvirt-qemu-Pass-migratable-host-CPU-model-to-virCPUUpdate.patch b/SOURCES/libvirt-qemu-Pass-migratable-host-CPU-model-to-virCPUUpdate.patch deleted file mode 100644 index 2ce3f7e..0000000 --- a/SOURCES/libvirt-qemu-Pass-migratable-host-CPU-model-to-virCPUUpdate.patch +++ /dev/null @@ -1,219 +0,0 @@ -From ea1a18cc0a5722b64c37c79bee7b9ed3c220ca01 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jiri Denemark -Date: Wed, 29 Mar 2017 15:31:17 +0200 -Subject: [PATCH] qemu: Pass migratable host CPU model to virCPUUpdate - -We already know from QEMU which CPU features will block migration. Let's -use this information to make a migratable copy of the host CPU model and -use it for updating guest CPU specification. This will allow us to drop -feature filtering from virCPUUpdate where it was just a hack. - -Signed-off-by: Jiri Denemark -(cherry picked from commit 56bd7edcb5dc878beffb80d4e6a9cfb812378ded) - -https://bugzilla.redhat.com/show_bug.cgi?id=1444421 - -Signed-off-by: Jiri Denemark ---- - src/qemu/qemu_capabilities.c | 57 +++++++++++++++++++++++++++++++++++++------- - src/qemu/qemu_capabilities.h | 2 ++ - src/qemu/qemu_process.c | 2 +- - tests/cputest.c | 7 +++++- - 4 files changed, 57 insertions(+), 11 deletions(-) - -diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c -index e84de9f5b..ec773971e 100644 ---- a/src/qemu/qemu_capabilities.c -+++ b/src/qemu/qemu_capabilities.c -@@ -385,6 +385,8 @@ struct _virQEMUCapsHostCPUData { - qemuMonitorCPUModelInfoPtr info; - /* Host CPU definition reported in domain capabilities. */ - virCPUDefPtr reported; -+ /* Migratable host CPU definition used for updating guest CPU. */ -+ virCPUDefPtr migratable; - }; - - /* -@@ -2106,6 +2108,10 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsHostCPUDataPtr dst, - !(dst->reported = virCPUDefCopy(src->reported))) - return -1; - -+ if (src->migratable && -+ !(dst->migratable = virCPUDefCopy(src->migratable))) -+ return -1; -+ - return 0; - } - -@@ -2115,6 +2121,7 @@ virQEMUCapsHostCPUDataClear(virQEMUCapsHostCPUDataPtr cpuData) - { - qemuMonitorCPUModelInfoFree(cpuData->info); - virCPUDefFree(cpuData->reported); -+ virCPUDefFree(cpuData->migratable); - - memset(cpuData, 0, sizeof(*cpuData)); - } -@@ -2453,6 +2460,9 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - switch (cpuType) { - case VIR_QEMU_CAPS_HOST_CPU_REPORTED: - return cpuData->reported; -+ -+ case VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE: -+ return cpuData->migratable; - } - - return NULL; -@@ -2462,11 +2472,13 @@ virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - static void - virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type, -- virCPUDefPtr cpu) -+ virCPUDefPtr reported, -+ virCPUDefPtr migratable) - { - virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); - -- cpuData->reported = cpu; -+ cpuData->reported = reported; -+ cpuData->migratable = migratable; - } - - -@@ -3313,26 +3325,39 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps, - } - - -+static virCPUDefPtr -+virQEMUCapsNewHostCPUModel(void) -+{ -+ virCPUDefPtr cpu; -+ -+ if (VIR_ALLOC(cpu) < 0) -+ return NULL; -+ -+ cpu->type = VIR_CPU_TYPE_GUEST; -+ cpu->mode = VIR_CPU_MODE_CUSTOM; -+ cpu->match = VIR_CPU_MATCH_EXACT; -+ cpu->fallback = VIR_CPU_FALLBACK_ALLOW; -+ -+ return cpu; -+} -+ -+ - void - virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - virCapsPtr caps, - virDomainVirtType type) - { - virCPUDefPtr cpu = NULL; -+ virCPUDefPtr migCPU = NULL; - virCPUDefPtr hostCPU = NULL; - int rc; - - if (!caps || !virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch)) - return; - -- if (VIR_ALLOC(cpu) < 0) -+ if (!(cpu = virQEMUCapsNewHostCPUModel())) - goto error; - -- cpu->type = VIR_CPU_TYPE_GUEST; -- cpu->mode = VIR_CPU_MODE_CUSTOM; -- cpu->match = VIR_CPU_MATCH_EXACT; -- cpu->fallback = VIR_CPU_FALLBACK_ALLOW; -- - if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) { - goto error; - } else if (rc == 1) { -@@ -3346,7 +3371,20 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - goto error; - } - -- virQEMUCapsSetHostModel(qemuCaps, type, cpu); -+ if (!(migCPU = virQEMUCapsNewHostCPUModel())) -+ goto error; -+ -+ if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, migCPU, true)) < 0) { -+ goto error; -+ } else if (rc == 1) { -+ VIR_DEBUG("CPU migratability not provided by QEMU"); -+ -+ virCPUDefFree(migCPU); -+ if (!(migCPU = virCPUCopyMigratable(qemuCaps->arch, cpu))) -+ goto error; -+ } -+ -+ virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU); - - cleanup: - virCPUDefFree(hostCPU); -@@ -3354,6 +3392,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps, - - error: - virCPUDefFree(cpu); -+ virCPUDefFree(migCPU); - virResetLastError(); - goto cleanup; - } -diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h -index 50333fc26..16fe044cc 100644 ---- a/src/qemu/qemu_capabilities.h -+++ b/src/qemu/qemu_capabilities.h -@@ -454,6 +454,8 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, - typedef enum { - /* Host CPU definition reported in domain capabilities. */ - VIR_QEMU_CAPS_HOST_CPU_REPORTED, -+ /* Migratable host CPU definition used for updating guest CPU. */ -+ VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE, - } virQEMUCapsHostCPUType; - - virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index dc073891a..c81389ef2 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -5313,7 +5313,7 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, - - if (virCPUUpdate(def->os.arch, def->cpu, - virQEMUCapsGetHostModel(qemuCaps, def->virtType, -- VIR_QEMU_CAPS_HOST_CPU_REPORTED)) < 0) -+ VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0) - goto cleanup; - - if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType, -diff --git a/tests/cputest.c b/tests/cputest.c -index 8c07cf4f6..efa891dc1 100644 ---- a/tests/cputest.c -+++ b/tests/cputest.c -@@ -393,6 +393,7 @@ cpuTestUpdate(const void *arg) - const struct data *data = arg; - int ret = -1; - virCPUDefPtr host = NULL; -+ virCPUDefPtr migHost = NULL; - virCPUDefPtr cpu = NULL; - char *result = NULL; - -@@ -400,7 +401,10 @@ cpuTestUpdate(const void *arg) - !(cpu = cpuTestLoadXML(data->arch, data->name))) - goto cleanup; - -- if (virCPUUpdate(host->arch, cpu, host) < 0) -+ if (!(migHost = virCPUCopyMigratable(data->arch, host))) -+ goto cleanup; -+ -+ if (virCPUUpdate(host->arch, cpu, migHost) < 0) - goto cleanup; - - if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0) -@@ -411,6 +415,7 @@ cpuTestUpdate(const void *arg) - cleanup: - virCPUDefFree(host); - virCPUDefFree(cpu); -+ virCPUDefFree(migHost); - VIR_FREE(result); - return ret; - } --- -2.12.2 - diff --git a/SOURCES/libvirt-qemu-Pass-the-number-of-heads-even-with-vga-qxl.patch b/SOURCES/libvirt-qemu-Pass-the-number-of-heads-even-with-vga-qxl.patch deleted file mode 100644 index 1d7743f..0000000 --- a/SOURCES/libvirt-qemu-Pass-the-number-of-heads-even-with-vga-qxl.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 7f85f27f9f14683fb784ffd9aecb545d7d39194d Mon Sep 17 00:00:00 2001 -Message-Id: <7f85f27f9f14683fb784ffd9aecb545d7d39194d@dist-git> -From: Martin Kletzander -Date: Mon, 19 Jun 2017 15:40:17 +0200 -Subject: [PATCH] qemu: Pass the number of heads even with -vga qxl - -When added in multiple previous commits, it was used only with -device -qxl(-vga), but for some QEMUs (< 1.6) we need to add this -functionality when using -vga qxl as well. - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1283207 - -Signed-off-by: Martin Kletzander -(cherry picked from commit d23410449fc9f91ceeeacb19d915a6db2f17f3be) -Signed-off-by: Martin Kletzander -Signed-off-by: Jiri Denemark -Reviewed-by: Pavel Hrdina ---- - src/qemu/qemu_command.c | 7 ++++ - .../qemuxml2argv-video-vga-qxl-heads.args | 30 ++++++++++++++ - .../qemuxml2argv-video-vga-qxl-heads.xml | 47 ++++++++++++++++++++++ - tests/qemuxml2argvtest.c | 3 ++ - 4 files changed, 87 insertions(+) - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args - create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml - -diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c -index 88223babeb..a4184b7378 100644 ---- a/src/qemu/qemu_command.c -+++ b/src/qemu/qemu_command.c -@@ -4585,6 +4585,7 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd, - unsigned int vram = video->vram; - unsigned int vram64 = video->vram64; - unsigned int vgamem = video->vgamem; -+ unsigned int heads = video->heads; - - if (ram) { - virCommandAddArg(cmd, "-global"); -@@ -4608,6 +4609,12 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd, - virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u", - dev, vgamem / 1024); - } -+ if (heads && -+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_MAX_OUTPUTS)) { -+ virCommandAddArg(cmd, "-global"); -+ virCommandAddArgFormat(cmd, "%s.max_outputs=%u", -+ dev, heads); -+ } - } - - if (video->vram && -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args -new file mode 100644 -index 0000000000..411a2eedbc ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.args -@@ -0,0 +1,30 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/home/test \ -+USER=test \ -+LOGNAME=test \ -+QEMU_AUDIO_DRV=none \ -+/usr/bin/qemu-system-i686 \ -+-name QEMUGuest1 \ -+-S \ -+-M pc \ -+-m 214 \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-nographic \ -+-nodefaults \ -+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ -+-no-acpi \ -+-boot c \ -+-usb \ -+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ -+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -+-vga qxl \ -+-global qxl-vga.ram_size=67108864 \ -+-global qxl-vga.vram_size=67108864 \ -+-global qxl-vga.max_outputs=1 \ -+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,max_outputs=3,\ -+bus=pci.0,addr=0x4 \ -+-device qxl,id=video2,ram_size=67108864,vram_size=67108864,max_outputs=7,\ -+bus=pci.0,addr=0x5 \ -+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml -new file mode 100644 -index 0000000000..d878ddcd6d ---- /dev/null -+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-qxl-heads.xml -@@ -0,0 +1,47 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-i686 -+ -+ -+ -+
      -+ -+ -+
      -+ -+ -+
      -+ -+ -+ -+ -+