code to create and start vm if state is powered on