8d6890f068
virt-manager-2.1.0.tar.bz2 virtman-fix-env-script-interpreter.patch * Bash autocompletion support (Lin Ma, Cole Robinson) * UI and command line –vsock support (Slavomir Kaslev) * virt-xml: Add –os-variant option (Andrea Bolognani) * virt-install: use libosinfo cpu, mem, disk size defaults (Fabiano Fidencio) * virt-install: Better usage of libosinfo -unknown distro IDs (Fabiano Fidencio) * virt-install: More usage of libosinfo for ISO –location detection * virt-install: Add –location LOCATION,kernel=X,initrd=Y for pointing to kernel/initrd in media that virt-install/libosinfo fails to detect - Drop 25b88733-urldetect-Dont-overload-suse_content-variable.patch 9308bae3-util-Fix-typo-vpcu-vcpu.patch b8aff280-virtinst-quickfix-ubuntu-net-preseed-insert-cdrom-error.patch c30b3bc6-increase-timeout-for-vm-to-start.patch virtinst-use-latest-opensuse-version-when-unknown-media.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=456
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.1.0/virtManager/create.py
|
|
===================================================================
|
|
--- virt-manager-2.1.0.orig/virtManager/create.py
|
|
+++ virt-manager-2.1.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
|
|
@@ -1184,6 +1187,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
|
|
@@ -1194,6 +1254,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)
|