[gnome-boxes/gnome-3-4] Use virtio disk for OSs that support it out of the box



commit cdebe3b22240982ea0840eebd12460285562dded
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Feb 25 02:46:57 2012 +0200

    Use virtio disk for OSs that support it out of the box
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670777

 data/fedora.ks            |    6 +++---
 src/fedora-installer.vala |    2 +-
 src/vm-configurator.vala  |   14 ++++++++++----
 3 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/data/fedora.ks b/data/fedora.ks
index 666f32c..defd71c 100644
--- a/data/fedora.ks
+++ b/data/fedora.ks
@@ -9,13 +9,13 @@ selinux --enforcing
 timezone --utc BOXES_TZ
 bootloader --location=mbr
 zerombr
-clearpart --all --drives=sda
+clearpart --all --drives=vda
 
 firstboot --disable
 
 part biosboot --fstype=biosboot --size=1
-part /boot --fstype ext4 --recommended --ondisk=sda
-part pv.2 --size=1 --grow --ondisk=sda
+part /boot --fstype ext4 --recommended --ondisk=vda
+part pv.2 --size=1 --grow --ondisk=vda
 volgroup VolGroup00 --pesize=32768 pv.2
 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536
 logvol / --fstype ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
diff --git a/src/fedora-installer.vala b/src/fedora-installer.vala
index bfca71a..a897800 100644
--- a/src/fedora-installer.vala
+++ b/src/fedora-installer.vala
@@ -38,7 +38,7 @@ private class Boxes.FedoraInstaller: UnattendedInstaller {
 
         os.set_kernel (kernel_path);
         os.set_ramdisk (initrd_path);
-        os.set_cmdline ("ks=hd:sdb:" + unattended_dest_name);
+        os.set_cmdline ("ks=hd:sda:" + unattended_dest_name);
     }
 
     public override void check_needed_info () throws UnattendedInstallerError.SETUP_INCOMPLETE {
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 79c0152..079171c 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -37,7 +37,7 @@ private class Boxes.VMConfigurator {
             clock.set_offset (DomainClockOffset.UTC);
         domain.set_clock (clock);
 
-        set_target_media_config (domain, target_path);
+        set_target_media_config (domain, target_path, install_media);
         set_unattended_disk_config (domain, install_media);
         set_source_media_config (domain, install_media);
 
@@ -142,16 +142,22 @@ private class Boxes.VMConfigurator {
         return pool;
     }
 
-    private void set_target_media_config (Domain domain, string target_path) {
+    private void set_target_media_config (Domain domain, string target_path, InstallerMedia install_media) {
         var disk = new DomainDisk ();
         disk.set_type (DomainDiskType.FILE);
         disk.set_guest_device_type (DomainDiskGuestDeviceType.DISK);
         disk.set_driver_name ("qemu");
         disk.set_driver_type ("qcow2");
         disk.set_source (target_path);
-        disk.set_target_dev ("hda");
-        disk.set_target_bus (DomainDiskBus.IDE);
         disk.set_driver_cache (DomainDiskCacheType.NONE);
+        var device = get_os_device_by_prop (install_media.os, DEVICE_PROP_NAME, "virtio-block");
+        if (device != null) {
+            disk.set_target_bus (DomainDiskBus.VIRTIO);
+            disk.set_target_dev ("vda");
+        } else {
+            disk.set_target_bus (DomainDiskBus.IDE);
+            disk.set_target_dev ("hda");
+        }
 
         domain.add_device (disk);
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]