From 7e3b03cbdee6a9fc694046ea3c98c5cdef941c92 Mon Sep 17 00:00:00 2001 Message-Id: <7e3b03cbdee6a9fc694046ea3c98c5cdef941c92@dist-git> From: Andrea Bolognani Date: Tue, 25 Jul 2017 10:29:27 +0200 Subject: [PATCH] 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 (cherry picked from commit 9b45cd8fab1c7d7d07dd3ae64970b3c93b78e04c) Conflicts: * src/conf/domain_conf.c: caused by e146264aaadf5aecf727d8c7b3d85683b55b6c48, which significantly refactored virDomainControllerDefFormat(), not being in the tree. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193 Signed-off-by: Andrea Bolognani Signed-off-by: Jiri Denemark --- src/conf/domain_conf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 86415964dc..f28f6aff63 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21670,6 +21670,23 @@ virDomainControllerDefFormat(virBufferPtr buf, pcihole64 = true; if (def->opts.pciopts.modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) pciModel = true; + /* 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) { + pciModel = false; + } if (def->opts.pciopts.chassisNr != -1 || def->opts.pciopts.chassis != -1 || def->opts.pciopts.port != -1 || -- 2.13.3