private bool SetFCDevicesOnLVMoMirrorPage() { LVMoMirrorChooseLogPage.three_devices.Clear(); List <FibreChannelDevice> devices; var success = LVMoMirror.FiberChannelScan(this, xenConnection, out devices); //devices.ForEach(device => all_device.Add(device)); all_device = devices; xenTabPageLvmoMirror.FCDevices = devices; xenTabPageLVMoMirrorChooseLog.FCDevices = devices; return(success); }
private void generateGeneralBox() { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("host.name_label"), Helpers.GetName(this.xenModelObject), General)); GeneralDataList.Add(new GeneralDataStructure(FriendlyName("host.name_description"), this.xenModelObject.Description, General)); GeneralDataList.Add(new GeneralDataStructure(Messages.FOLDER, this.xenModelObject.Path, General)); GeneralDataList.Add(new GeneralDataStructure(Messages.TAGS, this.TagsString(), General)); if (this.xenModelObject is XenObject <XenAPI.SR> ) { XenAPI.SR xenObject = this.xenModelObject as XenAPI.SR; GeneralDataList.Add(new GeneralDataStructure(Messages.TYPE, xenObject.FriendlyTypeName, General)); if ((xenObject.content_type != "iso") && (xenObject.GetSRType(false) != XenAPI.SR.SRTypes.udev)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.size"), xenObject.SizeString, General)); } if (xenObject.GetScsiID() != null && xenObject.GetScsiID().Count > 0) { foreach (String scsiid in xenObject.GetScsiID()) { if (xenObject.GetSRType(true) == SR.SRTypes.lvmobond) { if (CanAddLUN(scsiid) || isLunBondRed(scsiid)) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.ADD) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { List <FibreChannelDevice> devices; var success = LVMoBond.FiberChannelScan(this, xenObject.Connection, out devices); Program.MainWindow.ShowPerConnectionWizard(this.xenModelObject.Connection, new AddLUNDialog(xenObject, devices)); }; ctxMenuItems.Add(itm); GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else if (canissciRemove()) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.REMOVE) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { AsyncAction Action = new SrRemoveLUNAction(xenObject.Connection, xenObject, scsiid); ActionProgressDialog dialog = new ActionProgressDialog(Action, ProgressBarStyle.Marquee) { ShowCancel = true }; dialog.ShowDialog(this); }; ctxMenuItems.Add(itm); if (isLunBondRed(scsiid)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, ctxMenuItems)); } } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General)); } } else if (xenObject.GetSRType(true) == SR.SRTypes.lvmomirror && xenObject.other_config.ContainsKey("_type")) { if (CanAddMirrorLUN(scsiid)) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.ADD) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { // Program.MainWindow.ShowPerConnectionWizard(this.xenModelObject.Connection, new AddMirrorIscsiDialog(xenObject)); AddMirrorIscsiDialog dlg = new AddMirrorIscsiDialog(xenObject); dlg.ShowDialog(); }; ctxMenuItems.Add(itm); if (isMirrorRed(scsiid)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, ctxMenuItems)); } } else if (canMirrorissciRemove()) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.REMOVE) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { AsyncAction Action = new SrRemoveMirrorLUNAction(xenObject.Connection, xenObject, scsiid); ActionProgressDialog dialog = new ActionProgressDialog(Action, ProgressBarStyle.Marquee) { ShowCancel = true }; dialog.ShowDialog(this); }; ctxMenuItems.Add(itm); if (isMirrorRed(scsiid)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, ctxMenuItems)); } } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General)); } } else if (xenObject.GetSRType(true) == SR.SRTypes.lvmomirror && !xenObject.other_config.ContainsKey("_type")) { if (CanAddMirrorLUN(scsiid)) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.ADD) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { List <FibreChannelDevice> devices; var success = LVMoMirror.FiberChannelScan(this, xenObject.Connection, out devices); Program.MainWindow.ShowPerConnectionWizard(this.xenModelObject.Connection, new AddMirrorLUNDialog(xenObject, devices)); }; ctxMenuItems.Add(itm); if (isMirrorRed(scsiid)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, ctxMenuItems)); } } else if (canMirrorissciRemove()) { List <ToolStripMenuItem> ctxMenuItems = new List <ToolStripMenuItem>(); ToolStripMenuItem itm = new ToolStripMenuItem(Messages.REMOVE) { Image = Resources._000_StorageBroken_h32bit_16 }; itm.Click += delegate { AsyncAction Action = new SrRemoveMirrorLUNAction(xenObject.Connection, xenObject, scsiid); ActionProgressDialog dialog = new ActionProgressDialog(Action, ProgressBarStyle.Marquee) { ShowCancel = true }; dialog.ShowDialog(this); }; ctxMenuItems.Add(itm); if (isMirrorRed(scsiid)) { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, Color.Red, ctxMenuItems)); } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General, ctxMenuItems)); } } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General)); } } else { GeneralDataList.Add(new GeneralDataStructure(FriendlyName("SR.scsiid"), scsiid ?? Messages.UNKNOWN, General)); } } } if ((Program.MainWindow.SelectionManager.Selection.HostAncestor == null) && (Program.MainWindow.SelectionManager.Selection.PoolAncestor == null)) { IXenObject o = Helpers.GetPool(xenObject.Connection); if (o != null) { GeneralDataList.Add(new GeneralDataStructure(Messages.POOL, Helpers.GetName(o), General)); } else { o = Helpers.GetMaster(xenObject.Connection); if (o != null) { GeneralDataList.Add(new GeneralDataStructure(Messages.SERVER, Helpers.GetName(o), General)); } } } } GeneralDataList.Add(new GeneralDataStructure(FriendlyName("host.uuid"), GetUUID(this.xenModelObject), General)); }
private void action_Completed(ActionBase sender) { if (_srList.Count > 0 && _srList.Any(s => s != null && !s.MultipathAOK)) { SucceededWithWarning = true; SucceededWithWarningDescription = Messages.REPAIR_SR_WARNING_MULTIPATHS_DOWN; } Program.Invoke(this, () => { if (sender is MultipleAction) { Build(); } FinalizeProgressControls(sender); }); if (_srList.Count == 1 && _srList[0].GetSRType(true) == SR.SRTypes.lvmobond) { Program.Invoke(this, delegate() { if (!sender.Succeeded) { SrRepairAction act = sender as SrRepairAction; XenAPI.Failure f = act.failure; if (f.ErrorDescription[0] == "SR_BACKEND_FAILURE_1") { String s = f.ErrorDescription[2]; int start = s.IndexOf(":"); String scsiid = s.Substring(start + 2, s.Length - start - 2); DialogResult confirmResult = MessageBox.Show(string.Format(Messages.REPAIR_SR_DIALOG_SINGLE_LUN_RAID_WARNING, scsiid), Messages.MESSAGEBOX_CONFIRM, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (confirmResult == DialogResult.OK) { _repairAction = new SrRepairLUNAction(_srList[0].Connection, _srList[0], scsiid); _repairAction.RunAsync(); } else { //AsyncAction removeAction = new SrRepairLUNAction(_srList[0].Connection, _srList[0], scsiid); //removeAction.RunExternal(null); List <FibreChannelDevice> devices; var success = LVMoBond.FiberChannelScan(this, _srList[0].Connection, out devices); Program.MainWindow.ShowPerConnectionWizard(_srList[0].Connection, new AddMirrorLUNDialog(_srList[0], devices)); } this.Close(); } } }); } if (_srList.Count == 1 && _srList[0].GetSRType(true) == SR.SRTypes.lvmomirror) { Program.Invoke(this, delegate() { if (!sender.Succeeded) { SrRepairAction act = sender as SrRepairAction; XenAPI.Failure f = act.failure; if (f.ErrorDescription[0] == "SR_BACKEND_FAILURE_1") { String s = f.ErrorDescription[2]; int start = s.IndexOf(":"); String scsiid = s.Substring(start + 2, s.Length - start - 2); DialogResult confirmResult = MessageBox.Show(string.Format(Messages.REPAIR_SR_DIALOG_SINGLE_LUN_RAID_WARNING, scsiid), Messages.MESSAGEBOX_CONFIRM, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (confirmResult == DialogResult.OK) { _repairAction = new SrRepairLUNAction(_srList[0].Connection, _srList[0], scsiid); _repairAction.RunAsync(); } else { //AsyncAction removeAction = new SrRepairLUNAction(_srList[0].Connection, _srList[0], scsiid); //removeAction.RunExternal(null); List <FibreChannelDevice> devices; var success = LVMoMirror.FiberChannelScan(this, _srList[0].Connection, out devices); Program.MainWindow.ShowPerConnectionWizard(_srList[0].Connection, new AddMirrorLUNDialog(_srList[0], devices)); } this.Close(); } } }); } }
internal NewSRWizard(IXenConnection connection, SR srToReattach, bool disasterRecoveryTask) : base(connection) { InitializeComponent(); xenTabPageSrName = new NewSrWizardNamePage(); xenTabPageCifsIso = new CIFS_ISO(); xenTabPageCifs = new CifsFrontend(); xenTabPageCslg = new CSLG(); xenTabPageVhdoNFS = new VHDoNFS(); xenTabPageNfsIso = new NFS_ISO(); xenTabPageNetApp = new NetApp(); xentabPageEqualLogic = new EqualLogic(); xenTabPageLvmoIscsi = new LVMoISCSI(); xenTabPageLvmoHba = new LVMoHBA(); xenTabPageLvmoFcoe = new LVMoFCoE(); xenTabPageLvmoHbaSummary = new LVMoHBASummary(); xenTabPageLvmoBondSummary = new LVMoBondSummary(); xenTabPageLvmoBond = new LVMoBond(); xenTabPageLvmoMirror = new LVMoMirror(); xenTabPageLvmoMirrorSetIscsi = new LVMoMirrorIscsi(); xenTabPageLVMoMirrorChooseLog = new LVMoMirrorChooseLogPage(); xenTabPageLvmoMirrorSummary = new LVMoMirrorSummaryPage(); 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); //do not use virtual members in constructor var format = (srToReattach == null && !disasterRecoveryTask) ? Messages.NEWSR_TEXT : Messages.NEWSR_TEXT_ATTACH; m_text = string.Format(format, Helpers.GetName(xenConnection)); _srToReattach = srToReattach; xenTabPageChooseSrType.SrToReattach = srToReattach; xenTabPageChooseSrType.DisasterRecoveryTask = disasterRecoveryTask; // 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); } }