674d49879e
virt-manager-2.0.0.tar.bz2 * Finish port to Python 3 (Radostin Stoyanov, Cole Robinson) * Improved VM defaults for supported OS: q35 PCIe, usb3, CPU host-model * Search based OS selection UI for new VMs (Daniel P. Berrangé, Cole Robinson) * Track OS name for lifetime of domain in XML * Host interface management UI has been completely removed * Show domain IP on interface details page (Lin Ma, Cole Robinson) * More efficient stats polling with AllDomainStats (Simon Kobyda, Cole Robinson) * TPM device model and backend UI (Marc-André Lureau, Stefan Berger) * Show connection state in UI (Lin Ma) * Show attached devices in UI (Lin Ma) * UI option to plug/unplug VM nic link (Simon Kobyda) * UI support for disk discard and detect_zeroes (Povilas Kanapickas, Lin Ma) * Improved SUSE –location URL/ISO detection (Charles Arnold) * cli and UI support for SCSI persistent reservations (Lin Ma) * cli: Add –network mtu.size= option (Anya Harter) * cli: Add –disk driver.copy_on_read (Anya Harter) * cli: Add –disk geometry support (Anya Harter) * cli: Add –sound codec support (Anya Harter) * cli: Add –hostdev net/char/block for LXC (Lubomir Rintel) * cli: Add –memorybacking access_mode and source_type (Marc-André Lureau) * cli: Add –boot rebootTimout (Yossi Ovadia) * cli: Add –boot bootloader= * cli: Add –destroy-on-exit - Drop patches contained in new tarball or not required 0004-virtinst-python3-use-binary-mode-for-kernel.patch 27d4b167-virtinst-update-location-for-opensuse.patch 5a7698c7-fix-select-network-vol.patch d15b78ab-virtinst-read-CPU-model-from-domain-capabilities.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=437
90 lines
3.5 KiB
Diff
90 lines
3.5 KiB
Diff
Enhancement to default to the host os version when creating a VM
|
|
and media detection of the install source is turned off.
|
|
Index: virt-manager-2.0.0/virtManager/create.py
|
|
===================================================================
|
|
--- virt-manager-2.0.0.orig/virtManager/create.py
|
|
+++ virt-manager-2.0.0/virtManager/create.py
|
|
@@ -10,6 +10,9 @@ import pkgutil
|
|
import os
|
|
import threading
|
|
import time
|
|
+import sys
|
|
+import os
|
|
+import re
|
|
|
|
from gi.repository import Gdk
|
|
from gi.repository import Gtk
|
|
@@ -1183,6 +1186,63 @@ class vmmCreate(vmmGObjectUI):
|
|
def _iso_activated_cb(self, mediacombo, entry):
|
|
self._detectable_media_widget_changed(entry, checkfocus=False)
|
|
|
|
+ def _lookup_host_os(self):
|
|
+ def _lookup_sp(line):
|
|
+ sp = ""
|
|
+ m = re.search(' SP[12345] ', line)
|
|
+ if m:
|
|
+ sp = m.group(0).strip().lower()
|
|
+ return sp
|
|
+ if sys.platform.startswith('linux'):
|
|
+ if os.path.exists('/etc/issue'):
|
|
+ f = open('/etc/issue')
|
|
+ lines = f.readlines()
|
|
+ f.close()
|
|
+ for line in lines:
|
|
+ if "openSUSE " in line:
|
|
+ parts = line.split(' ')
|
|
+ if len(parts) > 2 and len(parts[3]) <= 4:
|
|
+ os_ver = "opensuse" + parts[3]
|
|
+ return 'linux', os_ver
|
|
+ return 'linux', 'opensuse42.2'
|
|
+ if "SUSE Linux Enterprise Server 15" in line:
|
|
+ return 'linux', ('sle15' + _lookup_sp(line))
|
|
+ if "SUSE Linux Enterprise Server 12" in line:
|
|
+ return 'linux', ('sles12' + _lookup_sp(line))
|
|
+ if "SUSE Linux Enterprise Server 11" in line:
|
|
+ return 'linux', ('sles11' + _lookup_sp(line))
|
|
+ if "SUSE Linux Enterprise Desktop 15" in line:
|
|
+ return 'linux', ('sled15' + _lookup_sp(line))
|
|
+ if "SUSE Linux Enterprise Desktop 12" in line:
|
|
+ return 'linux', ('sled12' + _lookup_sp(line))
|
|
+ if "SUSE Linux Enterprise Desktop 11" in line:
|
|
+ return 'linux', ('sled11' + _lookup_sp(line))
|
|
+ return None, None
|
|
+
|
|
+ def detect_host_os(self):
|
|
+ box = self.widget('install-os-type')
|
|
+ if box.get_active() <= 0:
|
|
+ os_type, os_variant = self._lookup_host_os()
|
|
+ if os_type is None:
|
|
+ return
|
|
+ model = box.get_model()
|
|
+ index = 0
|
|
+ for row in model:
|
|
+ if row[0] == 'linux':
|
|
+ box.set_active(index)
|
|
+ break
|
|
+ index += 1
|
|
+ if os_variant is None:
|
|
+ return
|
|
+ box = self.widget('install-os-version')
|
|
+ model = box.get_model()
|
|
+ index = 0
|
|
+ for row in model:
|
|
+ if row[0] == os_variant:
|
|
+ box.set_active(index)
|
|
+ break
|
|
+ index += 1
|
|
+
|
|
def _detect_os_toggled_cb(self, src):
|
|
if not src.is_visible():
|
|
return
|
|
@@ -1193,6 +1253,8 @@ class vmmCreate(vmmGObjectUI):
|
|
if dodetect:
|
|
self._os_already_detected_for_media = False
|
|
self._start_detect_os_if_needed()
|
|
+ else:
|
|
+ self.detect_host_os()
|
|
|
|
def _browse_oscontainer(self, ignore):
|
|
self._browse_file("install-oscontainer-fs", is_dir=True)
|