mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
Merge pull request #734 from MihaelaStoica/CA-186234
CA-186234: Group the issues found in a pool when retrieving CIS analy…
This commit is contained in:
commit
d9cd979a44
@ -36,6 +36,7 @@ using System.Net;
|
||||
using System.Web.Script.Serialization;
|
||||
using XenAdmin.Model;
|
||||
using XenAPI;
|
||||
using System.Linq;
|
||||
|
||||
namespace XenAdmin.Actions
|
||||
{
|
||||
@ -84,7 +85,7 @@ namespace XenAdmin.Actions
|
||||
log.Info("Saving analysis result");
|
||||
Dictionary<string, string> newConfig = Pool.health_check_config;
|
||||
newConfig[HealthCheckSettings.REPORT_ANALYSIS_SEVERITY] = GetMaxSeverity(analysisResult).ToString();
|
||||
newConfig[HealthCheckSettings.REPORT_ANALYSIS_ISSUES_DETECTED] = analysisResult.Count.ToString();
|
||||
newConfig[HealthCheckSettings.REPORT_ANALYSIS_ISSUES_DETECTED] = GetDistinctIssueCount(analysisResult).ToString();
|
||||
newConfig[HealthCheckSettings.REPORT_ANALYSIS_UPLOAD_UUID] = Pool.HealthCheckSettings.UploadUuid;
|
||||
newConfig[HealthCheckSettings.REPORT_ANALYSIS_UPLOAD_TIME] = Pool.HealthCheckSettings.LastSuccessfulUpload;
|
||||
Pool.set_health_check_config(Session, Pool.opaque_ref, newConfig);
|
||||
@ -111,6 +112,12 @@ namespace XenAdmin.Actions
|
||||
return maxSeverity;
|
||||
}
|
||||
|
||||
private int GetDistinctIssueCount(List<AnalysisResult> issues)
|
||||
{
|
||||
// get the number of distinct issues (by name)
|
||||
return issues.Select(issue => issue.name).Distinct().Count();
|
||||
}
|
||||
|
||||
private List<AnalysisResult> GetAnalysisResult(string diagnosticToken, string uploadUuid)
|
||||
{
|
||||
var urlString = string.Format("{0}{1}?upload_uuid={2}", diagnosticDomainName, DIAG_RESULT_URL, uploadUuid);
|
||||
@ -137,7 +144,7 @@ namespace XenAdmin.Actions
|
||||
private class AnalysisResult
|
||||
{
|
||||
public string severity { get; set; }
|
||||
/*public string extra_information { get; set; }
|
||||
public string extra_information { get; set; }
|
||||
public string owner { get; set; }
|
||||
public string crm_id { get; set; }
|
||||
public string id { get; set; }
|
||||
@ -152,7 +159,7 @@ namespace XenAdmin.Actions
|
||||
public string upload_description { get; set; }
|
||||
public string upload_id { get; set; }
|
||||
public string recommendations { get; set; }
|
||||
public string env_identifier { get; set; }*/
|
||||
public string env_identifier { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user