Pierre Inglebert
2008-May-19 12:17 UTC
[Ovirt-devel] [PATCH] Add support of image files for NFS Storage Pool during xml vm creation
Hi, This is my first contribution to the oVirt project and not the last one ( i will talk about that in my next email ). This patch adds support of image files for NFS Storage Pool during the xml vm creation because it is actually hard coded for an iSCSI Pool. ? -- Pierre Inglebert <Pierre.Inglebert at inria.fr> ---------------------------------------------------------------------------- diff --git a/ovirt3/wui/src/task-omatic/task_vm.rb b/ovirt2/wui/src/task-omatic/task_vm.rb index 29bcb1f..1de0c83 100644 --- a/ovirt3/wui/src/task-omatic/task_vm.rb +++ b/ovirt2/wui/src/task-omatic/task_vm.rb @@ -66,9 +66,9 @@ def create_vm_xml(name, uuid, memAllocated, memUsed, vcpus, bootDevice, i = 0 diskDevices.each do |disk| diskdev = Element.new("disk") - diskdev.add_attribute("type", "block") + diskdev.add_attribute("type", disk["type"]) diskdev.add_attribute("device", "disk") - diskdev.add_element("source", {"dev" => disk}) + diskdev.add_element("source", {disk["source"] => disk["path"]}) diskdev.add_element("target", {"dev" => devs[i]}) doc.root.elements["devices"] << diskdev i += 1 @@ -342,8 +342,14 @@ def start_vm(task) thepool.build(0) thepool.create(0) end - - storagedevs << thepool.lookup_volume_by_name(volume.read_attribute(thisstorage.db_column)).path + #We probably could take the xml/Pool_type before + doc = Document.new(thepool.xml_desc(0)) + case doc.root.attributes['type'] + when "iscsi" + storagedevs << {"type" => "block", "source" => "dev", "path" => thepool.lookup_volume_by_name(volume.read_attribute(thisstorage.db_column)).path} + when "netfs" + storagedevs << {"type" => "file", "source" => "file", "path" => thepool.lookup_volume_by_name(volume.read_attribute(thisstorage.db_column)).path} + end end conn.close -------------- next part -------------- A non-text attachment was scrubbed... Name: add_Imagefile_support_during_vm_creation.patch Type: text/x-patch Size: 1484 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20080519/4bfa12a9/attachment.bin>
Chris Lalancette
2008-May-19 13:17 UTC
[Ovirt-devel] [PATCH] Add support of image files for NFS Storage Pool during xml vm creation
Pierre Inglebert wrote:> Hi, > This is my first contribution to the oVirt project and not the last one > ( i will talk about that in my next email ). > This patch adds support of image files for NFS Storage Pool during the > xml vm creation because it is actually hard coded for an iSCSI Pool.Thanks for your contribution! I *thought* I had tested taskomatic working with both iSCSI and NFS. The way it works is that we mount the volume properly on the managed node, and then always point the XML at either the path for NFS (i.e. /mnt/foo/guest.img) or the dev device for iSCSI (i.e. /dev/disk/by/id/iscsi-blah-blah). However, it's possible that I didn't get it totally right, or I thought I tested something I really didn't. What exact problem did you face, and how does this patch solve it? Chris Lalancette