[gnome-boxes/wip/arm] tmp
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/arm] tmp
- Date: Tue, 10 May 2016 22:28:57 +0000 (UTC)
commit f6c6d1fad7e299c130045ee34a57f82d16a3b1e1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Jan 18 14:02:26 2016 +0000
tmp
src/installed-media.vala | 35 +++++++++++++++++++++--------------
src/installer-media.vala | 2 +-
src/os-database.vala | 1 +
src/util-app.vala | 27 +++++++++++++--------------
src/vm-configurator.vala | 19 +++++++++++--------
5 files changed, 47 insertions(+), 37 deletions(-)
---
diff --git a/src/installed-media.vala b/src/installed-media.vala
index e1102b9..9a302a7 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -3,14 +3,15 @@
using GVirConfig;
private class Boxes.InstalledMedia : Boxes.InstallerMedia {
- public const string[] supported_extensions = { ".qcow2", ".qcow2.gz",
- ".qcow", ".qcow.gz",
- ".img", ".img.gz",
- ".cow", ".cow.gz",
- ".vdi", ".vdi.gz",
- ".vmdk", ".vmdk.gz",
- ".vpc", ".vpc.gz",
- ".cloop", ".cloop.gz" };
+ public const string[] supported_extensions = { ".qcow2", ".qcow2.gz", ".qcow2.xz",
+ ".qcow", ".qcow.gz", ".qcow.xz",
+ ".img", ".img.gz", ".img.xz",
+ ".raw", ".raw.gz", ".raw.xz",
+ ".cow", ".cow.gz", ".cow.xz",
+ ".vdi", ".vdi.gz", ".vdi.xz",
+ ".vmdk", ".vmdk.gz", ".vmdk.xz",
+ ".vpc", ".vpc.gz", ".vmdk.xz",
+ ".cloop", ".cloop.gz", ".cloop.xz" };
private static Regex date_regex = /20[0-9]{6,6}/;
public override bool need_user_input_for_vm_creation { get { return false; } }
@@ -23,10 +24,14 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
if (device_file.contains ("amd64") || device_file.contains ("x86_64"))
return "x86_64";
else {
- string[] arch_list = { "i686", "i586", "i486", "i386" };
+ string[] arch_list = { "i686", "i586", "i486", "i386", "armhfp" };
foreach (var arch in arch_list) {
- if (device_file.contains (arch))
- return arch;
+ if (device_file.contains (arch)) {
+ if (arch == "armhfp")
+ return "armv7l";
+ else
+ return arch;
+ }
}
debug ("Failed to guess architecture for media '%s'.", device_file);
@@ -156,19 +161,21 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
}
private async bool decompress () throws GLib.Error {
- if (!device_file.has_suffix (".gz"))
+ var extension = get_file_extension (device_file);
+ if (extension != ".gz" && extension != ".xz")
return false;
var compressed = File.new_for_path (device_file);
var input_stream = yield compressed.read_async ();
- var decompressed_path = Path.get_basename (device_file).replace (".gz", "");
+ var decompressed_path = Path.get_basename (device_file).replace (extension, "");
decompressed_path = get_user_pkgcache (decompressed_path);
var decompressed = File.new_for_path (decompressed_path);
GLib.OutputStream output_stream = yield decompressed.replace_async (null,
false,
FileCreateFlags.REPLACE_DESTINATION);
- var decompressor = new ZlibDecompressor (ZlibCompressorFormat.GZIP);
+ var format = (extension == ".gz")? ZlibCompressorFormat.GZIP : ZlibCompressorFormat.ZLIB;
+ var decompressor = new ZlibDecompressor (format);
output_stream = new ConverterOutputStream (output_stream, decompressor);
debug ("Decompressing '%s'..", device_file);
diff --git a/src/installer-media.vala b/src/installer-media.vala
index b31de44..af82fbf 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -144,7 +144,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 (DomainDiskBus.SCSI);
if (mandatory)
disk.set_startup_policy (DomainDiskStartupPolicy.MANDATORY);
diff --git a/src/os-database.vala b/src/os-database.vala
index 9d9c2ee..ea542a1 100644
--- a/src/os-database.vala
+++ b/src/os-database.vala
@@ -164,6 +164,7 @@ private class Boxes.OSDatabase : GLib.Object {
return media;
}
+ // This one needs to be fixed to for non-x86
public Resources get_resources_for_os (Os? os, string? architecture) {
if (os == null)
return get_default_resources ();
diff --git a/src/util-app.vala b/src/util-app.vala
index ff530bb..eaae5a6 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -411,11 +411,13 @@ namespace Boxes {
}
public CPUArchCompatibility compare_cpu_architectures (string arch1, string arch2) {
+ print ("Comparing %s and %s\n", arch1, arch2);
+ if (arch1 == arch2)
+ return CPUArchCompatibility.IDENTICAL;
+
switch (arch2) {
case "i386":
switch (arch1) {
- case "i386":
- return CPUArchCompatibility.IDENTICAL;
case "i486":
case "i586":
case "i686":
@@ -427,8 +429,6 @@ namespace Boxes {
}
case "i486":
switch (arch1) {
- case "i486":
- return CPUArchCompatibility.IDENTICAL;
case "i586":
case "i686":
return CPUArchCompatibility.COMPATIBLE;
@@ -439,8 +439,6 @@ namespace Boxes {
}
case "i586":
switch (arch1) {
- case "i586":
- return CPUArchCompatibility.IDENTICAL;
case "i686":
return CPUArchCompatibility.COMPATIBLE;
case "x86_64":
@@ -450,20 +448,13 @@ namespace Boxes {
}
case "i686":
switch (arch1) {
- case "i686":
- return CPUArchCompatibility.IDENTICAL;
case "x86_64":
return CPUArchCompatibility.COMPATIBLE_DIFF_WORDSIZE;
default:
return CPUArchCompatibility.INCOMPATIBLE;
}
case "x86_64":
- switch (arch1) {
- case "x86_64":
- return CPUArchCompatibility.IDENTICAL;
- default:
- return CPUArchCompatibility.INCOMPATIBLE;
- }
+ return CPUArchCompatibility.INCOMPATIBLE;
case Osinfo.ARCHITECTURE_ALL:
return CPUArchCompatibility.COMPATIBLE;
default:
@@ -526,6 +517,14 @@ namespace Boxes {
return tokens[1];
}
+ string? get_file_extension (string str) {
+ var index = str.last_index_of_char ('.');
+ if (index < 0)
+ return null;
+
+ return str[index:str.length];
+ }
+
namespace UUID {
[CCode (cname = "uuid_generate", cheader_filename = "uuid/uuid.h")]
internal extern static void generate ([CCode (array_length = false)] uchar[] uuid);
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 1492e22..009fe35 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -35,7 +35,7 @@ private class Boxes.VMConfigurator {
var best_caps = get_best_guest_caps (caps, install_media);
domain.memory = install_media.resources.ram / KIBIBYTES;
- set_cpu_config (domain, caps);
+ //set_cpu_config (domain, caps);
var virt_type = guest_kvm_enabled (best_caps) ? DomainVirtType.KVM : DomainVirtType.QEMU;
domain.set_virt_type (virt_type);
@@ -101,11 +101,11 @@ private class Boxes.VMConfigurator {
domain.set_lifecycle (DomainLifecycleEvent.ON_REBOOT, DomainLifecycleAction.DESTROY);
domain.set_lifecycle (DomainLifecycleEvent.ON_CRASH, DomainLifecycleAction.DESTROY);
- var pm = new DomainPowerManagement ();
+ /*var pm = new DomainPowerManagement ();
// Disable S3 and S4 states for now due to many issues with it currently in qemu/libvirt
pm.set_mem_suspend_enabled (false);
pm.set_disk_suspend_enabled (false);
- domain.set_power_management (pm);
+ domain.set_power_management (pm);*/
var console = new DomainConsole ();
console.set_source (new DomainChardevSourcePty ());
domain.add_device (console);
@@ -285,7 +285,7 @@ private class Boxes.VMConfigurator {
disk.set_target_dev ("vd" + dev_letter_str);
} else {
debug ("Using IDE controller for the main disk");
- disk.set_target_bus (DomainDiskBus.IDE);
+ disk.set_target_bus (DomainDiskBus.SCSI);
disk.set_target_dev ("hd" + dev_letter_str);
}
@@ -322,9 +322,10 @@ private class Boxes.VMConfigurator {
private static void set_video_config (Domain domain, InstallerMedia install_media) {
var video = new DomainVideo ();
- var device = find_device_by_prop (install_media.supported_devices, DEVICE_PROP_CLASS, "video");
- var model = (device != null)? get_enum_value (device.get_name (), typeof (DomainVideoModel)) :
- DomainVideoModel.QXL;
+ //var device = find_device_by_prop (install_media.supported_devices, DEVICE_PROP_CLASS, "video");
+ //var model = (device != null)? get_enum_value (device.get_name (), typeof (DomainVideoModel)) :
+ // DomainVideoModel.QXL;
+ var model = DomainVideoModel.VGA;
return_if_fail (model != -1);
video.set_model ((DomainVideoModel) model);
@@ -537,8 +538,10 @@ private class Boxes.VMConfigurator {
foreach (var guest_caps in guests_caps) {
var guest_arch = guest_caps.get_arch ().get_name ();
- if (install_media.is_architecture_compatible (guest_arch))
+ if (install_media.is_architecture_compatible (guest_arch)) {
+ print ("%s is compatible\n", guest_arch);
compat_guests_caps.append (guest_caps);
+ }
}
// Now lets see if there is any KVM-enabled guest caps
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]