Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 On 28 November 2013 18:15, Stefan Kooman ste...@bit.nl wrote:
 
  Quoting Daniel Molina (dmol...@opennebula.org):
   On 27 November 2013 21:27, Stefan Kooman ste...@bit.nl wrote:
  
  
   We didn't change anything, just:
  
  https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd
  
   So, it should work as before.
 
  Passenger 4.0.26 is giving me this error (500):
 
  [ 2013-11-28 17:34:07.3852 19823/7f177e5a6700
  Pool2/Implementation.cpp:1291 ]: [App 19906 stderr] NameError -
  uninitialized constant PhusionPassenger::Utils::RewindableInput:
  [ 2013-11-28 17:34:07.3858 19823/7f177e5a6700
  Pool2/Implementation.cpp:1291 ]: [App 19906 stderr]
  /usr/lib/one/sunstone/sunstone-server.rb:412:in `block in top (required)'
 
  Image upload _is_ working with Apache Passenger 3.0.13debian-1.2.
  Apparently
  passenger 4.x needs this class to be handled differently.
 
 
 Could you check what it the value of rackinput.class in the post '/upload'
 do method of sunstone-server.rb. You can add a
 logger.error(rackinput.class) and it will be reported in the log.

##
# Upload image
##
post '/upload'do

tmpfile = nil
rackinput = request.env['rack.input']

if (rackinput.class == Tempfile)
tmpfile = rackinput
elsif (rackinput.class == StringIO || rackinput.class == 
PhusionPassenger::Utils::RewindableInput)
tmpfile = Tempfile.open('sunstone-upload', '/mnt/sunstone_upload')
tmpfile.write rackinput.read
tmpfile.flush
else
logger.error { Unexpected rackinput class #{rackinput.class} }
logger.error(rackinput.class)
return [500, ]
end

@SunstoneServer.upload(params[:img], tmpfile.path)
end

I included logger.error(rackinput.class) like above. But I can't find
the rackinput.class value. Is the above correct?

Gr. Stefan

-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Daniel Molina
On 29 November 2013 09:27, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):
  On 28 November 2013 18:15, Stefan Kooman ste...@bit.nl wrote:
 
   Quoting Daniel Molina (dmol...@opennebula.org):
On 27 November 2013 21:27, Stefan Kooman ste...@bit.nl wrote:
   
   
We didn't change anything, just:
   
  
 https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd
   
So, it should work as before.
  
   Passenger 4.0.26 is giving me this error (500):
  
   [ 2013-11-28 17:34:07.3852 19823/7f177e5a6700
   Pool2/Implementation.cpp:1291 ]: [App 19906 stderr] NameError -
   uninitialized constant PhusionPassenger::Utils::RewindableInput:
   [ 2013-11-28 17:34:07.3858 19823/7f177e5a6700
   Pool2/Implementation.cpp:1291 ]: [App 19906 stderr]
   /usr/lib/one/sunstone/sunstone-server.rb:412:in `block in top
 (required)'
  
   Image upload _is_ working with Apache Passenger 3.0.13debian-1.2.
   Apparently
   passenger 4.x needs this class to be handled differently.
  
 
  Could you check what it the value of rackinput.class in the post
 '/upload'
  do method of sunstone-server.rb. You can add a
  logger.error(rackinput.class) and it will be reported in the log.


 ##
 # Upload image

 ##
 post '/upload'do

 tmpfile = nil
 rackinput = request.env['rack.input']

 if (rackinput.class == Tempfile)
 tmpfile = rackinput
 elsif (rackinput.class == StringIO || rackinput.class ==
 PhusionPassenger::Utils::RewindableInput)
 tmpfile = Tempfile.open('sunstone-upload', '/mnt/sunstone_upload')
 tmpfile.write rackinput.read
 tmpfile.flush
 else
 logger.error { Unexpected rackinput class #{rackinput.class} }
 logger.error(rackinput.class)
 return [500, ]
 end

 @SunstoneServer.upload(params[:img], tmpfile.path)
 end

 I included logger.error(rackinput.class) like above. But I can't find
 the rackinput.class value. Is the above correct?


Include it before the if:
 logger.error(rackinput.class)
 if (rackinput.class == Tempfile)


 Gr. Stefan

 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKYUAcACgkQTyGgYdFIOcbkjwEAl5SvTwtbCCmry69wMObQ09vo
 kgh9EqGgRrlfBSpFhv4A/i6LHWeKdU857PpZo2/KIoIIliyOP7Y7dqgyljrBBShi
 =DSa7
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 
 Include it before the if:
  logger.error(rackinput.class)
  if (rackinput.class == Tempfile)

I did just that, restarted apache and tried again. I can't spot the
value in the logs, can you? Passenger errors are logged in apache error log
(not vhost) log. I did check all logs but didn't find anything.

[ 2013-11-29 09:49:54.3785 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr] NameError - uninitialized constant 
PhusionPassenger::Utils::RewindableInput:
[ 2013-11-29 09:49:54.3786 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/one/sunstone/sunstone-server.rb:413:in `block 
in top (required)'
[ 2013-11-29 09:49:54.3786 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:1212:in 
`call'
[ 2013-11-29 09:49:54.3786 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:1212:in 
`block in compile!'
[ 2013-11-29 09:49:54.3787 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in `[]'
[ 2013-11-29 09:49:54.3787 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in 
`block (3 levels) in route!'
[ 2013-11-29 09:49:54.3787 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:801:in 
`route_eval'
[ 2013-11-29 09:49:54.3787 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in 
`block (2 levels) in route!'
[ 2013-11-29 09:49:54.3787 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:822:in 
`block in process_route'
[ 2013-11-29 09:49:54.3788 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:820:in 
`catch'
[ 2013-11-29 09:49:54.3788 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:820:in 
`process_route'
[ 2013-11-29 09:49:54.3788 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:784:in 
`block in route!'
[ 2013-11-29 09:49:54.3788 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:783:in `each'
[ 2013-11-29 09:49:54.3788 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:783:in 
`route!'
[ 2013-11-29 09:49:54.3789 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:886:in 
`dispatch!'
[ 2013-11-29 09:49:54.3789 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:719:in 
`block in call!'
[ 2013-11-29 09:49:54.3789 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`block in invoke'
[ 2013-11-29 09:49:54.3789 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`catch'
[ 2013-11-29 09:49:54.3789 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`invoke'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:719:in 
`call!'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:705:in `call'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   /usr/lib/ruby/vendor_ruby/rack/commonlogger.rb:33:in 
`call'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   
/usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:225:in `context'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   
/usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:220:in `call'
[ 2013-11-29 09:49:54.3790 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/xss_header.rb:18:in `call'
[ 2013-11-29 09:49:54.3791 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/path_traversal.rb:16:in `call'
[ 2013-11-29 09:49:54.3791 25391/7f15dc523700 Pool2/Implementation.cpp:1291 ]: 
[App 25479 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/json_csrf.rb:18:in `call'
[ 2013-11-29 

Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Daniel Molina
On 29 November 2013 09:57, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):
 
  Include it before the if:
   logger.error(rackinput.class)
   if (rackinput.class == Tempfile)

 I did just that, restarted apache and tried again. I can't spot the
 value in the logs, can you? Passenger errors are logged in apache error log
 (not vhost) log. I did check all logs but didn't find anything.


It should be in /var/log/one/sunstone.log

You can also write the value to a file:
File.open('/tmp/debug_sunstone, 'w') { |file| file.write(rackinput.class) }


-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 On 29 November 2013 09:57, Stefan Kooman ste...@bit.nl wrote:
 
  Quoting Daniel Molina (dmol...@opennebula.org):
  
   Include it before the if:
logger.error(rackinput.class)
if (rackinput.class == Tempfile)
 
  I did just that, restarted apache and tried again. I can't spot the
  value in the logs, can you? Passenger errors are logged in apache error log
  (not vhost) log. I did check all logs but didn't find anything.
 
 
 It should be in /var/log/one/sunstone.log
 
 You can also write the value to a file:
 File.open('/tmp/debug_sunstone, 'w') { |file| file.write(rackinput.class) }
I changed that to:
File.open('/tmp/debug_sunstone', 'w') { |file| file.write(rackinput.class) }

(vim syntax highlighting ftw!)

sunstone.log:

Fri Nov 29 10:08:00 2013 [E]: PhusionPassenger::Utils::TeeInput
Fri Nov 29 10:08:00 2013 [I]: 2001:7b8:3:1000:201:80ff:fe7c:2f35 - - 
[29/Nov/2013 10:08:00] POST 
/upload?img=%7B%22image%22%3A%7B%22NAME%22%3A%22ttylinux%22%2C%22TYPE%22%3A%22CDROM%22%2C%22PERSISTENT%22%3A%22NO%22%7D%2C%22ds_id%22%3A%22101%22%7Dfile=ttylinux-pc_i686-16.1.isoqqfile=ttylinux-pc_i686-16.1.iso
  500 30 0.0059

cat /tmp/debug_sunstone
PhusionPassenger::Utils::TeeInput

Gr. Stefan





-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Daniel Molina
On 29 November 2013 10:13, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):
  On 29 November 2013 09:57, Stefan Kooman ste...@bit.nl wrote:
 
   Quoting Daniel Molina (dmol...@opennebula.org):
   
Include it before the if:
 logger.error(rackinput.class)
 if (rackinput.class == Tempfile)
  
   I did just that, restarted apache and tried again. I can't spot the
   value in the logs, can you? Passenger errors are logged in apache
 error log
   (not vhost) log. I did check all logs but didn't find anything.
 
 
  It should be in /var/log/one/sunstone.log
 
  You can also write the value to a file:
  File.open('/tmp/debug_sunstone, 'w') { |file|
 file.write(rackinput.class) }
 I changed that to:
 File.open('/tmp/debug_sunstone', 'w') { |file| file.write(rackinput.class)
 }

 (vim syntax highlighting ftw!)

 sunstone.log:

 Fri Nov 29 10:08:00 2013 [E]: PhusionPassenger::Utils::TeeInput
 Fri Nov 29 10:08:00 2013 [I]: 2001:7b8:3:1000:201:80ff:fe7c:2f35 - -
 [29/Nov/2013 10:08:00] POST
 /upload?img=%7B%22image%22%3A%7B%22NAME%22%3A%22ttylinux%22%2C%22TYPE%22%3A%22CDROM%22%2C%22PERSISTENT%22%3A%22NO%22%7D%2C%22ds_id%22%3A%22101%22%7Dfile=ttylinux-pc_i686-16.1.isoqqfile=ttylinux-pc_i686-16.1.iso
  500 30 0.0059

 cat /tmp/debug_sunstone
 PhusionPassenger::Utils::TeeInput


Could you try changing this line:
elsif (rackinput.class == StringIO || rackinput.class ==
PhusionPassenger::Utils::RewindableInput)

to
elsif rackinput.respond_to?('read')




 Gr. Stefan





 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKYWqEACgkQTyGgYdFIOcbFnwD/ehMxgF/ja5cILCU2f1cduidS
 7MqrrdOzmF3VPA8ygucBALqc/LofeUkrD/aVJEhUPdinL/ma4Z4/jAWHOm+Xb1X5
 =kRMl
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 
 Could you try changing this line:
 elsif (rackinput.class == StringIO || rackinput.class ==
 PhusionPassenger::Utils::RewindableInput)
 
 to
 elsif rackinput.respond_to?('read')

This doesn't produce any passenger errors. Image gets uploaded but ...
it fails with the following message:

Error
[ImageAllocate] Cannot determine Image SIZE

It turns out it takes a little while before the image gets flushed to
disk (nfs mount) and at the moment the file size gets determined it's
still 0 bytes ... a few seconds later the file gets filled to it's
actual size ... but that's too late.

watch -n 1 ls -lrth /mnt/sunstone_upload.

I tried again with nolock nfs mount option removed and that seems to
help. It works nows \o/.

One last thing though. Some time after a succesful copy to the datastore the
image got removed (cleanup I guess). That does'nt happen anymore. It's
not a big problem (I can make a cronjob for that) but I wonder if it's
related to this change.

Thanks,

Stefan

P.s. Is this change also going to work on Passenger 3.0? I can test if
you want. Not that I'm planning to but it would make the code version
independent.

-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Daniel Molina
On 29 November 2013 10:54, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):

  Could you try changing this line:
  elsif (rackinput.class == StringIO || rackinput.class ==
  PhusionPassenger::Utils::RewindableInput)
 
  to
  elsif rackinput.respond_to?('read')

 This doesn't produce any passenger errors. Image gets uploaded but ...
 it fails with the following message:

 Error
 [ImageAllocate] Cannot determine Image SIZE

 It turns out it takes a little while before the image gets flushed to
 disk (nfs mount) and at the moment the file size gets determined it's
 still 0 bytes ... a few seconds later the file gets filled to it's
 actual size ... but that's too late.

 watch -n 1 ls -lrth /mnt/sunstone_upload.

 I tried again with nolock nfs mount option removed and that seems to
 help. It works nows \o/.


Great!



 One last thing though. Some time after a succesful copy to the datastore
 the
 image got removed (cleanup I guess). That does'nt happen anymore. It's
 not a big problem (I can make a cronjob for that) but I wonder if it's
 related to this change.


This is handled by passenger, it should be removed by the GC sooner or
later



 Thanks,

 Stefan

 P.s. Is this change also going to work on Passenger 3.0? I can test if
 you want. Not that I'm planning to but it would make the code version
 independent.


Yes, the code I sent you is meant to be server/version agnostic. It would
be wonderful if you could test it with Passenger 3.0

Thanks



 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKYZFAACgkQTyGgYdFIOcah+wD/T+Jf1ul6vq0ciHBANJ5QwW+3
 bRslnAZOjnMj46LGkmMBAJqLm9EUHV/e78Q8DotF79F6vR5WbY/D8LubF+qLA2Z6
 =xAWh
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 
 This is handled by passenger, it should be removed by the GC sooner or
 later

Ah, I See. One file is cleaned up already. Proably I'm just impatient
:).
If I close apache passenger it cleans up after itself ... nice.

I just did test with Passenger 3.0 and I can confirm it's also working
for Passenger 3.0 (3.0.13debian-1.2 to be precise).

Thanks again!

Gr. Stefan


-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-29 Thread Daniel Molina
On 29 November 2013 11:18, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):
 
  This is handled by passenger, it should be removed by the GC sooner or
  later

 Ah, I See. One file is cleaned up already. Proably I'm just impatient
 :).
 If I close apache passenger it cleans up after itself ... nice.

 I just did test with Passenger 3.0 and I can confirm it's also working
 for Passenger 3.0 (3.0.13debian-1.2 to be precise).

 Thanks again!


Great, I will push it to the repo. It will not be included in one-4.4,
since the code is already closed, but it will be included in a future
maintenance release.

Thank you for your feedback


 Gr. Stefan


 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKYahAACgkQTyGgYdFIOcYl8wD/e0faBfBsJSsGUrFRl56UcWX1
 oVz1wV0m2cR1AeXec/IA/iB9qh1JJjWxU9VsrTlXjtzLlQEnCa2t9F7t9CqWSgle
 =Kdq3
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-28 Thread Daniel Molina
On 27 November 2013 21:27, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):

 
  Could you try exporting the $TMPDIR var before starting the passenger
  processes?
 
  This is the code that generates the temp file (sunstone-server.rb):
  tmpfile = Tempfile.open('sunstone-upload')
 
  by default, it uses Dir.tmpdir as temp dir and this method checks the env
  var TMPDIR.  This variable is defined in the sunstone-server script, but
  Apache do not use this script to start new server instances
 
  You can also specify it as a parameter in the code:
  tmpfile = Tempfile.open('sunstone-upload',
 '/mnt/sunstone_upload')

 Hmm, in opennebula 4.3.90 this isn't working anymore. I have the tmpfile
 hardcoded in sunstone-server.rb.

 I also tried exporting the TMPDIR in /etc/apache/envvars, /etc/bash.bashrc
 and in
 the ruby script itself:

 ENV['TMPDIR'] = '/mnt/sunstone_upload (and in config.ru)

 but without any effect. What changes have been made that defeat above
 settings?


We didn't change anything, just:
https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd

So, it should work as before.




 Thanks,

 Stefan





 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKWVc4ACgkQTyGgYdFIOcYG1AD+MYO5Wwb9TgjUorswPKBhryaw
 ugl40UkLuFaMkqGN2UoA/jkIVoMbIB1l0svlG5li4LVc2JFrW73XKfesGXSqOKhU
 =z1YO
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-28 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 On 27 November 2013 21:27, Stefan Kooman ste...@bit.nl wrote:
 
 
 We didn't change anything, just:
 https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd
 
 So, it should work as before.

Passenger 4.0.26 is giving me this error (500):

[ 2013-11-28 17:34:07.3852 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr] NameError - uninitialized constant 
PhusionPassenger::Utils::RewindableInput:
[ 2013-11-28 17:34:07.3858 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/one/sunstone/sunstone-server.rb:412:in `block 
in top (required)'
[ 2013-11-28 17:34:07.3860 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:1212:in 
`call'
[ 2013-11-28 17:34:07.3862 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:1212:in 
`block in compile!'
[ 2013-11-28 17:34:07.3864 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in `[]'
[ 2013-11-28 17:34:07.3865 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in 
`block (3 levels) in route!'
[ 2013-11-28 17:34:07.3867 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:801:in 
`route_eval'
[ 2013-11-28 17:34:07.3868 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:785:in 
`block (2 levels) in route!'
[ 2013-11-28 17:34:07.3870 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:822:in 
`block in process_route'
[ 2013-11-28 17:34:07.3872 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:820:in 
`catch'
[ 2013-11-28 17:34:07.3874 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:820:in 
`process_route'
[ 2013-11-28 17:34:07.3875 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:784:in 
`block in route!'
[ 2013-11-28 17:34:07.3877 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:783:in `each'
[ 2013-11-28 17:34:07.3879 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:783:in 
`route!'
[ 2013-11-28 17:34:07.3881 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:886:in 
`dispatch!'
[ 2013-11-28 17:34:07.3883 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:719:in 
`block in call!'
[ 2013-11-28 17:34:07.3884 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`block in invoke'
[ 2013-11-28 17:34:07.3886 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`catch'
[ 2013-11-28 17:34:07.3888 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:871:in 
`invoke'
[ 2013-11-28 17:34:07.3890 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:719:in 
`call!'
[ 2013-11-28 17:34:07.3891 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/sinatra/base.rb:705:in `call'
[ 2013-11-28 17:34:07.3893 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   /usr/lib/ruby/vendor_ruby/rack/commonlogger.rb:33:in 
`call'
[ 2013-11-28 17:34:07.3896 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   
/usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:225:in `context'
[ 2013-11-28 17:34:07.3898 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   
/usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:220:in `call'
[ 2013-11-28 17:34:07.3900 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/xss_header.rb:18:in `call'
[ 2013-11-28 17:34:07.3901 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/path_traversal.rb:16:in `call'
[ 2013-11-28 17:34:07.3903 19823/7f177e5a6700 Pool2/Implementation.cpp:1291 ]: 
[App 19906 stderr]   
/usr/lib/ruby/vendor_ruby/rack/protection/json_csrf.rb:18:in `call'
[ 2013-11-28 17:34:07.3905 19823/7f177e5a6700 

Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-28 Thread Daniel Molina
On 28 November 2013 18:15, Stefan Kooman ste...@bit.nl wrote:

 Quoting Daniel Molina (dmol...@opennebula.org):
  On 27 November 2013 21:27, Stefan Kooman ste...@bit.nl wrote:
 
 
  We didn't change anything, just:
 
 https://github.com/OpenNebula/one/commit/f8e2e65b0170268e9c72d52c4fe9f0e13fa05acd
 
  So, it should work as before.

 Passenger 4.0.26 is giving me this error (500):

 [ 2013-11-28 17:34:07.3852 19823/7f177e5a6700
 Pool2/Implementation.cpp:1291 ]: [App 19906 stderr] NameError -
 uninitialized constant PhusionPassenger::Utils::RewindableInput:
 [ 2013-11-28 17:34:07.3858 19823/7f177e5a6700
 Pool2/Implementation.cpp:1291 ]: [App 19906 stderr]
 /usr/lib/one/sunstone/sunstone-server.rb:412:in `block in top (required)'

 Image upload _is_ working with Apache Passenger 3.0.13debian-1.2.
 Apparently
 passenger 4.x needs this class to be handled differently.


Could you check what it the value of rackinput.class in the post '/upload'
do method of sunstone-server.rb. You can add a
logger.error(rackinput.class) and it will be reported in the log.

Cheers



 Gr. Stefan

 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKXejoACgkQTyGgYdFIOcbamgEA0CqmB4CHEhh5lGCu/EFEjsJy
 xOc+fp2UbMA9F0WAgH8A/1qrzs5RPipd+gY5l7DRQ1DZia/LalKJyFAQyp/nF7M9
 =6Fhy
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-27 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 
 
 Could you try exporting the $TMPDIR var before starting the passenger
 processes?
 
 This is the code that generates the temp file (sunstone-server.rb):
 tmpfile = Tempfile.open('sunstone-upload')
 
 by default, it uses Dir.tmpdir as temp dir and this method checks the env
 var TMPDIR.  This variable is defined in the sunstone-server script, but
 Apache do not use this script to start new server instances
 
 You can also specify it as a parameter in the code:
 tmpfile = Tempfile.open('sunstone-upload', '/mnt/sunstone_upload')

Hmm, in opennebula 4.3.90 this isn't working anymore. I have the tmpfile
hardcoded in sunstone-server.rb.

I also tried exporting the TMPDIR in /etc/apache/envvars, /etc/bash.bashrc and 
in
the ruby script itself: 

ENV['TMPDIR'] = '/mnt/sunstone_upload (and in config.ru)

but without any effect. What changes have been made that defeat above
settings?

Thanks,

Stefan





-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-15 Thread Stefan Kooman
Quoting Stefan Kooman (ste...@bit.nl):
 
 I've tried this and that works, i.e. the image gets uploaded and stored
 in /mnt/sunstone_upload directory. However, something goes wrong copying
 the file to the datastore. The file is empty (0 bytes). Here some logging:
Answering myself here. This turns out te be a permissions problem.
www-data user creates the uploaded image with 600 permissions as user
www-data. oned is unable to read that file, does create the file but it
is empty. oned logs the following:

Fri Nov 15 15:18:06 2013 [ImM][I]: Copying
/mnt/sunstone_upload/sunstone-upload20131115-17163-lj1x9r to repository
fo
r image 31
Fri Nov 15 15:18:06 2013 [ReM][D]: Req:560 UID:0 ImageAllocate result
SUCCESS, 31
Fri Nov 15 15:18:06 2013 [ReM][D]: Req:8720 UID:0 ImageInfo invoked, 31
Fri Nov 15 15:18:06 2013 [ReM][D]: Req:8720 UID:0 ImageInfo result
SUCCESS, IMAGEID31/IDU...
Fri Nov 15 15:18:06 2013 [ImM][I]: Image copied and ready to use.

It shouldn't report it's able to copy the file if it isn't. Somehow oned
manages to report file size (Size in sunstone) to be 16MB (instead of
232M). It would be safer to md5sum the image before the copy and
after. Only if the hashes are equal it should report succes. 

The more I think of it the more I think sunstone can better be run as
user oneadmin instead of www-data. Makes life easier in most places.

Shall I file a bug report?

Kind regards,

Stefan

P.s. Thanks for fixing the bugs anyway, you guys are doing a great job!

-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-15 Thread Daniel Molina
On 15 November 2013 15:30, Stefan Kooman ste...@bit.nl wrote:

 Quoting Stefan Kooman (ste...@bit.nl):

  I've tried this and that works, i.e. the image gets uploaded and stored
  in /mnt/sunstone_upload directory. However, something goes wrong copying
  the file to the datastore. The file is empty (0 bytes). Here some
 logging:
 Answering myself here. This turns out te be a permissions problem.
 www-data user creates the uploaded image with 600 permissions as user
 www-data. oned is unable to read that file, does create the file but it
 is empty. oned logs the following:

 Fri Nov 15 15:18:06 2013 [ImM][I]: Copying
 /mnt/sunstone_upload/sunstone-upload20131115-17163-lj1x9r to repository
 fo
 r image 31
 Fri Nov 15 15:18:06 2013 [ReM][D]: Req:560 UID:0 ImageAllocate result
 SUCCESS, 31
 Fri Nov 15 15:18:06 2013 [ReM][D]: Req:8720 UID:0 ImageInfo invoked, 31
 Fri Nov 15 15:18:06 2013 [ReM][D]: Req:8720 UID:0 ImageInfo result
 SUCCESS, IMAGEID31/IDU...
 Fri Nov 15 15:18:06 2013 [ImM][I]: Image copied and ready to use.

 It shouldn't report it's able to copy the file if it isn't. Somehow oned
 manages to report file size (Size in sunstone) to be 16MB (instead of
 232M). It would be safer to md5sum the image before the copy and
 after. Only if the hashes are equal it should report succes.

 The more I think of it the more I think sunstone can better be run as
 user oneadmin instead of www-data. Makes life easier in most places.

 Shall I file a bug report?


Yes, please.



 Kind regards,

 Stefan

 P.s. Thanks for fixing the bugs anyway, you guys are doing a great job!


Thanks to your great feedback



 --
 | BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
 | GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iF4EAREIAAYFAlKGL+4ACgkQTyGgYdFIOcbGxAD9HVvaDxj8T4eVz3iAGrIPocij
 3vLYcoyeX/G2hkegc/oBAMasaCvcRI/Sie0wK0+Ke1ixzcZ1moqDmkgS7b0dnZgP
 =5vls
 -END PGP SIGNATURE-




-- 
--
Daniel Molina
Project Engineer
OpenNebula - Flexible Enterprise Cloud Made Simple
www.OpenNebula.org | dmol...@opennebula.org | @OpenNebula
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Sunstone image upload not working - images not in tmpdir

2013-11-13 Thread Stefan Kooman
Quoting Daniel Molina (dmol...@opennebula.org):
 Hi Stefan,
 
 Could you try exporting the $TMPDIR var before starting the passenger
 processes?
 
 This is the code that generates the temp file (sunstone-server.rb):
 tmpfile = Tempfile.open('sunstone-upload')
 
 by default, it uses Dir.tmpdir as temp dir and this method checks the env
 var TMPDIR.  This variable is defined in the sunstone-server script, but
 Apache do not use this script to start new server instances
 
 You can also specify it as a parameter in the code:
 tmpfile = Tempfile.open('sunstone-upload', '/mnt/sunstone_upload')

I've tried this and that works, i.e. the image gets uploaded and stored
in /mnt/sunstone_upload directory. However, something goes wrong copying
the file to the datastore. The file is empty (0 bytes). Here some logging:

sunstone.log:
[13/Nov/2013 12:19:28] POST /upload?img=%7B%22i
mage%22%3A%7B%22NAME%22%3A%22ubuntu_saucy%22%2C%22TYPE%22%3A%22CDROM%22%2C%22PERSISTENT%22%3A%22NO%22%7D%2C%22ds_id%2
2%3A%22105%22%7Dfile=ubuntu-13.10-server-amd64.isoqqfile=ubuntu-13.10-server-amd64.iso
 201 910 11.8890

oned.log:

Wed Nov 13 12:19:23 2013 [ReM][D]: Req:8352 UID:0 ImageAllocate invoked,
NAME=ubuntu_saucy..., 105
Wed Nov 13 12:19:23 2013 [ImM][I]: Copying
/mnt/sunstone_upload/sunstone-upload20131113-23887-1gdh6b2 to repository
for image 22
Wed Nov 13 12:19:23 2013 [ReM][D]: Req:8352 UID:0 ImageAllocate result
SUCCESS, 22
Wed Nov 13 12:19:23 2013 [ReM][D]: Req:8624 UID:0 ImageInfo invoked, 22
Wed Nov 13 12:19:23 2013 [ReM][D]: Req:8624 UID:0 ImageInfo result
SUCCESS, IMAGEID22/IDU...
Wed Nov 13 12:19:24 2013 [ImM][I]: Image copied and ready to use.


file listing in datastore:
-rw-rw-r-- 1 oneadmin oneadmin 11G Nov 13 10:52 a72586472f7351691e70f637d0ff7278
-rw-rw-r-- 1 oneadmin oneadmin   0 Nov 13 12:54 54ea1f1607a44c65b70936e2df020887


 Hope this helps
It sure does help but I'm not there yet :).

How can I debug this final step (copy from tempdir to datastore)?

Thanks,

Stefan


-- 
| BIT BV  http://www.bit.nl/Kamer van Koophandel 09090351
| GPG: 0xD14839C6   +31 318 648 688 / i...@bit.nl


signature.asc
Description: Digital signature
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org