Fix a little bug in virtio disk attributions
Signed-off-by: Arthur Clement <aclement at linagora.com>
---
src/task-omatic/task_vm.rb | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb
index 3a197f9..cf84ea2 100644
--- a/src/task-omatic/task_vm.rb
+++ b/src/task-omatic/task_vm.rb
@@ -66,7 +66,9 @@ def create_vm_xml(name, uuid, memAllocated, memUsed, vcpus,
bootDevice,
doc.root.elements["devices"].add_element("emulator").add_text("/usr/bin/qemu-kvm")
devs = ['hda', 'hdb', 'hdc', 'hdd']
+ virtual_devs = ['vda', 'vdb', 'vdc', 'vdd']
which_device = 0
+ which_virtual_device = 0
diskDevices.each do |disk|
is_cdrom = (disk =~ /\.iso/) ? true : false
@@ -78,17 +80,18 @@ def create_vm_xml(name, uuid, memAllocated, memUsed, vcpus,
bootDevice,
diskdev.add_element("readonly")
diskdev.add_element("source", {"file" => disk})
diskdev.add_element("target", {"dev" =>
devs[which_device], "bus" => "ide"})
+ which_device += 1
elsif virtio
diskdev.add_element("driver", {"name" =>
"qemu", "type" => "raw"})
diskdev.add_element("source", {"dev" => disk})
- diskdev.add_element("target", {"dev" =>
"vda", "bus" => "virtio"})
+ diskdev.add_element("target", {"dev" =>
virtual_devs[which_virtual_device], "bus" => "virtio"})
+ which_virtual_device += 1
else
diskdev.add_element("source", {"dev" => disk})
diskdev.add_element("target", {"dev" =>
devs[which_device]})
+ which_device += 1
end
-
doc.root.elements["devices"] << diskdev
- which_device += 1
end
net_interfaces.each { |nic|
--
1.7.2.2
Arthur Clément
2010-Sep-01 13:05 UTC
[Ovirt-devel] [PATCH] Fix virtual disk name (virtio)
Pushed On mercredi 01 septembre 2010 14:59:35 you wrote:> Fix a little bug in virtio disk attributions > > Signed-off-by: Arthur Clement <aclement at linagora.com> > --- > src/task-omatic/task_vm.rb | 9 ++++++--- > 1 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/src/task-omatic/task_vm.rb b/src/task-omatic/task_vm.rb > index 3a197f9..cf84ea2 100644 > --- a/src/task-omatic/task_vm.rb > +++ b/src/task-omatic/task_vm.rb > @@ -66,7 +66,9 @@ def create_vm_xml(name, uuid, memAllocated, memUsed, > vcpus, bootDevice, > doc.root.elements["devices"].add_element("emulator").add_text("/usr/bin/qe > mu-kvm") > > devs = ['hda', 'hdb', 'hdc', 'hdd'] > + virtual_devs = ['vda', 'vdb', 'vdc', 'vdd'] > which_device = 0 > + which_virtual_device = 0 > diskDevices.each do |disk| > is_cdrom = (disk =~ /\.iso/) ? true : false > > @@ -78,17 +80,18 @@ def create_vm_xml(name, uuid, memAllocated, memUsed, > vcpus, bootDevice, diskdev.add_element("readonly") > diskdev.add_element("source", {"file" => disk}) > diskdev.add_element("target", {"dev" => devs[which_device], "bus" => > "ide"}) + which_device += 1 > elsif virtio > diskdev.add_element("driver", {"name" => "qemu", "type" => "raw"}) > diskdev.add_element("source", {"dev" => disk}) > - diskdev.add_element("target", {"dev" => "vda", "bus" => "virtio"}) > + diskdev.add_element("target", {"dev" => > virtual_devs[which_virtual_device], "bus" => "virtio"}) + > which_virtual_device += 1 > else > diskdev.add_element("source", {"dev" => disk}) > diskdev.add_element("target", {"dev" => devs[which_device]}) > + which_device += 1 > end > - > doc.root.elements["devices"] << diskdev > - which_device += 1 > end > > net_interfaces.each { |nic|-- Arthur CLEMENT Linagora Paris
Maybe Matching Threads
- [PATCH] Virtio support
- [PATCH] Introduce ability to select any kind of nic model, not just default or virtio.
- permit many-to-many vms / networks relationship redux
- permit many-to-many vms / networks relationship
- [PATCH server] permit many-to-many vms / networks relationship