public Boolean moveVmToHostSystem(final String vmName, final String hostName) throws VMWareException {

        ServiceInstance si = null;
        boolean retVal;

        try {

            si = this.getServerInstance();
            Folder rootFolder = si.getRootFolder();
            VirtualMachine vm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", vmName);

            HostSystem hostSystem = null;
            ManagedEntity[] hostSystems = new InventoryNavigator(si.getRootFolder()).searchManagedEntities("HostSystem");
            for (ManagedEntity hostSystem1 : hostSystems) {
                HostSystem host = (HostSystem) hostSystem1;

                if (host.getName().equalsIgnoreCase(hostName)) {
                    logger.log(Level.FINE, "Found HostSystem: " + hostName);
                    hostSystem = host;
                } else {
                    logger.log(Level.FINE, "HostSystem: " + hostName + " not found! Using default HostSystem.");
                }
            }

            VirtualMachineRelocateSpec relSpec = new VirtualMachineRelocateSpec();
            relSpec.setHost(hostSystem.getMOR());

            Task task = vm.relocateVM_Task(relSpec);

            String result = task.waitForTask();

            retVal = result.equals(Task.SUCCESS);

            return retVal;
        } catch (PlatformConfigFault f) {
            throw new VMWareException(f);
        } catch (RemoteException exc) {
            throw new VMWareException(exc);
        } catch (Exception exc) {
            throw new VMWareException(exc);
        }
    }