Exemplo n.º 1
0
void Filesets_Restore (LPIDENT lpiParent)
{
   LPSET_RESTORE_PARAMS psrp = New (SET_RESTORE_PARAMS);
   psrp->lpi = lpiParent;
   psrp->szFileset[0] = TEXT('\0');
   psrp->szFilename[0] = TEXT('\0');
   psrp->fIncremental = FALSE;

   if (lpiParent && lpiParent->fIsFileset())
      lpiParent->GetFilesetName (psrp->szFileset);

   INT_PTR rc = ModalDialogParam (IDD_SET_RESTORE, GetActiveWindow(), (DLGPROC)Filesets_Restore_DlgProc, (LPARAM)psrp);
   if (rc != IDOK)
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->lpi != NULL ))
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->szFileset[0] != TEXT('\0') ))
      {
      Delete (psrp);
      }
   else if (!ASSERT( psrp->szFilename[0] != TEXT('\0') ))
      {
      Delete (psrp);
      }
   else
      {
      StartTask (taskSET_RESTORE, NULL, psrp);
      }
}
Exemplo n.º 2
0
BOOL Filesets_BeginDrag (HWND hDlg, BOOL fRightBtn)
{
   LPIDENT lpi = Filesets_GetFocused (hDlg);

   if (!lpi || !lpi->fIsFileset())  // can only drag filesets!
      return FALSE;

   l.fRightBtn = fRightBtn;
   StartTask (taskSET_BEGINDRAG, hDlg, lpi);
   return TRUE;
}
Exemplo n.º 3
0
LPTSTR Alert_GetRemedyFunc (LPIDENT lpiPrimary, size_t iAlertPrimary, LPIDENT lpiServer)
{
   LPOBJECTALERTS lpoa;
   if ((lpoa = Alert_GetObjectAlerts (lpiPrimary)) != NULL)
      {
      switch (lpoa->aAlerts[ iAlertPrimary ].alert)
         {
         case alertTIMEOUT:
            return FormatString (IDS_ALERT_FIX_TIMEOUT);
         case alertFULL:
            if (lpiPrimary->fIsAggregate())
               return FormatString (IDS_ALERT_FIX_AGG_FULL);
            else if (lpiPrimary->fIsFileset())
               return FormatString (IDS_ALERT_FIX_SET_FULL);
            break;
         case alertNO_VLDBENT:
            return FormatString (IDS_ALERT_FIX_NO_VLDBENT);
         case alertNO_SVRENT:
            if (lpiPrimary->fIsFileset())
               return FormatString (IDS_ALERT_FIX_NO_SVRENT_SET);
            else
               return FormatString (IDS_ALERT_FIX_NO_SVRENT_AGG);
            break;
         case alertSTOPPED:
            return FormatString (IDS_ALERT_FIX_STOPPED);
         case alertBADCREDS:
            return FormatString (IDS_ALERT_FIX_BADCREDS);
         case alertOVERALLOC:
            return FormatString (IDS_ALERT_FIX_AGG_ALLOC);
         case alertSTATE_NO_VNODE:
            return FormatString (IDS_ALERT_FIX_STATE_NO_VNODE);
         case alertSTATE_NO_SERVICE:
            return FormatString (IDS_ALERT_FIX_STATE_NO_SERVICE);
         case alertSTATE_OFFLINE:
            return FormatString (IDS_ALERT_FIX_STATE_OFFLINE);
         }
      }

   return NULL;
}
Exemplo n.º 4
0
BOOL GetPreferencesInfo (LPIDENT lpi, LPTSTR pszPath, WORD *pwVer)
{
   if (lpi == NULL)
      return FALSE;

   // HKCU\Software\...\SVRMgr + \CellName
   //
   lstrcpy (pszPath, REGSTR_SETTINGS_PREFS);
   lstrcat (pszPath, TEXT("\\"));
   lpi->GetCellName (&pszPath[ lstrlen(pszPath) ]);

   // HKCU\Software\...\SVRMgr\CellName + \ServerName
   //
   lstrcat (pszPath, TEXT("\\"));
   lpi->GetLongServerName (&pszPath[ lstrlen(pszPath) ]);

   *pwVer = wVerSERVER_PREF;

   if (lpi->fIsService())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Services\ServiceName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, SERVICES_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetServiceName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerSERVICE_PREF;
      }
   else if (lpi->fIsAggregate())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Aggs\AggregateName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, AGGREGATES_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetAggregateName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerAGGREGATE_PREF;
      }
   else if (lpi->fIsFileset())
      {
      // HKCU\Software\...\SVRMgr\CellName\ServerName + \Filesets\FilesetName
      //
      lstrcat (pszPath, TEXT("\\"));
      lstrcat (pszPath, FILESETS_KW);
      lstrcat (pszPath, TEXT("\\"));
      lpi->GetFilesetName (&pszPath[ lstrlen(pszPath) ]);
      *pwVer = wVerFILESET_PREF;
      }

   return TRUE;
}
Exemplo n.º 5
0
void Filesets_OnSelect (HWND hDlg)
{
   LPIDENT lpi = Filesets_GetSelected (hDlg);

   if (!lpi || !lpi->fIsFileset())
      {
      EnableWindow (GetDlgItem (hDlg, IDC_SET_REP), FALSE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_DELETE), FALSE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_SETQUOTA), FALSE);
      }
   else
      {
      StartTask (taskSET_SELECT, hDlg, lpi);
      }
}
Exemplo n.º 6
0
void Server_Salvage_OnAggregate (HWND hDlg, LPIDENT lpi)
{
   LPIDENT lpiServer;
   if ((lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER))) != NULL)
      {
      LPIDENT lpiAggregate;
      if ((lpiAggregate = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_AGGREGATE))) != NULL)
         {
         LPSET_ENUM_TO_COMBOBOX_PACKET lpp = New (SET_ENUM_TO_COMBOBOX_PACKET);
         memset (lpp, 0x00, sizeof(SET_ENUM_TO_COMBOBOX_PACKET));
         lpp->hCombo = GetDlgItem (hDlg, IDC_FILESET);
         lpp->lpiServer = lpiServer;
         lpp->lpiAggregate = lpiAggregate;
         lpp->lpiSelect = ((lpiServer == lpi) && (lpi->fIsFileset())) ? (lpi->GetFileset()) : NULL;
         StartTask (taskSET_ENUM_TO_COMBOBOX, hDlg, lpp);
         }
      }
}
Exemplo n.º 7
0
LPTSTR Alert_GetQuickDescription (LPIDENT lpi)
{
   LPTSTR pszStatus = NULL;

   size_t cAlerts;
   if ((cAlerts = Alert_GetCount (lpi)) <= 1)
      pszStatus = Alert_GetDescription (lpi, 0, FALSE);
   else if (lpi->fIsServer())
      pszStatus = FormatString (IDS_SERVER_MULTIPLE_PROBLEMS, TEXT("%lu"), cAlerts);
   else if (lpi->fIsService())
      pszStatus = FormatString (IDS_SERVICE_MULTIPLE_PROBLEMS, TEXT("%lu"), cAlerts);
   else if (lpi->fIsAggregate())
      pszStatus = FormatString (IDS_AGGREGATE_MULTIPLE_PROBLEMS, TEXT("%lu"), cAlerts);
   else if (lpi->fIsFileset())
      pszStatus = FormatString (IDS_FILESET_MULTIPLE_PROBLEMS, TEXT("%lu"), cAlerts);

   return pszStatus;
}
Exemplo n.º 8
0
void Filesets_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
{
   if (!ptScreen.x && !ptScreen.y)
      {
      RECT rWindow;
      GetWindowRect (hList, &rWindow);
      ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
      ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
      Filesets_ShowParticularPopupMenu (hList, ptScreen, NULL);
      }
   else if (FL_HitTestForHeaderBar (hList, ptList))
      {
      HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
      DisplayContextMenu (hm, ptScreen, hList);
      }
   else
      {
      LPIDENT lpi = Filesets_GetFocused (GetParent (hList), &ptList);
      if (lpi && (lpi != Filesets_GetSelected (GetParent (hList))))
         {
         lpi = NULL; // right-click on item other than highlighted one?
         }

      if (lpi && lpi->fIsFileset())
         {
         Filesets_ShowParticularPopupMenu (hList, ptScreen, lpi);
         }
      else if (lpi && lpi->fIsAggregate())
         {
         Aggregates_ShowParticularPopupMenu (hList, ptScreen, lpi);
         }
      else if (lpi && lpi->fIsServer())
         {
         Server_ShowParticularPopupMenu (hList, ptScreen, lpi);
         }
      else if (!lpi) // display the _NONE menu? (no menu if it's a cell ident)
         {
         Filesets_ShowParticularPopupMenu (hList, ptScreen, lpi);
         }
      }
}
Exemplo n.º 9
0
void Server_Salvage_OnEndTask_EnumAggregates (HWND hDlg, LPIDENT lpi, LPTASKPACKET ptp)
{
   // We'll refill the Aggregates list any time the user selected a new server;
   // and whenever it gets filled, we must next fill the filesets list.
   //
   LPIDENT lpiServer;
   if ((lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER))) != NULL)
      {
      LPIDENT lpiAggregate;
      if ((lpiAggregate = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_AGGREGATE))) != NULL)
         {
         LPSET_ENUM_TO_COMBOBOX_PACKET lpp = New (SET_ENUM_TO_COMBOBOX_PACKET);
         memset (lpp, 0x00, sizeof(SET_ENUM_TO_COMBOBOX_PACKET));
         lpp->hCombo = GetDlgItem (hDlg, IDC_FILESET);
         lpp->lpiServer = lpiServer;
         lpp->lpiAggregate = lpiAggregate;
         lpp->lpiSelect = ((lpiServer == lpi->GetServer()) && (lpi->fIsFileset())) ? (lpi) : NULL;
         StartTask (taskSET_ENUM_TO_COMBOBOX, hDlg, lpp);
         }
      }
}
Exemplo n.º 10
0
void Server_Salvage_OnInitDialog (HWND hDlg, LPIDENT lpi)
{
   CheckDlgButton (hDlg, IDC_AGGREGATE_ALL, (lpi->fIsServer()) ? TRUE : FALSE);
   CheckDlgButton (hDlg, IDC_FILESET_ALL,  (lpi->fIsFileset()) ? FALSE : TRUE);

   EnableWindow (GetDlgItem (hDlg, IDC_SERVER), FALSE);
   EnableWindow (GetDlgItem (hDlg, IDC_AGGREGATE), FALSE);
   EnableWindow (GetDlgItem (hDlg, IDC_AGGREGATE_ALL), FALSE);
   EnableWindow (GetDlgItem (hDlg, IDC_FILESET), FALSE);
   EnableWindow (GetDlgItem (hDlg, IDC_FILESET_ALL), FALSE);
   EnableWindow (GetDlgItem (hDlg, IDOK), FALSE);

   LPSVR_ENUM_TO_COMBOBOX_PACKET lpp = New (SVR_ENUM_TO_COMBOBOX_PACKET);
   memset (lpp, 0x00, sizeof(SVR_ENUM_TO_COMBOBOX_PACKET));
   lpp->hCombo = GetDlgItem (hDlg, IDC_SERVER);
   lpp->lpiSelect = lpi->GetServer();
   StartTask (taskSVR_ENUM_TO_COMBOBOX, hDlg, lpp);

   CheckDlgButton (hDlg, IDC_SALVAGE_SIMUL, TRUE);
   CreateSpinner (GetDlgItem(hDlg,IDC_SALVAGE_NUM), 10, FALSE, 2, 4, 12);
}
Exemplo n.º 11
0
LPOBJECTALERTS Alert_GetObjectAlerts (LPIDENT lpi, BOOL fAlwaysServer, ULONG *pStatus)
{
   LPOBJECTALERTS lpoa = NULL;

   if (fAlwaysServer || lpi->fIsServer())
      {
      LPSERVER_PREF lpsp;
      if ((lpsp = (LPSERVER_PREF)lpi->GetServer()->GetUserParam()) != NULL)
         {
         lpoa = &lpsp->oa;
         }
      }
   else if (lpi->fIsService())
      {
      LPSERVICE_PREF lpsp;
      if ((lpsp = (LPSERVICE_PREF)lpi->GetUserParam()) != NULL)
         {
         lpoa = &lpsp->oa;
         }
      }
   else if (lpi->fIsAggregate())
      {
      LPAGGREGATE_PREF lpap;
      if ((lpap = (LPAGGREGATE_PREF)lpi->GetUserParam()) != NULL)
         {
         lpoa = &lpap->oa;
         }
      }
   else if (lpi->fIsFileset())
      {
      LPFILESET_PREF lpfp;
      if ((lpfp = (LPFILESET_PREF)lpi->GetUserParam()) != NULL)
         {
         lpoa = &lpfp->oa;
         }
      }

   return lpoa;
}
Exemplo n.º 12
0
void Server_Salvage_Results_OnInitDialog (HWND hDlg, LPIDENT lpiSalvage)
{
   TCHAR szServer[ cchNAME ];
   lpiSalvage->GetServerName (szServer);

   TCHAR szAggregate[ cchNAME ];
   if (!lpiSalvage->fIsServer())
      lpiSalvage->GetAggregateName (szAggregate);

   TCHAR szFileset[ cchNAME ];
   if (lpiSalvage->fIsFileset())
      lpiSalvage->GetFilesetName (szFileset);

   LPTSTR pszTitle;
   if (lpiSalvage->fIsServer())
      pszTitle = FormatString (IDS_SALVAGE_SVR, TEXT("%s"), szServer);
   else if (lpiSalvage->fIsAggregate())
      pszTitle = FormatString (IDS_SALVAGE_AGG, TEXT("%s%s"), szServer, szAggregate);
   else // (lpiSalvage->fIsFileset())
      pszTitle = FormatString (IDS_SALVAGE_SET, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
   SetDlgItemText (hDlg, IDC_SALVAGE_TITLE, pszTitle);
   FreeString (pszTitle);
}
Exemplo n.º 13
0
void Command_OnProperties (LPIDENT lpi)
{
   if (lpi)
      {
      size_t nAlerts = Alert_GetCount (lpi);

      if (lpi->fIsServer())
         {
         Server_ShowProperties (lpi, nAlerts);
         }
      else if (lpi->fIsService())
         {
         Services_ShowProperties (lpi, nAlerts);
         }
      else if (lpi->fIsAggregate())
         {
         Aggregates_ShowProperties (lpi, nAlerts);
         }
      else if (lpi->fIsFileset())
         {
         Filesets_ShowProperties (lpi, nAlerts);
         }
      }
}
Exemplo n.º 14
0
void DispatchNotification_MainThread (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
{
   LPIDENT lpiEvt = pParams->lpi1;

   // There are several notifications which are sent when beginning or ending
   // lengthy operations.  These "actions" each get a window indicating
   // progress, and get added to our ongoing list of actions-in-progress.
   //
   ActionNotification_MainThread (evt, pParams);

   // The real reason for this routine is as a dispatcher for the AFSClass's
   // notifications: various windows throughout the app register themselves
   // with this dispatcher, and thereby get a message whenever a particular
   // event of interest to that window happens.  Just what notifications
   // are "of interest" is specified by the window when it registers with
   // this dispatcher.
   //
   for (size_t iDispatch = 0; iDispatch < nDispatchList; ++iDispatch)
      {
      if (!aDispatchList[ iDispatch ].hWnd)
         continue;

      BOOL fDispatch = FALSE;

      // WHEN_CELL_OPENED + NULL      -> notify if any new cell is opened
      // WHEN_OBJECT_CHANGES + NULL   -> notify if anything at all changes
      // WHEN_OBJECT_CHANGES + lpi    -> notify if this object changes
      // WHEN_SVCS(etc)_CHANGE + NULL -> notify if any service at all changes
      // WHEN_SVCS(etc)_CHANGE + lpi  -> notify if any svc on this svr changes

      switch (aDispatchList[ iDispatch ].when)
         {
         case WHEN_CELL_OPENED:
            if (evt == evtCreate && lpiEvt->fIsCell())
               fDispatch = TRUE;
            break;

         case WHEN_OBJECT_CHANGES:
            if ( (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                 (aDispatchList[ iDispatch ].lpiObject == NULL) )
               {
               if (evt != evtCreate)
                  fDispatch = TRUE;
               }
            break;

         case WHEN_SVRS_CHANGE:
            switch (evt)
               {
               case evtInvalidate:
               case evtRefreshServersBegin:
               case evtRefreshServersEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && lpiEvt->fIsCell())
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsServer())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtCell = lpiEvt->GetCell();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtCell)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_SETS_CHANGE:
            switch (evt)
               {
               case evtInvalidate:
               case evtRefreshFilesetsBegin:
               case evtRefreshFilesetsEnd:
                  {
                  LPIDENT lpiEvtSvr = NULL;
                  if (lpiEvt && !lpiEvt->fIsCell())
                     lpiEvtSvr = lpiEvt->GetServer();

                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt)    ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer() || lpiEvt->fIsAggregate()))
                        fDispatch = TRUE;
                     }
                  }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsFileset())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtAgg = lpiEvt->GetAggregate();
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtAgg)
                           fDispatch = TRUE;
                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_AGGS_CHANGE:
            switch (evt)
               {
               case evtRefreshAggregatesBegin:
               case evtRefreshAggregatesEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer()))
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsAggregate())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_SVCS_CHANGE:
            switch (evt)
               {
               case evtRefreshServicesBegin:
               case evtRefreshServicesEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer()))
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsService())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;
         }

      if (fDispatch)
         {
         LPNOTIFYSTRUCT lpns = New (NOTIFYSTRUCT);
         lpns->hwndTarget = aDispatchList[ iDispatch ].hWnd;
         lpns->evt = evt;
         memcpy (&lpns->Params, pParams, sizeof(NOTIFYPARAMS));
         lpns->Params.lpUser = aDispatchList[ iDispatch ].lpUser;

         PostMessage (aDispatchList[ iDispatch ].hWnd,
                      WM_NOTIFY_FROM_DISPATCH,
                      (WPARAM)0,
                      (LPARAM)lpns);
         }
      }
}
Exemplo n.º 15
0
void DispatchNotification_AltThread (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
{
   LPIDENT lpiEvt = pParams->lpi1;

   switch (evt)
      {
      case evtRefreshStatusEnd:
         if (lpiEvt && (lpiEvt->fIsService() || lpiEvt->fIsAggregate() || lpiEvt->fIsFileset()))
            {
            Alert_RemoveSecondary (lpiEvt);
            Alert_Scout_QueueCheckServer (lpiEvt);
            }
         if (lpiEvt && lpiEvt->fIsServer())
            {
            LPSERVER_PREF lpsp;
            if ((lpsp = (LPSERVER_PREF)lpiEvt->GetUserParam()) != NULL)
               {
               LPSERVER lpServer;
               if ((lpServer = lpiEvt->OpenServer()) != NULL)
                  {
                  if (lpsp->fIsMonitored != lpServer->fIsMonitored())
                     {
                     g.sub = Subsets_SetMonitor (g.sub, lpiEvt, lpServer->fIsMonitored());
                     UpdateDisplay_ServerWindow (FALSE, lpiEvt);
                     }
                  lpsp->fIsMonitored = lpServer->fIsMonitored();
                  lpServer->Close();
                  }
               }

            Alert_Scout_ServerStatus (lpiEvt, pParams->status);
            }
         break;

      // When we get a create request, use the object's Get/SetUserParam()
      // methods to attach an allocated structure to the thing--the structure
      // contains the preferences for the server/fileset/etc (for instance,
      // its warning threshholds, any current scout problems, etc).
      // On delete requests, free that structure.
      //
      case evtCreate:
         if (lpiEvt->fIsServer())
            {
            PVOID pPref = Server_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);

            // Should this server be monitored?
            //
            if (!Subsets_fMonitorServer (g.sub, lpiEvt))
               {
               LPSERVER lpServer;
               if ((lpServer = lpiEvt->OpenServer()) != NULL)
                  {
                  lpServer->SetMonitor (FALSE);
                  lpServer->Close();
                  }
               }

            Alert_Scout_SetOutOfDate (lpiEvt);
            }
         else if (lpiEvt->fIsService())
            {
            PVOID pPref = Services_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         else if (lpiEvt->fIsAggregate())
            {
            PVOID pPref = Aggregates_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         else if (lpiEvt->fIsFileset())
            {
            PVOID pPref = Filesets_LoadPreferences (lpiEvt);
            lpiEvt->SetUserParam (pPref);
            }
         if (!lpiEvt->fIsCell())
            {
            Alert_Scout_QueueCheckServer (lpiEvt);
            }
         break;

      // When we get a create request, use the object's Get/SetUserParam()
      // methods to attach an allocated structure to the thing--the structure
      // contains the preferences for the server/fileset/etc (for instance,
      // its warning threshholds, any current scout problems, etc).
      // On delete requests, free that structure.
      //
      case evtDestroy:
         if (lpiEvt->fIsServer())
            {
            PVOID pPref = lpiEvt->GetUserParam();
            lpiEvt->SetUserParam (0);
            if (pPref)  Delete (pPref);
            }
         else if (lpiEvt->fIsService() || lpiEvt->fIsAggregate() || lpiEvt->fIsFileset())
            {
            Alert_RemoveSecondary (lpiEvt);
            PVOID pPref = lpiEvt->GetUserParam();
            lpiEvt->SetUserParam (0);
            if (pPref)  Delete (pPref);
            }
         break;
      }
}
Exemplo n.º 16
0
void StartContextCommand (HWND hDialog,
                          LPIDENT lpiRepresentedByWindow,
                          LPIDENT lpiChosenByClick,
                          int cmd)
{
   CHILDTAB iTab = Server_GetDisplayedTab (hDialog);
   LPIDENT lpi = (lpiChosenByClick) ? lpiChosenByClick : lpiRepresentedByWindow;

   if (lpi && lpi->fIsCell())
      lpi = NULL;

   switch (cmd)
      {
      case M_COLUMNS:
         if (iTab == tabSERVICES)
            ShowColumnsDialog (hDialog, &gr.viewSvc);
         else if (iTab == tabAGGREGATES)
            ShowColumnsDialog (hDialog, &gr.viewAgg);
         else if (iTab == tabFILESETS)
            ShowColumnsDialog (hDialog, &gr.viewSet);
         else
            ShowColumnsDialog (hDialog, NULL);
         break;

      case M_SVR_VIEW_ONEICON:
      case M_SVR_VIEW_TWOICONS:
      case M_SVR_VIEW_STATUS:
         Command_OnIconView (hDialog, TRUE, iTab, cmd);
         break;

      case M_VIEW_ONEICON:
      case M_VIEW_TWOICONS:
      case M_VIEW_STATUS:
         Command_OnIconView (hDialog, FALSE, iTab, cmd);
         break;

      case M_PROPERTIES:
         if (lpi)
            Command_OnProperties (lpi);
         break;

      case M_SUBSET:
         ShowSubsetsDialog();
         break;

      case M_REFRESHALL:
         if (g.lpiCell)
            StartTask (taskREFRESH, NULL, g.lpiCell);
         break;

      case M_REFRESH:
         if (lpi)
            StartTask (taskREFRESH, NULL, lpi);
         else if (g.lpiCell)
            StartTask (taskREFRESH, NULL, g.lpiCell);
         break;

      case M_SYNCVLDB:
         if (lpi)
            Server_SyncVLDB (lpi);
         break;

      case M_SALVAGE:
         if (lpi)
            Server_Salvage (lpi);
         break;

      case M_SET_CREATE:
         Filesets_Create (lpi);
         break;

      case M_SET_REPLICATION:
         if (lpi && lpi->fIsFileset())
            Filesets_ShowReplication (Server_GetWindowForChild (hDialog), lpi);
         break;

      case M_SET_DELETE:
         if (lpi && lpi->fIsFileset())
            Filesets_Delete (lpi);
         break;

      case M_SET_CLONE:
         Filesets_Clone (lpi);
         break;

      case M_SET_DUMP:
         if (lpi && lpi->fIsFileset())
            Filesets_Dump (lpi);
         break;

      case M_SET_RESTORE:
         Filesets_Restore (lpi);
         break;

      case M_SET_RELEASE:
         if (lpi && lpi->fIsFileset())
            Filesets_Release (lpi);
         break;

      case M_SET_MOVETO:
         if (lpi && lpi->fIsFileset())
            Filesets_ShowMoveTo (lpi, NULL);
         break;

      case M_SET_SETQUOTA:
         if (lpi && lpi->fIsFileset())
            Filesets_SetQuota (lpi);
         break;

      case M_SET_LOCK:
         if (lpi && lpi->fIsFileset())
            StartTask (taskSET_LOCK, NULL, lpi);
         break;

      case M_SET_UNLOCK:
         if (lpi && !lpi->fIsService())
            StartTask (taskSET_UNLOCK, NULL, lpi);
         else if (!lpi && g.lpiCell)
            StartTask (taskSET_UNLOCK, NULL, g.lpiCell);
         break;

      case M_SET_RENAME:
         if (lpi && lpi->fIsFileset())
            Filesets_ShowRename (lpi);
         break;

      case M_SVR_OPEN:
         if (lpi && lpi->fIsServer())
            StartTask (taskSVR_GETWINDOWPOS, g.hMain, lpi);
         break;

      case M_SVR_CLOSE:
         if (lpi && lpi->fIsServer())
            Server_Close (lpi);
         break;

      case M_SVR_CLOSEALL:
         Server_CloseAll (TRUE);
         break;

      case M_SVR_SECURITY:
         Server_Security (lpi);
         break;

      case M_SVR_HOSTS:
         Server_Hosts (lpi);
         break;

      case M_SVR_INSTALL:
         Server_Install (lpi);
         break;

      case M_SVR_UNINSTALL:
         Server_Uninstall (lpi);
         break;

      case M_SVR_PRUNE:
         Server_Prune (lpi);
         break;

      case M_SVR_GETDATES:
         Server_GetDates (lpi);
         break;

      case M_EXECUTE:
         Server_Execute (lpi);
         break;

      case M_VIEWLOG:
         if (lpi && lpi->fIsService())
            Services_ShowServiceLog (lpi);
         else
            Services_ShowServerLog (lpi);
         break;

      case M_SVR_MONITOR:
         if (lpi && lpi->fIsServer())
            StartTask (taskSVR_MONITOR_ONOFF, NULL, lpi);
         break;

      case M_SVC_CREATE:
         if (!lpi)
            Services_Create (NULL);
         else
            Services_Create (lpi->GetServer());
         break;

      case M_SVC_DELETE:
         if (lpi && lpi->fIsService())
            Services_Delete (lpi);
         break;

      case M_SVC_START:
         if (lpi && lpi->fIsService())
            Services_Start (lpi);
         break;

      case M_SVC_STOP:
         if (lpi && lpi->fIsService())
            Services_Stop (lpi);
         break;

      case M_SVC_RESTART:
         if (lpi && lpi->fIsService())
            Services_Restart (lpi);
         break;

      case M_CELL_OPEN:
         OpenCellDialog();
         break;

      case M_CREDENTIALS:
         NewCredsDialog();
         break;

      case M_OPTIONS:
         ShowOptionsDialog();
         break;

      case M_HELP:
         WinHelp (g.hMain, cszHELPFILENAME, HELP_FINDER, 0);
         break;

      case M_HELP_FIND:
         Help_FindCommand();
         break;

      case M_HELP_XLATE:
         Help_FindError();
         break;

      case M_ABOUT:
         Help_About();
         break;
      }
}
Exemplo n.º 17
0
LPTSTR Alert_GetDescriptionFunc (LPIDENT lpiPrimary, size_t iAlertPrimary, LPIDENT lpiServer, BOOL fFull)
{
   LPOBJECTALERTS lpoa;
   if ((lpoa = Alert_GetObjectAlerts (lpiPrimary)) != NULL)
      {
      int ids;
      TCHAR szServer[ cchRESOURCE ];
      TCHAR szService[ cchRESOURCE ];
      TCHAR szAggregate[ cchRESOURCE ];
      TCHAR szFileset[ cchRESOURCE ];

      switch (lpoa->aAlerts[ iAlertPrimary ].alert)
         {
         case alertTIMEOUT:
            ids = (fFull) ? IDS_ALERT_DESCFULL_TIMEOUT : IDS_ALERT_DESCSHORT_TIMEOUT;
            lpiPrimary->GetServerName (szServer);
            return FormatString (ids, TEXT("%s%t%e"), szServer, &lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.stLastAttempt, lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.status);

         case alertFULL:
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            if (lpiPrimary->fIsAggregate())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_FULL : IDS_ALERT_DESCSHORT_AGG_FULL;
               return FormatString (ids, TEXT("%s%s%d%.1B"), szServer, szAggregate, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning);
               }
            else if (lpiPrimary->fIsFileset())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_SET_FULL : IDS_ALERT_DESCSHORT_SET_FULL;
               lpiPrimary->GetFilesetName (szFileset);
               return FormatString (ids, TEXT("%s%s%s%d%.1B"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning);
               }
            break;

         case alertNO_VLDBENT:
            ids = (fFull) ? IDS_ALERT_DESCFULL_NO_VLDBENT : IDS_ALERT_DESCSHORT_NO_VLDBENT;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset);

         case alertNO_SVRENT:
            if (lpiPrimary->fIsFileset())
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_SET : IDS_ALERT_DESCSHORT_NO_SVRENT_SET;
               lpiPrimary->GetServerName (szServer);
               lpiPrimary->GetAggregateName (szAggregate);
               lpiPrimary->GetFilesetName (szFileset);
               return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset);
               }
            else
               {
               ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_AGG : IDS_ALERT_DESCSHORT_NO_SVRENT_AGG;
               lpiPrimary->GetServerName (szServer);
               lpiPrimary->GetAggregateName (szAggregate);
               return FormatString (ids, TEXT("%s%s"), szServer, szAggregate);
               }
            break;

         case alertSTOPPED:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STOPPED : IDS_ALERT_DESCSHORT_STOPPED;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetServiceName (szService);
            return FormatString (ids, TEXT("%s%s%t%t%lu"), szServer, szService, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stStopped, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stLastError, lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.errLastError);

         case alertBADCREDS:
            ids = (fFull) ? IDS_ALERT_DESCFULL_BADCREDS : IDS_ALERT_DESCSHORT_BADCREDS;
            lpiPrimary->GetServerName (szServer);
            return FormatString (ids, TEXT("%s"), szServer);

         case alertOVERALLOC:
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_ALLOC : IDS_ALERT_DESCSHORT_AGG_ALLOC;
            return FormatString (ids, TEXT("%s%s%.1B%.1B"), szServer, szAggregate, 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckCapacity), 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckAllocated));

         case alertSTATE_NO_VNODE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_VNODE : IDS_ALERT_DESCSHORT_STATE_NO_VNODE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);

         case alertSTATE_NO_SERVICE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_SERVICE : IDS_ALERT_DESCSHORT_STATE_NO_SERVICE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);

         case alertSTATE_OFFLINE:
            ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_OFFLINE : IDS_ALERT_DESCSHORT_STATE_OFFLINE;
            lpiPrimary->GetServerName (szServer);
            lpiPrimary->GetAggregateName (szAggregate);
            lpiPrimary->GetFilesetName (szFileset);
            return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State);
         }
      }

   return NULL;
}