mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
Following code review, adds a few adjustments to the code.
This commit is contained in:
parent
b919565a5a
commit
2720d1bc23
@ -177,19 +177,19 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
if (selectedHosts != null && !selectedHosts.Contains(host))
|
||||
{
|
||||
string alertName = null;
|
||||
string alertUuid = null;
|
||||
if (SelectedUpdateAlert != null)
|
||||
{
|
||||
alertName = SelectedUpdateAlert.Name;
|
||||
alertUuid = SelectedUpdateAlert.uuid;
|
||||
}
|
||||
else if (FileFromDiskAlert != null)
|
||||
{
|
||||
alertName = FileFromDiskAlert.Name;
|
||||
alertUuid = FileFromDiskAlert.uuid;
|
||||
}
|
||||
|
||||
if (alertName != null)
|
||||
if (alertUuid != null)
|
||||
{
|
||||
if (isPatchApplied(alertName, host))
|
||||
if (isPatchApplied(alertUuid, host))
|
||||
{
|
||||
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_PATCH_ALREADY_APPLIED;
|
||||
}
|
||||
@ -202,12 +202,12 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
}
|
||||
}
|
||||
|
||||
private bool isPatchApplied(string name, Host host)
|
||||
private bool isPatchApplied(string uuid, Host host)
|
||||
{
|
||||
List<Pool_patch> hostPatches = host.AppliedPatches();
|
||||
foreach (Pool_patch patch in hostPatches)
|
||||
{
|
||||
if (patch.Name.Equals(name))
|
||||
if (patch.uuid.Equals(uuid))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
get { return _patch; }
|
||||
}
|
||||
|
||||
public Dictionary<Alert, string> AllDownloadedPatches = new Dictionary<Alert, string>();
|
||||
public Dictionary<string, string> AllDownloadedPatches = new Dictionary<string, string>();
|
||||
public readonly List<VDI> AllCreatedSuppPackVdis = new List<VDI>();
|
||||
public Dictionary<Host, VDI> SuppPackVdis = new Dictionary<Host, VDI>();
|
||||
|
||||
@ -65,16 +65,18 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
{
|
||||
flickerFreeListBox1.Items.Clear();
|
||||
if (SelectedUpdateAlert != null && String.IsNullOrEmpty(SelectedNewPatch)&&
|
||||
(!AllDownloadedPatches.Any(kvp => kvp.Key.uuid == SelectedUpdateAlert.uuid)
|
||||
|| String.IsNullOrEmpty(AllDownloadedPatches[SelectedUpdateAlert])
|
||||
|| !File.Exists(AllDownloadedPatches[SelectedUpdateAlert])))
|
||||
var selectedPatch = SelectedUpdateAlert != null ? ((XenServerPatchAlert)SelectedUpdateAlert).Patch : null;
|
||||
if (selectedPatch != null && String.IsNullOrEmpty(SelectedNewPatch) &&
|
||||
(!AllDownloadedPatches.Any(kvp => kvp.Key == selectedPatch.Uuid)
|
||||
|| String.IsNullOrEmpty(AllDownloadedPatches[selectedPatch.Uuid])
|
||||
|| !File.Exists(AllDownloadedPatches[selectedPatch.Uuid])))
|
||||
{
|
||||
DownloadFile();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectedPatch != null && AllDownloadedPatches.ContainsKey(selectedPatch.Uuid))
|
||||
SelectedNewPatch = AllDownloadedPatches[selectedPatch.Uuid];
|
||||
PrepareUploadActions();
|
||||
TryUploading();
|
||||
}
|
||||
@ -154,11 +156,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
switch (SelectedUpdateType)
|
||||
{
|
||||
case UpdateType.NewRetail:
|
||||
if (_patch == null)
|
||||
{
|
||||
action = new UploadPatchAction(selectedServer.Connection, SelectedNewPatch, true);
|
||||
}
|
||||
else if (!PatchExistsOnPool(_patch, selectedServer))
|
||||
if (_patch == null || !PatchExistsOnPool(_patch, selectedServer))
|
||||
{
|
||||
action = new UploadPatchAction(selectedServer.Connection, SelectedNewPatch, true);
|
||||
}
|
||||
@ -379,7 +377,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
if (action is DownloadAndUnzipXenServerPatchAction)
|
||||
{
|
||||
SelectedNewPatch = ((DownloadAndUnzipXenServerPatchAction)action).PatchPath;
|
||||
AllDownloadedPatches.Add(SelectedUpdateAlert, SelectedNewPatch);
|
||||
AllDownloadedPatches.Add((SelectedUpdateAlert as XenServerPatchAlert).Patch.Uuid, SelectedNewPatch);
|
||||
_patch = null;
|
||||
PrepareUploadActions();
|
||||
TryUploading();
|
||||
|
Loading…
Reference in New Issue
Block a user