core: Allow to create template from scratch

This patch add the ability to create a template from a VmStatic object,
even if this is not an existing vm in the engine db.

basically patch does:
1. move all image related checks in canDoAction to one method
2. handle places assuming vm in db (vm lock and vm-device handling)

frontend changes to use this abillity are under development,
as part of instance types work.

Change-Id: Iac363613af778157a50be1f7a211896d70e18952
Signed-off-by: Omer Frenkel <ofrenkel@redhat.com>