CP-10799: Ensuring sufficient disk space for service pack installation: Display hotfix installation size on the Updates page

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2015-02-06 12:32:29 +00:00
parent c392e7625e
commit e6784d1837
6 changed files with 34 additions and 9 deletions

View File

@ -112,7 +112,12 @@ namespace XenAdmin.Alerts
public override string Description
{
get { return Patch.Description; }
get
{
if (Patch.InstallationSize != 0)
return string.Format(Messages.PATCH_DESCRIPTION_AND_INSTALLATION_SIZE, Patch.Description, Util.DiskSizeString(Patch.InstallationSize));
return Patch.Description;
}
}
public override string Name

View File

@ -52,7 +52,7 @@ namespace XenAdminTests.UnitTests.AlertTests
[Test]
public void TestAlertWithConnectionAndHosts()
{
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "");
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "", "");
XenServerPatchAlert alert = new XenServerPatchAlert(p);
alert.IncludeConnection(connA.Object);
alert.IncludeConnection(connB.Object);
@ -80,7 +80,7 @@ namespace XenAdminTests.UnitTests.AlertTests
[Test]
public void TestAlertWithHostsAndNoConnection()
{
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "1");
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "1", "");
XenServerPatchAlert alert = new XenServerPatchAlert(p);
alert.IncludeHosts(new List<Host>() { hostA.Object, hostB.Object });
@ -106,7 +106,7 @@ namespace XenAdminTests.UnitTests.AlertTests
[Test]
public void TestAlertWithConnectionAndNoHosts()
{
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "0");
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "0", "");
XenServerPatchAlert alert = new XenServerPatchAlert(p);
alert.IncludeConnection(connA.Object);
alert.IncludeConnection(connB.Object);
@ -133,7 +133,7 @@ namespace XenAdminTests.UnitTests.AlertTests
[Test]
public void TestAlertWithNoConnectionAndNoHosts()
{
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "5");
XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "5", "");
XenServerPatchAlert alert = new XenServerPatchAlert(p);
IUnitTestVerifier validator = new VerifyGetters(alert);

View File

@ -135,6 +135,7 @@ namespace XenAdmin.Actions
string patchUrl = "";
string timestamp = "";
string priority = "";
string installationSize = "";
foreach (XmlAttribute attrib in version.Attributes)
{
@ -156,13 +157,15 @@ namespace XenAdmin.Actions
timestamp = attrib.Value;
else if (attrib.Name == "priority")
priority = attrib.Value;
else if (attrib.Name == "installation-size")
installationSize = attrib.Value;
}
var conflictingPatches = GetPatchDependencies(version, ConflictingPatchesNode, ConflictingPatchNode);
var requiredPatches = GetPatchDependencies(version, RequiredPatchesNode, RequiredPatchNode);
XenServerPatches.Add(new XenServerPatch(uuid, name, description, guidance, patchVersion, url,
patchUrl, timestamp, priority, conflictingPatches, requiredPatches));
patchUrl, timestamp, priority, installationSize, conflictingPatches, requiredPatches));
}
}
}

View File

@ -45,6 +45,7 @@ namespace XenAdmin.Core
public readonly string PatchUrl;
public readonly DateTime TimeStamp;
public readonly int Priority;
public readonly long InstallationSize; // installation size, in btyes
public readonly List<string> ConflictingPatches;
public readonly List<string> RequiredPatches;
@ -52,7 +53,7 @@ namespace XenAdmin.Core
private const int DEFAULT_PRIORITY = 2;
public XenServerPatch(string uuid, string name, string description, string guidance, string version, string url,
string patchUrl, string timestamp, string priority)
string patchUrl, string timestamp, string priority, string installationSize)
{
_uuid = uuid.ToLowerInvariant();
Name = name;
@ -66,11 +67,13 @@ namespace XenAdmin.Core
DateTime.TryParse(timestamp, out TimeStamp);
if (!Int32.TryParse(priority, out Priority))
Priority = DEFAULT_PRIORITY;
if (!Int64.TryParse(installationSize, out InstallationSize))
InstallationSize = 0;
}
public XenServerPatch(string uuid, string name, string description, string guidance, string version, string url,
string patchUrl, string timestamp, string priority, List<string> conflictingPatches, List<string> requiredPatches)
:this(uuid, name, description, guidance, version, url, patchUrl, timestamp, priority)
string patchUrl, string timestamp, string priority, string installationSize, List<string> conflictingPatches, List<string> requiredPatches)
: this(uuid, name, description, guidance, version, url, patchUrl, timestamp, priority, installationSize)
{
ConflictingPatches = conflictingPatches;
RequiredPatches = requiredPatches;

View File

@ -24001,6 +24001,16 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to {0}
///Installation size: {1}.
/// </summary>
public static string PATCH_DESCRIPTION_AND_INSTALLATION_SIZE {
get {
return ResourceManager.GetString("PATCH_DESCRIPTION_AND_INSTALLATION_SIZE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}
///Date modified: {1}

View File

@ -8512,6 +8512,10 @@ It is strongly recommended that you Cancel and apply the latest version of the p
<data name="PATCH_APPLIED" xml:space="preserve">
<value>Update '{0}' Applied to Server '{1}'</value>
</data>
<data name="PATCH_DESCRIPTION_AND_INSTALLATION_SIZE" xml:space="preserve">
<value>{0}
Installation size: {1}</value>
</data>
<data name="PATCH_EXPANDED_DESCRIPTION" xml:space="preserve">
<value>{0}
Date modified: {1}