[virt-tools-list] [RFC PATCH 4/6] virtinstall: add some quirks
Giuseppe Scrivano
gscrivan at redhat.com
Mon Oct 14 21:16:40 UTC 2013
Some OS names are different under libosinfo, add quirks to be
backward compatible.
Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
virtinst/osdict.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 2 deletions(-)
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 481d5db..d840797 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -269,6 +269,9 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _get_netmodel(self):
+ if self._os.get_distro() == "fedora":
+ return _SENTINEL
+
fltr = libosinfo.Filter()
fltr.add_constraint("class", "net")
devs = self._os.get_all_devices(fltr)
@@ -277,6 +280,15 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _get_videomodel(self):
+ if self._os.get_short_id() in {"ubuntu13.10", "ubuntu13.04"}:
+ return "vmvga"
+
+ if _OsVariantOsInfo.is_windows(self._os):
+ return "vga"
+
+ if self._os.get_distro() == "fedora":
+ return _SENTINEL
+
fltr = libosinfo.Filter()
fltr.add_constraint("class", "video")
devs = self._os.get_all_devices(fltr)
@@ -322,6 +334,9 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _is_virtiodisk(self):
+ if self._os.get_distro() == "fedora":
+ return int(self._os.get_version() >= 10) or _SENTINEL
+
fltr = libosinfo.Filter()
fltr.add_constraint("class", "block")
devs = self._os.get_all_devices(fltr)
@@ -333,6 +348,9 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _is_virtionet(self):
+ if self._os.get_distro() == "fedora":
+ return int(self._os.get_version() >= 9) or _SENTINEL
+
fltr = libosinfo.Filter()
fltr.add_constraint("class", "net")
devs = self._os.get_all_devices(fltr)
@@ -343,6 +361,9 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _is_virtioconsole(self):
+ if self._os.get_distro() == "fedora":
+ return int(self._os.get_version()) >= 18 or _SENTINEL
+
fltr = libosinfo.Filter()
fltr.add_constraint("class", "console")
devs = self._os.get_all_devices(fltr)
@@ -358,8 +379,8 @@ class _OsVariantOsInfo(_OSVariant):
return _SENTINEL
def _is_qemu_ga(self):
- if _OsVariantOsInfo.is_os_related_to(self._os, ["fedora18"]):
- return True
+ if self._os.get_distro() == "fedora":
+ return int(self._os.get_version()) >= 18 or _SENTINEL
return _SENTINEL
def _get_typename(self):
@@ -394,14 +415,62 @@ class _OsVariantOsInfo(_OSVariant):
def _get_supported(self):
d = self._os.get_eol_date_string()
+ if self._os.get_distro() == "msdos":
+ return False
return d is None or datetime.strptime(d, "%Y-%m-%d") > datetime.now()
def _get_urldistro(self):
urldistro = self._os.get_distro()
+ remap = {
+ "opensuse" : "suse",
+ "sles" : "suse",
+ "mes" : "mandriva"
+ }
+
+ if self._os.get_short_id() == "debian7":
+ return "debian"
+
+ if remap.get(urldistro):
+ return remap[urldistro]
+
return urldistro
def _get_name(self):
name = self._os.get_short_id()
+ remap = {
+ "msdos6.22" : "msdos",
+ "winvista" : "vista",
+ "opensolaris2009.06" : "opensolaris",
+ "rhel4.0" : "rhel4",
+ "rhel5.0" : "rhel5",
+ "rhel6.0" : "rhel6",
+ "debian4" : "debianetch",
+ "debian5" : "debianlenny",
+ "debian6" : "debiansqueeze",
+ "freebsd6.0" : "freebsd6",
+ "freebsd7.0" : "freebsd7",
+ "freebsd8.0" : "freebsd8",
+ "freebsd9.0" : "freebsd9",
+ "freebsd10.0" : "freebsd10",
+ "debian7" : "debianwheezy",
+ "openbsd4.2" : "openbsd4",
+ "opensuse12.3" : "opensuse12",
+ "opensuse11.4" : "opensuse11",
+ "ubuntu13.10" : "ubuntusaucy",
+ "ubuntu13.04" : "ubunturaring",
+ "ubuntu12.10" : "ubuntuquantal",
+ "ubuntu10.10" : "ubuntumaverick",
+ "ubuntu11.10" : "ubuntuoneiric",
+ "ubuntu8.10" : "ubuntuintrepid",
+ "ubuntu8.04" : "ubuntuhardy",
+ "ubuntu9.04" : "ubuntujaunty",
+ "ubuntu12.04" : "ubuntuprecise",
+ "ubuntu9.10" : "ubuntukarmic",
+ "ubuntu10.04" : "ubuntulucid",
+ "ubuntu11.04" : "ubuntunatty"
+ }
+ if remap.get(name):
+ return remap[name]
return name
def get_label(self):
--
1.8.3.1
More information about the virt-tools-list
mailing list