class XenHypervisor implements HypervisorHost {

    @Override
    public void shutdownHost(HostVO hostVo) {
        String privateMacAddress = getHostPrivateMacAddress(hostVo);
        hostService.updateHostPrivaceMacAddress(hostVo, privateMacAddress);

        Connection conn = getConnection(hostVo);
        String hostToDeactivatedUuid = hostVo.getGuid();

        try {
            Host master = getMasterHost(conn);
            changeMasterIfNeeded(conn, master, hostToDeactivatedUuid);

            Host host = Host.getByUuid(conn, hostToDeactivatedUuid);
            String hostAddress = host.getAddress(conn);

            disableAndShutdownHost(conn, host);

            do {
                threadUtils.sleepThread(3);
            } while (hostUtils.isHostReachable(hostAddress));

        } catch (Exception e) {
            throw new CloudRuntimeException(String.format("Could not shut down host [uuid=%s]", hostToDeactivatedUuid), e);
        }
    }

}