Ian Main
2009-Mar-03 19:30 UTC
[Ovirt-devel] [PATCH server] Fix NFS volume creation in taskomatic
This patch fixes NFS volume creation by removing bogus user/group values and just using the default permissions in libvirt. It also uses sparse files when creating volumes to allow this to happen MUCH faster thereby avoiding the QMF timeout for now. Note that this is really just a workaround for lack of threading/asynchronous calls/timeouts etc. Signed-off-by: Ian Main <imain at redhat.com> --- src/task-omatic/task_storage.rb | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/task-omatic/task_storage.rb b/src/task-omatic/task_storage.rb index 6465308..afc8964 100644 --- a/src/task-omatic/task_storage.rb +++ b/src/task-omatic/task_storage.rb @@ -168,9 +168,9 @@ class LibvirtPool @vol_xml.root.add_element("capacity", {"unit" => "K"}).add_text(size.to_s) @vol_xml.root.add_element("target") @vol_xml.root.elements["target"].add_element("permissions") - @vol_xml.root.elements["target"].elements["permissions"].add_element("owner").add_text(owner) - @vol_xml.root.elements["target"].elements["permissions"].add_element("group").add_text(group) - @vol_xml.root.elements["target"].elements["permissions"].add_element("mode").add_text(mode) + @vol_xml.root.elements["target"].elements["permissions"].add_element("owner").add_text(owner) if owner + @vol_xml.root.elements["target"].elements["permissions"].add_element("group").add_text(group) if group + @vol_xml.root.elements["target"].elements["permissions"].add_element("mode").add_text(mode) if mode end def shutdown @@ -260,6 +260,13 @@ class NFSLibvirtPool < LibvirtPool # FIXME: we have to add the format as raw here because of a bug in libvirt; # if you specify a volume with no format, it will crash libvirtd @vol_xml.root.elements["target"].add_element("format", {"type" => "raw"}) + + # FIXME: Add allocation 0 element so that we create a sparse file. + # This was done because qmf was timing out waiting for the create + # operation to complete. This needs to be fixed in a better way + # however. We want to have non-sparse files for performance reasons. + @vol_xml.root.add_element("allocation").add_text('0') + result = @remote_pool.createVolumeXML(@vol_xml.to_s) raise "Error creating remote pool: #{result.text}" unless result.status == 0 return result.volume -- 1.6.0.6
Scott Seago
2009-Mar-03 22:49 UTC
[Ovirt-devel] [PATCH server] Fix NFS volume creation in taskomatic
Ian Main wrote:> This patch fixes NFS volume creation by removing bogus user/group > values and just using the default permissions in libvirt. It also > uses sparse files when creating volumes to allow this to happen > MUCH faster thereby avoiding the QMF timeout for now. Note that > this is really just a workaround for lack of threading/asynchronous > calls/timeouts etc. > > Signed-off-by: Ian Main <imain at redhat.com> > >ACK works for me. Scott