Factor out the existing code.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c9d213dd7b..8a37cda464 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4346,6 +4346,19 @@ qemuDomainDefaultSerialModel(const virDomainDef *def,
}
+static int
+qemuDomainDefaultPanicModel(const virDomainDef *def)
+{
+ if (qemuDomainIsPSeries(def))
+ return VIR_DOMAIN_PANIC_MODEL_PSERIES;
+
+ if (ARCH_IS_S390(def->os.arch))
+ return VIR_DOMAIN_PANIC_MODEL_S390;
+
+ return VIR_DOMAIN_PANIC_MODEL_ISA;
+}
+
+
static int
qemuDomainDefAddDefaultDevices(virQEMUDriver *driver,
virDomainDef *def,
@@ -6123,14 +6136,8 @@ static int
qemuDomainDevicePanicDefPostParse(virDomainPanicDef *panic,
const virDomainDef *def)
{
- if (panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT) {
- if (qemuDomainIsPSeries(def))
- panic->model = VIR_DOMAIN_PANIC_MODEL_PSERIES;
- else if (ARCH_IS_S390(def->os.arch))
- panic->model = VIR_DOMAIN_PANIC_MODEL_S390;
- else
- panic->model = VIR_DOMAIN_PANIC_MODEL_ISA;
- }
+ if (panic->model == VIR_DOMAIN_PANIC_MODEL_DEFAULT)
+ panic->model = qemuDomainDefaultPanicModel(def);
return 0;
}
--
2.43.0