refactor the code for command vmprovider