def ensure_dbms_is_running(self, options, properties, scmStatus=None):
    """
    :param scmStatus : SvcStatusCallback
    :rtype : None
    """

    db_host_components = self.database_host.split("\\")
    if len(db_host_components) == 1:
      db_machine = self.database_host
      sql_svc_name = "MSSQLServer"
    else:
      db_machine = db_host_components[0]
      sql_svc_name = "MSSQL$" + db_host_components[1]

    if db_machine == "localhost" or db_machine.lower() == os.getenv("COMPUTERNAME").lower() or \
            db_machine.lower() == socket.getfqdn().lower():
      #TODO: Configure the SQL Server service name in ambari.properties
      ret = WinServiceController.EnsureServiceIsStarted(sql_svc_name)
      if 0 != ret:
        raise FatalException(-1, "Error starting SQL Server: " + string(ret))

      if scmStatus is not None:
        scmStatus.reportStartPending()

      ret = WinServiceController.EnsureServiceIsStarted("SQLBrowser")  #The SQL Server JDBC driver needs this one
      if 0 != ret:
        raise FatalException(-1, "Error starting SQL Server Browser: " + string(ret))
    pass
Esempio n. 2
0
def ensure_hdp_service_soft_dependencies():
    ret = WinServiceController.EnsureServiceIsStarted(
        EMBEDDED_HBASE_MASTER_SERVICE)
    if ret != 0:
        err = 'ERROR: Cannot start service "{0}". Error = {1}'.format(
            EMBEDDED_HBASE_MASTER_SERVICE, ret)
        raise FatalException(1, err)
Esempio n. 3
0
def ensure_time_service_is_started():
    ret = WinServiceController.EnsureServiceIsStarted("W32Time")
    if 0 != ret:
        raise FatalException(
            -1, "Error starting Windows Time service: " + str(ret))
    pass