Merge pull request #957 from shenrie/master

Refactor the prepare resource operations
Fix for support of create devices