/**
* Power off a {@link Vm}.
*/
protected Vm powerOffVm(String vmUrn) {
Vm test = vmApi.get(vmUrn);
Status status = test.getStatus();
if (status != Status.POWERED_OFF || test.isDeployed()) {
UndeployVAppParams undeployParams = UndeployVAppParams.builder().build();
Task shutdownVapp = vmApi.undeploy(vmUrn, undeployParams);
assertTaskSucceedsLong(shutdownVapp);
}