qemu-kvm/kvm-fdc-Restrict-floppy-controllers-to-RHEL-7-machine-ty.patch
Danilo C. L. de Paula dd7d9e5a43 * Mon Feb 25 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-16.el8
- kvm-fdc-Revert-downstream-disablement-of-device-floppy.patch [bz#1664997]
- kvm-fdc-Restrict-floppy-controllers-to-RHEL-7-machine-ty.patch [bz#1664997]
- Resolves: bz#1664997
  (Restrict floppy device to RHEL-7 machine types)
2019-02-25 18:26:37 +00:00

56 lines
1.9 KiB
Diff

From f869cc062302515f4d031305584386ead0d32714 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Thu, 21 Feb 2019 09:11:01 +0000
Subject: [PATCH 2/2] fdc: Restrict floppy controllers to RHEL-7 machine types
RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <20190221091101.31999-3-armbru@redhat.com>
Patchwork-id: 84693
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH v2 2/2] fdc: Restrict floppy controllers to RHEL-7 machine types
Bugzilla: 1664997
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>
Make floppy controllers' realize() fail except with RHEL-7 machine
types. The "is a RHEL-7 machine type" test is a bit of a hack: it
looks for "-rhel7." in the machine type name.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/block/fdc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 6f19f12..9ece2db 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -42,6 +42,8 @@
#include "qemu/log.h"
#include "trace.h"
+#include "hw/boards.h"
+
/********************************************************/
/* debug Floppy devices */
@@ -2629,6 +2631,14 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
int i, j;
static int command_tables_inited = 0;
+ /* Restricted for Red Hat Enterprise Linux: */
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+ if (!strstr(mc->name, "-rhel7.")) {
+ error_setg(errp, "Device %s is not supported with machine type %s",
+ object_get_typename(OBJECT(dev)), mc->name);
+ return;
+ }
+
if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'");
}
--
1.8.3.1