Bläddra i källkod

Merge pull request #13617 from wangkx/h21809

HPCC-21809 Add Exception field to report error in ws_machine

Reviewed-By: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 år sedan
förälder
incheckning
5823eece9d
2 ändrade filer med 49 tillägg och 23 borttagningar
  1. 24 18
      esp/scm/ws_machine.ecm
  2. 25 5
      esp/services/ws_machine/ws_machineService.cpp

+ 24 - 18
esp/scm/ws_machine.ecm

@@ -31,6 +31,7 @@ ESPStruct [nil_remove] DiskUsage
     int64 InUse;
     int64 Available;
     int PercentAvailable;
+    [min_ver("1.17")] string Exception;
 };
 
 ESPStruct [nil_remove] MachineUsage
@@ -38,6 +39,7 @@ ESPStruct [nil_remove] MachineUsage
     string Name;
     string NetAddress;
     string Description;
+    [min_ver("1.17")] string Exception;
     ESParray<ESPstruct DiskUsage> DiskUsages;
 };
 
@@ -52,6 +54,7 @@ ESPStruct [nil_remove] ComponentUsage
     string Type;
     string Name;
     string Description;
+    [min_ver("1.17")] string Exception;
     ESParray<ESPstruct MachineUsage> MachineUsages;
 };
 
@@ -59,6 +62,7 @@ ESPStruct [nil_remove] TargetClusterUsage
 {
     string Name;
     string Description;
+    [min_ver("1.17")] string Exception;
     ESParray<ESPstruct ComponentUsage> ComponentUsages;
 };
 
@@ -66,6 +70,7 @@ ESPStruct [nil_remove] NodeGroupUsage
 {
     string Name;
     string Description;
+    [min_ver("1.17")] string Exception;
     ESParray<ESPstruct ComponentUsage> ComponentUsages;
 };
 
@@ -165,27 +170,28 @@ ESPstruct MachineInfoEx
 {
     string Address;
     [min_ver("1.04")] string ConfigAddress;
-   string Name;
-   string ProcessType;
+    string Name;
+    string ProcessType;
     string DisplayType;
     string Description;
-   string AgentVersion;
-   string Contact;
-   string Location;
-   string UpTime;
-   string ComponentName;
-   string ComponentPath;
-   [min_ver("1.13")] string RoxieState;
-   [min_ver("1.13")] string RoxieStateDetails;
-   int    OS;
-   [min_ver("1.10")] int    ProcessNumber;
-   [min_ver("1.16")] unsigned Channels;
-   ESParray<ESPstruct ProcessorInfo> Processors;
-   ESParray<ESPstruct StorageInfo> Storage;
-   ESParray<ESPstruct SWRunInfo> Running;
-   ESPstruct StorageInfo PhysicalMemory;
-   ESPstruct StorageInfo VirtualMemory;
+    string AgentVersion;
+    string Contact;
+    string Location;
+    string UpTime;
+    string ComponentName;
+    string ComponentPath;
+    [min_ver("1.13")] string RoxieState;
+    [min_ver("1.13")] string RoxieStateDetails;
+    int    OS;
+    [min_ver("1.10")] int    ProcessNumber;
+    [min_ver("1.16")] unsigned Channels;
+    ESParray<ESPstruct ProcessorInfo> Processors;
+    ESParray<ESPstruct StorageInfo> Storage;
+    ESParray<ESPstruct SWRunInfo> Running;
+    ESPstruct StorageInfo PhysicalMemory;
+    ESPstruct StorageInfo VirtualMemory;
     ESPstruct ComponentInfo ComponentInfo;
+    [min_ver("1.17")] string Exception;
 };
 
 

+ 25 - 5
esp/services/ws_machine/ws_machineService.cpp

@@ -1753,7 +1753,10 @@ void Cws_machineEx::setProcessInfo(IEspContext& context, CMachineInfoThreadParam
             description.append("Failed in getting Machine Information");
         else
             description = response;
-        pMachineInfo->setDescription(description.str());
+        if (version < 1.17)
+            pMachineInfo->setDescription(description.str());
+        else
+            pMachineInfo->setException(description.str());
     }
     else
     {
@@ -2750,6 +2753,7 @@ void Cws_machineEx::getMachineUsage(IEspContext& context, CGetMachineUsageThread
 void Cws_machineEx::readComponentUsageResult(IEspContext& context, IPropertyTree* usageReq,
     const IPropertyTree* uniqueUsages, IArrayOf<IEspComponentUsage>& componentUsages)
 {
+    double version = context.getClientVersion();
     Owned<IPropertyTreeIterator> components= usageReq->getElements("Component");
     ForEach(*components)
     {
@@ -2774,14 +2778,20 @@ void Cws_machineEx::readComponentUsageResult(IEspContext& context, IPropertyTree
             IPropertyTree* uniqueMachineReqTree = uniqueUsages->queryPropTree(xpath);
             if (!uniqueMachineReqTree)
             {
-                machineUsage->setDescription("No data returns.");
+                if (version < 1.17)
+                    machineUsage->setDescription("No data returns.");
+                else
+                    machineUsage->setException("No data returns.");
                 machineUsages.append(*machineUsage.getClear());
                 continue;
             }
             const char* error = uniqueMachineReqTree->queryProp("@error");
             if (!isEmptyString(error))
             {
-                machineUsage->setDescription(error);
+                if (version < 1.17)
+                    machineUsage->setDescription(error);
+                else
+                    machineUsage->setException(error);
                 machineUsages.append(*machineUsage.getClear());
                 continue;
             }
@@ -2800,12 +2810,22 @@ void Cws_machineEx::readComponentUsageResult(IEspContext& context, IPropertyTree
                 xpath.setf("Folder[@path='%s']", aDiskPath);
                 IPropertyTree* folderTree = uniqueMachineReqTree->queryPropTree(xpath);
                 if (!folderTree)
-                    diskUsage->setDescription("No data returns.");
+                {
+                    if (version < 1.17)
+                        diskUsage->setDescription("No data returns.");
+                    else
+                        diskUsage->setException("No data returns.");
+                }
                 else
                 {
                     const char* error = folderTree->queryProp("@error");
                     if (!isEmptyString(error))
-                        diskUsage->setDescription(error);
+                    {
+                        if (version < 1.17)
+                            diskUsage->setDescription(error);
+                        else
+                            diskUsage->setException(error);
+                    }
                     else
                     {
                         diskUsage->setAvailable(folderTree->getPropInt64("@available"));