Blame SOURCES/virt-manager-show-correctly-EGD-RNG-devices-informat.patch

d0fc41
From e810fadbc755b722c33862556dffae8a3450544b Mon Sep 17 00:00:00 2001
d0fc41
From: Giuseppe Scrivano <gscrivan@redhat.com>
d0fc41
Date: Wed, 30 Oct 2013 14:55:59 +0100
d0fc41
Subject: [RHEL-7.0 virt-manager PATCH] virt-manager: show correctly EGD RNG
d0fc41
 devices information
d0fc41
d0fc41
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
d0fc41
(cherry picked from commit 408771004fa54825eb30cd7cc43b9b7b2accd151)
d0fc41
d0fc41
Conflicts:
d0fc41
	ui/vmm-details.ui
d0fc41
	virtManager/details.py
d0fc41
---
d0fc41
 ui/vmm-details.ui      | 116 ++++++++++++++++++++++++++++++++++++++-----------
d0fc41
 virtManager/details.py |  30 ++++++++-----
d0fc41
 2 files changed, 111 insertions(+), 35 deletions(-)
d0fc41
d0fc41
diff --git a/ui/vmm-details.ui b/ui/vmm-details.ui
d0fc41
index 5ef2f73..4296827 100644
d0fc41
--- a/ui/vmm-details.ui
d0fc41
+++ b/ui/vmm-details.ui
d0fc41
@@ -6970,7 +6970,9 @@ I/O:</property>
d0fc41
                                       <object class="GtkTable" id="table16">
d0fc41
                                         <property name="visible">True</property>
d0fc41
                                         <property name="can_focus">False</property>
d0fc41
+                                        <property name="halign">start</property>
d0fc41
                                         <property name="border_width">3</property>
d0fc41
+                                        <property name="n_rows">10</property>
d0fc41
                                         <property name="column_spacing">6</property>
d0fc41
                                         <property name="row_spacing">6</property>
d0fc41
                                         <child>
d0fc41
@@ -7017,11 +7019,11 @@ I/O:</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-host">
d0fc41
+                                          <object class="GtkLabel" id="rng-connect-host">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">0</property>
d0fc41
-                                            <property name="label">rng-host</property>
d0fc41
+                                            <property name="label">rng-connect-host</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
@@ -7040,11 +7042,11 @@ I/O:</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-service">
d0fc41
+                                          <object class="GtkLabel" id="rng-connect-service">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">0</property>
d0fc41
-                                            <property name="label">rng-service</property>
d0fc41
+                                            <property name="label">rng-connect-service</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
@@ -7063,26 +7065,41 @@ I/O:</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-label4">
d0fc41
+                                          <object class="GtkLabel" id="rng-label5">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">1</property>
d0fc41
-                                            <property name="label" translatable="yes">Backend type:</property>
d0fc41
+                                            <property name="label" translatable="yes">Rate (bytes):</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
-                                            <property name="top_attach">4</property>
d0fc41
+                                            <property name="top_attach">9</property>
d0fc41
+                                            <property name="bottom_attach">10</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-backend-type">
d0fc41
+                                          <object class="GtkLabel" id="rng-rate-bytes">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">0</property>
d0fc41
-                                            <property name="label">rng-backend-type</property>
d0fc41
+                                            <property name="label">rng-rate-bytes</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
-                                            <property name="top_attach">4</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">9</property>
d0fc41
+                                            <property name="bottom_attach">10</property>
d0fc41
+                                          </packing>
d0fc41
+                                        </child>
d0fc41
+                                        <child>
d0fc41
+                                          <object class="GtkLabel" id="rng-label6">
d0fc41
+                                            <property name="visible">True</property>
d0fc41
+                                            <property name="can_focus">False</property>
d0fc41
+                                            <property name="xalign">1</property>
d0fc41
+                                            <property name="label" translatable="yes">Rate (period):</property>
d0fc41
+                                          </object>
d0fc41
+                                          <packing>
d0fc41
+                                            <property name="top_attach">8</property>
d0fc41
+                                            <property name="bottom_attach">9</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
@@ -7094,64 +7111,113 @@ I/O:</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
-                                            <property name="top_attach">6</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">8</property>
d0fc41
+                                            <property name="bottom_attach">9</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-label6">
d0fc41
+                                          <object class="GtkLabel" id="rng-label7">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">1</property>
d0fc41
-                                            <property name="label" translatable="yes">Rate (period):</property>
d0fc41
+                                            <property name="label" translatable="yes">Mode:</property>
d0fc41
+                                          </object>
d0fc41
+                                          <packing>
d0fc41
+                                            <property name="top_attach">7</property>
d0fc41
+                                            <property name="bottom_attach">8</property>
d0fc41
+                                          </packing>
d0fc41
+                                        </child>
d0fc41
+                                        <child>
d0fc41
+                                          <object class="GtkLabel" id="rng-mode">
d0fc41
+                                            <property name="visible">True</property>
d0fc41
+                                            <property name="can_focus">False</property>
d0fc41
+                                            <property name="xalign">0</property>
d0fc41
+                                            <property name="label">rng-mode</property>
d0fc41
+                                          </object>
d0fc41
+                                          <packing>
d0fc41
+                                            <property name="left_attach">1</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">7</property>
d0fc41
+                                            <property name="bottom_attach">8</property>
d0fc41
+                                          </packing>
d0fc41
+                                        </child>
d0fc41
+                                        <child>
d0fc41
+                                          <object class="GtkLabel" id="rng-label4">
d0fc41
+                                            <property name="visible">True</property>
d0fc41
+                                            <property name="can_focus">False</property>
d0fc41
+                                            <property name="xalign">1</property>
d0fc41
+                                            <property name="label" translatable="yes">Backend type:</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="top_attach">6</property>
d0fc41
+                                            <property name="bottom_attach">7</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-label7">
d0fc41
+                                          <object class="GtkLabel" id="rng-backend-type">
d0fc41
+                                            <property name="visible">True</property>
d0fc41
+                                            <property name="can_focus">False</property>
d0fc41
+                                            <property name="xalign">0</property>
d0fc41
+                                            <property name="label">rng-backend-type</property>
d0fc41
+                                          </object>
d0fc41
+                                          <packing>
d0fc41
+                                            <property name="left_attach">1</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">6</property>
d0fc41
+                                            <property name="bottom_attach">7</property>
d0fc41
+                                          </packing>
d0fc41
+                                        </child>
d0fc41
+                                        <child>
d0fc41
+                                          <object class="GtkLabel" id="rng-label8">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">1</property>
d0fc41
-                                            <property name="label" translatable="yes">Mode:</property>
d0fc41
+                                            <property name="label" translatable="yes">Bind Host:</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
-                                            <property name="top_attach">5</property>
d0fc41
+                                            <property name="top_attach">4</property>
d0fc41
+                                            <property name="bottom_attach">5</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-mode">
d0fc41
+                                          <object class="GtkLabel" id="rng-bind-host">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">0</property>
d0fc41
-                                            <property name="label">rng-mode</property>
d0fc41
+                                            <property name="label">rng-bind-host</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
-                                            <property name="top_attach">5</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">4</property>
d0fc41
+                                            <property name="bottom_attach">5</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-label5">
d0fc41
+                                          <object class="GtkLabel" id="rng-label9">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">1</property>
d0fc41
-                                            <property name="label" translatable="yes">Rate (bytes):</property>
d0fc41
+                                            <property name="label" translatable="yes">Bind Service:</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
-                                            <property name="top_attach">7</property>
d0fc41
+                                            <property name="top_attach">5</property>
d0fc41
+                                            <property name="bottom_attach">6</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                         <child>
d0fc41
-                                          <object class="GtkLabel" id="rng-rate-bytes">
d0fc41
+                                          <object class="GtkLabel" id="rng-bind-service">
d0fc41
                                             <property name="visible">True</property>
d0fc41
                                             <property name="can_focus">False</property>
d0fc41
                                             <property name="xalign">0</property>
d0fc41
-                                            <property name="label">rng-rate-bytes</property>
d0fc41
+                                            <property name="label">rng-bind-service</property>
d0fc41
                                           </object>
d0fc41
                                           <packing>
d0fc41
                                             <property name="left_attach">1</property>
d0fc41
-                                            <property name="top_attach">7</property>
d0fc41
+                                            <property name="right_attach">2</property>
d0fc41
+                                            <property name="top_attach">5</property>
d0fc41
+                                            <property name="bottom_attach">6</property>
d0fc41
                                           </packing>
d0fc41
                                         </child>
d0fc41
                                       </object>
d0fc41
diff --git a/virtManager/details.py b/virtManager/details.py
d0fc41
index 48f9faa..be3b6ec 100644
d0fc41
--- a/virtManager/details.py
d0fc41
+++ b/virtManager/details.py
d0fc41
@@ -38,6 +38,7 @@ from virtManager.console import vmmConsolePages
d0fc41
 from virtManager.serialcon import vmmSerialConsole
d0fc41
 from virtManager.graphwidgets import Sparkline
d0fc41
 from virtManager import util as util
d0fc41
+from virtinst import VirtualRNGDevice
d0fc41
d0fc41
 import virtinst
d0fc41
d0fc41
@@ -3211,30 +3212,34 @@ class vmmDetails(vmmGObjectUI):
d0fc41
     def refresh_rng_page(self):
d0fc41
         dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
d0fc41
         values = {
d0fc41
+            "rng-bind-host" : "bind_host",
d0fc41
+            "rng-bind-service" : "bind_service",
d0fc41
+            "rng-connect-host" : "connect_host",
d0fc41
+            "rng-connect-service" : "connect_service",
d0fc41
             "rng-type" : "type",
d0fc41
             "rng-device" : "device",
d0fc41
-            "rng-host" : "backend_source_host",
d0fc41
-            "rng-service" : "backend_source_service",
d0fc41
-            "rng-mode" : "backend_source_mode",
d0fc41
             "rng-backend-type" : "backend_type",
d0fc41
             "rng-rate-bytes" : "rate_bytes",
d0fc41
             "rng-rate-period" : "rate_period"
d0fc41
         }
d0fc41
         rewriter = {
d0fc41
             "rng-type" : lambda x:
d0fc41
-            virtinst.VirtualRNGDevice.get_pretty_type(x),
d0fc41
+            VirtualRNGDevice.get_pretty_type(x),
d0fc41
             "rng-backend-type" : lambda x:
d0fc41
-            virtinst.VirtualRNGDevice.get_pretty_backend_type(x),
d0fc41
-            "rng-mode" : lambda x:
d0fc41
-            virtinst.VirtualRNGDevice.get_pretty_mode(x)
d0fc41
+            VirtualRNGDevice.get_pretty_backend_type(x),
d0fc41
         }
d0fc41
d0fc41
         is_egd = dev.type == virtinst.VirtualRNGDevice.TYPE_EGD
d0fc41
+        udp = dev.backend_type == virtinst.VirtualRNGDevice.BACKEND_TYPE_UDP
d0fc41
+        bind = virtinst.VirtualRNGDevice.BACKEND_MODE_BIND in dev.backend_mode()
d0fc41
+
d0fc41
         self.widget("rng-device").set_sensitive(not is_egd)
d0fc41
-        self.widget("rng-host").set_sensitive(is_egd)
d0fc41
-        self.widget("rng-service").set_sensitive(is_egd)
d0fc41
-        self.widget("rng-mode").set_sensitive(is_egd)
d0fc41
+        self.widget("rng-mode").set_sensitive(is_egd and not udp)
d0fc41
         self.widget("rng-backend-type").set_sensitive(is_egd)
d0fc41
+        self.widget("rng-connect-host").set_sensitive(is_egd and (udp or not bind))
d0fc41
+        self.widget("rng-connect-service").set_sensitive(is_egd and (udp or not bind))
d0fc41
+        self.widget("rng-bind-host").set_sensitive(is_egd and (udp or bind))
d0fc41
+        self.widget("rng-bind-service").set_sensitive(is_egd and (udp or bind))
d0fc41
d0fc41
         for k, prop in values.items():
d0fc41
             val = "-"
d0fc41
@@ -3244,6 +3249,11 @@ class vmmDetails(vmmGObjectUI):
d0fc41
                 if r:
d0fc41
                     val = r(val)
d0fc41
             self.widget(k).set_text(val)
d0fc41
+        if is_egd and not udp:
d0fc41
+            mode = VirtualRNGDevice.get_pretty_mode(dev.backend_mode()[0])
d0fc41
+            self.widget("rng-mode").set_text(mode)
d0fc41
+        else:
d0fc41
+            self.widget("rng-mode").set_text("-")
d0fc41
d0fc41
     def refresh_char_page(self):
d0fc41
         chardev = self.get_hw_selection(HW_LIST_COL_DEVICE)
d0fc41
-- 
d0fc41
1.8.4.2
d0fc41