[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 1/2] conf: Fix backwards migration of pSeries guests



Recent commits made it so that pci-root controllers for
pSeries guests are automatically assigned the
spapr-pci-host-bridge model name; however, that prevents
guests to migrate to older versions of libvirt which don't
know about that model name at all, which at the moment is
all of them :)

To avoid the issue, just strip the model name from PHBs
when formatting the migratable XML; guests that use more
than one PHB are not going to be migratable anyway.

Signed-off-by: Andrea Bolognani <abologna redhat com>
---
 src/conf/domain_conf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d88a88e..b5ab97a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21813,7 +21813,30 @@ virDomainControllerDefFormat(virBufferPtr buf,
     }
 
     if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
-        if (def->opts.pciopts.modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) {
+        bool formatModelName = true;
+
+        if (def->opts.pciopts.modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
+            formatModelName = false;
+
+        /* Historically, libvirt didn't support specifying a model name for
+         * pci-root controllers; starting from 3.6.0, however, pSeries guests
+         * use pci-root controllers with model name spapr-pci-host-bridge to
+         * represent all PHBs, including the default one.
+         *
+         * In order to allow migration of pSeries guests from older libvirt
+         * versions and back, we don't format the model name in the migratable
+         * XML if it's spapr-pci-host-bridge, thus making "no model name" and
+         * "spapr-pci-host-bridge model name" basically equivalent.
+         *
+         * The spapr-pci-host-bridge device is specific to pSeries.
+         */
+        if (def->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
+            def->opts.pciopts.modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE &&
+            flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) {
+            formatModelName = false;
+        }
+
+        if (formatModelName) {
             modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
             if (!modelName) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
2.7.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]