Merge pull request #76 from GaborApatiNagy/xs64bit

CP-8474: Remove iSL radio button from XenCenter for >= Creedence servers...
This commit is contained in:
Mihaela Stoica 2014-05-21 14:57:05 +01:00
commit 795e371bda
10 changed files with 191 additions and 255 deletions

View File

@ -1,133 +0,0 @@
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System.Collections.Generic;
using System.Linq;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.VMProblem;
using XenAPI;
namespace XenAdmin.Diagnostics.Checks
{
public class AssertCanEvacuateUpgradeCheck : AssertCanEvacuateCheck
{
public AssertCanEvacuateUpgradeCheck(Host host)
: base(host)
{
}
public override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLive(this, Host);
//Storage link check
var storageLinkProblem = GetStorageLinkProblem();
if (storageLinkProblem != null)
return storageLinkProblem;
return base.RunCheck();
}
private Problem GetStorageLinkProblem()
{
if (Helpers.BostonOrGreater(Host))
return null;
var vmsInStorageLink = new List<VM>();
foreach (var vm in Host.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm))
{
foreach (var sr in vm.SRs.Where(sr => sr.GetSRType(true) == SR.SRTypes.cslg))
{
//Check if it is a supported adapter
if (IsSupportedAdapter(sr))
{
if (vm.power_state == vm_power_state.Suspended || vm.power_state == vm_power_state.Running)
{
vmsInStorageLink.Add(vm);
break;
}
}
else
{
return new IsInStorageLinkLegacySR(this, vm);
}
}
}
if (vmsInStorageLink.Count > 0)
return new IsInStorageLinkLegacySR(this, vmsInStorageLink);
return null;
}
private bool IsSupportedAdapter(SR sr)
{
bool isSMIS = false;
bool isNetApp = false;
bool isDell = false;
try
{
var storageRepository = sr.StorageLinkRepository(Program.StorageLinkConnections);
if (storageRepository == null)
{
// The CSLG is down, maybe because it was on local storage:
// try the other_config instead: see CA-63607.
string adapter;
if (sr.other_config.TryGetValue("CSLG-adapter", out adapter))
{
isSMIS = (adapter == "SMI-S");
isNetApp = adapter.ToLower().Contains("netapp");
isDell = adapter.ToLower().Contains("equallogic");
}
}
else
{
// The CSLG is up: look up the adapter type, and save it away in the other_config
var storageSystem = storageRepository.StorageLinkSystem;
isSMIS = storageSystem.StorageLinkAdapter.IsSMIS;
isNetApp = storageSystem.StorageLinkAdapter.AdapterName.ToLower().Contains("netapp");
isDell = storageSystem.StorageLinkAdapter.AdapterName.ToLower().Contains("equallogic");
Helpers.SetOtherConfig(sr.Connection.Session, sr, "CSLG-adapter",
isSMIS ? "SMI-S" : storageSystem.StorageLinkAdapter.AdapterName);
}
}
catch
{
}
return (isNetApp || isDell || isSMIS);
}
}
}

View File

@ -0,0 +1,67 @@
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System.Linq;
using XenAdmin.Diagnostics.Problems.SRProblem;
using XenAPI;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Core;
namespace XenAdmin.Diagnostics.Checks
{
class HostHasUnsupportedStorageLinkSRCheck : Check
{
public HostHasUnsupportedStorageLinkSRCheck(Host host)
: base(host)
{
}
public override Problem RunCheck()
{
foreach (var sr in Host.Connection.Cache.SRs.Where(sr => sr.GetSRType(true) == SR.SRTypes.cslg))
{
return new UnsupportedStorageLinkSrIsPresentProblem(this, sr);
}
return null;
}
public override string Description
{
get
{
return Messages.STORAGELINK_UPGRADE_TEST;
}
}
}
}

View File

@ -0,0 +1,61 @@
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using XenAdmin.Diagnostics.Checks;
using XenAPI;
namespace XenAdmin.Diagnostics.Problems.SRProblem
{
class UnsupportedStorageLinkSrIsPresentProblem : SRProblem
{
public UnsupportedStorageLinkSrIsPresentProblem(Check check, SR sr)
: base(check, sr)
{
}
public override string Description
{
get
{
return Messages.PROBLEM_UNSUPPORTED_STORAGELINK_SR;
}
}
public override string HelpMessage
{
get
{
return Messages.PROBLEM_UNSUPPORTED_STORAGELINK_SR_HELP;
}
}
}
}

View File

@ -1,114 +0,0 @@
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using XenAdmin.Actions;
using XenAdmin.Actions.VMActions;
using XenAdmin.Diagnostics.Checks;
using XenAdmin.Dialogs;
using XenAdmin.Properties;
using XenAPI;
namespace XenAdmin.Diagnostics.Problems.VMProblem
{
class IsInStorageLinkLegacySR : Problem
{
// Case 1: VMs using one of the CSLG adapters we can upgrade
private readonly List<VM> VMs = new List<VM>();
public IsInStorageLinkLegacySR(Check check, List<VM> vm)
: base(check)
{
VMs = vm;
}
// Case 2: VM using one of the CSLG adapters we can't upgrade
private readonly VM NotSMISVM;
public IsInStorageLinkLegacySR(Check check, VM vm)
: base(check)
{
NotSMISVM = vm;
}
public override string Title
{
get { return Description; }
}
public override string Description
{
get
{
if (NotSMISVM != null)
return Messages.ONLY_VMS_USING_STORAGELINK_SMIS;
return Messages.IS_IN_STORAGELINK_SR;
}
}
public override string HelpMessage
{
get
{
if (NotSMISVM != null)
return Messages.TELL_ME_MORE;
else
return Messages.SHUTDOWN_VM;
}
}
protected override AsyncAction CreateAction(out bool cancelled)
{
cancelled = false;
if (VMs.Count == 1)
{
if (VMs[0].power_state == vm_power_state.Suspended)
return new VMHardShutdown(VMs[0]);
return new VMCleanShutdown(VMs[0]);
}
if (VMs.Count > 1)
{
var listShutdownActions = new List<AsyncAction>();
VMs.ForEach((vm) =>
{
if (vm.power_state == vm_power_state.Suspended)
listShutdownActions.Add(new VMHardShutdown(vm));
else
listShutdownActions.Add(new VMCleanShutdown(vm));
});
return new MultipleAction(VMs[0].Connection, Messages.ACTION_VM_SHUTTING_DOWN, Messages.ACTION_VM_SHUTTING_DOWN
, Messages.ACTION_VM_SHUT_DOWN, listShutdownActions);
}
return null;
}
}
}

View File

@ -87,6 +87,8 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
public override void PopulatePage()
{
radioButtonCslg.Visible = !Helpers.CreedenceOrGreater(Connection); //Hide iSL radio button for Creedence or higher (StorageLink is not supported)
foreach (var radioButton in RadioButtons)
{
var frontend = (SrWizardType)radioButton.Tag;

View File

@ -536,10 +536,7 @@ namespace XenAdmin.Wizards.PatchingWizard
}
else
{
if (preCheckHostRow.Problem is IsInStorageLinkLegacySR)
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.ROLLING_UPGRADE_WARNING_SL)).ShowDialog();
else if (preCheckHostRow.Problem is WarningWithInformationUrl)
if (preCheckHostRow.Problem is WarningWithInformationUrl)
(preCheckHostRow.Problem as WarningWithInformationUrl).LaunchUrlInBrowser();
else if (!cancelled)

View File

@ -168,7 +168,7 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
checkGroup = checks[checks.Count - 1].Value;
foreach (Host host in SelectedServers)
{
checkGroup.Add(new AssertCanEvacuateUpgradeCheck(host));
checkGroup.Add(new AssertCanEvacuateCheck(host));
}
//PBDsPluggedCheck
@ -197,6 +197,14 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
}
}
//iSL (StorageLink) check
checks.Add(new KeyValuePair<string, List<Check>>(Messages.CHECKING_STORAGELINK_STATUS, new List<Check>()));
checkGroup = checks[checks.Count - 1].Value;
foreach (Host host in SelectedServers)
{
checkGroup.Add(new HostHasUnsupportedStorageLinkSRCheck(host));
}
//Upgrading to Clearwater and above - license changes warning and deprecations
if(SelectedServers.Any(h=> !Helpers.ClearwaterOrGreater(h)))
{

View File

@ -192,6 +192,9 @@
<Compile Include="Controls\UpsellPage.designer.cs">
<DependentUpon>UpsellPage.cs</DependentUpon>
</Compile>
<Compile Include="Diagnostics\Checks\AssertCanEvacuateCheck.cs" />
<Compile Include="Diagnostics\Checks\HostHasUnsupportedStorageLinkSRCheck.cs" />
<Compile Include="Diagnostics\Problems\SRProblem\UnsupportedStorageLinkSrIsPresentProblem.cs" />
<Compile Include="Dialogs\ExportVMDialog.cs">
</Compile>
<Compile Include="Dialogs\ResolvingSubjectsDialog.cs">
@ -1117,7 +1120,6 @@
<DependentUpon>HAWizard.cs</DependentUpon>
</Compile>
<Compile Include="Diagnostics\Problems\SRProblem\BrokenSR.cs" />
<Compile Include="Diagnostics\Checks\AssertCanEvacuateCheck.cs" />
<Compile Include="Diagnostics\Checks\Check.cs" />
<Compile Include="Diagnostics\Checks\HostLivenessCheck.cs" />
<Compile Include="Diagnostics\Checks\PatchPrecheckCheck.cs" />
@ -2438,7 +2440,6 @@
<DependentUpon>SectionHeaderLabel.cs</DependentUpon>
</Compile>
<Compile Include="Core\ExtensionMethods.cs" />
<Compile Include="Diagnostics\Checks\AssertCanEvacuateUpgradeCheck.cs" />
<Compile Include="Diagnostics\Checks\DR\AssertCanBeRecoveredCheck.cs" />
<Compile Include="Diagnostics\Checks\DR\DrHAEnabledCheck.cs" />
<Compile Include="Diagnostics\Checks\DR\ExistingVmApplianceCheck.cs" />
@ -2456,7 +2457,6 @@
<Compile Include="Diagnostics\Problems\VmApplianceProblem\RunningVmApplianceProblem.cs" />
<Compile Include="Diagnostics\Problems\VmApplianceProblem\VmApplianceProblem.cs" />
<Compile Include="Diagnostics\Problems\VMProblem\ExistingVmProblem.cs" />
<Compile Include="Diagnostics\Problems\VMProblem\IsInStorageLinkLegacySR.cs" />
<Compile Include="Diagnostics\Problems\PoolProblem\MissingSRProblem.cs" />
<Compile Include="Diagnostics\Problems\VMProblem\RunningVMProblem.cs" />
<Compile Include="Diagnostics\Problems\VMProblem\ExistingVmWarning.cs" />

View File

@ -6068,6 +6068,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Checking StorageLink status.
/// </summary>
public static string CHECKING_STORAGELINK_STATUS {
get {
return ResourceManager.GetString("CHECKING_STORAGELINK_STATUS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Checking upgrade hotfix status.
/// </summary>
@ -24966,6 +24975,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Unsupported StorageLink SR is present..
/// </summary>
public static string PROBLEM_UNSUPPORTED_STORAGELINK_SR {
get {
return ResourceManager.GetString("PROBLEM_UNSUPPORTED_STORAGELINK_SR", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Remove StorageLink SR before upgrading..
/// </summary>
public static string PROBLEM_UNSUPPORTED_STORAGELINK_SR_HELP {
get {
return ResourceManager.GetString("PROBLEM_UNSUPPORTED_STORAGELINK_SR_HELP", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to vApp {0}.
/// </summary>
@ -28957,6 +28984,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to StorageLink SR status.
/// </summary>
public static string STORAGELINK_UPGRADE_TEST {
get {
return ResourceManager.GetString("STORAGELINK_UPGRADE_TEST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to StorageLink Storage Pool.
/// </summary>

View File

@ -2201,6 +2201,9 @@ Do you want to assign it to the policy '{2}' instead?</value>
<data name="CHECKING_STORAGELINK_CONNECTIONS" xml:space="preserve">
<value>Checking StorageLink connections</value>
</data>
<data name="CHECKING_STORAGELINK_STATUS" xml:space="preserve">
<value>Checking StorageLink status</value>
</data>
<data name="CHECKING_STORAGE_CONNECTIONS_STATUS" xml:space="preserve">
<value>Checking storage connections status</value>
</data>
@ -8683,6 +8686,12 @@ The VM protection policy for this VM does not have automatic archiving configure
<data name="PROBLEM_STORAGELINK_CONNECTION_FAILED" xml:space="preserve">
<value>An error has occurred while attempting to connect to Storage Link Gateway: \n\n{0}\n\nPlease review the settings for this host and reconnect.</value>
</data>
<data name="PROBLEM_UNSUPPORTED_STORAGELINK_SR" xml:space="preserve">
<value>Unsupported StorageLink SR is present.</value>
</data>
<data name="PROBLEM_UNSUPPORTED_STORAGELINK_SR_HELP" xml:space="preserve">
<value>Remove StorageLink SR before upgrading.</value>
</data>
<data name="PROBLEM_VMAPPLIANCEPROBLEM_TITLE" xml:space="preserve">
<value>vApp {0}</value>
</data>
@ -10031,6 +10040,9 @@ Do you want to connect to the pool master '{1}'?</value>
<data name="STORAGELINK_UNABLE_TO_CONNECT" xml:space="preserve">
<value>Unable to connect to StorageLink server on {0}.</value>
</data>
<data name="STORAGELINK_UPGRADE_TEST" xml:space="preserve">
<value>StorageLink SR status</value>
</data>
<data name="STORAGEPOOLS" xml:space="preserve">
<value>Storage Pools</value>
</data>