From 644562f25238201d7152e1d5a5f270961c713d9a Mon Sep 17 00:00:00 2001
From: Thomas Wohllaib <tomwoh@microsoft.com>
Date: Thu, 23 May 2024 13:44:36 -0700
Subject: [PATCH 1/3] Update PrivateCloud.DiagnosticInfo.psm1

Run get-clusterlog sequentially.
---
 .../PrivateCloud.DiagnosticInfo.psm1                       | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1 b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
index 3686ee6..6e366de 100644
--- a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
+++ b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
@@ -2204,10 +2204,7 @@ function Get-SddcDiagnosticInfo
             {
                 $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -UseLocalTime -Netft
             }
-        }
-
-        if ($S2DEnabled) {
-            $JobStatic += Start-Job -Name ClusterHealthLogs {
+            if ($S2DEnabled) {
                 $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -Health -UseLocalTime
             }
         }
@@ -6224,4 +6221,4 @@ Export-ModuleMember -Alias * -Function 'Get-SddcDiagnosticInfo',
     'Show-StorageCounters',
     'Get-SpacesTimeline',
     'Set-SddcDiagnosticArchiveJobParameters',
-    'Get-SddcDiagnosticArchiveJobParameters'
\ No newline at end of file
+    'Get-SddcDiagnosticArchiveJobParameters'

From 36bbf7d54ec04294284eed2a276ccbc41c08ced1 Mon Sep 17 00:00:00 2001
From: Thomas Wohllaib <tomwoh@microsoft.com>
Date: Thu, 23 May 2024 13:48:53 -0700
Subject: [PATCH 2/3] Update PrivateCloud.DiagnosticInfo.psm1

update variable $S2DEnabled to $using:S2DEnabled
---
 PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1 b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
index 6e366de..c422c29 100644
--- a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
+++ b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
@@ -2204,7 +2204,7 @@ function Get-SddcDiagnosticInfo
             {
                 $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -UseLocalTime -Netft
             }
-            if ($S2DEnabled) {
+            if ($using:S2DEnabled) {
                 $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -Health -UseLocalTime
             }
         }

From b774bba289f4c059fbfe5fda25a19bb2eb10051a Mon Sep 17 00:00:00 2001
From: Thomas Wohllaib <tomwoh@microsoft.com>
Date: Tue, 4 Jun 2024 10:55:32 -0700
Subject: [PATCH 3/3] Update PrivateCloud.DiagnosticInfo.psm1

CAU log collection is also using the same log collection interface as the collection for the netft, health and cluster logs, moved CAU log collection to the same job so that it would be done sequentially for reliability
---
 .../PrivateCloud.DiagnosticInfo.psm1          | 32 ++++++++-----------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1 b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
index c422c29..0e24155 100644
--- a/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
+++ b/PrivateCloud.DiagnosticInfo/PrivateCloud.DiagnosticInfo.psm1
@@ -1962,23 +1962,8 @@ function Get-SddcDiagnosticInfo
                     Export-Clixml ($using:Path + "GetClusterQuorum.XML")
                 }
                 catch { Show-Warning("Unable to get Cluster Quorum.  `nError="+$_.Exception.Message) }
-            }
-
-            $JobStatic += start-job -Name CauDebugTrace {
-                try {
-
-                    # SCDT returns a fileinfo object for the saved ZIP on the pipeline; discard (allow errors/warnings to flow as normal)
-
-                    if ((Get-Command Save-CauDebugTrace).Parameters.ContainsKey("FeatureUpdateLogs")) {
-                        $null = Save-CauDebugTrace -Cluster $using:AccessNode -FeatureUpdateLogs All -FilePath $using:Path
-                    }
-                    else {
-                        $null = Save-CauDebugTrace -Cluster $using:AccessNode -FilePath $using:Path
-                    }
-                }
-                catch { Show-Warning("Unable to get CAU debug trace.  `nError="+$_.Exception.Message) }
-            }
-
+            } 
+            
         } else {
             Show-Update "... Skip gather of cluster configuration since cluster is not available"
         }
@@ -2196,7 +2181,7 @@ function Get-SddcDiagnosticInfo
         }
 
         # Events, cmd, reports, et.al.
-        Show-Update "Start gather of system info, cluster/netft/health logs, reports and dump files ..."
+        Show-Update "Start gather of system info, cluster/netft/health/CAU logs, reports and dump files ..."
 
         $JobStatic += Start-Job -Name ClusterLogs {
             $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -UseLocalTime
@@ -2207,6 +2192,17 @@ function Get-SddcDiagnosticInfo
             if ($using:S2DEnabled) {
                 $null = Get-ClusterLog -Node $using:ClusterNodes.Name -Destination $using:Path -Health -UseLocalTime
             }
+
+            try {
+                    # SCDT returns a fileinfo object for the saved ZIP on the pipeline; discard (allow errors/warnings to flow as normal)
+                    if ((Get-Command Save-CauDebugTrace).Parameters.ContainsKey("FeatureUpdateLogs")) {
+                        $null = Save-CauDebugTrace -Cluster $using:AccessNode -FeatureUpdateLogs All -FilePath $using:Path
+                    }
+                    else {
+                        $null = Save-CauDebugTrace -Cluster $using:AccessNode -FilePath $using:Path
+                    }
+                }
+                catch { Show-Warning("Unable to get CAU debug trace.  `nError="+$_.Exception.Message) }
         }
 
         $JobStatic += $ClusterNodes.Name |% {