import sources

This commit is contained in:
Adam Samalik 2023-06-21 14:41:37 +02:00
parent 861347c11e
commit 0e21fdf87d
6 changed files with 888 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
SOURCES/gnome-boxes-3.36.5.tar.xz
/gnome-boxes-3.36.5.tar.xz
/gnome-boxes-*.tar.xz

View File

@ -0,0 +1,82 @@
From 4de5a560474d4e5a9e4084f3fa47a18426c2217a Mon Sep 17 00:00:00 2001
From: Felipe Borges <feborges@redhat.com>
Date: Tue, 21 Jan 2020 11:44:14 +0100
Subject: [PATCH] media-manager: Filter architectures only for known medias
https://bugzilla.redhat.com/show_bug.cgi?id=1793413
os-database: Only offer supported arches for download
app-window: Fix build with new Vala
---
src/app-window.vala | 2 +-
src/installed-media.vala | 2 +-
src/media-manager.vala | 11 ++++++++++-
src/os-database.vala | 3 +++
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/app-window.vala b/src/app-window.vala
index ebe7007a..7e951945 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -422,7 +422,7 @@ public bool on_key_pressed (Widget widget, Gdk.EventKey event) {
return true;
} else if (event.keyval == Gdk.Key.A &&
- (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK) {
+ (event.state & default_modifiers) == (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)) {
foreach_view ((view) => { view.unselect_all (); });
return true;
diff --git a/src/installed-media.vala b/src/installed-media.vala
index 09ceffdf..e60f3508 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -12,7 +12,7 @@
".vpc", ".vpc.gz",
".cloop", ".cloop.gz" };
public const string[] supported_architectures = {
- "i686", "i586", "i486", "i386"
+ "i686", "i586", "i486", "i386", "x86_64", "amd64"
};
private static Regex date_regex = /20[0-9]{6,6}/;
diff --git a/src/media-manager.vala b/src/media-manager.vala
index 427ce874..f3651d4b 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -150,7 +150,16 @@ else if (VMConfigurator.is_libvirt_cloning_config (config))
continue;
}
- list.insert_sorted (media, compare_media_by_vendor);
+ if (os_id != null) {
+ var os = yield os_db.get_os_by_id (os_id);
+ var os_media = os_db.get_media_by_id (os, media_id);
+
+ if (os_media == null || !(os_media.architecture in InstalledMedia.supported_architectures)) {
+ continue;
+ }
+ }
+
+ list.insert_sorted (media, compare_media_by_vendor);
} catch (GLib.Error error) {
warning ("Failed to use ISO '%s': %s", path, error.message);
}
diff --git a/src/os-database.vala b/src/os-database.vala
index d636cae2..26c0a500 100644
--- a/src/os-database.vala
+++ b/src/os-database.vala
@@ -124,6 +124,9 @@ public async Os get_os_by_id (string id) throws OSDatabaseError {
if (media.url == null)
continue;
+ if (!(media.architecture in InstalledMedia.supported_architectures))
+ continue;
+
var eol = (os as Product).get_eol_date ();
if (eol == null || now.compare (eol) > 1)
after_list.append (media);
--
2.17.2

View File

@ -0,0 +1,332 @@
From b874d9355644eb686a8af9df03884a0a19513059 Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Tue, 13 Nov 2018 14:26:12 +0100
Subject: [PATCH] wizard-downloads: Load recommended downloads from an XML file
This way downstreams (vendors, distros) could easily tweak the
list and offer the Osinfo downloads that they prefer, with the
sorting they want.
Cherry-picked from eb3af034b5cda6ce1fa6812624b531ea53f90f72
---
data/gnome-boxes.gresource.xml | 1 +
data/recommended-downloads.xml | 18 +++++++
data/ui/wizard-source.ui | 1 -
src/util-app.vala | 80 ++++++++++++++++++++++++++++
src/wizard-downloads-page.vala | 95 ++++++++++++++++++++++++++++++++++
src/wizard-source.vala | 33 ++++--------
6 files changed, 204 insertions(+), 24 deletions(-)
create mode 100644 data/recommended-downloads.xml
create mode 100644 src/wizard-downloads-page.vala
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 01c72d59..8a9b8b95 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/org/gnome/Boxes">
<file>gtk-style.css</file>
<file preprocess="xml-stripblanks" alias="gtk/menus.ui">ui/menus.ui</file>
+ <file preprocess="xml-stripblanks">recommended-downloads.xml</file>
<file>icons/boxes-arrow.svg</file>
<file>icons/boxes-create.png</file>
<file>icons/empty-boxes.png</file>
diff --git a/data/recommended-downloads.xml b/data/recommended-downloads.xml
new file mode 100644
index 00000000..b389e945
--- /dev/null
+++ b/data/recommended-downloads.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ These are OSes listed in the recommended section of the "Download an OS" page.
+
+ This list is powered by libosinfo, therefore the URLs are unique identifiers
+ for each OS in osinfo-db.
+
+ Downstreams are encouraged to tweak the list as they wish. Sorting is also
+ available.
+ -->
+<list>
+ <os_id>http://redhat.com/rhel/7.6</os_id>
+ <os_id>http://fedoraproject.org/fedora/29</os_id>
+ <os_id>http://fedoraproject.org/silverblue/29</os_id>
+ <os_id>http://ubuntu.com/ubuntu/18.10</os_id>
+ <os_id>http://opensuse.org/opensuse/15.0</os_id>
+ <os_id>http://debian.org/debian/9</os_id>
+</list>
diff --git a/data/ui/wizard-source.ui b/data/ui/wizard-source.ui
index b59fccfc..6762d2d6 100644
--- a/data/ui/wizard-source.ui
+++ b/data/ui/wizard-source.ui
@@ -49,7 +49,6 @@
<child>
<object class="BoxesWizardScrolled" id="downloads_scrolled">
<property name="visible">False</property>
- <signal name="show" handler="on_downloads_scrolled_shown"/>
</object>
</child>
diff --git a/src/util-app.vala b/src/util-app.vala
index aba87cfd..253d1b74 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -102,6 +102,86 @@ public void fetch_os_logo (Gtk.Image image, Osinfo.Os os, int size) {
}
}
+ public string serialize_os_title (Osinfo.Media media) {
+ var title = "unknown";
+
+ /* Libosinfo lacks some OS variant names, so we do some
+ parsing here to compose a unique human-readable media
+ identifier. */
+ var variant = "";
+ var variants = media.get_os_variants ();
+ if (variants.get_length () > 0)
+ variant = (variants.get_nth (0) as Osinfo.OsVariant).get_name ();
+ else if ((media.os as Osinfo.Product).name != null) {
+ variant = (media.os as Osinfo.Product).name;
+ if (media.url != null && media.url.contains ("server"))
+ variant += " Server";
+ } else {
+ var file = File.new_for_uri (media.url);
+
+ title = file.get_basename ().replace ("_", "");
+ }
+
+ var subvariant = "";
+
+ if (media.url != null) {
+ if (media.url.contains ("netinst"))
+ subvariant = "(netinst)";
+ else if (media.url.contains ("minimal"))
+ subvariant = "(minimal)";
+ else if (media.url.contains ("dvd"))
+ subvariant = "(DVD)";
+ }
+
+ var is_live = media.live ? " (" + _("Live") + ")" : "";
+
+ title = @"$variant $(media.architecture) $subvariant $is_live";
+
+ /* Strip consequent whitespaces */
+ return title.replace (" ", "");
+ }
+
+ public async GLib.List<Osinfo.Media>? get_recommended_downloads () {
+ uint8[] contents;
+
+ try {
+ File file = File.new_for_uri ("resource:///org/gnome/Boxes/recommended-downloads.xml");
+
+ file.load_contents (null, out contents, null);
+ } catch (GLib.Error e) {
+ warning ("Failed to load recommended downloads file: %s", e.message);
+
+ return null;
+ }
+
+ Xml.Doc* doc = Xml.Parser.parse_doc ((string)contents);
+ if (doc == null)
+ return null;
+
+ Xml.Node* root = doc->get_root_element ();
+ if (root == null || root->name != "list") {
+ warning ("Failed to parse recommended downloads");
+
+ return null;
+ }
+
+ GLib.List<Osinfo.Media> list = new GLib.List<Osinfo.Media> ();
+ var os_db = MediaManager.get_instance ().os_db;
+ for (Xml.Node* iter = root->children; iter != null; iter = iter->next) {
+ var os_id = iter->get_content ();
+ try {
+ var os = yield os_db.get_os_by_id (os_id);
+ var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
+
+ list.append (media);
+ } catch (OSDatabaseError error) {
+ warning ("Failed to find OS with id: '%s': %s", os_id, error.message);
+ }
+ }
+
+ return list;
+ }
+
public async GVir.StoragePool ensure_storage_pool (GVir.Connection connection) throws GLib.Error {
var pool = get_storage_pool (connection);
if (pool == null) {
diff --git a/src/wizard-downloads-page.vala b/src/wizard-downloads-page.vala
new file mode 100644
index 00000000..0b77a9cb
--- /dev/null
+++ b/src/wizard-downloads-page.vala
@@ -0,0 +1,95 @@
+// This file is part of GNOME Boxes. License: LGPLv2+
+
+public enum WizardDownloadsPageView {
+ RECOMMENDED,
+ SEARCH_RESULTS,
+ NO_RESULTS,
+}
+
+public delegate void Boxes.DownloadChosenFunc (Boxes.WizardDownloadableEntry entry);
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-downloads-page.ui")]
+public class Boxes.WizardDownloadsPage : Gtk.Stack {
+ private OSDatabase os_db = new OSDatabase ();
+ public DownloadsSearch search { private set; get; }
+
+ public DownloadChosenFunc download_chosen_func;
+
+ [GtkChild]
+ private Gtk.ListBox listbox;
+ [GtkChild]
+ private Gtk.ListBox recommended_listbox;
+
+ private GLib.ListStore recommended_model;
+
+ private WizardDownloadsPageView _page;
+ public WizardDownloadsPageView page {
+ get { return _page; }
+ set {
+ _page = value;
+
+ switch (_page) {
+ case WizardDownloadsPageView.SEARCH_RESULTS:
+ visible_child_name = "search-results";
+ break;
+ case WizardDownloadsPageView.NO_RESULTS:
+ visible_child_name = "no-results";
+ break;
+ case WizardDownloadsPageView.RECOMMENDED:
+ default:
+ visible_child_name = "recommended";
+ break;
+ }
+ }
+ }
+
+ construct {
+ os_db.load.begin ();
+
+ search = new DownloadsSearch ();
+
+ recommended_model = new GLib.ListStore (typeof (Osinfo.Media));
+ recommended_listbox.bind_model (recommended_model, create_downloads_entry);
+ populate_recommended_list.begin ();
+
+ listbox.bind_model (search.model, create_downloads_entry);
+
+ search.search_changed.connect (set_visible_view);
+ }
+
+ private void set_visible_view () {
+ if (search.text.length == 0) {
+ page = WizardDownloadsPageView.RECOMMENDED;
+ } else if (search.model.get_n_items () == 0) {
+ page = WizardDownloadsPageView.NO_RESULTS;
+ } else {
+ page = WizardDownloadsPageView.SEARCH_RESULTS;
+ }
+ }
+
+ private async void populate_recommended_list () {
+ foreach (var media in yield get_recommended_downloads ()) {
+ recommended_model.append (media);
+ }
+ }
+
+ private Gtk.Widget create_downloads_entry (Object item) {
+ var media = item as Osinfo.Media;
+
+ return new WizardDownloadableEntry (media);
+ }
+
+ [GtkCallback]
+ private void on_listbox_row_activated (Gtk.ListBoxRow row) {
+ var entry = row as WizardDownloadableEntry;
+
+ download_chosen_func (entry);
+ }
+
+ [GtkCallback]
+ private void on_show_more_button_clicked () {
+ search.show_all ();
+
+ page = WizardDownloadsPageView.SEARCH_RESULTS;
+ }
+}
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 9ea0a9b1..494c5561 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -310,6 +310,7 @@ private void on_notify_estimated_load_progress () {
private Gtk.ListBox media_vbox;
private Gtk.ListBox downloads_vbox;
+ private GLib.ListStore downloads_model;
private Osinfo.Os rhel_os;
private Cancellable? rhel_cancellable;
@@ -318,12 +319,6 @@ private void on_notify_estimated_load_progress () {
public string filename { get; set; }
- private string[] recommended_downloads = {
- "http://ubuntu.com/ubuntu/16.04",
- "http://opensuse.org/opensuse/42.2",
- "http://fedoraproject.org/fedora/27",
- };
-
public bool download_required {
get {
string scheme = Uri.parse_scheme (uri);
@@ -409,6 +404,8 @@ private void on_notify_estimated_load_progress () {
}
});
+ downloads_model = new GLib.ListStore (typeof (Osinfo.Media));
+
rhel_web_view.view.decide_policy.connect (on_rhel_web_view_decide_policy);
}
@@ -425,26 +422,16 @@ public void setup_ui (AppWindow window) {
assert (window != null);
this.window = window;
+
+ downloads_vbox.bind_model (downloads_model, create_downloadable_entry);
+
+ populate_recommended_downloads.begin ();
}
- [GtkCallback]
- private void on_downloads_scrolled_shown () {
+ private async void populate_recommended_downloads () {
var os_db = media_manager.os_db;
- foreach (var os_id in recommended_downloads) {
- os_db.get_os_by_id.begin (os_id, (obj, res) => {
- try {
- var os = os_db.get_os_by_id.end (res);
-
- // TODO: Select the desktop/workstation variant.
- var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
- var entry = create_downloadable_entry (media);
-
- downloads_vbox.insert (entry, -1);
- } catch (OSDatabaseError error) {
- warning ("Failed to find OS with ID '%s': %s", os_id, error.message);
- return;
- }
- });
+ foreach (var media in yield get_recommended_downloads ()) {
+ downloads_model.append (media);
}
}
--
2.19.2

View File

@ -0,0 +1,56 @@
From e8b9d5ca5ebed5f2e076e6e6c975ec37efc21c5b Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Fri, 8 Jun 2018 12:42:49 +0200
Subject: [PATCH] build: Unbreak the icon installation in gnome-3-28
The icons were getting directly copied to $data_dir/icons without
retaining the directory hierarchy inside.
Fallout from d2410d0959094dee8cc3e1276b255e8fb991fe31
It was also broken in master, but was fixed by
c115f5bfb56aa9fe42356c5f4f9ee87f6c87f454 and
578707e9924c32a808e12c2830f18156ccb109f6
https://gitlab.gnome.org/GNOME/gnome-boxes/issues/217
---
data/meson.build | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/data/meson.build b/data/meson.build
index 847734e59715..9f1c4b482356 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,28 +1,4 @@
-icondir = join_paths(data_dir, 'icons')
-
-install_data('icons/hicolor/16x16/apps/org.gnome.Boxes.png',
- install_dir: icondir,
-)
-
-install_data('icons/hicolor/24x24/apps/org.gnome.Boxes.png',
- install_dir: icondir,
-)
-
-install_data('icons/hicolor/symbolic/apps/org.gnome.Boxes-symbolic.svg',
- install_dir: icondir,
-)
-install_data('icons/hicolor/32x32/apps/org.gnome.Boxes.png',
- install_dir: icondir,
-)
-
-install_data('icons/hicolor/48x48/apps/org.gnome.Boxes.png',
- install_dir: icondir,
-)
-
-install_data('icons/hicolor/256x256/apps/org.gnome.Boxes.png',
- install_dir: icondir,
-)
-
+install_subdir('icons/hicolor/', install_dir: join_paths (data_dir, 'icons'))
resource_files = files ('gnome-boxes.gresource.xml')
resources = gnome.compile_resources ('org.gnome.Boxes',
--
2.14.4

View File

@ -0,0 +1,63 @@
diff --git a/data/osinfo/meson.build b/data/osinfo/meson.build
index 0f4982f..c7c6017 100644
--- a/data/osinfo/meson.build
+++ b/data/osinfo/meson.build
@@ -10,7 +10,8 @@ osinfo_db = [
['rhel-4.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
['rhel-5.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
['rhel-6.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
- ['rhel-7.0.xml', 'gnome-boxes/osinfo/os/redhat.com']
+ ['rhel-7.0.xml', 'gnome-boxes/osinfo/os/redhat.com'],
+ ['rhel-8.0.xml', 'gnome-boxes/osinfo/os/redhat.com']
]
foreach os: osinfo_db
diff --git a/data/osinfo/rhel-4.0.xml b/data/osinfo/rhel-4.0.xml
index 2839687..318544e 100644
--- a/data/osinfo/rhel-4.0.xml
+++ b/data/osinfo/rhel-4.0.xml
@@ -3,7 +3,7 @@
<!-- Please read README.logos for any questions about usage of product logos in Boxes. !-->
<os id="http://redhat.com/rhel/4.0">
- <logo>https://people.gnome.org/~zeeshanak/logos/shadownman-pill.svg</logo>
+ <logo>https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/shadownman-pill.svg</logo>
</os>
</libosinfo>
diff --git a/data/osinfo/rhel-8.0.xml b/data/osinfo/rhel-8.0.xml
new file mode 100644
index 0000000..ad7a785
--- /dev/null
+++ b/data/osinfo/rhel-8.0.xml
@@ -0,0 +1,9 @@
+<libosinfo version="0.0.1">
+
+ <!-- Please read README.logos for any questions about usage of product logos in Boxes. !-->
+
+ <os id="http://redhat.com/rhel/8.0">
+ <logo>https://gitlab.gnome.org/GNOME/gnome-boxes-logos/raw/master/logos/shadownman-pill.svg</logo>
+ </os>
+
+</libosinfo>
diff --git a/data/recommended-downloads.xml b/data/recommended-downloads.xml
index b389e94..6f2ccce 100644
--- a/data/recommended-downloads.xml
+++ b/data/recommended-downloads.xml
@@ -9,10 +9,11 @@
available.
-->
<list>
- <os_id>http://redhat.com/rhel/7.6</os_id>
- <os_id>http://fedoraproject.org/fedora/29</os_id>
- <os_id>http://fedoraproject.org/silverblue/29</os_id>
- <os_id>http://ubuntu.com/ubuntu/18.10</os_id>
- <os_id>http://opensuse.org/opensuse/15.0</os_id>
+ <os_id>http://redhat.com/rhel/8.1</os_id>
+ <os_id>http://redhat.com/rhel/7.7</os_id>
+ <os_id>http://fedoraproject.org/fedora/30</os_id>
+ <os_id>http://fedoraproject.org/silverblue/30</os_id>
+ <os_id>http://ubuntu.com/ubuntu/19.04</os_id>
+ <os_id>http://opensuse.org/opensuse/15.1</os_id>
<os_id>http://debian.org/debian/9</os_id>
</list>

View File

@ -0,0 +1,354 @@
---
src/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/meson.build b/src/meson.build
index ac79b7fc..00903170 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -125,8 +125,8 @@ dependencies = [
dependency ('libsecret-1'),
dependency ('libsoup-2.4', version: '>= 2.38'),
dependency ('libusb-1.0', version: '>= 1.0.9'),
- dependency ('libvirt-gconfig-1.0', version: '>= 0.2.0'),
- dependency ('libvirt-gobject-1.0', version: '>= 0.2.0'),
+ dependency ('libvirt-gconfig-1.0', version: '>= 2.0.0'),
+ dependency ('libvirt-gobject-1.0', version: '>= 2.0.0'),
dependency ('libxml-2.0', version: '>= 2.7.8'),
dependency ('spice-client-gtk-3.0', version: '>= 0.32'),
dependency ('tracker-sparql-2.0'),
--
---
src/installer-media.vala | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index feb5d7b..b29c10b 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -25,12 +25,24 @@ private class Boxes.InstallerMedia : GLib.Object {
public virtual bool need_user_input_for_vm_creation { get { return false; } }
public virtual bool ready_to_create { get { return true; } }
+ public bool supports_virtio1_disk {
+ get {
+ return (find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "virtio1.0-block") != null);
+ }
+ }
+
public bool supports_virtio_disk {
get {
return (find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "virtio-block") != null);
}
}
+ public bool supports_virtio1_net {
+ get {
+ return (find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "virtio1.0-net") != null);
+ }
+ }
+
public bool supports_virtio_net {
get {
return (find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "virtio-net") != null);
--
---
src/unattended-installer.vala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 4e0ba23..6a37e20 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -232,7 +232,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
if (os.distro == "win")
config.set_target_disk ("C");
else
- config.set_target_disk (supports_virtio_disk? "/dev/vda" : "/dev/sda");
+ config.set_target_disk (supports_virtio_disk || supports_virtio1_disk? "/dev/vda" : "/dev/sda");
var disk_config = get_unattended_disk_config (script.path_format);
var device_path = device_name_to_path (script.path_format, disk_config.get_target_dev ());
@@ -360,7 +360,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
disk.set_target_bus (DomainDiskBus.FDC);
} else {
// Path format checks below are most probably practically redundant but a small price for future safety
- if (supports_virtio_disk)
+ if (supports_virtio_disk || supports_virtio1_disk)
disk.set_target_dev ((path_format == PathFormat.UNIX)? "sda" : "E");
else
disk.set_target_dev ((path_format == PathFormat.UNIX)? "sdb" : "E");
--
---
src/vm-configurator.vala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index e8eefa3..ceadc80 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -114,9 +114,10 @@ private class Boxes.VMConfigurator {
console.set_source (new DomainChardevSourcePty ());
domain.add_device (console);
+ var supports_virtio_net = install_media.supports_virtio_net || install_media.supports_virtio1_net;
var iface = create_network_interface (domain,
is_libvirt_bridge_net_available (),
- install_media.supports_virtio_net);
+ supports_virtio_net);
domain.add_device (iface);
return domain;
@@ -309,7 +310,7 @@ private class Boxes.VMConfigurator {
disk.set_driver_cache (DomainDiskCacheType.WRITEBACK);
var dev_letter_str = ((char) (dev_index + 97)).to_string ();
- if (install_media.supports_virtio_disk) {
+ if (install_media.supports_virtio_disk || install_media.supports_virtio1_disk) {
debug ("Using virtio controller for the main disk");
disk.set_target_bus (DomainDiskBus.VIRTIO);
disk.set_target_dev ("vd" + dev_letter_str);
--
---
src/installer-media.vala | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index b29c10b..0a83ba0 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -49,6 +49,12 @@ private class Boxes.InstallerMedia : GLib.Object {
}
}
+ public bool prefers_q35 {
+ get {
+ return false;
+ }
+ }
+
public virtual bool live { get { return os_media == null || os_media.live; } }
public virtual bool eject_after_install { get { return os_media == null || os_media.eject_after_install; } }
--
---
src/installer-media.vala | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 0a83ba0..7d95d65 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -55,6 +55,12 @@ private class Boxes.InstallerMedia : GLib.Object {
}
}
+ public bool prefers_ich9 {
+ get {
+ return false;
+ }
+ }
+
public virtual bool live { get { return os_media == null || os_media.live; } }
public virtual bool eject_after_install { get { return os_media == null || os_media.eject_after_install; } }
--
---
src/installer-media.vala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 7d95d65..ba6bfc8 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -173,7 +173,7 @@ private class Boxes.InstallerMedia : GLib.Object {
disk.set_target_dev (device_name);
if (iso_path != null)
disk.set_source (iso_path);
- disk.set_target_bus (DomainDiskBus.IDE);
+ disk.set_target_bus (prefers_q35? DomainDiskBus.SATA : DomainDiskBus.IDE);
if (mandatory)
disk.set_startup_policy (DomainDiskStartupPolicy.MANDATORY);
--
---
src/unattended-installer.vala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 6a37e20..e3fd115 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -379,7 +379,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
disk.set_source (secondary_disk_file.get_path ());
disk.set_target_dev ((path_format == PathFormat.DOS)? "E" : "hdd");
disk.set_guest_device_type (DomainDiskGuestDeviceType.CDROM);
- disk.set_target_bus (DomainDiskBus.IDE);
+ disk.set_target_bus (prefers_q35? DomainDiskBus.SATA : DomainDiskBus.IDE);
return disk;
}
--
---
src/vm-configurator.vala | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index ceadc80..c537316 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -315,8 +315,13 @@ private class Boxes.VMConfigurator {
disk.set_target_bus (DomainDiskBus.VIRTIO);
disk.set_target_dev ("vd" + dev_letter_str);
} else {
- debug ("Using IDE controller for the main disk");
- disk.set_target_bus (DomainDiskBus.IDE);
+ if (install_media.prefers_q35) {
+ debug ("Using SATA controller for the main disk");
+ disk.set_target_bus (DomainDiskBus.SATA);
+ } else {
+ debug ("Using IDE controller for the main disk");
+ disk.set_target_bus (DomainDiskBus.IDE);
+ }
disk.set_target_dev ("hd" + dev_letter_str);
}
--
---
src/vm-configurator.vala | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index c537316..07804f9 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -363,13 +363,22 @@ private class Boxes.VMConfigurator {
domain.add_device (video);
}
- private static void set_sound_config (Domain domain, InstallerMedia install_media) {
- var sound = new DomainSound ();
+ private static DomainSoundModel get_sound_model (InstallerMedia install_media) {
+ if (install_media.prefers_ich9)
+ return (DomainSoundModel) DomainSoundModel.ICH9;
+
var device = find_device_by_prop (install_media.supported_devices, DEVICE_PROP_CLASS, "audio");
- var model = (device != null)? get_enum_value (device.get_name (), typeof (DomainSoundModel)) :
- DomainSoundModel.AC97;
+ if (device == null)
+ return (DomainSoundModel) DomainSoundModel.ICH6;
+
+ var model = get_enum_value (device.get_name (), typeof (DomainSoundModel));
return_if_fail (model != -1);
- sound.set_model ((DomainSoundModel) model);
+ return (DomainSoundModel) model;
+ }
+
+ private static void set_sound_config (Domain domain, InstallerMedia install_media) {
+ var sound = new DomainSound ();
+ sound.set_model (get_sound_model (install_media));
domain.add_device (sound);
}
--
---
src/vm-configurator.vala | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 07804f9..3dc1c8e 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -338,6 +338,7 @@ private class Boxes.VMConfigurator {
os.set_boot_devices (boot_devices);
os.set_arch (old_os.get_arch ());
+ os.set_machine (old_os.get_machine ());
domain.set_os (os);
}
--
---
src/vm-configurator.vala | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 3dc1c8e..6c20f5e 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -347,6 +347,8 @@ private class Boxes.VMConfigurator {
var os = new DomainOs ();
os.set_os_type (DomainOsType.HVM);
os.set_arch (guest_caps.get_arch ().get_name ());
+ if (install_media.prefers_q35)
+ os.set_machine ("q35");
var boot_devices = new GLib.List<DomainOsBootDevice> ();
install_media.set_direct_boot_params (os);
--
---
src/installer-media.vala | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index ba6bfc8..4a8d913 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -57,7 +57,14 @@ private class Boxes.InstallerMedia : GLib.Object {
public bool prefers_ich9 {
get {
- return false;
+ if (!prefers_q35)
+ return false;
+
+ var device = find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "ich9-hda");
+ if (device == null)
+ return false;
+
+ return true;
}
}
--
---
src/installer-media.vala | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 4a8d913..5bde3ca 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -51,7 +51,17 @@ private class Boxes.InstallerMedia : GLib.Object {
public bool prefers_q35 {
get {
- return false;
+ if (os == null)
+ return true;
+
+ var device = find_device_by_prop (supported_devices, DEVICE_PROP_NAME, "qemu-x86-q35");
+ if (device == null)
+ return false;
+
+ if (supports_virtio_net && !supports_virtio1_net)
+ return false;
+
+ return true;
}
}
--