This changeset adds support of max_instances and available_instances.  Resource manager tracks all registered instances, except those in the DELETED state.  Its could_reserve? and numbers reserverable methods responds positively when the total number of undeleted instances fall under the max_instances limit.

added more test cases for an new method created as a result of refactoring.

added more test cases for an new method created as a result of refactoring.

added more test cases for an new method created as a result of refactoring.

added more test cases for an new method created as a result of refactoring.