ae026a575b
* Merged code with python-virtinst. virtinst is no longer public * Port from GTK2 to GTK3 (Daniel Berrange, Cole Robinson) * Port from gconf to gsettings * Port from autotools to python distutils * Remove virt-manager-tui * Remove HAL support * IPv6 and static route virtual network support (Gene Czarcinski) * virt-install: Add –cpu host-passthrough (Ken ICHIKAWA, Hu Tao) OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=129
74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
Index: virt-manager-0.10.0/virtManager/create.py
|
|
===================================================================
|
|
--- virt-manager-0.10.0.orig/virtManager/create.py
|
|
+++ virt-manager-0.10.0/virtManager/create.py
|
|
@@ -20,6 +20,8 @@
|
|
|
|
import threading
|
|
import logging
|
|
+import sys
|
|
+import os
|
|
|
|
# pylint: disable=E0611
|
|
from gi.repository import GObject
|
|
@@ -1143,6 +1145,51 @@ class vmmCreate(vmmGObjectUI):
|
|
return
|
|
self.start_detection(forward=forward)
|
|
|
|
+ def _lookup_host_os(self):
|
|
+ if sys.platform == 'linux2':
|
|
+ if os.path.exists('/etc/issue'):
|
|
+ f = open('/etc/issue')
|
|
+ lines = f.readlines()
|
|
+ f.close()
|
|
+ for line in lines:
|
|
+ if "openSUSE 13" in line:
|
|
+ return 'linux', 'opensuse13'
|
|
+ if "openSUSE 12" in line:
|
|
+ return 'linux', 'opensuse12'
|
|
+ if "SUSE Linux Enterprise Server 11" in line:
|
|
+ return 'linux', 'sles11'
|
|
+ if "SUSE Linux Enterprise Desktop 11" in line:
|
|
+ return 'linux', 'sled11'
|
|
+ if "Fedora" in line:
|
|
+ return 'linux', 'fedora17'
|
|
+ if "Red Hat Enterprise Linux Server" in line:
|
|
+ return 'linux', 'rhel6'
|
|
+ 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 toggle_detect_os(self, src):
|
|
dodetect = src.get_active()
|
|
|
|
@@ -1158,6 +1205,7 @@ class vmmCreate(vmmGObjectUI):
|
|
self.widget("install-os-version-label").hide()
|
|
self.widget("install-os-type").show()
|
|
self.widget("install-os-version").show()
|
|
+ self.detect_host_os()
|
|
|
|
def _selected_os_row(self):
|
|
box = self.widget("install-os-type")
|