[libvirt] [PATCH] qemu: remove panic device with model s390 when migrating

Ján Tomko jtomko at redhat.com
Tue Jul 26 16:41:40 UTC 2016


[cc-ing Andrea who auto-added panic for PPC64]

Should we do the same for PANIC_MODEL_PSERIES?

On Tue, Jul 26, 2016 at 09:52:59AM +0200, Boris Fiuczynski wrote:
>The panic device with model s390 is autogenerated on domains with
>S390 architecture since libvirt version 1.3.5.
>For backwards compatibility reasons the device is to be removed
>when migrating.
>
>Signed-off-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
>---
> src/qemu/qemu_domain.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index ceac22f..0d97ea6 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -3310,6 +3310,28 @@ qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
>             virDomainControllerDefFree(usb);
>         }
>
>+        /* Remove the panic device with model s390 if present */
>+        for (i = 0; i < def->npanics; i++) {
>+            if (def->panics[i]->model == VIR_DOMAIN_PANIC_MODEL_S390) {
>+                virDomainPanicDefPtr *panics = def->panics;
>+                int npanics = def->npanics;
>+                size_t j;
>+

>+                if (VIR_ALLOC_N(def->panics, npanics - 1) < 0) {
>+                    def->panics = panics;
>+                    goto cleanup;
>+                }
>+
>+                def->npanics = 0;
>+                for (j = 0; j < npanics; j++) {
>+                    if (j != i)
>+                        def->panics[def->npanics++] = panics[j];
>+                }
>+                VIR_FREE(panics);

VIR_DELETE_ELEMENT can do all this for you.

Jan

>+                break; /* only one panic dev with model s390 can exist */
>+            }
>+        }
>+
>         for (i = 0; i < def->nchannels; i++)
>             qemuDomainChrDefDropDefaultPath(def->channels[i], driver);
>     }




More information about the libvir-list mailing list