core: fix NPE on add vm template ctor

AddVmTemplateCommand ctor is using masterVm from parameters,
without checking for null, this can happen when command is created
during backend recovery - so added a null check.
this is ok because the parameter is not needed in end action.

in addition the 'isVmInDb' member initialized on endAction in order
unlockVm will be called if source vm is in db.

Change-Id: I9b870a89c337a47110aaa7d20d027ad8ef06cfe8
Bug-Url: https://bugzilla.redhat.com/994860
Signed-off-by: Omer Frenkel <ofrenkel@redhat.com>