[virt-tools-list] [PATCH v2 virt-manager] panic notifier: display default value if not set

Cole Robinson crobinso at redhat.com
Tue Jan 14 15:03:12 UTC 2014


On 01/13/2014 10:45 PM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> 
> If we didn't set values for @type and @iobase in
> XML, libvirt will use the default value.
> Currently, virt-manager will display "-" if we don't
> set any values.
> This patch will use default value for display.
> And update test case to cover this scenario.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
> v2: update existed test case
> 
>  tests/xmlparse.py       | 4 ++--
>  virtManager/details.py  | 3 +++
>  virtinst/devicepanic.py | 1 +
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/xmlparse.py b/tests/xmlparse.py
> index 4567bb8..0bf0637 100644
> --- a/tests/xmlparse.py
> +++ b/tests/xmlparse.py
> @@ -787,8 +787,8 @@ class XMLParseTest(unittest.TestCase):
>          dev1 = guest.get_devices("panic")[0]
>  
>          check = self._make_checker(dev1)
> -        check("type", "isa", "isa")
> -        check("iobase", "0x505", "0x506")
> +        check("type", "isa", None, "isa")
> +        check("iobase", "0x505", None, "0x506")
>          self._alter_compare(guest.get_xml_config(), outfile)
>  
>      def testAddRemoveDevices(self):
> diff --git a/virtManager/details.py b/virtManager/details.py
> index 51573f6..72fbc98 100644
> --- a/virtManager/details.py
> +++ b/virtManager/details.py
> @@ -3110,6 +3110,9 @@ class vmmDetails(vmmGObjectUI):
>              widgetname = "panic-" + param.replace("_", "-")
>              if not val:
>                  val = getattr(dev, param)
> +                if not val:
> +                    propername = param.upper() + "_DEFAULT"
> +                    val = getattr(virtinst.VirtualPanicDevice, propername, "-").upper()
>  
>              uihelpers.set_grid_row_visible(self.widget(widgetname), True)
>              self.widget(widgetname).set_text(val or "-")
> diff --git a/virtinst/devicepanic.py b/virtinst/devicepanic.py
> index 5f7cbd8..a41af94 100644
> --- a/virtinst/devicepanic.py
> +++ b/virtinst/devicepanic.py
> @@ -26,6 +26,7 @@ class VirtualPanicDevice(VirtualDevice):
>  
>      virtual_device_type = VirtualDevice.VIRTUAL_DEV_PANIC
>      ADDRESS_TYPE_ISA = "isa"
> +    TYPE_DEFAULT = ADDRESS_TYPE_ISA
>      TYPES = [ADDRESS_TYPE_ISA]
>      IOBASE_DEFAULT = "0x505"
>  
> 

Thanks, pushed now.

- Cole




More information about the virt-tools-list mailing list