fix database connection problem

when fetching attribute from database you need to call db.close()
and db.closeSession() to really close both the connection and the
session used by sqlalchemy, if you forget to call closeSession
the session connection will be kept alive and after some hours might
be closed by mysql.

Removed a lot of cut&paste code to fetch various attributes and created
a common function, which should be used everywhere in the code
commands: remove non ASCI characters
imgstorage: use the new imgstorage.get_attribute in vm daemon

now imgstorage.imgstoragevm also uses the new function
imgstorage.get_attribute to fetch attributes