return response;
}
@Override
public SystemVmInstanceResponse createSystemVmInstanceResponse(VirtualMachine vm) {
SystemVmInstanceResponse vmResponse = new SystemVmInstanceResponse();
vmResponse.setId(vm.getId());
vmResponse.setSystemVmType(vm.getType().toString().toLowerCase());
vmResponse.setName(vm.getHostName());
if (vm.getHostId() != null) {
vmResponse.setHostId(vm.getHostId());
}
if (vm.getState() != null) {
vmResponse.setState(vm.getState().toString());
}
if (vm.getType() == Type.DomainRouter) {
VirtualRouter router = (VirtualRouter) vm;
if (router.getRole() != null) {
vmResponse.setRole(router.getRole().toString());
}
}
vmResponse.setObjectName("systemvminstance");
return vmResponse;
}