Blob Blame History Raw
From b5b1e8fc6b212a42d07ddca424a6474ce413e1e4 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <gscrivan@redhat.com>
Date: Wed, 19 Mar 2014 16:05:54 +0100
Subject: [PATCH 2/2] virt-manager: disable CD/DVDROM passtrough on RHEL

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1072610

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 8d580cc483d2a9bf47283676233914e4cc8d29a6)

Conflicts:
	virtManager/choosecd.py
	virtManager/create.py
---
 virtManager/choosecd.py | 8 +++++++-
 virtManager/create.py   | 7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/virtManager/choosecd.py b/virtManager/choosecd.py
index a0cac24..540e4b7 100644
--- a/virtManager/choosecd.py
+++ b/virtManager/choosecd.py
@@ -83,7 +83,13 @@ class vmmChooseCD(vmmGObjectUI):
 
     def reset_state(self):
         cd_path = self.widget("cd-path")
-        use_cdrom = (cd_path.get_active() > -1)
+
+        enable_phys = not self.vm.stable_defaults()
+        self.widget("physical-media").set_sensitive(enable_phys)
+        self.widget("physical-media").set_tooltip_text("" if enable_phys else
+            _("Physical CDROM passthrough not supported with this hypervisor"))
+
+        use_cdrom = (cd_path.get_active() > -1) and enable_phys
 
         if use_cdrom:
             self.widget("physical-media").set_active(True)
diff --git a/virtManager/create.py b/virtManager/create.py
index 90ef1eb..76a355e 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -547,8 +547,13 @@ class vmmCreate(vmmGObjectUI):
         else:
             iso_option.set_active(True)
 
+        enable_phys = not self._stable_defaults()
+        cdrom_option.set_sensitive(enable_phys)
+        cdrom_option.set_tooltip_text("" if enable_phys else
+            _("Physical CDROM passthrough not supported with this hypervisor"))
+
         # Only allow ISO option for remote VM
-        if not is_local:
+        if not is_local or not enable_phys:
             iso_option.set_active(True)
 
         self.toggle_local_cdrom(cdrom_option)
-- 
1.8.3.1