CLOUDIFY-2222 add some functions and tests and fix file server to shutdow properly