Beispiel #1
0
        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)
                    AddPage(xenTabPageLvmoIscsi);
                else if (m_srWizardType is SrWizardType_LvmoHba)
                {
                    AddPage(xenTabPageLvmoHba);
                    AddPage(xenTabPageLvmoHbaSummary);
                }
                else if (m_srWizardType is SrWizardType_Cslg)
                {
                    AddPage(xenTabPageCslg);

                    if (Helpers.BostonOrGreater(xenConnection))
                        AddPages(xenTabPageCslgLocation, xenTabPageCslgSettings);
                    else
                        AddPages(new XenTabPage { Text = "" });
                }
                else if (m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
                {
                    AddPages(xenTabPageCslg, xenTabPageFilerDetails);

                    if (m_srWizardType is SrWizardType_NetApp)
                    {
                        xenTabPageFilerDetails.IsNetApp = true;
                        AddPage(xenTabPageNetApp);
                    }
                    else if (m_srWizardType is SrWizardType_EqualLogic)
                    {
                        xenTabPageFilerDetails.IsNetApp = false;
                        AddPage(xentabPageEqualLogic);
                    }
                }
                else if (m_srWizardType is SrWizardType_CifsIso)
                    AddPage(xenTabPageCifsIso);
                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;
                #endregion
            }
            else if (senderPagetype == typeof(CIFS_ISO))
            {
                m_srWizardType.DeviceConfig = xenTabPageCifsIso.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageCifsIso.SrDescription);
            }
            else if (senderPagetype == typeof(LVMoHBA))
            {
                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();
                foreach (var lvmOhbaSrDescriptor in xenTabPageLvmoHba.SrDescriptors)
                {
                    lvmOhbaSrDescriptor.Name = name;
                    if (!string.IsNullOrEmpty(description))
                        lvmOhbaSrDescriptor.Description = description;

                    m_srWizardType.SrDescriptors.Add(lvmOhbaSrDescriptor);
                    names.Add(name);
                    name = SrWizardHelpers.DefaultSRName(Messages.NEWSR_HBA_DEFAULT_NAME, names);
                }

                xenTabPageLvmoHbaSummary.SuccessfullyCreatedSRs.Clear();
                xenTabPageLvmoHbaSummary.FailedToCreateSRs.Clear();
                RunFinalAction();
            }
            else if (senderPagetype == typeof(LVMoISCSI))
            {
                m_srWizardType.UUID = xenTabPageLvmoIscsi.UUID;
                m_srWizardType.DeviceConfig = xenTabPageLvmoIscsi.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageLvmoIscsi.SrDescription);
            }
            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);
            }
        }
Beispiel #2
0
 private static void SetCustomDescription(SrWizardType srwizardtype, string description)
 {
     if (srwizardtype.Description == null)
         srwizardtype.Description = description;
 }
Beispiel #3
0
        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)
                {
                    AddPage(xenTabPageLvmoIscsi);

                    if (Helpers.DundeeOrGreater(xenConnection))
                        AddPage(xenTabPageStorageProvisioningMethod);
                }
                else if (m_srWizardType is SrWizardType_LvmoHba)
                {
                    AddPage(xenTabPageLvmoHba);

                    if (Helpers.DundeeOrGreater(xenConnection))
                        AddPage(xenTabPageStorageProvisioningMethod);
                    
                    AddPage(xenTabPageLvmoHbaSummary);
                }
                else if (m_srWizardType is SrWizardType_Fcoe)
                {
                    AddPage(xenTabPageLvmoFcoe);
                    AddPage(xenTabPageLvmoHbaSummary);
                }
                else if (m_srWizardType is SrWizardType_Cslg)
                {
                    AddPage(xenTabPageCslg);

                    if (Helpers.BostonOrGreater(xenConnection))
                        AddPages(xenTabPageCslgLocation, xenTabPageCslgSettings);
                    else
                        AddPages(new XenTabPage { Text = "" });
                }
                else if (m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
                {
                    AddPages(xenTabPageCslg, xenTabPageFilerDetails);

                    if (m_srWizardType is SrWizardType_NetApp)
                    {
                        xenTabPageFilerDetails.IsNetApp = true;
                        AddPage(xenTabPageNetApp);
                    }
                    else if (m_srWizardType is SrWizardType_EqualLogic)
                    {
                        xenTabPageFilerDetails.IsNetApp = false;
                        AddPage(xentabPageEqualLogic);
                    }
                }
                else if (m_srWizardType is SrWizardType_CifsIso)
                    AddPage(xenTabPageCifsIso);
                else if (m_srWizardType is SrWizardType_Cifs)
                    AddPage(xenTabPageCifs);
                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;
                else if (m_srWizardType is SrWizardType_Cifs)
                    xenTabPageCifs.SrWizardType = m_srWizardType;
                else if (m_srWizardType is SrWizardType_Fcoe)
                    xenTabPageLvmoFcoe.SrWizardType = m_srWizardType;
                #endregion
            }
            else if (senderPagetype == typeof(CIFS_ISO))
            {
                m_srWizardType.DeviceConfig = xenTabPageCifsIso.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageCifsIso.SrDescription);
            }
            else if (senderPagetype == typeof(CifsFrontend))
            {
                m_srWizardType.DeviceConfig = xenTabPageCifs.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageCifs.SrDescription);
            }
            else if (senderPagetype == typeof(LVMoISCSI))
            {
                xenTabPageStorageProvisioningMethod.SRSize = xenTabPageLvmoIscsi.SRSize;
                SetCustomDescription(m_srWizardType, xenTabPageLvmoIscsi.SrDescription);

                if (xenTabPageLvmoIscsi.UUID != null) //already existing SR
                {
                    xenTabPageStorageProvisioningMethod.SetControlsUsingExistingSMConfig(m_srWizardType.SMConfig);
                    xenTabPageStorageProvisioningMethod.DisableControls();
                }
                else
                {
                    xenTabPageStorageProvisioningMethod.ResetControls();
                }
            }
            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);
            }
            else if (senderPagetype == typeof(LVMoHBA))
            {
                xenTabPageStorageProvisioningMethod.SRSize = xenTabPageLvmoHba.SRSize;
                bool creatingNew = m_srWizardType.SrDescriptors.Any(srDescriptor => string.IsNullOrEmpty(srDescriptor.UUID));
                if (!creatingNew)
                {
                    DisablePage(xenTabPageStorageProvisioningMethod, true);
                    xenTabPageStorageProvisioningMethod.ResetControls();
                }
            }
            else if (senderPagetype == typeof(StorageProvisioning))
            {
                m_srWizardType.SMConfig = xenTabPageStorageProvisioningMethod.SMConfig;
                m_srWizardType.UUID = xenTabPageLvmoIscsi.UUID;
                m_srWizardType.DeviceConfig = xenTabPageLvmoIscsi.DeviceConfig;

            }
        }
Beispiel #4
0
        public override void PopulatePage()
        {
            //Hide iSL radio button for Creedence or higher (StorageLink is not supported)
            radioButtonCslg.Visible = !Helpers.CreedenceOrGreater(Connection);

            radioButtonCifs.Visible = !Helpers.FeatureForbidden(Connection, Host.RestrictCifs);

            radioButtonFcoe.Visible = Helpers.DundeeOrGreater(Connection);

            foreach (var radioButton in _radioButtons)
            {
                var frontend = (SrWizardType)radioButton.Tag;
                frontend.ResetSrName(Connection);
                frontend.AllowToCreateNewSr   = SrToReattach == null && !DisasterRecoveryTask;
                frontend.DisasterRecoveryTask = DisasterRecoveryTask;
                frontend.SrToReattach         = SrToReattach;
            }

            _matchingFrontends = 0;

            if (Connection == null)
            {
                // disable all except CSLG
                Array.ForEach(_radioButtons, r => r.Enabled = r.Checked = ((SrWizardType)r.Tag).Type == SR.SRTypes.cslg);
                _matchingFrontends = 1;
                return;
            }

            if (SrToReattach == null)
            {
                foreach (RadioButton radioButton in _radioButtons)
                {
                    SM sm = GetSmForRadioButton(radioButton);

                    // CA-21758: Use SM.other_config HideFromXenCenter flag to hide backends in the New SR wizard
                    // Only do this when we're doing a create.

                    if (sm == null || (!Properties.Settings.Default.ShowHiddenVMs && sm.IsHidden()))
                    {
                        radioButton.Visible = false;
                    }

                    if (radioButton.Visible && radioButton.Tag.GetType() == m_preselectedWizardType)
                    {
                        radioButton.Checked = true;
                    }
                }

                bool visibleRadioButtonsExist = _radioButtons.Any(r => r.Visible);
                bool checkedRadioButtonExists = _radioButtons.Any(r => r.Visible && r.Checked);

                tableLayoutPanel2.Visible = visibleRadioButtonsExist;

                if (visibleRadioButtonsExist && !checkedRadioButtonExists)
                {
                    _radioButtons.First(r => r.Visible).Checked = true;
                }
            }
            else
            {
                // If we're reconfiguring then try and select the correct page.  If we find more than one matching frontend
                // (ISO SRs - CA-19605) then just disable non-matching ones and leave it at the first page

                foreach (RadioButton radioButton in _radioButtons)
                {
                    SrWizardType wizardType = (SrWizardType)radioButton.Tag;
                    SM           sm         = GetSmForRadioButton(radioButton);

                    if (sm == null)
                    {
                        radioButton.Visible = false;
                    }
                    else if (radioButton == radioButtonCslg && SrToReattach.type == SR.SRTypes.netapp.ToString())
                    {
                        _matchingFrontends++;
                        radioButtonCslg.Checked = true;
                        radioButtonCslg.Tag     = ((SrWizardType_Cslg)radioButtonCslg.Tag).ToNetApp();
                    }
                    else if (radioButton == radioButtonCslg && SrToReattach.type == SR.SRTypes.equal.ToString())
                    {
                        _matchingFrontends++;
                        radioButtonCslg.Checked = true;
                        radioButtonCslg.Tag     = ((SrWizardType_Cslg)radioButtonCslg.Tag).ToEqualLogic();
                    }
                    else if (wizardType.Type.ToString() == SrToReattach.type)
                    {
                        if (_matchingFrontends == 0)
                        {
                            radioButton.Checked = true;
                        }
                        _matchingFrontends++;
                    }
                    else
                    {
                        radioButton.Enabled = false;
                    }
                }

                if (SrToReattach.type == "iso")
                {
                    string isoType;
                    if (SrToReattach.sm_config.TryGetValue("iso_type", out isoType))
                    {
                        if (isoType == "cifs")
                        {
                            radioButtonCifsIso.Checked = true;
                            _matchingFrontends--;
                        }
                        else if (isoType == "nfs_iso")
                        {
                            radioButtonNfsIso.Checked = true;
                            _matchingFrontends--;
                        }
                    }
                }
            }

            labelVirtualDiskStorage.Visible = radioButtonNfs.Visible || radioButtonIscsi.Visible ||
                                              radioButtonFibreChannel.Visible || radioButtonCslg.Visible ||
                                              radioButtonCifs.Visible || radioButtonFcoe.Visible;

            labelISOlibrary.Visible = radioButtonNfsIso.Visible || radioButtonCifsIso.Visible;
        }
        public override void PopulatePage()
        {
            radioButtonCslg.Visible = !Helpers.CreedenceOrGreater(Connection); //Hide iSL radio button for Creedence or higher (StorageLink is not supported)

            radioButtonCifs.Visible = !Helpers.FeatureForbidden(Connection, Host.RestrictCifs);

            foreach (var radioButton in RadioButtons)
            {
                var frontend = (SrWizardType)radioButton.Tag;
                frontend.ResetSrName(Connection);
                frontend.AllowToCreateNewSr   = SrToReattach == null && !DisasterRecoveryTask;
                frontend.DisasterRecoveryTask = DisasterRecoveryTask;
                frontend.SrToReattach         = SrToReattach;
            }

            _matchingFrontends = 0;

            if (Connection == null)
            {
                // disable all except CSLG
                Array.ForEach(RadioButtons, r => r.Enabled = r.Checked = ((SrWizardType)r.Tag).Type == SR.SRTypes.cslg);
                _matchingFrontends = 1;
                return;
            }

            if (SrToReattach == null)
            {
                // CA-21758: Use SM.other_config HideFromXenCenter flag to hide backends in the New SR wizard
                // Only do this when we're doing a create.

                if (!Properties.Settings.Default.ShowHiddenVMs)
                {
                    foreach (RadioButton radioButton in RadioButtons)
                    {
                        SrWizardType wizardType = (SrWizardType)radioButton.Tag;

                        SM sm = SM.GetByType(Connection, wizardType.Type.ToString());

                        if (sm != null && sm.IsHidden)
                        {
                            radioButton.Visible = false;
                        }
                    }
                }

                foreach (RadioButton radioButton in RadioButtons)
                {
                    if (radioButton.Visible && radioButton.Tag.GetType() == m_preselectedWizardType)
                    {
                        radioButton.Checked = true;
                    }
                }
            }
            else
            {
                // If we're reconfiguring then try and select the correct page.  If we find more than one matching frontend
                // (ISO SRs - CA-19605) then just disable non-matching ones and leave it at the first page

                foreach (RadioButton radioButton in RadioButtons)
                {
                    SrWizardType wizardType = (SrWizardType)radioButton.Tag;

                    if (wizardType.Type.ToString() == SrToReattach.type)
                    {
                        if (_matchingFrontends == 0)
                        {
                            radioButton.Checked = true;
                        }
                        _matchingFrontends++;
                    }
                    else
                    {
                        radioButton.Enabled = false;
                    }
                }

                if (SrToReattach.type == SR.SRTypes.netapp.ToString() || SrToReattach.type == SR.SRTypes.equal.ToString())
                {
                    // the user is trying to reattach a netapp or Equallogic storage
                    // then move on to the correct page as there aren't radio buttons for them.
                    // we need to reenable the radioButtonCslg because it was disabled at the above iterations

                    _matchingFrontends++;
                    radioButtonCslg.Enabled = radioButtonCslg.Checked = true;

                    if (SrToReattach.type == SR.SRTypes.netapp.ToString())
                    {
                        radioButtonCslg.Tag = ((SrWizardType_Cslg)radioButtonCslg.Tag).ToNetApp();
                    }
                    else if (SrToReattach.type == SR.SRTypes.equal.ToString())
                    {
                        radioButtonCslg.Tag = ((SrWizardType_Cslg)radioButtonCslg.Tag).ToEqualLogic();
                    }
                }

                if (SrToReattach.type == "iso")
                {
                    string isoType;
                    if (SrToReattach.sm_config.TryGetValue("iso_type", out isoType))
                    {
                        if (isoType == "cifs")
                        {
                            radioButtonCifsIso.Checked = true;
                            _matchingFrontends--;
                        }
                        else if (isoType == "nfs_iso")
                        {
                            radioButtonNfsIso.Checked = true;
                            _matchingFrontends--;
                        }
                    }
                }
            }
        }
Beispiel #6
0
        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)
                {
                    AddPage(xenTabPageLvmoIscsi);
                }
                else if (m_srWizardType is SrWizardType_LvmoHba)
                {
                    AddPage(xenTabPageLvmoHba);
                    AddPage(xenTabPageLvmoHbaSummary);
                }
                else if (m_srWizardType is SrWizardType_Fcoe)
                {
                    AddPage(xenTabPageLvmoFcoe);
                    AddPage(xenTabPageLvmoHbaSummary);
                }
                else if (m_srWizardType is SrWizardType_Cslg)
                {
                    AddPage(xenTabPageCslg);
                    AddPages(xenTabPageCslgLocation, xenTabPageCslgSettings);
                }
                else if (m_srWizardType is SrWizardType_NetApp || m_srWizardType is SrWizardType_EqualLogic)
                {
                    AddPages(xenTabPageCslg, xenTabPageFilerDetails);

                    if (m_srWizardType is SrWizardType_NetApp)
                    {
                        xenTabPageFilerDetails.IsNetApp = true;
                        AddPage(xenTabPageNetApp);
                    }
                    else if (m_srWizardType is SrWizardType_EqualLogic)
                    {
                        xenTabPageFilerDetails.IsNetApp = false;
                        AddPage(xentabPageEqualLogic);
                    }
                }
                else if (m_srWizardType is SrWizardType_CifsIso)
                    AddPage(xenTabPageCifsIso);
                else if (m_srWizardType is SrWizardType_Cifs)
                    AddPage(xenTabPageCifs);
                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;
                else if (m_srWizardType is SrWizardType_Cifs)
                    xenTabPageCifs.SrWizardType = m_srWizardType;
                else if (m_srWizardType is SrWizardType_Fcoe)
                    xenTabPageLvmoFcoe.SrWizardType = m_srWizardType;
                #endregion
            }
            else if (senderPagetype == typeof(CIFS_ISO))
            {
                m_srWizardType.DeviceConfig = xenTabPageCifsIso.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageCifsIso.SrDescription);
            }
            else if (senderPagetype == typeof(CifsFrontend))
            {
                m_srWizardType.UUID = xenTabPageCifs.UUID;
                m_srWizardType.DeviceConfig = xenTabPageCifs.DeviceConfig;
                SetCustomDescription(m_srWizardType, xenTabPageCifs.SrDescription);
            }
            else if (senderPagetype == typeof(LVMoISCSI))
            {
                SetCustomDescription(m_srWizardType, xenTabPageLvmoIscsi.SrDescription);

                m_srWizardType.UUID = xenTabPageLvmoIscsi.UUID;
                m_srWizardType.DeviceConfig = xenTabPageLvmoIscsi.DeviceConfig;
            }
            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))
            {
                xenTabPageCslgLocation.SelectedStorageAdapter = xenTabPageCslg.SelectedStorageAdapter;
                xenTabPageCslgSettings.SelectedStorageAdapter = xenTabPageCslg.SelectedStorageAdapter;
                NotifyNextPagesOfChange(xenTabPageCslgLocation, xenTabPageCslgSettings);

                foreach (var entry in xenTabPageCslg.DeviceConfigParts)
                    m_srWizardType.DeviceConfig[entry.Key] = entry.Value;
            }
            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);
            }
        }
Beispiel #7
0
        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton radioButton = (RadioButton)sender;

            if (radioButton.Checked)
            {
                foreach (RadioButton rb in _radioButtons)
                {
                    rb.Checked = rb == radioButton;
                }

                SrWizardType frontend = (SrWizardType)radioButton.Tag;

                SetupDeprecationBanner(frontend is SrWizardType_Cslg);

                if (frontend.IsEnhancedSR && Helpers.FeatureForbidden(Connection, Host.RestrictStorageChoices))
                {
                    selectedStoreTypeLabel.Visible = false;
                    selectedStoreTypeLabel.Text    = string.Empty;
                    SRBlurb.Visible     = false;
                    upsellPage1.Visible = true;
                    upsellPage1.SetAllTexts(Messages.UPSELL_BLURB_ENHANCEDSR, InvisibleMessages.UPSELL_LEARNMOREURL_ENHANCEDSR);
                    m_allowNext = false;
                }
                else if (radioButton == radioButtonlunbond && frontend.IsEnhancedSR && Helpers.FeatureForbidden(Connection, Host.RestrictLUNBondSR))
                {
                    selectedStoreTypeLabel.Visible = false;
                    selectedStoreTypeLabel.Text    = string.Empty;
                    SRBlurb.Visible     = false;
                    upsellPage1.Visible = true;
                    upsellPage1.SetAllTexts(Messages.LUNBOND_BLURB_ENHANCEDSR, InvisibleMessages.UPSELL_LEARNMOREURL_ENHANCEDSR);
                    m_allowNext = false;
                }
                else if (radioButton == radioButtonLVMMirror && frontend.IsEnhancedSR && Helpers.FeatureForbidden(Connection, Host.RestrictLUNMirrorSR))
                {
                    selectedStoreTypeLabel.Visible = false;
                    selectedStoreTypeLabel.Text    = string.Empty;
                    SRBlurb.Visible     = false;
                    upsellPage1.Visible = true;
                    upsellPage1.SetAllTexts(Messages.LVMOMIRROR_BLURB_ENHANCEDSR, InvisibleMessages.UPSELL_LEARNMOREURL_ENHANCEDSR);
                    m_allowNext = false;
                }
                else if (radioButton == radioButtonLVMMirror_ISCSI && frontend.IsEnhancedSR && Helpers.FeatureForbidden(Connection, Host.RestrictLUNMirrorSR))
                {
                    selectedStoreTypeLabel.Visible = false;
                    selectedStoreTypeLabel.Text    = string.Empty;
                    SRBlurb.Visible     = false;
                    upsellPage1.Visible = true;
                    upsellPage1.SetAllTexts(Messages.LVMOMIRROR_BLURB_ENHANCEDSR, InvisibleMessages.UPSELL_LEARNMOREURL_ENHANCEDSR);
                    m_allowNext = false;
                }
                else
                {
                    upsellPage1.Visible            = false;
                    selectedStoreTypeLabel.Visible = true;
                    selectedStoreTypeLabel.Text    = radioButton.Text;
                    SRBlurb.Visible = true;
                    SRBlurb.Text    = frontend.FrontendBlurb;
                    m_allowNext     = true;
                }
                OnPageUpdated();
            }
        }