2013-06-24 13:41:48 +02:00
|
|
|
|
/* 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.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using XenAdmin.Actions;
|
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAdmin.Network;
|
|
|
|
|
using XenAdmin.Wizards.GenericPages;
|
|
|
|
|
using XenAPI;
|
|
|
|
|
using XenAdmin.Dialogs;
|
|
|
|
|
using XenAdmin.Wizards.NewSRWizard_Pages;
|
|
|
|
|
using XenAdmin.Wizards.NewSRWizard_Pages.Frontends;
|
|
|
|
|
using XenAdmin.Controls;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using XenAdmin.Actions.DR;
|
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Wizards
|
|
|
|
|
{
|
|
|
|
|
public partial class NewSRWizard : XenWizardBase
|
|
|
|
|
{
|
|
|
|
|
#region Wizard pages
|
|
|
|
|
private readonly NewSrWizardNamePage xenTabPageSrName;
|
|
|
|
|
private readonly CIFS_ISO xenTabPageCifsIso;
|
2015-03-03 16:51:56 +01:00
|
|
|
|
private readonly CifsFrontend xenTabPageCifs;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private readonly CSLG xenTabPageCslg;
|
|
|
|
|
private readonly VHDoNFS xenTabPageVhdoNFS;
|
|
|
|
|
private readonly NFS_ISO xenTabPageNfsIso;
|
|
|
|
|
private readonly NetApp xenTabPageNetApp;
|
|
|
|
|
private readonly EqualLogic xentabPageEqualLogic;
|
|
|
|
|
private readonly LVMoISCSI xenTabPageLvmoIscsi;
|
|
|
|
|
private readonly LVMoHBA xenTabPageLvmoHba;
|
2015-06-26 15:02:26 +02:00
|
|
|
|
private readonly LVMoFCoE xenTabPageLvmoFcoe;
|
2013-07-09 17:59:47 +02:00
|
|
|
|
private readonly LVMoHBASummary xenTabPageLvmoHbaSummary;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private readonly CslgSettings xenTabPageCslgSettings;
|
|
|
|
|
private readonly CslgLocation xenTabPageCslgLocation;
|
|
|
|
|
private readonly FilerDetails xenTabPageFilerDetails;
|
|
|
|
|
private readonly ChooseSrTypePage xenTabPageChooseSrType;
|
|
|
|
|
private readonly RBACWarningPage xenTabPageRbacWarning;
|
2015-06-17 10:59:21 +02:00
|
|
|
|
private readonly StorageProvisioning xenTabPageStorageProvisioningMethod;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The final action for this wizard is handled in this class, but the front end pages sometimes need to know when it's done so they
|
|
|
|
|
/// allow the user to leave them.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public AsyncAction FinalAction;
|
|
|
|
|
|
|
|
|
|
private readonly string m_text;
|
|
|
|
|
|
|
|
|
|
// For SR Reconfiguration
|
|
|
|
|
private readonly SR _srToReattach;
|
|
|
|
|
private SrWizardType m_srWizardType;
|
|
|
|
|
|
|
|
|
|
private readonly bool _rbac;
|
|
|
|
|
|
|
|
|
|
public NewSRWizard(IXenConnection connection)
|
|
|
|
|
: this(connection, null, null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NewSRWizard(IXenConnection connection, SR srToReattach)
|
|
|
|
|
: this(connection, srToReattach, null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject)
|
|
|
|
|
: this(connection, srToReattach, storageLinkObject, false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal NewSRWizard(IXenConnection connection, SR srToReattach, IStorageLinkObject storageLinkObject, bool disasterRecoveryTask)
|
|
|
|
|
: base(connection)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
xenTabPageSrName = new NewSrWizardNamePage();
|
|
|
|
|
xenTabPageCifsIso = new CIFS_ISO();
|
2015-03-03 16:51:56 +01:00
|
|
|
|
xenTabPageCifs = new CifsFrontend();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
xenTabPageCslg = new CSLG();
|
|
|
|
|
xenTabPageVhdoNFS = new VHDoNFS();
|
|
|
|
|
xenTabPageNfsIso = new NFS_ISO();
|
|
|
|
|
xenTabPageNetApp = new NetApp();
|
|
|
|
|
xentabPageEqualLogic = new EqualLogic();
|
|
|
|
|
xenTabPageLvmoIscsi = new LVMoISCSI();
|
|
|
|
|
xenTabPageLvmoHba = new LVMoHBA();
|
2015-06-26 15:02:26 +02:00
|
|
|
|
xenTabPageLvmoFcoe = new LVMoFCoE();
|
2013-07-09 17:59:47 +02:00
|
|
|
|
xenTabPageLvmoHbaSummary = new LVMoHBASummary();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
xenTabPageCslgSettings = new CslgSettings();
|
|
|
|
|
xenTabPageCslgLocation = new CslgLocation();
|
|
|
|
|
xenTabPageFilerDetails = new FilerDetails();
|
|
|
|
|
xenTabPageChooseSrType = new ChooseSrTypePage();
|
|
|
|
|
xenTabPageRbacWarning = new RBACWarningPage((srToReattach == null && !disasterRecoveryTask)
|
|
|
|
|
? Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_CREATE
|
|
|
|
|
: Messages.RBAC_WARNING_PAGE_DESCRIPTION_SR_ATTACH);
|
2015-06-17 10:59:21 +02:00
|
|
|
|
xenTabPageStorageProvisioningMethod = new StorageProvisioning();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
if (connection == null)
|
|
|
|
|
Util.ThrowIfParameterNull(storageLinkObject, "storageLinkObject");
|
|
|
|
|
if (storageLinkObject == null)
|
|
|
|
|
Util.ThrowIfParameterNull(connection, "connection");
|
|
|
|
|
if (storageLinkObject != null && connection != null)
|
|
|
|
|
throw new ArgumentException("connection must be null when passing in a storageLinkObject", "connection");
|
|
|
|
|
|
|
|
|
|
//do not use virtual members in constructor
|
|
|
|
|
var format = (srToReattach == null && !disasterRecoveryTask)
|
|
|
|
|
? Messages.NEWSR_TEXT
|
|
|
|
|
: Messages.NEWSR_TEXT_ATTACH;
|
|
|
|
|
m_text = string.Format(format, xenConnection == null ? storageLinkObject.ToString() : Helpers.GetName(xenConnection));
|
|
|
|
|
|
|
|
|
|
_srToReattach = srToReattach;
|
|
|
|
|
|
|
|
|
|
xenTabPageChooseSrType.SrToReattach = srToReattach;
|
|
|
|
|
xenTabPageChooseSrType.DisasterRecoveryTask = disasterRecoveryTask;
|
|
|
|
|
xenTabPageCslg.SetStorageLinkObject(storageLinkObject);
|
|
|
|
|
|
|
|
|
|
// Order the tab pages
|
|
|
|
|
AddPage(xenTabPageChooseSrType);
|
|
|
|
|
AddPage(xenTabPageSrName);
|
|
|
|
|
AddPage(new XenTabPage {Text = Messages.NEWSR_LOCATION});
|
|
|
|
|
|
|
|
|
|
// RBAC warning page
|
|
|
|
|
_rbac = (xenConnection != null && !xenConnection.Session.IsLocalSuperuser) &&
|
|
|
|
|
Helpers.GetMaster(xenConnection).external_auth_type != Auth.AUTH_TYPE_NONE;
|
|
|
|
|
if (_rbac)
|
|
|
|
|
{
|
|
|
|
|
// if reattaching, add "Permission checks" page after "Name" page, otherwise as first page (Ref. CA-61525)
|
|
|
|
|
if (_srToReattach != null)
|
|
|
|
|
AddAfterPage(xenTabPageSrName, xenTabPageRbacWarning);
|
|
|
|
|
else
|
|
|
|
|
AddPage(xenTabPageRbacWarning, 0);
|
|
|
|
|
ConfigureRbacPage(disasterRecoveryTask);
|
|
|
|
|
}
|
2015-06-17 10:59:21 +02:00
|
|
|
|
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConfigureRbacPage(bool disasterRecoveryTask)
|
|
|
|
|
{
|
|
|
|
|
if (!_rbac)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
xenTabPageRbacWarning.Connection = xenConnection;
|
|
|
|
|
|
|
|
|
|
xenTabPageRbacWarning.ClearPermissionChecks();
|
|
|
|
|
|
|
|
|
|
var warningMessage = (_srToReattach == null && !disasterRecoveryTask)
|
|
|
|
|
? Messages.RBAC_WARNING_SR_WIZARD_CREATE
|
|
|
|
|
: Messages.RBAC_WARNING_SR_WIZARD_ATTACH;
|
|
|
|
|
|
|
|
|
|
RBACWarningPage.WizardPermissionCheck check =
|
|
|
|
|
new RBACWarningPage.WizardPermissionCheck(warningMessage) { Blocking = true };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
check.AddApiCheckRange(new RbacMethodList("SR.probe"));
|
|
|
|
|
|
|
|
|
|
if (_srToReattach == null)
|
|
|
|
|
{
|
|
|
|
|
// create
|
|
|
|
|
check.AddApiCheckRange(SrCreateAction.StaticRBACDependencies);
|
|
|
|
|
}
|
|
|
|
|
else if (disasterRecoveryTask && SR.SupportsDatabaseReplication(xenConnection, _srToReattach))
|
|
|
|
|
{
|
|
|
|
|
// "Attach SR needed for DR" case
|
|
|
|
|
check.AddApiCheckRange(DrTaskCreateAction.StaticRBACDependencies);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// reattach
|
|
|
|
|
check.AddApiCheckRange(SrReattachAction.StaticRBACDependencies);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xenTabPageRbacWarning.AddPermissionChecks(xenConnection, check);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-26 15:02:26 +02:00
|
|
|
|
private bool SetFCDevicesOnLVMoHBAPage(LVMoHBA page)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
List<FibreChannelDevice> devices;
|
2015-06-26 15:02:26 +02:00
|
|
|
|
var success = page.FiberChannelScan(this, xenConnection, out devices);
|
|
|
|
|
page.FCDevices = devices;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-26 15:02:26 +02:00
|
|
|
|
private bool CanShowLVMoHBASummaryPage(List<LvmOhbaSrDescriptor> SrDescriptors)
|
2013-07-24 14:34:21 +02:00
|
|
|
|
{
|
|
|
|
|
string description = m_srWizardType.Description;
|
|
|
|
|
string name = m_srWizardType.SrName;
|
|
|
|
|
|
|
|
|
|
List<string> names = xenConnection.Cache.SRs.Select(sr => sr.Name).ToList();
|
|
|
|
|
|
|
|
|
|
m_srWizardType.SrDescriptors.Clear();
|
2015-06-26 15:02:26 +02:00
|
|
|
|
foreach (var lvmOhbaSrDescriptor in SrDescriptors)
|
2013-07-24 14:34:21 +02:00
|
|
|
|
{
|
|
|
|
|
lvmOhbaSrDescriptor.Name = name;
|
|
|
|
|
if (!string.IsNullOrEmpty(description))
|
|
|
|
|
lvmOhbaSrDescriptor.Description = description;
|
|
|
|
|
|
|
|
|
|
m_srWizardType.SrDescriptors.Add(lvmOhbaSrDescriptor);
|
|
|
|
|
names.Add(name);
|
2015-06-29 15:26:37 +02:00
|
|
|
|
name = SrWizardHelpers.DefaultSRName(m_srWizardType is SrWizardType_LvmoHba
|
|
|
|
|
? Messages.NEWSR_HBA_DEFAULT_NAME
|
|
|
|
|
: Messages.NEWSR_FCOE_DEFAULT_NAME, names);
|
2013-07-24 14:34:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xenTabPageLvmoHbaSummary.SuccessfullyCreatedSRs.Clear();
|
|
|
|
|
xenTabPageLvmoHbaSummary.FailedToCreateSRs.Clear();
|
|
|
|
|
|
|
|
|
|
bool closeWizard;
|
|
|
|
|
RunFinalAction(out closeWizard);
|
|
|
|
|
return closeWizard;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
protected override bool RunNextPagePrecheck(XenTabPage senderPage)
|
|
|
|
|
{
|
|
|
|
|
// if reattaching and RBAC warning page is visible, then we run the prechecks when leaving the RBAC warning page
|
|
|
|
|
// otherwise, when leaving xenTabPageSrName (Ref. CA-61525)
|
|
|
|
|
bool runPrechecks = _srToReattach != null && _rbac
|
|
|
|
|
? senderPage == xenTabPageRbacWarning
|
|
|
|
|
: senderPage == xenTabPageSrName;
|
|
|
|
|
|
|
|
|
|
if (runPrechecks)
|
|
|
|
|
{
|
2015-06-26 15:02:26 +02:00
|
|
|
|
|
|
|
|
|
if (m_srWizardType is SrWizardType_Fcoe)
|
|
|
|
|
{
|
|
|
|
|
return SetFCDevicesOnLVMoHBAPage(xenTabPageLvmoFcoe);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
if (m_srWizardType is SrWizardType_LvmoHba)
|
|
|
|
|
{
|
2015-06-26 15:02:26 +02:00
|
|
|
|
return SetFCDevicesOnLVMoHBAPage(xenTabPageLvmoHba);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
if (m_srWizardType is SrWizardType_Cslg || m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
|
|
|
|
|
{
|
|
|
|
|
xenTabPageCslg.SrWizardType = m_srWizardType;
|
|
|
|
|
return xenTabPageCslg.PerformStorageSystemScan();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-26 15:02:26 +02:00
|
|
|
|
|
|
|
|
|
if (senderPage == xenTabPageLvmoFcoe)
|
|
|
|
|
{
|
|
|
|
|
return CanShowLVMoHBASummaryPage(xenTabPageLvmoFcoe.SrDescriptors);
|
|
|
|
|
}
|
2015-06-18 16:03:25 +02:00
|
|
|
|
|
|
|
|
|
if (m_srWizardType is SrWizardType_LvmoHba)
|
2013-07-24 14:34:21 +02:00
|
|
|
|
{
|
2015-06-26 16:35:13 +02:00
|
|
|
|
if (!Helpers.DundeeOrGreater(xenConnection) && senderPage == xenTabPageLvmoHba)
|
2015-06-18 16:03:25 +02:00
|
|
|
|
{
|
2015-06-26 15:02:26 +02:00
|
|
|
|
return CanShowLVMoHBASummaryPage(xenTabPageLvmoHba.SrDescriptors);
|
2015-06-26 16:35:13 +02:00
|
|
|
|
}
|
|
|
|
|
else if (senderPage == xenTabPageStorageProvisioningMethod
|
|
|
|
|
//if there is no sr to be created (all will be reattached)
|
|
|
|
|
|| senderPage == xenTabPageLvmoHba && xenTabPageLvmoHba.SrDescriptors.All(srDescriptor => !string.IsNullOrEmpty(srDescriptor.UUID)))
|
|
|
|
|
{
|
|
|
|
|
//setting SM Config to the SRs being created (UUID == empty)
|
2015-06-18 16:03:25 +02:00
|
|
|
|
if (xenTabPageStorageProvisioningMethod.SMConfig.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
xenTabPageLvmoHba.SrDescriptors
|
|
|
|
|
.Where(desc => string.IsNullOrEmpty(desc.UUID)).ToList()
|
|
|
|
|
.ForEach(desc => desc.SMConfig = xenTabPageStorageProvisioningMethod.SMConfig);
|
|
|
|
|
}
|
2015-06-26 15:02:26 +02:00
|
|
|
|
return CanShowLVMoHBASummaryPage(xenTabPageLvmoHba.SrDescriptors);
|
2015-06-18 16:03:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return base.RunNextPagePrecheck(senderPage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateWizardContent(XenTabPage senderPage)
|
|
|
|
|
{
|
|
|
|
|
var senderPagetype = senderPage.GetType();
|
|
|
|
|
|
|
|
|
|
if (senderPagetype == typeof(ChooseSrTypePage))
|
|
|
|
|
{
|
|
|
|
|
#region
|
|
|
|
|
RemovePagesFrom(_rbac ? 3 : 2);
|
|
|
|
|
m_srWizardType = xenTabPageChooseSrType.SrWizardType;
|
|
|
|
|
|
|
|
|
|
if (m_srWizardType is SrWizardType_VhdoNfs)
|
|
|
|
|
AddPage(xenTabPageVhdoNFS);
|
|
|
|
|
else if (m_srWizardType is SrWizardType_LvmoIscsi)
|
2015-06-17 10:59:21 +02:00
|
|
|
|
{
|
2013-06-24 13:41:48 +02:00
|
|
|
|
AddPage(xenTabPageLvmoIscsi);
|
2015-06-17 10:59:21 +02:00
|
|
|
|
|
|
|
|
|
if (Helpers.DundeeOrGreater(xenConnection))
|
|
|
|
|
AddPage(xenTabPageStorageProvisioningMethod);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_LvmoHba)
|
2013-07-09 17:59:47 +02:00
|
|
|
|
{
|
2013-06-24 13:41:48 +02:00
|
|
|
|
AddPage(xenTabPageLvmoHba);
|
2015-06-18 16:03:25 +02:00
|
|
|
|
|
2015-06-17 10:59:21 +02:00
|
|
|
|
if (Helpers.DundeeOrGreater(xenConnection))
|
|
|
|
|
AddPage(xenTabPageStorageProvisioningMethod);
|
|
|
|
|
|
2013-07-09 17:59:47 +02:00
|
|
|
|
AddPage(xenTabPageLvmoHbaSummary);
|
|
|
|
|
}
|
2015-06-26 15:02:26 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_Fcoe)
|
|
|
|
|
{
|
|
|
|
|
AddPage(xenTabPageLvmoFcoe);
|
|
|
|
|
AddPage(xenTabPageLvmoHbaSummary);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_Cslg)
|
|
|
|
|
{
|
|
|
|
|
AddPage(xenTabPageCslg);
|
|
|
|
|
|
|
|
|
|
if (Helpers.BostonOrGreater(xenConnection))
|
|
|
|
|
AddPages(xenTabPageCslgLocation, xenTabPageCslgSettings);
|
|
|
|
|
else
|
2013-07-09 17:59:47 +02:00
|
|
|
|
AddPages(new XenTabPage { Text = "" });
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
else if (m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
|
|
|
|
|
{
|
2013-07-09 17:59:47 +02:00
|
|
|
|
AddPages(xenTabPageCslg, xenTabPageFilerDetails);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
2013-07-09 17:59:47 +02:00
|
|
|
|
if (m_srWizardType is SrWizardType_NetApp)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
xenTabPageFilerDetails.IsNetApp = true;
|
2013-07-09 17:59:47 +02:00
|
|
|
|
AddPage(xenTabPageNetApp);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
2013-07-09 17:59:47 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_EqualLogic)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
xenTabPageFilerDetails.IsNetApp = false;
|
2013-07-09 17:59:47 +02:00
|
|
|
|
AddPage(xentabPageEqualLogic);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (m_srWizardType is SrWizardType_CifsIso)
|
|
|
|
|
AddPage(xenTabPageCifsIso);
|
2015-03-03 16:51:56 +01:00
|
|
|
|
else if (m_srWizardType is SrWizardType_Cifs)
|
|
|
|
|
AddPage(xenTabPageCifs);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_NfsIso)
|
|
|
|
|
AddPage(xenTabPageNfsIso);
|
|
|
|
|
|
|
|
|
|
xenTabPageSrName.SrWizardType = m_srWizardType;
|
|
|
|
|
xenTabPageSrName.MatchingFrontends = xenTabPageChooseSrType.MatchingFrontends;
|
|
|
|
|
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageSrName);
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(NewSrWizardNamePage))
|
|
|
|
|
{
|
|
|
|
|
#region
|
|
|
|
|
m_srWizardType.SrName = xenTabPageSrName.SrName;
|
|
|
|
|
m_srWizardType.Description = xenTabPageSrName.SrDescription;
|
|
|
|
|
m_srWizardType.AutoDescriptionRequired = xenTabPageSrName.AutoDescriptionRequired;
|
|
|
|
|
|
|
|
|
|
if (m_srWizardType is SrWizardType_VhdoNfs)
|
|
|
|
|
xenTabPageVhdoNFS.SrWizardType = m_srWizardType;
|
|
|
|
|
else if (m_srWizardType is SrWizardType_LvmoIscsi)
|
|
|
|
|
xenTabPageLvmoIscsi.SrWizardType = m_srWizardType;
|
|
|
|
|
else if (m_srWizardType is SrWizardType_LvmoHba)
|
|
|
|
|
xenTabPageLvmoHba.SrWizardType = m_srWizardType;
|
|
|
|
|
else if (m_srWizardType is SrWizardType_Cslg || m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
|
|
|
|
|
xenTabPageCslg.SrWizardType = m_srWizardType;
|
|
|
|
|
else if (m_srWizardType is SrWizardType_CifsIso)
|
|
|
|
|
xenTabPageCifsIso.SrWizardType = m_srWizardType;
|
|
|
|
|
else if (m_srWizardType is SrWizardType_NfsIso)
|
|
|
|
|
xenTabPageNfsIso.SrWizardType = m_srWizardType;
|
2015-03-03 16:51:56 +01:00
|
|
|
|
else if (m_srWizardType is SrWizardType_Cifs)
|
|
|
|
|
xenTabPageCifs.SrWizardType = m_srWizardType;
|
2015-06-26 15:02:26 +02:00
|
|
|
|
else if (m_srWizardType is SrWizardType_Fcoe)
|
|
|
|
|
xenTabPageLvmoFcoe.SrWizardType = m_srWizardType;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(CIFS_ISO))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.DeviceConfig = xenTabPageCifsIso.DeviceConfig;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageCifsIso.SrDescription);
|
|
|
|
|
}
|
2015-03-03 16:51:56 +01:00
|
|
|
|
else if (senderPagetype == typeof(CifsFrontend))
|
|
|
|
|
{
|
2015-10-21 18:14:09 +02:00
|
|
|
|
m_srWizardType.UUID = xenTabPageCifs.UUID;
|
2015-03-03 16:51:56 +01:00
|
|
|
|
m_srWizardType.DeviceConfig = xenTabPageCifs.DeviceConfig;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageCifs.SrDescription);
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
else if (senderPagetype == typeof(LVMoISCSI))
|
|
|
|
|
{
|
2015-08-26 18:41:59 +02:00
|
|
|
|
xenTabPageStorageProvisioningMethod.SRSize = xenTabPageLvmoIscsi.SRSize;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageLvmoIscsi.SrDescription);
|
2015-06-17 10:59:21 +02:00
|
|
|
|
|
2015-09-01 18:25:44 +02:00
|
|
|
|
if (xenTabPageLvmoIscsi.UUID != null) //already existing SR
|
2015-06-18 16:03:25 +02:00
|
|
|
|
{
|
|
|
|
|
xenTabPageStorageProvisioningMethod.SetControlsUsingExistingSMConfig(m_srWizardType.SMConfig);
|
|
|
|
|
xenTabPageStorageProvisioningMethod.DisableControls();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xenTabPageStorageProvisioningMethod.ResetControls();
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(NFS_ISO))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.DeviceConfig = xenTabPageNfsIso.DeviceConfig;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageNfsIso.SrDescription);
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(VHDoNFS))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.UUID = xenTabPageVhdoNFS.UUID;
|
|
|
|
|
m_srWizardType.DeviceConfig = xenTabPageVhdoNFS.DeviceConfig;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageVhdoNFS.SrDescription);
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(CSLG))
|
|
|
|
|
{
|
|
|
|
|
#region
|
|
|
|
|
if (Helpers.BostonOrGreater(xenConnection))
|
|
|
|
|
{
|
|
|
|
|
xenTabPageCslgLocation.SelectedStorageAdapter = xenTabPageCslg.SelectedStorageAdapter;
|
|
|
|
|
xenTabPageCslgSettings.SelectedStorageAdapter = xenTabPageCslg.SelectedStorageAdapter;
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageCslgLocation, xenTabPageCslgSettings);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RemovePagesFrom(_rbac ? 4 : 3);
|
|
|
|
|
|
|
|
|
|
if (xenTabPageCslg.SelectedStorageSystem != null)
|
|
|
|
|
{
|
|
|
|
|
AddPages(xenTabPageCslgSettings);
|
|
|
|
|
xenTabPageCslgSettings.SystemStorage = xenTabPageCslg.SelectedStorageSystem;
|
|
|
|
|
xenTabPageCslgSettings.StoragePools = xenTabPageCslg.StoragePools;
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageCslgLocation);
|
|
|
|
|
}
|
|
|
|
|
else if (xenTabPageCslg.NetAppSelected || xenTabPageCslg.DellSelected)
|
|
|
|
|
{
|
|
|
|
|
AddPage(xenTabPageFilerDetails);
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageFilerDetails);
|
|
|
|
|
|
|
|
|
|
if (xenTabPageCslg.NetAppSelected)
|
|
|
|
|
{
|
|
|
|
|
if (m_srWizardType is SrWizardType_Cslg)
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType = ((SrWizardType_Cslg)m_srWizardType).ToNetApp();
|
|
|
|
|
xenTabPageCslg.SrWizardType = m_srWizardType;
|
|
|
|
|
}
|
|
|
|
|
xenTabPageFilerDetails.IsNetApp = true;
|
|
|
|
|
AddPage(xenTabPageNetApp);
|
|
|
|
|
}
|
|
|
|
|
else if (xenTabPageCslg.DellSelected)
|
|
|
|
|
{
|
|
|
|
|
if (m_srWizardType is SrWizardType_Cslg)
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType = ((SrWizardType_Cslg)m_srWizardType).ToEqualLogic();
|
|
|
|
|
xenTabPageCslg.SrWizardType = m_srWizardType;
|
|
|
|
|
}
|
|
|
|
|
xenTabPageFilerDetails.IsNetApp = false;
|
|
|
|
|
AddPage(xentabPageEqualLogic);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var entry in xenTabPageCslg.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(CslgLocation))
|
|
|
|
|
{
|
|
|
|
|
xenTabPageCslgSettings.StorageLinkCredentials = xenTabPageCslgLocation.StorageLinkCredentials;
|
|
|
|
|
xenTabPageCslgSettings.SystemStorage = xenTabPageCslgLocation.SystemStorage;
|
|
|
|
|
xenTabPageCslgSettings.StoragePools = xenTabPageCslgLocation.StoragePools;
|
|
|
|
|
|
|
|
|
|
foreach (var entry in xenTabPageCslgLocation.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageCslgSettings);
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(CslgSettings))
|
|
|
|
|
{
|
|
|
|
|
foreach (var entry in xenTabPageCslgSettings.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageCslgSettings.SrDescription);
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(FilerDetails))
|
|
|
|
|
{
|
|
|
|
|
#region
|
|
|
|
|
foreach (var entry in xenTabPageFilerDetails.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
|
|
|
|
|
if (xenTabPageFilerDetails.IsNetApp)
|
|
|
|
|
{
|
|
|
|
|
xenTabPageNetApp.SrScanAction = xenTabPageFilerDetails.SrScanAction;
|
|
|
|
|
xenTabPageNetApp.SrWizardType = m_srWizardType;
|
|
|
|
|
NotifyNextPagesOfChange(xenTabPageNetApp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xentabPageEqualLogic.SrScanAction = xenTabPageFilerDetails.SrScanAction;
|
|
|
|
|
xentabPageEqualLogic.SrWizardType = m_srWizardType;
|
|
|
|
|
NotifyNextPagesOfChange(xentabPageEqualLogic);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(NetApp))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.UUID = xenTabPageNetApp.UUID;
|
|
|
|
|
foreach (var entry in xenTabPageNetApp.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xenTabPageNetApp.SrDescription);
|
|
|
|
|
}
|
|
|
|
|
else if (senderPagetype == typeof(EqualLogic))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.UUID = xentabPageEqualLogic.UUID;
|
|
|
|
|
foreach (var entry in xentabPageEqualLogic.DeviceConfigParts)
|
|
|
|
|
m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
|
|
|
|
|
SetCustomDescription(m_srWizardType, xentabPageEqualLogic.SrDescription);
|
|
|
|
|
}
|
2015-06-18 16:03:25 +02:00
|
|
|
|
else if (senderPagetype == typeof(LVMoHBA))
|
|
|
|
|
{
|
2015-08-26 18:41:59 +02:00
|
|
|
|
xenTabPageStorageProvisioningMethod.SRSize = xenTabPageLvmoHba.SRSize;
|
2015-06-18 16:03:25 +02:00
|
|
|
|
bool creatingNew = m_srWizardType.SrDescriptors.Any(srDescriptor => string.IsNullOrEmpty(srDescriptor.UUID));
|
|
|
|
|
if (!creatingNew)
|
|
|
|
|
{
|
|
|
|
|
DisablePage(xenTabPageStorageProvisioningMethod, true);
|
|
|
|
|
xenTabPageStorageProvisioningMethod.ResetControls();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-17 10:59:21 +02:00
|
|
|
|
else if (senderPagetype == typeof(StorageProvisioning))
|
|
|
|
|
{
|
|
|
|
|
m_srWizardType.SMConfig = xenTabPageStorageProvisioningMethod.SMConfig;
|
2015-09-01 18:25:44 +02:00
|
|
|
|
m_srWizardType.UUID = xenTabPageLvmoIscsi.UUID;
|
|
|
|
|
m_srWizardType.DeviceConfig = xenTabPageLvmoIscsi.DeviceConfig;
|
|
|
|
|
|
2015-06-17 10:59:21 +02:00
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void SetCustomDescription(SrWizardType srwizardtype, string description)
|
|
|
|
|
{
|
|
|
|
|
if (srwizardtype.Description == null)
|
|
|
|
|
srwizardtype.Description = description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void FinishWizard()
|
2013-07-09 17:59:47 +02:00
|
|
|
|
{
|
2015-06-29 15:26:37 +02:00
|
|
|
|
if (m_srWizardType is SrWizardType_LvmoHba || m_srWizardType is SrWizardType_Fcoe)
|
2013-07-09 17:59:47 +02:00
|
|
|
|
{
|
|
|
|
|
base.FinishWizard();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool closeWizard;
|
|
|
|
|
RunFinalAction(out closeWizard);
|
|
|
|
|
if (closeWizard)
|
|
|
|
|
base.FinishWizard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RunFinalAction(out bool closeWizard)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
FinalAction = null;
|
2013-07-09 17:59:47 +02:00
|
|
|
|
closeWizard = false;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
// Override the WizardBase: try running the SR create/attach. If it succeeds, close the wizard.
|
|
|
|
|
// Otherwise show the error and allow the user to adjust the settings and try again.
|
|
|
|
|
Pool pool = Helpers.GetPoolOfOne(xenConnection);
|
|
|
|
|
if (pool == null)
|
|
|
|
|
{
|
|
|
|
|
log.Error("New SR Wizard: Pool has disappeared");
|
|
|
|
|
new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.NEW_SR_CONNECTION_LOST, Helpers.GetName(xenConnection)), Messages.XENCENTER)).ShowDialog(this);
|
2013-07-09 17:59:47 +02:00
|
|
|
|
|
|
|
|
|
closeWizard = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Host master = xenConnection.Resolve(pool.master);
|
|
|
|
|
if (master == null)
|
|
|
|
|
{
|
|
|
|
|
log.Error("New SR Wizard: Master has disappeared");
|
|
|
|
|
new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.NEW_SR_CONNECTION_LOST, Helpers.GetName(xenConnection)), Messages.XENCENTER)).ShowDialog(this);
|
2013-07-09 17:59:47 +02:00
|
|
|
|
|
|
|
|
|
closeWizard = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-19 17:15:37 +02:00
|
|
|
|
if (_srToReattach != null && _srToReattach.HasPBDs && _srToReattach.Connection == xenConnection)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
// Error - cannot reattach attached SR
|
|
|
|
|
MessageBox.Show(this,
|
|
|
|
|
String.Format(Messages.STORAGE_IN_USE, _srToReattach.Name, Helpers.GetName(xenConnection)),
|
|
|
|
|
Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
|
|
|
|
|
FinishCanceled();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// show warning prompt if required
|
|
|
|
|
if (!AskUserIfShouldContinue())
|
|
|
|
|
{
|
|
|
|
|
FinishCanceled();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<AsyncAction> actionList = GetActions(master, m_srWizardType.DisasterRecoveryTask);
|
|
|
|
|
|
|
|
|
|
if (actionList.Count == 1)
|
|
|
|
|
FinalAction = actionList[0];
|
|
|
|
|
else
|
|
|
|
|
FinalAction = new ParallelAction(xenConnection, Messages.NEW_SR_WIZARD_FINAL_ACTION_TITLE,
|
|
|
|
|
Messages.NEW_SR_WIZARD_FINAL_ACTION_START,
|
|
|
|
|
Messages.NEW_SR_WIZARD_FINAL_ACTION_END, actionList);
|
|
|
|
|
|
|
|
|
|
// if this is a Disaster Recovery Task, it could be either a "Find existing SRs" or an "Attach SR needed for DR" case
|
|
|
|
|
if (m_srWizardType.DisasterRecoveryTask)
|
|
|
|
|
{
|
2013-07-09 17:59:47 +02:00
|
|
|
|
closeWizard = true;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProgressBarStyle progressBarStyle = FinalAction is SrIntroduceAction ? ProgressBarStyle.Blocks : ProgressBarStyle.Marquee;
|
|
|
|
|
ActionProgressDialog dialog = new ActionProgressDialog(FinalAction, progressBarStyle) {ShowCancel = true};
|
2013-07-09 17:59:47 +02:00
|
|
|
|
|
2015-06-29 15:26:37 +02:00
|
|
|
|
if (m_srWizardType is SrWizardType_LvmoHba || m_srWizardType is SrWizardType_Fcoe)
|
2013-07-09 17:59:47 +02:00
|
|
|
|
{
|
|
|
|
|
ActionProgressDialog closureDialog = dialog;
|
|
|
|
|
// close dialog even when there's an error for HBA SR type as there will be the Summary page displayed.
|
|
|
|
|
FinalAction.Completed +=
|
2013-08-05 15:28:21 +02:00
|
|
|
|
s => Program.Invoke(Program.MainWindow, () =>
|
|
|
|
|
{
|
|
|
|
|
if (closureDialog != null)
|
|
|
|
|
closureDialog.Close();
|
|
|
|
|
});
|
2013-07-09 17:59:47 +02:00
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
dialog.ShowDialog(this);
|
|
|
|
|
|
2015-06-29 15:26:37 +02:00
|
|
|
|
if (m_srWizardType is SrWizardType_LvmoHba || m_srWizardType is SrWizardType_Fcoe)
|
2014-07-24 13:14:40 +02:00
|
|
|
|
{
|
|
|
|
|
foreach (var asyncAction in actionList)
|
|
|
|
|
{
|
|
|
|
|
AddActionToSummary(asyncAction);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-19 17:15:37 +02:00
|
|
|
|
if (!FinalAction.Succeeded && FinalAction is SrReattachAction && _srToReattach.HasPBDs)
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
2013-07-19 17:15:37 +02:00
|
|
|
|
// reattach failed. Ensure PBDs are now unplugged and destroyed.
|
|
|
|
|
dialog = new ActionProgressDialog(new SrAction(SrActionKind.UnplugAndDestroyPBDs, _srToReattach), progressBarStyle);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
dialog.ShowCancel = false;
|
|
|
|
|
dialog.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If action failed and frontend wants to stay open, just return
|
|
|
|
|
if (!FinalAction.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.None;
|
|
|
|
|
FinishCanceled();
|
|
|
|
|
|
|
|
|
|
if (m_srWizardType.AutoDescriptionRequired)
|
|
|
|
|
{
|
|
|
|
|
foreach (var srDescriptor in m_srWizardType.SrDescriptors)
|
|
|
|
|
{
|
|
|
|
|
srDescriptor.Description = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Close wizard
|
2013-07-09 17:59:47 +02:00
|
|
|
|
closeWizard = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Dictionary<AsyncAction, SrDescriptor> actionSrDescriptorDict = new Dictionary<AsyncAction, SrDescriptor>();
|
|
|
|
|
|
2014-07-24 13:14:40 +02:00
|
|
|
|
void AddActionToSummary(AsyncAction action)
|
2013-07-09 17:59:47 +02:00
|
|
|
|
{
|
|
|
|
|
if (action == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
SrDescriptor srDescriptor;
|
|
|
|
|
actionSrDescriptorDict.TryGetValue(action, out srDescriptor);
|
|
|
|
|
|
|
|
|
|
if (srDescriptor == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (action.Succeeded)
|
|
|
|
|
xenTabPageLvmoHbaSummary.SuccessfullyCreatedSRs.Add(srDescriptor);
|
|
|
|
|
else
|
|
|
|
|
xenTabPageLvmoHbaSummary.FailedToCreateSRs.Add(srDescriptor);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<AsyncAction> GetActions(Host master, bool disasterRecoveryTask)
|
|
|
|
|
{
|
|
|
|
|
// Now we need to decide what to do.
|
|
|
|
|
// This will be one off create, introduce, reattach
|
|
|
|
|
|
|
|
|
|
List<AsyncAction> finalActions = new List<AsyncAction>();
|
2013-07-09 17:59:47 +02:00
|
|
|
|
actionSrDescriptorDict.Clear();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
|
|
foreach (var srDescriptor in m_srWizardType.SrDescriptors)
|
|
|
|
|
{
|
2013-07-09 17:59:47 +02:00
|
|
|
|
if (String.IsNullOrEmpty(srDescriptor.UUID))
|
2013-06-24 13:41:48 +02:00
|
|
|
|
{
|
|
|
|
|
// Don't need to show any warning, as the only destructive creates
|
|
|
|
|
// are in iSCSI and HBA, where they show their own warning
|
|
|
|
|
finalActions.Add(new SrCreateAction(xenConnection, master,
|
|
|
|
|
srDescriptor.Name,
|
|
|
|
|
srDescriptor.Description,
|
|
|
|
|
m_srWizardType.Type,
|
|
|
|
|
m_srWizardType.ContentType,
|
|
|
|
|
!master.RestrictPoolAttachedStorage,
|
|
|
|
|
srDescriptor.DeviceConfig,
|
2015-06-17 10:59:21 +02:00
|
|
|
|
srDescriptor.SMConfig,
|
2013-06-24 13:41:48 +02:00
|
|
|
|
Program.StorageLinkConnections.GetCopy()));
|
|
|
|
|
}
|
|
|
|
|
else if (_srToReattach == null || _srToReattach.Connection != xenConnection)
|
|
|
|
|
{
|
|
|
|
|
// introduce
|
|
|
|
|
if (disasterRecoveryTask &&
|
|
|
|
|
(_srToReattach == null || SR.SupportsDatabaseReplication(xenConnection, _srToReattach)))
|
|
|
|
|
{
|
|
|
|
|
// "Find existing SRs" or "Attach SR needed for DR" cases
|
|
|
|
|
ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(m_srWizardType.Type,
|
|
|
|
|
srDescriptor.DeviceConfig,
|
|
|
|
|
srDescriptor.UUID);
|
|
|
|
|
finalActions.Add(new DrTaskCreateAction(xenConnection, deviceInfo));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
finalActions.Add(new SrIntroduceAction(xenConnection,
|
|
|
|
|
srDescriptor.UUID,
|
|
|
|
|
srDescriptor.Name,
|
|
|
|
|
srDescriptor.Description,
|
|
|
|
|
m_srWizardType.Type,
|
|
|
|
|
m_srWizardType.ContentType,
|
|
|
|
|
!master.RestrictPoolAttachedStorage,
|
|
|
|
|
srDescriptor.DeviceConfig));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Reattach
|
|
|
|
|
if (disasterRecoveryTask && SR.SupportsDatabaseReplication(xenConnection, _srToReattach))
|
|
|
|
|
{
|
|
|
|
|
// "Attach SR needed for DR" case
|
|
|
|
|
ScannedDeviceInfo deviceInfo = new ScannedDeviceInfo(_srToReattach.GetSRType(true),
|
|
|
|
|
srDescriptor.DeviceConfig,
|
|
|
|
|
_srToReattach.uuid);
|
|
|
|
|
finalActions.Add(new DrTaskCreateAction(xenConnection, deviceInfo));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
finalActions.Add(new SrReattachAction(_srToReattach,
|
|
|
|
|
srDescriptor.Name,
|
|
|
|
|
srDescriptor.Description,
|
|
|
|
|
srDescriptor.DeviceConfig));
|
|
|
|
|
}
|
2013-07-09 17:59:47 +02:00
|
|
|
|
|
|
|
|
|
AsyncAction action = finalActions.Last();
|
|
|
|
|
if (!actionSrDescriptorDict.ContainsKey(action))
|
|
|
|
|
actionSrDescriptorDict.Add(action, srDescriptor);
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return finalActions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool AskUserIfShouldContinue()
|
|
|
|
|
{
|
|
|
|
|
if (!Program.RunInAutomatedTestMode && !String.IsNullOrEmpty(m_srWizardType.UUID))
|
|
|
|
|
{
|
|
|
|
|
if (_srToReattach == null)
|
|
|
|
|
{
|
|
|
|
|
// introduce
|
|
|
|
|
if (m_srWizardType.ShowIntroducePrompt)
|
|
|
|
|
{
|
|
|
|
|
return DialogResult.Yes == new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(SystemIcons.Warning, String.Format(Messages.NEWSR_MULTI_POOL_WARNING, m_srWizardType.UUID), Text),
|
|
|
|
|
ThreeButtonDialog.ButtonYes,
|
|
|
|
|
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (_srToReattach.Connection == xenConnection)
|
|
|
|
|
{
|
|
|
|
|
// Reattach
|
|
|
|
|
if (m_srWizardType.ShowReattachWarning)
|
|
|
|
|
{
|
|
|
|
|
return DialogResult.Yes == new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(SystemIcons.Warning, String.Format(Messages.NEWSR_MULTI_POOL_WARNING, _srToReattach.Name), Text),
|
|
|
|
|
ThreeButtonDialog.ButtonYes,
|
|
|
|
|
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// uuid != null
|
|
|
|
|
// _srToReattach != null
|
|
|
|
|
// _srToReattach.Server.IsDetached
|
|
|
|
|
// _srToReattach.Connection != current connection
|
|
|
|
|
|
|
|
|
|
// Warn user SR is already attached to other pool, and then introduce to this pool
|
|
|
|
|
|
|
|
|
|
return DialogResult.OK == new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(
|
|
|
|
|
SystemIcons.Warning,
|
|
|
|
|
string.Format(Messages.ALREADY_ATTACHED_ELSEWHERE, _srToReattach.Name, Helpers.GetName(xenConnection),
|
|
|
|
|
Text)),
|
|
|
|
|
ThreeButtonDialog.ButtonOK,
|
|
|
|
|
ThreeButtonDialog.ButtonCancel).ShowDialog(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnShown(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnShown(e);
|
|
|
|
|
|
|
|
|
|
Text = m_text; //set here; do not set virtual members in constructor
|
|
|
|
|
|
|
|
|
|
if (_srToReattach == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (xenTabPageChooseSrType.MatchingFrontends <= 0)
|
|
|
|
|
{
|
|
|
|
|
new ThreeButtonDialog(
|
|
|
|
|
new ThreeButtonDialog.Details(
|
|
|
|
|
SystemIcons.Error,
|
|
|
|
|
String.Format(Messages.CANNOT_FIND_SR_WIZARD_TYPE, _srToReattach.type),
|
|
|
|
|
Messages.XENCENTER)).ShowDialog(this);
|
|
|
|
|
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
else if (xenTabPageChooseSrType.MatchingFrontends == 1)
|
|
|
|
|
{
|
|
|
|
|
// move to "Name" page
|
|
|
|
|
NextStep();
|
|
|
|
|
// move to "Location" page or "Permission checks" page
|
|
|
|
|
NextStep();
|
|
|
|
|
// if rbac, stay on this page (Ref. CA-61525)
|
|
|
|
|
if (_rbac)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_srToReattach.type == "cslg" && Helpers.BostonOrGreater(_srToReattach.Connection)
|
|
|
|
|
&& xenTabPageCslg.SelectedStorageAdapter != null)
|
|
|
|
|
{
|
|
|
|
|
NextStep();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string WizardPaneHelpID()
|
|
|
|
|
{
|
|
|
|
|
return CurrentStepTabPage is RBACWarningPage ? FormatHelpId("Rbac") : base.WizardPaneHelpID();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CheckNFSISORadioButton()
|
|
|
|
|
{
|
|
|
|
|
xenTabPageChooseSrType.PreselectNewSrWizardType(typeof(SrWizardType_NfsIso));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|