Skip to content

Commit

Permalink
Improve backup check
Browse files Browse the repository at this point in the history
  • Loading branch information
franklupo committed Nov 29, 2020
1 parent d02358e commit 713e368
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
11 changes: 1 addition & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Diagnostic/bin/Debug/netcoreapp3.1/cv4pve-diag.dll",
"args": [
"--host",
"10.92.90.91",
"--username",
"test",
"--password",
"test",
"--output",
"text"
],
"args": [],
"cwd": "${workspaceFolder}/src/Corsinvest.ProxmoxVE.Diagnostic",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
Expand Down
19 changes: 16 additions & 3 deletions src/Corsinvest.ProxmoxVE.Diagnostic.Api/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,6 @@ private static void CheckQemu(ClusterInfo clusterInfo,
}
}



private static void CheckCommonVm(ClusterInfo clusterInfo,
List<DiagnosticResult> result,
Settings settings,
Expand All @@ -799,8 +797,10 @@ private static void CheckCommonVm(ClusterInfo clusterInfo,
.Select(a => a.vmid))
.Split(',');

var allInBackup = clusterInfo.Backups.Any(a => a.enabled == 1 && a.all == 1);

string vmId = vm.vmid.Value + "";
if (!vmsIdBackup.Contains(vmId))
if (!allInBackup && !vmsIdBackup.Contains(vmId))
{
result.Add(new DiagnosticResult
{
Expand All @@ -813,6 +813,19 @@ private static void CheckCommonVm(ClusterInfo clusterInfo,
});
}

//check disk no backup
result.AddRange(((List<(string Id, string Image)>)GetVmImages(vm))
.Where(a => a.Image.Contains("backup=0"))
.Select(a => new DiagnosticResult
{
Id = vm.vmid,
ErrorCode = "WV0001",
Description = $"Disk '{a.Id}' disabled for backup",
Context = DiagnosticResultContext.Qemu,
SubContext = "Backup",
Gravity = DiagnosticResultGravity.Critical,
}));

//check exists backup and recent
var regex = new Regex(@"^.*?:(.*?\/)?");
var foundBackup = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<Version>1.4.7</Version>
<Version>1.4.8</Version>
<Company>Corsinvest Srl</Company>
<Authors>Daniele Corsini</Authors>
<Copyright>Corsinvest Srl</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Version>1.3.6</Version>
<Version>1.3.7</Version>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyName>cv4pve-diag</AssemblyName>
<Company>Corsinvest Srl</Company>
Expand All @@ -20,9 +20,9 @@
<TrimmerRootAssembly Include="System.Net.WebClient" />

<!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Shell\Corsinvest.ProxmoxVE.Api.Shell.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.6.7" />
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.6.11" />

<!-- <ProjectReference Include="..\Corsinvest.ProxmoxVE.Diagnostic.Api\Corsinvest.ProxmoxVE.Diagnostic.Api.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Diagnostic.Api" Version="1.4.7" />
<PackageReference Include="Corsinvest.ProxmoxVE.Diagnostic.Api" Version="1.4.8" />
</ItemGroup>
</Project>

0 comments on commit 713e368

Please sign in to comment.