- jsc#SLE-12902 virt-manager: Display information about nvram file

used instead of the path to the Nvram
  virtman-add-tooltip-to-firmware.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=523
This commit is contained in:
Charles Arnold 2020-10-30 20:18:46 +00:00 committed by Git OBS Bridge
parent 8bfd716ef6
commit 9f737c10db
3 changed files with 84 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 30 14:03:50 MDT 2020 - carnold@suse.com
- jsc#SLE-12902 virt-manager: Display information about nvram file
used instead of the path to the Nvram
virtman-add-tooltip-to-firmware.patch
-------------------------------------------------------------------
Tue Oct 27 14:16:41 MDT 2020 - carnold@suse.com

View File

@ -42,6 +42,7 @@ Patch75: virtinst-change-location-for-grub_xen.patch
Patch76: virtinst-set-qemu-emulator.patch
# Features or Enhancements
Patch103: virtman-load-stored-uris.patch
Patch104: virtman-add-tooltip-to-firmware.patch
Patch120: virtinst-default-xen-to-qcow2-format.patch
Patch121: virtinst-detect-oes-distros.patch
Patch122: virtinst-modify-gui-defaults.patch
@ -166,6 +167,7 @@ machine).
%patch76 -p1
# Enhancements
%patch103 -p1
%patch104 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1

View File

@ -0,0 +1,75 @@
References:
When a particular firmware is selected, read the json file for a description.
Add a tooltip of the json description when the mouse move overs the selected firmware.
--- virt-manager-3.1.0/virtManager/details/details.py.orig 2020-10-30 13:56:26.748245557 -0600
+++ virt-manager-3.1.0/virtManager/details/details.py 2020-10-30 13:56:48.952246534 -0600
@@ -5,6 +5,9 @@
# See the COPYING file in the top-level directory.
import re
+import os
+import json
+import textwrap
from gi.repository import Gtk
@@ -424,7 +427,7 @@ class vmmDetails(vmmGObjectUI):
"on_overview_name_changed": _e(EDIT_NAME),
"on_overview_title_changed": _e(EDIT_TITLE),
"on_machine_type_changed": _e(EDIT_MACHTYPE),
- "on_overview_firmware_changed": _e(EDIT_FIRMWARE),
+ "on_overview_firmware_changed": self._uefi_combobox_changed_cb,
"on_overview_chipset_changed": _e(EDIT_MACHTYPE),
"on_details_inspection_refresh_clicked": self._inspection_refresh_clicked_cb,
@@ -1125,6 +1128,49 @@ class vmmDetails(vmmGObjectUI):
self.storage_browser.set_browse_reason(reason)
self.storage_browser.show(self.topwin)
+ def _uefi_combobox_changed_cb(self, src):
+ def get_firmware_description(firmware_file):
+ json_description = ""
+ firmware_json_path = "/usr/share/qemu/firmware"
+ if os.path.isdir(firmware_json_path):
+ json_files = [f for f in os.listdir(firmware_json_path) if os.path.isfile(os.path.join(firmware_json_path, f))]
+ for jf in json_files:
+ full_path = firmware_json_path + '/' + jf
+ if not full_path.endswith(".json"):
+ continue
+ try:
+ if os.stat(full_path).st_size > 65536:
+ continue
+ except OSError:
+ continue
+ with open(full_path, 'r') as json_file:
+ data = json_file.read()
+ try:
+ json_obj = json.loads(data)
+ except Exception as e:
+ continue
+ if 'mapping' in json_obj and 'executable' in json_obj['mapping']:
+ json_exec = str(json_obj['mapping']['executable']['filename'])
+ if json_exec == firmware_file:
+ json_description = str(json_obj['description'])
+ wrapper = textwrap.TextWrapper(width=60)
+ json_list = wrapper.wrap(text=json_description)
+ json_description = "\n".join(json_list)
+ break
+ return json_description
+
+ combo = self.widget("overview-firmware")
+ tree_iter = combo.get_active_iter()
+ if tree_iter is not None:
+ model = combo.get_model()
+ tooltip_text = ""
+ firmware = model[tree_iter][0]
+ if firmware != 'BIOS':
+ firmware_file = firmware.split()[-1]
+ tooltip_text = get_firmware_description(firmware_file)
+ combo.set_tooltip_text(tooltip_text)
+ self._enable_apply(EDIT_FIRMWARE)
+
def _inspection_refresh_clicked_cb(self, src):
from ..lib.inspection import vmmInspection
inspection = vmmInspection.get_instance()