render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 8152b6ac3b740bfe1155e3c4c251684cc5b3192e Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <8152b6ac3b740bfe1155e3c4c251684cc5b3192e@dist-git>
fbe740
From: Andrea Bolognani <abologna@redhat.com>
fbe740
Date: Fri, 14 Feb 2020 13:12:36 +0100
fbe740
Subject: [PATCH] qemu: Validate configuration for the armvtimer timer
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Its use is limited to certain guest types, and it only supports
fbe740
a subset of all possible tick policies.
fbe740
fbe740
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
fbe740
Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
(cherry picked from commit aeddab230cd1e2a12d5d6352971bb70ea067a1c4)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1762634
fbe740
fbe740
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
fbe740
Message-Id: <20200214121237.623948-6-abologna@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_domain.c | 38 ++++++++++++++++++++++++++++++++++++++
fbe740
 1 file changed, 38 insertions(+)
fbe740
fbe740
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
fbe740
index 4de4f9da53..1bed117eb0 100644
fbe740
--- a/src/qemu/qemu_domain.c
fbe740
+++ b/src/qemu/qemu_domain.c
fbe740
@@ -5506,6 +5506,44 @@ qemuDomainDefValidateClockTimers(const virDomainDef *def,
fbe740
             break;
fbe740
 
fbe740
         case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
fbe740
+            if (def->virtType != VIR_DOMAIN_VIRT_KVM ||
fbe740
+                !qemuDomainIsARMVirt(def)) {
fbe740
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
fbe740
+                               _("Configuring the '%s' timer is not supported "
fbe740
+                                 "for virtType=%s arch=%s machine=%s guests"),
fbe740
+                               virDomainTimerNameTypeToString(timer->name),
fbe740
+                               virDomainVirtTypeToString(def->virtType),
fbe740
+                               virArchToString(def->os.arch),
fbe740
+                               def->os.machine);
fbe740
+                return -1;
fbe740
+            }
fbe740
+            if (timer->present == 0) {
fbe740
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
fbe740
+                               _("The '%s' timer can't be disabled"),
fbe740
+                               virDomainTimerNameTypeToString(timer->name));
fbe740
+                return -1;
fbe740
+            }
fbe740
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_KVM_NO_ADJVTIME)) {
fbe740
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
fbe740
+                               _("Configuring the '%s' timer is not supported "
fbe740
+                                 "with this QEMU binary"),
fbe740
+                               virDomainTimerNameTypeToString(timer->name));
fbe740
+                return -1;
fbe740
+            }
fbe740
+
fbe740
+            switch (timer->tickpolicy) {
fbe740
+            case -1:
fbe740
+            case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
fbe740
+            case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD:
fbe740
+                break;
fbe740
+            case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
fbe740
+            case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
fbe740
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
fbe740
+                               _("The '%s' timer does not support tickpolicy '%s'"),
fbe740
+                               virDomainTimerNameTypeToString(timer->name),
fbe740
+                               virDomainTimerTickpolicyTypeToString(timer->tickpolicy));
fbe740
+                return -1;
fbe740
+            }
fbe740
             break;
fbe740
         }
fbe740
     }
fbe740
-- 
fbe740
2.25.0
fbe740