-
-@@ -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).
-+ 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.
-+
-+ 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
-+
-@@ -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.
-
-+
- 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 @@
-
-
+- 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.
+
+@@ -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 @@
+
+-
++
+
+
+
+-
++
+
+
+
+
++
++ 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.
+
-+ 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)
-+
-@@ -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)
-+
-+ 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)
-+
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)
-+
-+ 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
-
-
-+
-+ 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
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-
-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>
-
-+
-+ 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 (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
-+
-+ 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:
-+