Merge pull request #1512 from GaborApatiNagy/REQ-411_2

CP-21504: Updates wizard: Automated mode for new versions that are available as updates
This commit is contained in:
Mihaela Stoica 2017-03-24 12:11:01 +00:00 committed by GitHub
commit d2eda25f40

View File

@ -568,6 +568,46 @@ namespace XenAdmin.Core
} }
} }
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn, XenServerPatchAlert alert)
{
var uSeq = new UpgradeSequence();
if (XenServerVersions == null)
return null;
Host master = Helpers.GetMaster(conn);
if (master == null)
return null;
var version = GetCommonServerVersionOfHostsInAConnection(conn, XenServerVersions);
if (version != null)
{
//if it's a version updgrade the min sequence will be this patch (the upgrade) and the min patches for the new version
if (alert.NewServerVersion != null)
{
if (alert.NewServerVersion.MinimalPatches == null)
return null;
uSeq.MinimalPatches = new List<XenServerPatch>();
uSeq.MinimalPatches.Add(alert.Patch);
uSeq.MinimalPatches.AddRange(alert.NewServerVersion.MinimalPatches);
List<Host> hosts = conn.Cache.Hosts.ToList();
foreach (Host h in hosts)
{
uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches);
}
return uSeq;
}
}
return null;
}
/// <summary> /// <summary>
/// Returns a XenServerVersion if all hosts of the pool have the same version /// Returns a XenServerVersion if all hosts of the pool have the same version
/// Returns null if it is unknown or they don't match /// Returns null if it is unknown or they don't match