[gnome-boxes] vm-configurator: Allow setting index of target media
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] vm-configurator: Allow setting index of target media
- Date: Wed, 22 Jul 2015 12:56:34 +0000 (UTC)
commit 088dc482b517c408e1bceb783bac6ee26f3e9921
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Jul 22 13:48:14 2015 +0100
vm-configurator: Allow setting index of target media
In a following patch, we'll use this parameter to ensure that newly
added hard disk's guest device doesn't conflict with that of any existing
CD-ROM devices in imported domain configuration from system libvirt.
src/vm-configurator.vala | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index b9e13bc..9549682 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -267,7 +267,10 @@ private class Boxes.VMConfigurator {
}
}
- public static void set_target_media_config (Domain domain, string target_path, InstallerMedia
install_media) {
+ public static void set_target_media_config (Domain domain,
+ string target_path,
+ InstallerMedia install_media,
+ uint8 dev_index = 0) {
var disk = new DomainDisk ();
disk.set_type (DomainDiskType.FILE);
disk.set_guest_device_type (DomainDiskGuestDeviceType.DISK);
@@ -276,14 +279,15 @@ private class Boxes.VMConfigurator {
disk.set_source (target_path);
disk.set_driver_cache (DomainDiskCacheType.WRITEBACK);
+ var dev_letter_str = ((char) (dev_index + 97)).to_string ();
if (install_media.supports_virtio_disk) {
debug ("Using virtio controller for the main disk");
disk.set_target_bus (DomainDiskBus.VIRTIO);
- disk.set_target_dev ("vda");
+ 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_dev ("hda");
+ disk.set_target_dev ("hd" + dev_letter_str);
}
domain.add_device (disk);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]