use cloud.has_instance to cleanup some code

use cloud.has_instance to cleanup some code
Merge pull request #16485 from steverweber/cloud_state

use cloud.has_instance to cleanup some code