提交 9b45cd8f 编写于 作者: A Andrea Bolognani

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: NAndrea Bolognani <abologna@redhat.com>
上级 f7237d63
...@@ -21831,7 +21831,30 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -21831,7 +21831,30 @@ virDomainControllerDefFormat(virBufferPtr buf,
} }
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { 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); modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
if (!modelName) { if (!modelName) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册